system-model.html 42.8 KB
<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>系统交互模型 | 买买买文档平台</title>
    <meta name="generator" content="VuePress 1.7.1">
    
    <meta name="description" content="买买买文档平台">
    
    <link rel="preload" href="/assets/css/0.styles.d07e157f.css" as="style"><link rel="preload" href="/assets/js/app.b322d566.js" as="script"><link rel="preload" href="/assets/js/2.ef86ff21.js" as="script"><link rel="preload" href="/assets/js/25.0458cf97.js" as="script"><link rel="prefetch" href="/assets/js/10.5819cc99.js"><link rel="prefetch" href="/assets/js/11.fd597b20.js"><link rel="prefetch" href="/assets/js/12.b2402a37.js"><link rel="prefetch" href="/assets/js/13.e003b70f.js"><link rel="prefetch" href="/assets/js/14.00c355b3.js"><link rel="prefetch" href="/assets/js/15.5f87eecb.js"><link rel="prefetch" href="/assets/js/16.1b53dc86.js"><link rel="prefetch" href="/assets/js/17.ab400218.js"><link rel="prefetch" href="/assets/js/18.20932e4d.js"><link rel="prefetch" href="/assets/js/19.b2394897.js"><link rel="prefetch" href="/assets/js/20.ecc32992.js"><link rel="prefetch" href="/assets/js/21.86007ef2.js"><link rel="prefetch" href="/assets/js/22.8eb68f06.js"><link rel="prefetch" href="/assets/js/23.f9d43b92.js"><link rel="prefetch" href="/assets/js/24.45b4a9ea.js"><link rel="prefetch" href="/assets/js/26.28900d1b.js"><link rel="prefetch" href="/assets/js/27.81d86e4f.js"><link rel="prefetch" href="/assets/js/28.1807ea10.js"><link rel="prefetch" href="/assets/js/29.c674570a.js"><link rel="prefetch" href="/assets/js/3.3e1e6257.js"><link rel="prefetch" href="/assets/js/30.d9de9467.js"><link rel="prefetch" href="/assets/js/31.c5b3b33e.js"><link rel="prefetch" href="/assets/js/32.267ac0e0.js"><link rel="prefetch" href="/assets/js/4.cbe5fc7a.js"><link rel="prefetch" href="/assets/js/5.6a270bea.js"><link rel="prefetch" href="/assets/js/6.f72612cc.js"><link rel="prefetch" href="/assets/js/7.94e920fe.js"><link rel="prefetch" href="/assets/js/8.b7861e0c.js"><link rel="prefetch" href="/assets/js/9.e023b86e.js">
    <link rel="stylesheet" href="/assets/css/0.styles.d07e157f.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="/logo.png" alt="买买买文档平台" class="logo"> <span class="site-name can-hide">买买买文档平台</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link">
  查询导览
</a></div><div class="nav-item"><a href="/product/" class="nav-link">
  项目清单
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="团队文档" class="dropdown-title"><span class="title">团队文档</span> <span class="arrow down"></span></button> <button type="button" aria-label="团队文档" class="mobile-dropdown-title"><span class="title">团队文档</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/team/design/" class="nav-link">
  产品设计
</a></li><li class="dropdown-item"><!----> <a href="/team/ios/" class="nav-link">
  IOS
</a></li><li class="dropdown-item"><!----> <a href="/team/android/" class="nav-link">
  安卓
</a></li><li class="dropdown-item"><!----> <a href="/team/backend/" class="nav-link">
  服务端
</a></li><li class="dropdown-item"><!----> <a href="/team/quality/" class="nav-link">
  测试
</a></li><li class="dropdown-item"><h4>
          前端
        </h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/team/frontend/overview/" class="nav-link router-link-active">
  概况
</a></li><li class="dropdown-subitem"><a href="/team/frontend/plugins/" class="nav-link">
  插件库
</a></li><li class="dropdown-subitem"><a href="/team/frontend/utils/" class="nav-link">
  工具集
</a></li></ul></li></ul></div></div><div class="nav-item"><a href="/standard/" class="nav-link">
  标准与规范
