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