16.4011c09c.js
26.8 KB
(window.webpackJsonp=window.webpackJsonp||[]).push([[16],{282:function(s,t,a){"use strict";a.r(t);var n=a(14),r=Object(n.a)({},(function(){var s=this,t=s.$createElement,a=s._self._c||t;return a("ContentSlotsDistributor",{attrs:{"slot-key":s.$parent.slotKey}},[a("h1",{attrs:{id:"数据交互格式标准"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#数据交互格式标准"}},[s._v("#")]),s._v(" 数据交互格式标准")]),s._v(" "),a("p",[s._v("前后端数据交互标准格式详细说明")]),s._v(" "),a("h2",{attrs:{id:"数据格式样例"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#数据格式样例"}},[s._v("#")]),s._v(" 数据格式样例")]),s._v(" "),a("div",{staticClass:"language-js line-numbers-mode"},[a("div",{staticClass:"highlight-lines"},[a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("div",{staticClass:"highlighted"},[s._v(" ")]),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("br"),a("div",{staticClass:"highlighted"},[s._v(" ")]),a("br"),a("br"),a("br"),a("br"),a("br"),a("br")]),a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("/**\n * 请求结果\n * -1: 业务检查不通过\n * 0: 请求成功,数据正常返回\n * 2: token 失效,主要用于用户登录超时、特定情况下主动清除用户登录状态\n * 例如用户权限发生变化等场景\n */")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"code"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" number"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v('/**\n * 请求异常的提示信息\n * 当数据请求结果为 0 时,本节点令需固定输出 "ok" 即可\n * 当数据请求结果为 -1 时,必须输出错误相关的描述内容\n * \n * 业务检查不通过示例:\n * {\n * "code": -1,\n * "msg": "姓名不能超过 20 个字符"\n * }\n * \n * 请求成功的示例:\n * {\n * "code": 0,\n * "msg": "ok",\n * "data": {\n * 业务数据\n * }\n * }\n */')]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"msg"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" string"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("/**\n * 请求后返回的数据内容都应在 data 节点下输出\n */")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"data"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("/**\n * 常规单一数据节点\n */")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"attr"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" value"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("/**\n * 对象数据节点\n */")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"user"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"name"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"zhangsan"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"age"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[s._v("18")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" \n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("/** \n * 列表型数据节点\n */")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"users"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("[")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v(" object "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v("...")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("]")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("/**\n * 数据表格结果输出的数据节点\n */")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"gridResult"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 当前页码")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"pageNumber"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" number"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 总记录数")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"totalRow"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" number"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 数据列表内容")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"lists"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("[")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n object "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 数据模型")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v("...")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("]")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("/**\n * 用户登录、更新/刷新 token 等登录授权操作后输出的数据节点\n */")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"access"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"accessToken"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" string"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"expiresIn"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" number\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n")])]),a("div",{staticClass:"line-numbers-wrapper"},[a("span",{staticClass:"line-number"},[s._v("1")]),a("br"),a("span",{staticClass:"line-number"},[s._v("2")]),a("br"),a("span",{staticClass:"line-number"},[s._v("3")]),a("br"),a("span",{staticClass:"line-number"},[s._v("4")]),a("br"),a("span",{staticClass:"line-number"},[s._v("5")]),a("br"),a("span",{staticClass:"line-number"},[s._v("6")]),a("br"),a("span",{staticClass:"line-number"},[s._v("7")]),a("br"),a("span",{staticClass:"line-number"},[s._v("8")]),a("br"),a("span",{staticClass:"line-number"},[s._v("9")]),a("br"),a("span",{staticClass:"line-number"},[s._v("10")]),a("br"),a("span",{staticClass:"line-number"},[s._v("11")]),a("br"),a("span",{staticClass:"line-number"},[s._v("12")]),a("br"),a("span",{staticClass:"line-number"},[s._v("13")]),a("br"),a("span",{staticClass:"line-number"},[s._v("14")]),a("br"),a("span",{staticClass:"line-number"},[s._v("15")]),a("br"),a("span",{staticClass:"line-number"},[s._v("16")]),a("br"),a("span",{staticClass:"line-number"},[s._v("17")]),a("br"),a("span",{staticClass:"line-number"},[s._v("18")]),a("br"),a("span",{staticClass:"line-number"},[s._v("19")]),a("br"),a("span",{staticClass:"line-number"},[s._v("20")]),a("br"),a("span",{staticClass:"line-number"},[s._v("21")]),a("br"),a("span",{staticClass:"line-number"},[s._v("22")]),a("br"),a("span",{staticClass:"line-number"},[s._v("23")]),a("br"),a("span",{staticClass:"line-number"},[s._v("24")]),a("br"),a("span",{staticClass:"line-number"},[s._v("25")]),a("br"),a("span",{staticClass:"line-number"},[s._v("26")]),a("br"),a("span",{staticClass:"line-number"},[s._v("27")]),a("br"),a("span",{staticClass:"line-number"},[s._v("28")]),a("br"),a("span",{staticClass:"line-number"},[s._v("29")]),a("br"),a("span",{staticClass:"line-number"},[s._v("30")]),a("br"),a("span",{staticClass:"line-number"},[s._v("31")]),a("br"),a("span",{staticClass:"line-number"},[s._v("32")]),a("br"),a("span",{staticClass:"line-number"},[s._v("33")]),a("br"),a("span",{staticClass:"line-number"},[s._v("34")]),a("br"),a("span",{staticClass:"line-number"},[s._v("35")]),a("br"),a("span",{staticClass:"line-number"},[s._v("36")]),a("br"),a("span",{staticClass:"line-number"},[s._v("37")]),a("br"),a("span",{staticClass:"line-number"},[s._v("38")]),a("br"),a("span",{staticClass:"line-number"},[s._v("39")]),a("br"),a("span",{staticClass:"line-number"},[s._v("40")]),a("br"),a("span",{staticClass:"line-number"},[s._v("41")]),a("br"),a("span",{staticClass:"line-number"},[s._v("42")]),a("br"),a("span",{staticClass:"line-number"},[s._v("43")]),a("br"),a("span",{staticClass:"line-number"},[s._v("44")]),a("br"),a("span",{staticClass:"line-number"},[s._v("45")]),a("br"),a("span",{staticClass:"line-number"},[s._v("46")]),a("br"),a("span",{staticClass:"line-number"},[s._v("47")]),a("br"),a("span",{staticClass:"line-number"},[s._v("48")]),a("br"),a("span",{staticClass:"line-number"},[s._v("49")]),a("br"),a("span",{staticClass:"line-number"},[s._v("50")]),a("br"),a("span",{staticClass:"line-number"},[s._v("51")]),a("br"),a("span",{staticClass:"line-number"},[s._v("52")]),a("br"),a("span",{staticClass:"line-number"},[s._v("53")]),a("br"),a("span",{staticClass:"line-number"},[s._v("54")]),a("br"),a("span",{staticClass:"line-number"},[s._v("55")]),a("br"),a("span",{staticClass:"line-number"},[s._v("56")]),a("br"),a("span",{staticClass:"line-number"},[s._v("57")]),a("br"),a("span",{staticClass:"line-number"},[s._v("58")]),a("br"),a("span",{staticClass:"line-number"},[s._v("59")]),a("br"),a("span",{staticClass:"line-number"},[s._v("60")]),a("br"),a("span",{staticClass:"line-number"},[s._v("61")]),a("br"),a("span",{staticClass:"line-number"},[s._v("62")]),a("br"),a("span",{staticClass:"line-number"},[s._v("63")]),a("br"),a("span",{staticClass:"line-number"},[s._v("64")]),a("br"),a("span",{staticClass:"line-number"},[s._v("65")]),a("br"),a("span",{staticClass:"line-number"},[s._v("66")]),a("br"),a("span",{staticClass:"line-number"},[s._v("67")]),a("br"),a("span",{staticClass:"line-number"},[s._v("68")]),a("br"),a("span",{staticClass:"line-number"},[s._v("69")]),a("br"),a("span",{staticClass:"line-number"},[s._v("70")]),a("br"),a("span",{staticClass:"line-number"},[s._v("71")]),a("br"),a("span",{staticClass:"line-number"},[s._v("72")]),a("br"),a("span",{staticClass:"line-number"},[s._v("73")]),a("br"),a("span",{staticClass:"line-number"},[s._v("74")]),a("br")])]),a("h2",{attrs:{id:"api-交互规则"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#api-交互规则"}},[s._v("#")]),s._v(" API 交互规则")]),s._v(" "),a("p",[s._v("RESTful API 是 API 设计风格而非标准,在团队应用中仅按需使用相应内容即可,目前团队执行以下规范")]),s._v(" "),a("ol",[a("li",[s._v("开发与测试环境使用 "),a("code",[s._v("http")]),s._v(" 协议,生产环境下使用 "),a("code",[s._v("https")]),s._v(" 协议")]),s._v(" "),a("li",[s._v("描述性 api 地址(Endpoint),例如:"),a("code",[s._v("https://aa.com/v1/system/user/profile/{id}")])]),s._v(" "),a("li",[a("strong",[s._v("HTTP 动词统一使用 "),a("code",[s._v("POST")])])])]),s._v(" "),a("p",[s._v("更多 RESTful API 内容:")]),s._v(" "),a("ul",[a("li",[a("a",{attrs:{href:"http://www.ruanyifeng.com/blog/2014/05/restful_api.html",target:"_blank",rel:"noopener noreferrer"}},[s._v("RESTful API 设计指南"),a("OutboundLink")],1)]),s._v(" "),a("li",[a("a",{attrs:{href:"https://www.ruanyifeng.com/blog/2018/10/restful-api-best-practices.html",target:"_blank",rel:"noopener noreferrer"}},[s._v("RESTful API 最佳实践"),a("OutboundLink")],1)])]),s._v(" "),a("h2",{attrs:{id:"跨域与重复请求"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#跨域与重复请求"}},[s._v("#")]),s._v(" 跨域与重复请求")]),s._v(" "),a("p",[s._v("除少数历史遗留项目外,公司现有项目均使用前后端分离模式,即前端、服务端各自独立开发、运行和部署。")]),s._v(" "),a("h3",{attrs:{id:"跨域(cors)"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#跨域(cors)"}},[s._v("#")]),s._v(" 跨域(CORS)")]),s._v(" "),a("p",[s._v("示例网址: "),a("code",[s._v("https://abc.com:8080/")])]),s._v(" "),a("p",[s._v("构成网址的三个基本元素")]),s._v(" "),a("ul",[a("li",[s._v("协议("),a("code",[s._v("https://")]),s._v(")")]),s._v(" "),a("li",[s._v("网址("),a("code",[s._v("abc.com")]),s._v(")")]),s._v(" "),a("li",[s._v("端口("),a("code",[s._v("8080")]),s._v(")")])]),s._v(" "),a("p",[s._v("两个网址之间,只要有上述三个元素中其中一项不一致,即为跨域访问。前后端项目在各自独立运行部署后,则天然处于跨域模式下")]),s._v(" "),a("p",[s._v("更多跨域资料:"),a("a",{attrs:{href:"http://www.ruanyifeng.com/blog/2016/04/cors.html",target:"_blank",rel:"noopener noreferrer"}},[s._v("跨域资源共享 CORS 详解"),a("OutboundLink")],1)]),s._v(" "),a("h3",{attrs:{id:"跨域请求模式"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#跨域请求模式"}},[s._v("#")]),s._v(" 跨域请求模式")]),s._v(" "),a("p",[s._v("浏览器将 CORS 请求分成两类:")]),s._v(" "),a("ul",[a("li",[s._v("简单请求(simple request)")]),s._v(" "),a("li",[s._v("非简单请求(not-so-simple request)")])]),s._v(" "),a("h4",{attrs:{id:"简单请求"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#简单请求"}},[s._v("#")]),s._v(" 简单请求")]),s._v(" "),a("p",[s._v("只要同时满足以下两大条件,就属于简单请求")]),s._v(" "),a("ol",[a("li",[s._v("请求方法是以下三种方法之一:"),a("code",[s._v("HEAD")]),s._v("、"),a("code",[s._v("GET")]),s._v("、"),a("code",[s._v("POST")])]),s._v(" "),a("li",[s._v("HTTP的头信息不超出以下几种字段\n"),a("ul",[a("li",[s._v("Accept")]),s._v(" "),a("li",[s._v("Accept-Language")]),s._v(" "),a("li",[s._v("Content-Language")]),s._v(" "),a("li",[s._v("Last-Event-ID")]),s._v(" "),a("li",[s._v("Content-Type:只限于三个值 "),a("code",[s._v("application/x-www-form-urlencoded")]),s._v("、"),a("code",[s._v("multipart/form-data")]),s._v("、"),a("code",[s._v("text/plain")])])])])]),s._v(" "),a("h4",{attrs:{id:"非简单请求"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#非简单请求"}},[s._v("#")]),s._v(" 非简单请求")]),s._v(" "),a("p",[s._v("非简单请求是那种对服务器有特殊要求的请求,比如请求方法是 "),a("code",[s._v("PUT")]),s._v(" 或 "),a("code",[s._v("DELETE")]),s._v(",或者 "),a("code",[s._v("Content-Type")]),s._v(" 字段的类型是 "),a("code",[s._v("application/json")])]),s._v(" "),a("h3",{attrs:{id:"跨域应用"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#跨域应用"}},[s._v("#")]),s._v(" 跨域应用")]),s._v(" "),a("p",[s._v("根据以上描述的内容,结合公司使用的规则")]),s._v(" "),a("ul",[a("li",[s._v("跨域")]),s._v(" "),a("li",[s._v("HTTP 动词为 "),a("code",[s._v("POST")])]),s._v(" "),a("li",[s._v("Content-Type 为 "),a("code",[s._v("application/json")])])]),s._v(" "),a("p",[s._v("那么在发起 HTTP 数据请求时,HTTP Client 插件将会增加一次 HTTP 查询请求,称为 “预检” 请求(preflight),特点就是该请求的 "),a("code",[s._v("General")]),s._v(" 段中的 "),a("code",[s._v("Request Method")]),s._v(" 值为 "),a("code",[s._v("OPTIONS")]),s._v(",没有请求参数,该请求的功能仅在向服务器询问当前的 "),a("strong",[s._v("非简单请求")]),s._v(" 是否允许访问")]),s._v(" "),a("div",{staticClass:"custom-block danger"},[a("p",{staticClass:"custom-block-title"},[s._v("应用服务器 / 静态网页服务器处理")]),s._v(" "),a("p",[s._v("项目开发之初,服务端应优先开发调试跨域支持,以免影响后续工作")]),s._v(" "),a("p",[s._v("另外,无论是具体的应用服务,如 "),a("code",[s._v("nodejs")]),s._v("、"),a("code",[s._v("PHP")]),s._v(" 、"),a("code",[s._v("GO")]),s._v(" 或 "),a("code",[s._v("Java")]),s._v(" 等,还是静态网页服务器 "),a("code",[s._v("nginx")]),s._v(",在检测到请求方法是 "),a("code",[s._v("OPTIONS")]),s._v(" 时,请直接返回 "),a("code",[s._v("204")]),s._v(" 状态,该状态意为请求成功,但无返回内容(NO CONTENT),该处理可避免预检请求执行业务内容,浪费资源")])]),s._v(" "),a("h2",{attrs:{id:"数据表格"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#数据表格"}},[s._v("#")]),s._v(" 数据表格")]),s._v(" "),a("p",[s._v("数据表格的标准数据交换格式")]),s._v(" "),a("div",{staticClass:"language-js line-numbers-mode"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 入参")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 表格自动根据当前分页情况发送")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"pageNumber"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" number"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"pageSize"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" number"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 自定义业务/查询参数")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v("...")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n"),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 返回数据")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"data"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"gridResult"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 当前页")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"pageNumber"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[s._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 总记录数")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"totalRow"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[s._v("3")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 数据列表内容")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"lists"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("[")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n object "),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 数据模型")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v("...")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("]")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n")])]),s._v(" "),a("div",{staticClass:"line-numbers-wrapper"},[a("span",{staticClass:"line-number"},[s._v("1")]),a("br"),a("span",{staticClass:"line-number"},[s._v("2")]),a("br"),a("span",{staticClass:"line-number"},[s._v("3")]),a("br"),a("span",{staticClass:"line-number"},[s._v("4")]),a("br"),a("span",{staticClass:"line-number"},[s._v("5")]),a("br"),a("span",{staticClass:"line-number"},[s._v("6")]),a("br"),a("span",{staticClass:"line-number"},[s._v("7")]),a("br"),a("span",{staticClass:"line-number"},[s._v("8")]),a("br"),a("span",{staticClass:"line-number"},[s._v("9")]),a("br"),a("span",{staticClass:"line-number"},[s._v("10")]),a("br"),a("span",{staticClass:"line-number"},[s._v("11")]),a("br"),a("span",{staticClass:"line-number"},[s._v("12")]),a("br"),a("span",{staticClass:"line-number"},[s._v("13")]),a("br"),a("span",{staticClass:"line-number"},[s._v("14")]),a("br"),a("span",{staticClass:"line-number"},[s._v("15")]),a("br"),a("span",{staticClass:"line-number"},[s._v("16")]),a("br"),a("span",{staticClass:"line-number"},[s._v("17")]),a("br"),a("span",{staticClass:"line-number"},[s._v("18")]),a("br"),a("span",{staticClass:"line-number"},[s._v("19")]),a("br"),a("span",{staticClass:"line-number"},[s._v("20")]),a("br"),a("span",{staticClass:"line-number"},[s._v("21")]),a("br"),a("span",{staticClass:"line-number"},[s._v("22")]),a("br"),a("span",{staticClass:"line-number"},[s._v("23")]),a("br"),a("span",{staticClass:"line-number"},[s._v("24")]),a("br"),a("span",{staticClass:"line-number"},[s._v("25")]),a("br"),a("span",{staticClass:"line-number"},[s._v("26")]),a("br"),a("span",{staticClass:"line-number"},[s._v("27")]),a("br")])]),a("h2",{attrs:{id:"登录授权"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#登录授权"}},[s._v("#")]),s._v(" 登录授权")]),s._v(" "),a("p",[s._v("访问类似用户登录、切换用户/公司/企业、交换/刷新 "),a("code",[s._v("token")]),s._v(" 等接口时,在请求成功后,应输出 "),a("code",[s._v("access")]),s._v(" 标准节点,用于输出登录授权相关的访问令牌及有效期限等内容")]),s._v(" "),a("div",{staticClass:"language-js line-numbers-mode"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"data"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"access"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"accessToken"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" string"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"expiresIn"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(":")]),s._v(" number\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n")])]),s._v(" "),a("div",{staticClass:"line-numbers-wrapper"},[a("span",{staticClass:"line-number"},[s._v("1")]),a("br"),a("span",{staticClass:"line-number"},[s._v("2")]),a("br"),a("span",{staticClass:"line-number"},[s._v("3")]),a("br"),a("span",{staticClass:"line-number"},[s._v("4")]),a("br"),a("span",{staticClass:"line-number"},[s._v("5")]),a("br"),a("span",{staticClass:"line-number"},[s._v("6")]),a("br"),a("span",{staticClass:"line-number"},[s._v("7")]),a("br"),a("span",{staticClass:"line-number"},[s._v("8")]),a("br")])]),a("h3",{attrs:{id:"处理逻辑"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#处理逻辑"}},[s._v("#")]),s._v(" 处理逻辑")]),s._v(" "),a("p",[s._v("用于数据请求的 "),a("strong",[s._v("http client")]),s._v(" 会在每一次数据请求成功后("),a("code",[s._v('"code": 0')]),s._v("),检查数据内容中是否包含 "),a("code",[s._v("access")]),s._v(" 节点,若有,则当前用户访问令牌等内容会被新数据所更新,并在下一次数据请求时,于 "),a("code",[s._v("Request Headers")]),s._v(" 数据段中增加")]),s._v(" "),a("p",[a("code",[s._v('"Authorization": "Bearer ${token}"')])]),s._v(" "),a("p",[s._v("属性,上述 "),a("code",[s._v("${token}")]),s._v(" 内容为登录授权接口返回的 "),a("code",[s._v("access.accessToken")]),s._v(" 数据,用于服务端进行用户身份验证")])])}),[],!1,null,null,null);t.default=r.exports}}]);