</a></div><div class="nav-item"><a href="/project/" class="nav-link">
  项目管控
</a></div><div class="nav-item"><a href="/adm/" class="nav-link">
  行政管理
</a></div><div class="nav-item"><a href="/util/" class="nav-link">
  协作工具
</a></div><div class="nav-item"><a href="/guide/" class="nav-link">
  文档写作平台入门
</a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link">
  查询导览
</a></div><div class="nav-item"><a href="/product/" class="nav-link">
  项目清单
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="团队文档" class="dropdown-title"><span class="title">团队文档</span> <span class="arrow down"></span></button> <button type="button" aria-label="团队文档" class="mobile-dropdown-title"><span class="title">团队文档</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/team/design/" class="nav-link">
  产品设计
</a></li><li class="dropdown-item"><!----> <a href="/team/ios/" class="nav-link">
  IOS
</a></li><li class="dropdown-item"><!----> <a href="/team/android/" class="nav-link">
  安卓
</a></li><li class="dropdown-item"><!----> <a href="/team/backend/" class="nav-link">
  服务端
</a></li><li class="dropdown-item"><!----> <a href="/team/quality/" class="nav-link">
  测试
</a></li><li class="dropdown-item"><h4>
          前端
        </h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/team/frontend/overview/" class="nav-link router-link-active">
  概况
</a></li><li class="dropdown-subitem"><a href="/team/frontend/plugins/" class="nav-link">
  插件库
</a></li><li class="dropdown-subitem"><a href="/team/frontend/utils/" class="nav-link">
  工具集
</a></li></ul></li></ul></div></div><div class="nav-item"><a href="/standard/" class="nav-link">
  标准与规范
</a></div><div class="nav-item"><a href="/project/" class="nav-link">
  项目管控
</a></div><div class="nav-item"><a href="/adm/" class="nav-link">
  行政管理
</a></div><div class="nav-item"><a href="/util/" class="nav-link">
  协作工具
</a></div><div class="nav-item"><a href="/guide/" class="nav-link">
  文档写作平台入门
</a></div> <!----></nav>  <ul class="sidebar-links"><li><a href="/team/frontend/overview/" aria-current="page" class="sidebar-link">前端 Frontend</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/team/frontend/overview/#能力输出" class="sidebar-link">能力输出</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/#项目构建及发布" class="sidebar-link">项目构建及发布</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/#浏览器支持情况" class="sidebar-link">浏览器支持情况</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/#项目技术组成" class="sidebar-link">项目技术组成</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/#代码版本控制位置" class="sidebar-link">代码版本控制位置</a></li></ul></li><li><a href="/team/frontend/overview/showcase.html" class="sidebar-link">陈列柜</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/team/frontend/overview/showcase.html#网站" class="sidebar-link">网站</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/showcase.html#微信小程序" class="sidebar-link">微信小程序</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/showcase.html#桌面客户端" class="sidebar-link">桌面客户端</a></li></ul></li><li><a href="/team/frontend/overview/standard.html" class="sidebar-link">开发规范</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/team/frontend/overview/standard.html#vscode-插件" class="sidebar-link">VSCode 插件</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/standard.html#文件与目录命名规范" class="sidebar-link">文件与目录命名规范</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/standard.html#css-样式预处理" class="sidebar-link">CSS 样式预处理</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/standard.html#路由命名规则" class="sidebar-link">路由命名规则</a></li></ul></li><li><a href="/team/frontend/overview/http.html" class="sidebar-link">数据交互格式标准</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/team/frontend/overview/http.html#数据格式样例" class="sidebar-link">数据格式样例</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/http.html#api-交互规则" class="sidebar-link">API 交互规则</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/http.html#跨域与重复请求" class="sidebar-link">跨域与重复请求</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/http.html#数据表格" class="sidebar-link">数据表格</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/http.html#登录授权" class="sidebar-link">登录授权</a></li></ul></li><li><a href="/team/frontend/overview/system-model.html" aria-current="page" class="active sidebar-link">系统交互模型</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/team/frontend/overview/system-model.html#基础原则" class="sidebar-link">基础原则</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/system-model.html#流程示意" class="sidebar-link">流程示意</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/system-model.html#数据模型" class="sidebar-link">数据模型</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/system-model.html#api-接口" class="sidebar-link">API 接口</a></li></ul></li><li><a href="/team/frontend/overview/framework.html" class="sidebar-link">系统框架</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/team/frontend/overview/framework.html#目录结构描述" class="sidebar-link">目录结构描述</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/framework.html#api" class="sidebar-link">API</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/framework.html#自定义指令集-directive" class="sidebar-link">自定义指令集 directive</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/framework.html#表单校验规则" class="sidebar-link">表单校验规则</a></li></ul></li><li><a href="/team/frontend/overview/web-open-platform.html" class="sidebar-link">网页能力开放平台</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/team/frontend/overview/web-open-platform.html#平台介绍及使用规范" class="sidebar-link">平台介绍及使用规范</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/web-open-platform.html#现有项目-模块" class="sidebar-link">现有项目/模块</a></li></ul></li><li><a href="/team/frontend/overview/quality.html" class="sidebar-link">质量保证体系</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/team/frontend/overview/quality.html#团队应用现状" class="sidebar-link">团队应用现状</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/quality.html#语法检查" class="sidebar-link">语法检查</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/quality.html#单元测试" class="sidebar-link">单元测试</a></li><li class="sidebar-sub-header"><a href="/team/frontend/overview/quality.html#端对端测试-end-to-end" class="sidebar-link">端对端测试(End-to-end)</a></li></ul></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="系统交互模型"><a href="#系统交互模型" class="header-anchor">#</a> 系统交互模型</h1> <p><strong>系统交互模型</strong>,描述了软件产品的网站类型项目中系统基础功能模块的流程、数据模型以及相应 API 输入输出标准格式,包含以下内容:</p> <ul><li>用户登录,包含登录形式及流程</li> <li>认证授权方式</li> <li>数据模型输出</li></ul> <p>目标在于各端作为 <strong>数据服务供应商</strong><strong>数据应用消费者</strong> 在交互上统一行为,面向标准接口开发,使得项目新建之初可依照 <strong>系统交互模型</strong> 快速完成系统基础功能建设,从而更从容而有序应对企业后续不断增加的项目和业务</p> <h2 id="基础原则"><a href="#基础原则" class="header-anchor">#</a> 基础原则</h2> <h3 id="api-路径命名规则"><a href="#api-路径命名规则" class="header-anchor">#</a> API 路径命名规则</h3> <p>基于 <a href="/team/frontend/overview/http.html#api-交互规则">数据交互格式标准 - API 交互规则</a> 规则, 在路径命名中应用 <a href="/team/frontend/overview/standard.html#路由命名规则">开发规范 - 路由命名规则</a> 规则,简言之特性如下</p> <ul><li>路径使用功能/业务描述性命名,例:<code>/user/profile/del/{id}</code></li> <li>单词均使用小写方式书写</li> <li>词组使用 <code>-</code> 符号分隔,例:<code>/config/user-role/list</code></li></ul> <h3 id="对象、属性命名规则"><a href="#对象、属性命名规则" class="header-anchor">#</a> 对象、属性命名规则</h3> <p>对于数据接口中输出的对象名,以及对象中的属性等内容,应使用驼峰命名法(Camel Case)</p> <div class="language-js line-numbers-mode"><pre class="language-js"><code>
<span class="token punctuation">{</span>
  <span class="token string">&quot;user_info&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token string">&quot;Name&quot;</span><span class="token operator">:</span> <span class="token string">&quot;zhangsan&quot;</span><span class="token punctuation">,</span>
    <span class="token string">&quot;age&quot;</span><span class="token operator">:</span> <span class="token number">18</span><span class="token punctuation">,</span>
    <span class="token string">&quot;phone_number&quot;</span><span class="token operator">:</span> <span class="token string">&quot;13655555555&quot;</span><span class="token punctuation">,</span>
    <span class="token string">&quot;admin_type&quot;</span><span class="token operator">:</span> <span class="token number">1</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>


<span class="token punctuation">{</span>
  <span class="token string">&quot;userInfo&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token string">&quot;name&quot;</span><span class="token operator">:</span> <span class="token string">&quot;zhangsan&quot;</span><span class="token punctuation">,</span>
    <span class="token string">&quot;age&quot;</span><span class="token operator">:</span> <span class="token number">18</span><span class="token punctuation">,</span>
    <span class="token string">&quot;phoneNumber&quot;</span><span class="token operator">:</span> <span class="token string">&quot;13655555555&quot;</span><span class="token punctuation">,</span>
    <span class="token string">&quot;adminType&quot;</span><span class="token operator">:</span> <span class="token number">1</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br></div></div><p><code>xxx_yyy_zzz</code> 命名格式仅推荐应用于数据库(表名及表字段名)环境</p> <p>在编程环境中,即使是变量的声明都应尽可能不使用该格式,在自动化语法检查工具中,也有相应的检查/推荐规则:<a href="https://cn.eslint.org/docs/rules/camelcase" target="_blank" rel="noopener noreferrer">ESLint - &quot;camelcase&quot; 规则<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>,但常量的命名是个例外</p> <div class="language-js line-numbers-mode"><pre class="language-js"><code><span class="token comment">// javascript</span>
<span class="token keyword">const</span> <span class="token constant">MASTER_ADMIN</span> <span class="token operator">=</span> <span class="token number">1</span>
<span class="token keyword">const</span> <span class="token constant">STATUS_ENABLED</span> <span class="token operator">=</span> <span class="token number">1</span>
<span class="token keyword">const</span> <span class="token constant">STATUS_DISABLED</span> <span class="token operator">=</span> <span class="token number">2</span>

<span class="token comment">// java</span>
<span class="token keyword">public</span> <span class="token keyword">static</span> final String <span class="token constant">STATUS_ENABLED</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">static</span> final String <span class="token constant">STATUS_DISABLED</span> <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><h2 id="流程示意"><a href="#流程示意" class="header-anchor">#</a> 流程示意</h2> <p><img src="/frontend/login-process.png" alt="login-process"></p> <h2 id="数据模型"><a href="#数据模型" class="header-anchor">#</a> 数据模型</h2> <p>罗列了系统功能相关的基础数据模型,此处仅列举满足系统功能的模型及元素,后续可根据实际情况进行增补修订</p> <h3 id="用户"><a href="#用户" class="header-anchor">#</a> 用户</h3> <div class="language-js line-numbers-mode"><pre class="language-js"><code><span class="token punctuation">{</span>
  <span class="token string">&quot;id&quot;</span>         <span class="token operator">:</span> number<span class="token punctuation">,</span> <span class="token comment">// 用户 id</span>
  <span class="token string">&quot;name&quot;</span>       <span class="token operator">:</span> string<span class="token punctuation">,</span> <span class="token comment">// 用户名称</span>
  <span class="token string">&quot;avatar&quot;</span>     <span class="token operator">:</span> string<span class="token punctuation">,</span> <span class="token comment">// 用户头像</span>
  <span class="token string">&quot;companyId&quot;</span>  <span class="token operator">:</span> string<span class="token punctuation">,</span> <span class="token comment">// 用户当前所属公司 id</span>
  <span class="token string">&quot;companyName&quot;</span><span class="token operator">:</span> string<span class="token punctuation">,</span> <span class="token comment">// 公司名称</span>
  <span class="token string">&quot;companyLogo&quot;</span><span class="token operator">:</span> string<span class="token punctuation">,</span> <span class="token comment">// 公司 logo</span>
  <span class="token string">&quot;adminType&quot;</span>  <span class="token operator">:</span> number  <span class="token comment">// 管理员类型(0:普通用户 1:主管理员 2:子管理员)</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><h3 id="公司"><a href="#公司" class="header-anchor">#</a> 公司</h3> <div class="language-js line-numbers-mode"><pre class="language-js"><code><span class="token punctuation">{</span>
  <span class="token string">&quot;id&quot;</span>  <span class="token operator">:</span> number<span class="token punctuation">,</span> <span class="token comment">// 公司 id</span>
  <span class="token string">&quot;name&quot;</span><span class="token operator">:</span> string<span class="token punctuation">,</span> <span class="token comment">// 公司名称</span>
  <span class="token string">&quot;logo&quot;</span><span class="token operator">:</span> string  <span class="token comment">// 公司 logo</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h3 id="菜单"><a href="#菜单" class="header-anchor">#</a> 菜单</h3> <div class="language-js line-numbers-mode"><div class="highlight-lines"><br><br><br><br><br><br><div class="highlighted"> </div><br><br><br></div><pre class="language-js"><code><span class="token punctuation">{</span>
  <span class="token string">&quot;id&quot;</span>      <span class="token operator">:</span> number<span class="token punctuation">,</span> <span class="token comment">// 菜单 id</span>
  <span class="token string">&quot;name&quot;</span>    <span class="token operator">:</span> string<span class="token punctuation">,</span> <span class="token comment">// 菜单名称</span>
  <span class="token string">&quot;icon&quot;</span>    <span class="token operator">:</span> string<span class="token punctuation">,</span> <span class="token comment">// 菜单图标</span>
  <span class="token string">&quot;parentId&quot;</span><span class="token operator">:</span> number<span class="token punctuation">,</span> <span class="token comment">// 菜单父节点 id</span>
  <span class="token string">&quot;sort&quot;</span>    <span class="token operator">:</span> number<span class="token punctuation">,</span> <span class="token comment">// 排列顺序</span>
  <span class="token string">&quot;code&quot;</span>    <span class="token operator">:</span> string<span class="token punctuation">,</span> <span class="token comment">// 菜单编码</span>
  <span class="token string">&quot;status&quot;</span>  <span class="token operator">:</span> number  <span class="token comment">// 菜单状态(1:启用,0:禁用)</span>
<span class="token punctuation">}</span>
</code></pre><div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><p>系统菜单应全量输出,但需要在 <code>status</code> 属性中体现该菜单节点的状态</p> <div class="custom-block danger"><p class="custom-block-title">注意</p> <p><code>code</code> 字段为菜单项目的编码,是前端系统中作为功能模块的唯一标识编码而定义,该编码由前端统一进行定义</p></div> <h3 id="权限"><a href="#权限" class="header-anchor">#</a> 权限</h3> <div class="language-js line-numbers-mode"><div class="highlight-lines"><br><div class="highlighted"> </div><br><br><br><br><br></div><pre class="language-js"><code><span class="token punctuation">{</span>
  <span class="token punctuation">[</span>code<span class="token punctuation">]</span><span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token comment">// 权限数据节点输出,内容根据具体系统情况而定</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token operator">...</span>
<span class="token punctuation">}</span>
</code></pre><div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><p>此处的 <code>code</code> 与上述 <a href="/team/frontend/overview/system-model.html#菜单">菜单模型</a> 中的 <code>code</code> 属性对应,代表了某个功能模块</p> <h2 id="api-接口"><a href="#api-接口" class="header-anchor">#</a> API 接口</h2> <p>系统功能模块 API 接口,内容仅为请求成功后返回的数据格式,完整数据交换格式请参考:<a href="/team/frontend/overview/http.html">数据交互格式标准</a></p> <h3 id="图形验证码初始化"><a href="#图形验证码初始化" class="header-anchor">#</a> 图形验证码初始化</h3> <p>图形验证码使用的是极验图形验证码,根据返回的数据初始化图形验证码插件</p> <p>接口路径: <code>/auth/captcha-init</code></p> <div class="language-js line-numbers-mode"><pre class="language-js"><code><span class="token comment">// 入参</span>


<span class="token comment">// 返回数据</span>
<span class="token comment">// 该格式为极验插件的标准数据格式</span>
<span class="token punctuation">{</span>
  <span class="token string">&quot;code&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
  <span class="token string">&quot;data&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token string">&quot;success&quot;</span><span class="token operator">:</span> number<span class="token punctuation">,</span>
    <span class="token string">&quot;gt&quot;</span><span class="token operator">:</span> string<span class="token punctuation">,</span>
    <span class="token string">&quot;challenge&quot;</span><span class="token operator">:</span> string<span class="token punctuation">,</span>
    <span class="token string">&quot;newCaptcha&quot;</span><span class="token operator">:</span> boolean
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br></div></div><h3 id="密码登录"><a href="#密码登录" class="header-anchor">#</a> 密码登录</h3> <p>使用 <strong>用户名</strong><strong>密码</strong> 进行登录</p> <p>接口路径:<code>/auth/pwd-login</code></p> <div class="language-js line-numbers-mode"><pre class="language-js"><code><span class="token comment">// 入参</span>
<span class="token punctuation">{</span>
  <span class="token string">&quot;username&quot;</span><span class="token operator">:</span> string<span class="token punctuation">,</span> <span class="token comment">// 用户名</span>
  <span class="token string">&quot;password&quot;</span><span class="token operator">:</span> string  <span class="token comment">// 密码</span>
<span class="token punctuation">}</span>

<span class="token comment">// 返回数据</span>
<span class="token punctuation">{</span>
  <span class="token string">&quot;code&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
  <span class="token string">&quot;data&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token string">&quot;access&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
      <span class="token string">&quot;accessToken&quot;</span><span class="token operator">:</span> string<span class="token punctuation">,</span>
      <span class="token string">&quot;expiresIn&quot;</span><span class="token operator">:</span> number
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br></div></div><h3 id="获取手机短信验证码"><a href="#获取手机短信验证码" class="header-anchor">#</a> 获取手机短信验证码</h3> <p>使用 <strong>手机号</strong> 获得验证码用于系统登录,成功访问接口后,相应手机号的手机将收到包含验证码的短信</p> <p>接口路径:<code>/auth/sms-code</code></p> <div class="language-js line-numbers-mode"><pre class="language-js"><code><span class="token comment">// 入参</span>
<span class="token punctuation">{</span>
  <span class="token string">&quot;phone&quot;</span><span class="token operator">:</span> string <span class="token comment">// 手机号</span>
<span class="token punctuation">}</span>

<span class="token comment">// 返回数据</span>

</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><h3 id="手机短信验证码登录"><a href="#手机短信验证码登录" class="header-anchor">#</a> 手机短信验证码登录</h3> <p>使用 <strong>手机号</strong><strong>验证码</strong> 进行登录</p> <p>接口路径:<code>/auth/sms-login</code></p> <div class="language-js line-numbers-mode"><pre class="language-js"><code><span class="token comment">// 入参</span>
<span class="token punctuation">{</span>
  <span class="token string">&quot;phone&quot;</span><span class="token operator">:</span> string<span class="token punctuation">,</span> <span class="token comment">// 手机号</span>
  <span class="token string">&quot;code&quot;</span><span class="token operator">:</span> string   <span class="token comment">// 短信验证码</span>
<span class="token punctuation">}</span>

<span class="token comment">// 返回数据</span>
<span class="token punctuation">{</span>
  <span class="token string">&quot;code&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
  <span class="token string">&quot;data&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token string">&quot;access&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
      <span class="token string">&quot;accessToken&quot;</span><span class="token operator">:</span> string<span class="token punctuation">,</span>
      <span class="token string">&quot;expiresIn&quot;</span><span class="token operator">:</span> number
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br></div></div><h3 id="获取当前用户数据"><a href="#获取当前用户数据" class="header-anchor">#</a> 获取当前用户数据</h3> <p>在使用 <a href="/team/frontend/overview/system-model.html#密码登录">密码登录</a><a href="/team/frontend/overview/system-model.html#手机短信验证码登录">手机短信验证码登录</a> 登录成功后,获取当前用户的系统功能模型集合,系统根据该模型集合自行进行数据转换、过滤以及缓存,完成网站基础框架功能初始化</p> <p>接口路径:<code>/auth/profile</code></p> <div class="language-js line-numbers-mode"><pre class="language-js"><code><span class="token comment">// 入参</span>


<span class="token comment">// 返回数据</span>
<span class="token punctuation">{</span>
  <span class="token string">&quot;code&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
  <span class="token string">&quot;data&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token string">&quot;user&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
      <span class="token comment">// 用户模型</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token string">&quot;companys&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
      <span class="token punctuation">{</span>
        <span class="token comment">// 公司模型</span>
      <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
        <span class="token operator">...</span>
      <span class="token punctuation">}</span>
    <span class="token punctuation">]</span><span class="token punctuation">,</span>
    <span class="token string">&quot;menus&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
      <span class="token punctuation">{</span>
        <span class="token comment">// 菜单模型</span>
      <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
        <span class="token operator">...</span>
      <span class="token punctuation">}</span>
    <span class="token punctuation">]</span><span class="token punctuation">,</span>
    <span class="token string">&quot;permission&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
      <span class="token punctuation">[</span>菜单节点编码<span class="token punctuation">]</span><span class="token operator">:</span> <span class="token punctuation">{</span>
        <span class="token comment">// 权限数据节点</span>
      <span class="token punctuation">}</span><span class="token punctuation">,</span>
      <span class="token operator">...</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br></div></div><p>数据节点与数据模型的对应关系</p> <table><thead><tr><th>数据节点</th> <th>数据模型</th></tr></thead> <tbody><tr><td>user</td> <td><a href="/team/frontend/overview/system-model.html#用户">用户模型</a></td></tr> <tr><td>companys</td> <td><a href="/team/frontend/overview/system-model.html#公司">公司模型</a></td></tr> <tr><td>menus</td> <td><a href="/team/frontend/overview/system-model.html#菜单">菜单模型</a></td></tr> <tr><td>permission</td> <td><a href="/team/frontend/overview/system-model.html#权限">权限模型</a></td></tr></tbody></table> <h3 id="切换公司"><a href="#切换公司" class="header-anchor">#</a> 切换公司</h3> <p>切换用户当前所属公司,该操作相当于用户重新登录,所以需要重新分发用户的访问令牌。在完成公司切换的操作后,前端系统会自行再次访问 <a href="/team/frontend/overview/system-model.html#获取当前用户数据">获取当前用户数据</a> 接口,更新用户信息中当前所属公司等相关信息</p> <p>接口路径:<code>/auth/switch-company</code></p> <div class="language-js line-numbers-mode"><pre class="language-js"><code><span class="token comment">// 入参</span>
<span class="token punctuation">{</span>
  <span class="token string">&quot;companyId&quot;</span><span class="token operator">:</span> number <span class="token comment">// 待切换的公司 id</span>
<span class="token punctuation">}</span>

<span class="token comment">// 返回数据</span>
<span class="token punctuation">{</span>
  <span class="token string">&quot;code&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
  <span class="token string">&quot;data&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token string">&quot;access&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
      <span class="token string">&quot;accessToken&quot;</span><span class="token operator">:</span> string<span class="token punctuation">,</span>
      <span class="token string">&quot;expiresIn&quot;</span><span class="token operator">:</span> number
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br></div></div><p>事实上有多个接口均为获取用户访问令牌的功能:</p> <ul><li><a href="/team/frontend/overview/system-model.html#密码登录">密码登录</a></li> <li><a href="/team/frontend/overview/system-model.html#获取当前用户数据">获取当前用户数据</a></li> <li><a href="/team/frontend/overview/system-model.html#切换公司">切换公司</a></li></ul> <p>数据格式及处理规则请参考 <a href="/team/frontend/overview/http.html#登录授权">数据交互格式标准 - 登录授权</a></p></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">最后更新时间:</span> <span class="time">10/13/2020, 10:23:58 AM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">

      <a href="/team/frontend/overview/http.html" class="prev">
        数据交互格式标准
      </a></span> <span class="next"><a href="/team/frontend/overview/framework.html">
        系统框架
      </a>

    </span></p></div> </main></div><div class="global-ui"><!----></div></div>
    <script src="/assets/js/app.b322d566.js" defer></script><script src="/assets/js/2.ef86ff21.js" defer></script><script src="/assets/js/25.0458cf97.js" defer></script>
  </body>
</html>