ui-process-h5 0.1.40 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/configure/README.md +83 -42
- package/build/configure/package.json +3 -2
- package/package.json +5 -2
- package/src/App.vue +87 -16
- package/src/assets/js/auth.js +36 -12
- package/src/assets/js/request.js +80 -71
- package/src/assets/js/utils.js +2 -1
- package/src/assets/status/check.png +0 -0
- package/src/assets/status/del.png +0 -0
- package/src/main.js +14 -12
- package/src/packages/attchUpload/index.js +19 -16
- package/src/packages/attchUpload/index.scss +10 -3
- package/src/packages/downSelect/index.js +25 -7
- package/src/packages/downSelect/index.scss +4 -0
- package/src/packages/downSelect/index.vue +6 -3
- package/src/packages/popup/index.js +17 -5
- package/src/packages/popup/index.scss +0 -1
- package/src/packages/popup/index.vue +1 -0
- package/src/packages/preview/index.vue +1 -1
- package/src/packages/previewImage/index.js +125 -2
- package/src/packages/previewImage/index.scss +19 -2
- package/src/packages/previewImage/index.vue +25 -4
- package/src/packages/process/index.js +299 -55
- package/src/packages/process/index.scss +12 -1
- package/src/packages/process/index.vue +114 -40
- package/src/packages/process/operation/backNode.vue +117 -25
- package/src/packages/process/operation/cancel.vue +133 -14
- package/src/packages/process/operation/ccTask.vue +46 -34
- package/src/packages/process/operation/complete.vue +729 -91
- package/src/packages/process/operation/counterSign.vue +130 -25
- package/src/packages/process/operation/delegateTask.vue +130 -23
- package/src/packages/process/operation/msgList.vue +174 -0
- package/src/packages/process/operation/restart.vue +15 -4
- package/src/packages/submitPopup/index.js +407 -59
- package/src/packages/submitPopup/index.scss +51 -46
- package/src/packages/submitPopup/index.vue +21 -5
- package/src/packages/tab/index.js +34 -5
- package/src/packages/tab/index.scss +2 -1
- package/src/packages/tab/index.vue +7 -7
- package/src/packages/tip/index.js +8 -2
- package/src/packages/tip/index.scss +39 -0
- package/src/packages/tip/index.vue +1 -1
- package/src/packages/viewAttchList/index.js +16 -14
- package/vite.config.ts +101 -72
- package/ui-process-h5/README.md +0 -171
- package/ui-process-h5/package.json +0 -27
- package/ui-process-h5/scripts/postinstall.mjs +0 -14
- package/ui-process-h5/scripts/switch-cli.mjs +0 -4
- package/ui-process-h5/scripts/utils.mjs +0 -60
- package/ui-process-h5/v2/style.css +0 -1
- package/ui-process-h5/v2/ui-process-h5.js +0 -13467
- package/ui-process-h5/v2/ui-process-h5.umd.cjs +0 -67
- package/ui-process-h5/v2.7/style.css +0 -1
- package/ui-process-h5/v2.7/ui-process-h5.js +0 -12844
- package/ui-process-h5/v2.7/ui-process-h5.umd.cjs +0 -67
- package/ui-process-h5/v3/style.css +0 -1
- package/ui-process-h5/v3/ui-process-h5.js +0 -10336
- package/ui-process-h5/v3/ui-process-h5.umd.cjs +0 -55
|
@@ -39,12 +39,13 @@ export default {
|
|
|
39
39
|
:processInstId="processInstId"
|
|
40
40
|
:processDefId="processDefId"
|
|
41
41
|
:formData="formData"
|
|
42
|
-
:appId="appId"
|
|
43
42
|
:isView="isView"
|
|
44
43
|
:userId="userId"
|
|
45
44
|
:request="request"
|
|
46
45
|
:tapList="tapList"
|
|
47
46
|
:selfTapList="selfTapList"
|
|
47
|
+
:endFunction="endFunction"
|
|
48
|
+
:isDocument="isDocument"
|
|
48
49
|
>
|
|
49
50
|
<slot></slot>
|
|
50
51
|
</TopProcess>
|
|
@@ -65,12 +66,13 @@ export default {
|
|
|
65
66
|
:id="businessKey"
|
|
66
67
|
:businessType="businessType"
|
|
67
68
|
:todoParameter="todoParameter"
|
|
68
|
-
:isClearHistory="isClearHistory"
|
|
69
69
|
:title="title"
|
|
70
|
+
@successFn="successFn"
|
|
71
|
+
:beforeFunction="beforeFunction"
|
|
70
72
|
></TopSumbitPopup>
|
|
71
73
|
</template>
|
|
72
74
|
<script>
|
|
73
|
-
import "ui-process-h5/
|
|
75
|
+
import "ui-process-h5/style.css";
|
|
74
76
|
import {
|
|
75
77
|
TopProcess,
|
|
76
78
|
attchViews,
|
|
@@ -92,38 +94,66 @@ export default {
|
|
|
92
94
|
reason: reason,
|
|
93
95
|
meetingTheme: meetingTheme,
|
|
94
96
|
},
|
|
97
|
+
selfBtn: [
|
|
98
|
+
{
|
|
99
|
+
name: "测试",
|
|
100
|
+
type: "danger",
|
|
101
|
+
click: () => {
|
|
102
|
+
console.log("当前::");
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "测试2",
|
|
107
|
+
type: "default",
|
|
108
|
+
click: () => {
|
|
109
|
+
console.log("当前::");
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
],
|
|
95
113
|
};
|
|
96
114
|
},
|
|
97
|
-
methods: {
|
|
115
|
+
methods: {
|
|
116
|
+
endFunction() {
|
|
117
|
+
console.log("endFunction");
|
|
118
|
+
},
|
|
119
|
+
beforeFunction() {
|
|
120
|
+
console.log("beforeFunction");
|
|
121
|
+
},
|
|
122
|
+
},
|
|
98
123
|
};
|
|
99
124
|
</script>
|
|
100
125
|
```
|
|
101
126
|
|
|
102
127
|
## 属性-Attributes (TopProcess)
|
|
103
128
|
|
|
104
|
-
| 参数
|
|
105
|
-
|
|
|
106
|
-
| tapList
|
|
107
|
-
| selfTapList
|
|
108
|
-
| processDefId
|
|
109
|
-
| request
|
|
110
|
-
| processInstId
|
|
111
|
-
| userId
|
|
112
|
-
| formData
|
|
113
|
-
|
|
|
114
|
-
| getVars
|
|
115
|
-
| endFunction
|
|
129
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
130
|
+
| -------------- | -------- | ----------------- | ----------------------------------------------- |
|
|
131
|
+
| tapList | Array | [] | tab 节点插入、自定义附件等信息 |
|
|
132
|
+
| selfTapList | Array | [] | 自定义 tab 节点,传入后覆盖原本参数 |
|
|
133
|
+
| processDefId | String | '' | 流程 ID |
|
|
134
|
+
| request | Object | null | axios 接口请求方法 [需要包含 get post 请求方式] |
|
|
135
|
+
| processInstId | String | '' | 流程实例 ID |
|
|
136
|
+
| userId | String | '' | 当前角色 id |
|
|
137
|
+
| formData | Object | {} | 集合数据 内部存储流程相关信息 |
|
|
138
|
+
| isAdditional | boolean | false | 自定义按钮 |
|
|
139
|
+
| getVars | Function | null | 业务方法 |
|
|
140
|
+
| endFunction | Function | null | 弹窗结束后执行方法 |
|
|
141
|
+
| beforeFunction | Function | null | 弹窗开启前执行方法 |
|
|
142
|
+
| restartData | Object | null | 重新提交参数 |
|
|
143
|
+
| isDocument | Boolean | false | 公文独立配置 |
|
|
144
|
+
| selfList | Array | {id,name} | 自定义流程列表 |
|
|
145
|
+
| selfBtn | Array | {name,type,click} | 自定义流程按钮(查看案例 data) |
|
|
116
146
|
|
|
117
147
|
## 属性-Attributes (attchViews)
|
|
118
148
|
|
|
119
|
-
| 参数 | 类型
|
|
120
|
-
| -------- |
|
|
121
|
-
| request | Object
|
|
122
|
-
| limit | [Number
|
|
123
|
-
| getValue | Function
|
|
124
|
-
| requires | Boolean
|
|
125
|
-
| inComing | Array
|
|
126
|
-
| deletFn | Function
|
|
149
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
150
|
+
| -------- | ---------------- | ------ | ----------------------------------------------- |
|
|
151
|
+
| request | Object | null | axios 接口请求方法 [需要包含 get post 请求方式] |
|
|
152
|
+
| limit | [String, Number] | 4 | 最大上传数 |
|
|
153
|
+
| getValue | Function | null | 返回上传数据 url |
|
|
154
|
+
| requires | Boolean | false | 必填 |
|
|
155
|
+
| inComing | Array | Array | 回显已上传列表 |
|
|
156
|
+
| deletFn | Function | null | 组件本身提供静态删除功能,动态删除需传入相应方法 |
|
|
127
157
|
|
|
128
158
|
## 属性-Attributes (ViewAttchList)
|
|
129
159
|
|
|
@@ -133,27 +163,30 @@ export default {
|
|
|
133
163
|
|
|
134
164
|
## 属性-Attributes (TopSumbitPopup)
|
|
135
165
|
|
|
136
|
-
| 参数 | 类型 | 默认值
|
|
137
|
-
| -------------- | ---------------- |
|
|
138
|
-
| visible | Boolean | false
|
|
139
|
-
|
|
|
140
|
-
|
|
|
141
|
-
|
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
|
|
|
145
|
-
|
|
|
146
|
-
|
|
|
166
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
167
|
+
| -------------- | ---------------- | --------- | ----------------------------------------------- |
|
|
168
|
+
| visible | Boolean | false | 展示参数 | |
|
|
169
|
+
| title | String | "" | 送审提交标题参数 |
|
|
170
|
+
| todoParameter | Object | {} | 发起流程时的其他参数 |
|
|
171
|
+
| businessType | [String, Number] | null | 业务类型 |
|
|
172
|
+
| id | String | "" | 业务 Id |
|
|
173
|
+
| resubmit | Boolean | false | 是否为重新提交 |
|
|
174
|
+
| request | Object | null | axios 接口请求方法 [需要包含 get post 请求方式] |
|
|
175
|
+
| appId | String | '' | appId |
|
|
176
|
+
| beforeFunction | Function | null | 提交前执行事件 |
|
|
177
|
+
| successFn | Function | null | 成功后回调 |
|
|
178
|
+
| manual | Boolean | false | 手动执行启动(ref 绑定后执行 handleSongshen()) |
|
|
179
|
+
| selfList | Array | {id,name} | 自定义流程列表 |
|
|
147
180
|
|
|
148
181
|
> ### tapList-对象说明
|
|
149
182
|
>
|
|
150
|
-
| 属性名 | 类型 | 说明 |
|
|
151
|
-
| ------ | ------ | ---------------------------------------------------------------------------- |
|
|
152
|
-
| label | String | 选项卡 title |
|
|
153
|
-
| key | String | 选项卡 ID 请勿重复 defaultTabList 内已拥有的默认 key(a、b、c 为默认节点 key) |
|
|
154
|
-
| type | String | 插槽类型 默认 default 插槽 slot |
|
|
155
|
-
| slot | String | 插槽名 |
|
|
156
|
-
| sort | Number | 排序参数,无参数默认插入末尾 |
|
|
183
|
+
> | 属性名 | 类型 | 说明 |
|
|
184
|
+
> | ------ | ------ | ---------------------------------------------------------------------------- |
|
|
185
|
+
> | label | String | 选项卡 title |
|
|
186
|
+
> | key | String | 选项卡 ID 请勿重复 defaultTabList 内已拥有的默认 key(a、b、c 为默认节点 key) |
|
|
187
|
+
> | type | String | 插槽类型 默认 default 插槽 slot |
|
|
188
|
+
> | slot | String | 插槽名 |
|
|
189
|
+
> | sort | Number | 排序参数,无参数默认插入末尾 |
|
|
157
190
|
|
|
158
191
|
### selfTapList-对象说明 同上
|
|
159
192
|
|
|
@@ -169,3 +202,11 @@ export default {
|
|
|
169
202
|
| userName | String | 姓名 |
|
|
170
203
|
|
|
171
204
|
附件相关列表,参考 getValue 回调参数
|
|
205
|
+
|
|
206
|
+
### restartData-对象说明
|
|
207
|
+
|
|
208
|
+
| 属性名 | 类型 | 说明 |
|
|
209
|
+
| ------------ | ------ | -------------------- |
|
|
210
|
+
| businessType | String | 业务 类型 |
|
|
211
|
+
| showType | String | 流程类型(all,pc,app) |
|
|
212
|
+
| processName | String | 流程查询字段 |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ui-process-h5",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.28",
|
|
4
4
|
"description": "> app端 流程插件",
|
|
5
5
|
"main": "./ui-process-h5.umd.cjs",
|
|
6
6
|
"style": "./style.css",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"postinstall": "node scripts/postinstall.mjs"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"checked-pick-app": "^1.
|
|
23
|
+
"checked-pick-app": "^1.3.10",
|
|
24
|
+
"dsbridge": "^3.1.4"
|
|
24
25
|
},
|
|
25
26
|
"author": "",
|
|
26
27
|
"license": "ISC"
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "ui-process-h5",
|
|
3
3
|
"private": false,
|
|
4
4
|
"description": "流程组件",
|
|
5
|
-
"version": "0.1
|
|
5
|
+
"version": "1.0.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "vite --host 0.0.0.0",
|
|
@@ -22,11 +22,15 @@
|
|
|
22
22
|
"@types/node": "^18.16.3",
|
|
23
23
|
"@vue/composition-api": "^1.7.1",
|
|
24
24
|
"axios": "^1.3.6",
|
|
25
|
+
"checked-pick-app": "^1.3.10",
|
|
26
|
+
"dsbridge": "^3.1.4",
|
|
25
27
|
"js-cookie": "^3.0.5",
|
|
26
28
|
"json-bigint": "^1.0.0",
|
|
27
29
|
"npm-run-all": "^4.1.5",
|
|
28
30
|
"perfect-scrollbar": "^1.5.5",
|
|
29
31
|
"sass": "^1.62.1",
|
|
32
|
+
"ui-process-h5": "^1.0.36",
|
|
33
|
+
"vconsole": "^3.15.1",
|
|
30
34
|
"vue-demi": "^0.13.8"
|
|
31
35
|
},
|
|
32
36
|
"peerDependencies": {
|
|
@@ -40,7 +44,6 @@
|
|
|
40
44
|
},
|
|
41
45
|
"devDependencies": {
|
|
42
46
|
"@vitejs/plugin-vue": "^3.0.3",
|
|
43
|
-
"checked-pick-app": "1.0.5",
|
|
44
47
|
"postcss-relaxed-unit": "^1.1.1",
|
|
45
48
|
"rimraf": "^3.0.2",
|
|
46
49
|
"rollup-plugin-copy": "^3.4.0",
|
package/src/App.vue
CHANGED
|
@@ -1,38 +1,53 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<TopProcess
|
|
3
|
-
processInstId="
|
|
4
|
-
processDefId="
|
|
3
|
+
:processInstId="formData.processInstId"
|
|
4
|
+
:processDefId="formData.processDefId"
|
|
5
5
|
:formData="formData"
|
|
6
|
-
appId="
|
|
7
|
-
:
|
|
8
|
-
|
|
9
|
-
userId="8c7d012761a680dff78b19e10e794c99"
|
|
6
|
+
:appId="appId"
|
|
7
|
+
:uid="formData.uid"
|
|
10
8
|
:request="request"
|
|
9
|
+
:tapList="tapList"
|
|
10
|
+
:endFunction="endFunction"
|
|
11
|
+
:beforeFunction="beforeFunction"
|
|
12
|
+
:restartData="restartData"
|
|
13
|
+
:selfBtn="selfBtn"
|
|
14
|
+
:isDocument="false"
|
|
15
|
+
:isMsg="true"
|
|
16
|
+
:isView="false"
|
|
11
17
|
>
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
<!-- :isDocument="true" -->
|
|
19
|
+
<!-- :isAdditional="true" -->
|
|
20
|
+
<!-- :getVars="getVars" -->
|
|
21
|
+
<template #default>展示当前形态</template>
|
|
22
|
+
<template #attch>attch</template>
|
|
23
|
+
<template #fsList>fsList</template>
|
|
24
|
+
<template #documentPage>documentPage</template>
|
|
25
|
+
<template v-slot:btn="data">
|
|
26
|
+
<div>123{{ data.data.status }}</div>
|
|
27
|
+
</template>
|
|
14
28
|
</TopProcess>
|
|
15
29
|
</template>
|
|
16
30
|
<script>
|
|
17
31
|
import { TopProcess } from "@/packages/index.js";
|
|
18
32
|
import request from "@/assets/js/request";
|
|
19
33
|
import { defineComponent } from "vue-demi";
|
|
20
|
-
import { setToken } from "@/assets/js/auth";
|
|
21
|
-
import
|
|
34
|
+
import { setToken, setSubject, setProject } from "@/assets/js/auth";
|
|
35
|
+
// import departPerson from "@/packages/checked-pick-app";
|
|
22
36
|
export default {
|
|
23
37
|
data() {
|
|
24
38
|
return {
|
|
25
39
|
formData: {
|
|
26
|
-
businessKey: "
|
|
27
|
-
processInstId: "
|
|
28
|
-
processDefId: "
|
|
40
|
+
businessKey: "db6bf1d242f940d0cef14eb775cab458",
|
|
41
|
+
processInstId: "0fff228a-eb2b-4ce6-8127-aa27c6dfbc1c",
|
|
42
|
+
processDefId: "obj_6534ff52252941f280a87516a9754b77",
|
|
29
43
|
title: "测试",
|
|
30
44
|
subjectId: "3a4ef115e32c85a78239e3f5f76b9637",
|
|
31
45
|
tel: "15107910151",
|
|
32
46
|
userId: "8c7d012761a680dff78b19e10e794c99",
|
|
33
47
|
userName: "刘博文",
|
|
48
|
+
uid:"2a8e7180ea1666679d3052f26f3fa8ee",
|
|
34
49
|
},
|
|
35
|
-
appId: "com.awspaas.user.apps.
|
|
50
|
+
appId: "com.awspaas.user.apps.recevie.document",
|
|
36
51
|
isView: false,
|
|
37
52
|
info: {},
|
|
38
53
|
bizId: "",
|
|
@@ -60,12 +75,56 @@ export default {
|
|
|
60
75
|
codeType: [1, 2, 3], // 可选类型 1-主体 2-部门 3-人员
|
|
61
76
|
multiple: true, // 是否多选
|
|
62
77
|
},
|
|
78
|
+
tapList: [
|
|
79
|
+
{
|
|
80
|
+
label: "附件",
|
|
81
|
+
key: "attch",
|
|
82
|
+
type: "slot",
|
|
83
|
+
sort: 2,
|
|
84
|
+
slot: "attch",
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
label: "分送记录",
|
|
88
|
+
key: "fsList",
|
|
89
|
+
type: "slot",
|
|
90
|
+
slot: "fsList",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: "正文",
|
|
94
|
+
key: "documentPage",
|
|
95
|
+
type: "slot",
|
|
96
|
+
sort: 3,
|
|
97
|
+
slot: "documentPage",
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
restartData: {
|
|
101
|
+
businessType: "4",
|
|
102
|
+
title: "测试送审",
|
|
103
|
+
showType: "all",
|
|
104
|
+
processName: "",
|
|
105
|
+
},
|
|
106
|
+
selfBtn: [
|
|
107
|
+
{
|
|
108
|
+
name: "测试",
|
|
109
|
+
type: "danger",
|
|
110
|
+
click: () => {
|
|
111
|
+
console.log("当前::");
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "测试2",
|
|
116
|
+
type: "default",
|
|
117
|
+
click: () => {
|
|
118
|
+
console.log("当前::");
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
],
|
|
63
122
|
};
|
|
64
123
|
},
|
|
65
124
|
components: {
|
|
66
125
|
/* topProcess, */
|
|
67
126
|
TopProcess,
|
|
68
|
-
departPerson,
|
|
127
|
+
// departPerson,
|
|
69
128
|
},
|
|
70
129
|
onLoad(e) {
|
|
71
130
|
this.bizId = e.bizId;
|
|
@@ -75,7 +134,11 @@ export default {
|
|
|
75
134
|
},
|
|
76
135
|
mounted() {
|
|
77
136
|
console.log("this.request", this.request);
|
|
78
|
-
setToken("
|
|
137
|
+
setToken("b2cd4a4d-200a-4ac3-bee5-8842f39233c3");
|
|
138
|
+
// 7369abf4-e2b4-44d0-87b2-7c46a444d3b5
|
|
139
|
+
// da6bab4f-fa42-4730-b0fe-c5e022123c0c
|
|
140
|
+
setSubject("9f13a9c9c400fa6e6228848ce1f131ee");
|
|
141
|
+
/* setProject("4b23dd7dcb9cf7cb548fbd087ce9d748"); */
|
|
79
142
|
console.log("processIDS", request);
|
|
80
143
|
},
|
|
81
144
|
methods: {
|
|
@@ -83,6 +146,14 @@ export default {
|
|
|
83
146
|
console.log("getVars");
|
|
84
147
|
return true;
|
|
85
148
|
},
|
|
149
|
+
endFunction(val) {
|
|
150
|
+
console.log("endFunction:::",val);
|
|
151
|
+
/* location.reload(); */
|
|
152
|
+
},
|
|
153
|
+
beforeFunction() {
|
|
154
|
+
console.log("beforeFunction111");
|
|
155
|
+
return true;
|
|
156
|
+
},
|
|
86
157
|
},
|
|
87
158
|
};
|
|
88
159
|
</script>
|
package/src/assets/js/auth.js
CHANGED
|
@@ -1,41 +1,65 @@
|
|
|
1
|
-
import Cookies from
|
|
1
|
+
import Cookies from "js-cookie";
|
|
2
2
|
|
|
3
|
-
const TokenKey =
|
|
3
|
+
const TokenKey = "Admin-Token";
|
|
4
4
|
|
|
5
|
-
const ExpiresInKey =
|
|
5
|
+
const ExpiresInKey = "Admin-Expires-In";
|
|
6
6
|
|
|
7
7
|
export function getToken() {
|
|
8
|
-
|
|
8
|
+
return Cookies.get(TokenKey);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export function setToken(token) {
|
|
12
|
-
|
|
12
|
+
return Cookies.set(TokenKey, token);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function removeToken() {
|
|
16
|
-
|
|
16
|
+
return Cookies.remove(TokenKey);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export function getExpiresIn() {
|
|
20
|
-
|
|
20
|
+
return Cookies.get(ExpiresInKey) || -1;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export function setExpiresIn(time) {
|
|
24
|
-
|
|
24
|
+
return Cookies.set(ExpiresInKey, time);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export function removeExpiresIn() {
|
|
28
|
-
|
|
28
|
+
return Cookies.remove(ExpiresInKey);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function setSystemId(systemId) {
|
|
32
|
-
|
|
32
|
+
return Cookies.set("systemId", systemId);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export function getSystemId() {
|
|
36
|
-
|
|
36
|
+
return Cookies.get("systemId") || "oa";
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export function removeSystemId() {
|
|
40
|
-
|
|
40
|
+
return Cookies.remove("systemId");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function getSubject() {
|
|
44
|
+
return Cookies.get("subjectId");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function setSubject(token) {
|
|
48
|
+
return Cookies.set("subjectId", token);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function removeSubject() {
|
|
52
|
+
return Cookies.remove("subjectId");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getProject() {
|
|
56
|
+
return Cookies.get("projectId");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function setProject(token) {
|
|
60
|
+
return Cookies.set("projectId", token);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function removeProject() {
|
|
64
|
+
return Cookies.remove("projectId");
|
|
41
65
|
}
|
package/src/assets/js/request.js
CHANGED
|
@@ -1,90 +1,99 @@
|
|
|
1
|
-
import axios from
|
|
2
|
-
import { messageBox } from
|
|
3
|
-
import { getToken } from
|
|
4
|
-
import errorCode from
|
|
5
|
-
import { tansParams } from
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { messageBox } from "./message";
|
|
3
|
+
import { getToken, getProject, getSubject } from "./auth";
|
|
4
|
+
import errorCode from "./errorCode";
|
|
5
|
+
import { tansParams } from "./top";
|
|
6
6
|
import JSONbig from "json-bigint";
|
|
7
|
-
import { baseConfig } from
|
|
8
|
-
axios.defaults.headers[
|
|
7
|
+
import { baseConfig } from "./utils";
|
|
8
|
+
axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
|
|
9
9
|
const opts = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
baseURL: baseConfig.apiUrl,
|
|
11
|
+
timeout: 999999999,
|
|
12
|
+
errorTip: true,
|
|
13
|
+
transformResponse: [
|
|
14
|
+
function (data) {
|
|
15
|
+
if (typeof data === "string") {
|
|
16
|
+
try {
|
|
17
|
+
data = JSONbig.parse(data);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
console.log(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return data;
|
|
23
|
+
},
|
|
24
|
+
],
|
|
21
25
|
};
|
|
22
26
|
opts.headers = {
|
|
23
|
-
|
|
27
|
+
"X-Tag": sessionStorage.getItem("tag"),
|
|
24
28
|
};
|
|
25
29
|
const service = axios.create(opts);
|
|
26
30
|
|
|
27
31
|
service.interceptors.request.use(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
(config) => {
|
|
33
|
+
const isToken = (config.headers || {}).isToken === false;
|
|
34
|
+
if (getToken() && !isToken) {
|
|
35
|
+
config.headers["Authorization"] = "Bearer " + getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
|
|
36
|
+
config.headers["Subjectid"] = getSubject();
|
|
37
|
+
// config.headers["Projectid"] = getProject();
|
|
38
|
+
}
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
if (config.method === "get" && config.params) {
|
|
41
|
+
let url = config.url + "?" + tansParams(config.params);
|
|
42
|
+
url = url.slice(0, -1);
|
|
43
|
+
config.params = {};
|
|
44
|
+
config.url = url;
|
|
45
|
+
}
|
|
46
|
+
return config;
|
|
47
|
+
},
|
|
48
|
+
(error) => {
|
|
49
|
+
Promise.reject(error);
|
|
39
50
|
}
|
|
40
|
-
return config;
|
|
41
|
-
},
|
|
42
|
-
(error) => {
|
|
43
|
-
Promise.reject(error);
|
|
44
|
-
}
|
|
45
51
|
);
|
|
46
52
|
|
|
47
53
|
// 响应拦截器
|
|
48
54
|
service.interceptors.response.use(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
(response) => {
|
|
56
|
+
if (Object.prototype.toString.call(response.data) === "[object Blob]") {
|
|
57
|
+
return response;
|
|
58
|
+
}
|
|
59
|
+
const { data, config } = response;
|
|
60
|
+
const { code, success } = data;
|
|
61
|
+
const message =
|
|
62
|
+
response.data.msg || errorCode[code] || errorCode["default"];
|
|
63
|
+
// 增加失败判断
|
|
64
|
+
data.fail = code !== 200 && success !== true;
|
|
58
65
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
if (code === 401) {
|
|
67
|
+
new messageBox().message({
|
|
68
|
+
content: "登录状态已过期,您可以继续留在该页面,或者重新登录",
|
|
69
|
+
type: "error",
|
|
70
|
+
});
|
|
71
|
+
return data;
|
|
72
|
+
} else if (code !== 200 && code !== "0" && config.errorTip) {
|
|
73
|
+
new messageBox().message({ content: message, type: "error" });
|
|
74
|
+
return data;
|
|
75
|
+
}
|
|
76
|
+
return data;
|
|
77
|
+
},
|
|
78
|
+
(error) => {
|
|
79
|
+
let { message } = error;
|
|
80
|
+
if (message === "Network Error") {
|
|
81
|
+
message = "后端接口连接异常";
|
|
82
|
+
} else if (message.includes("timeout")) {
|
|
83
|
+
message = "系统接口请求超时";
|
|
84
|
+
} else if (message.includes("Request failed with status code")) {
|
|
85
|
+
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
|
86
|
+
}
|
|
87
|
+
new messageBox().message({ content: message, type: "error" });
|
|
88
|
+
// if (config.errorTip) {
|
|
89
|
+
// Message({
|
|
90
|
+
// message: message,
|
|
91
|
+
// type: 'error',
|
|
92
|
+
// duration: 5 * 1000
|
|
93
|
+
// });
|
|
94
|
+
// }
|
|
95
|
+
return Promise.reject(error);
|
|
77
96
|
}
|
|
78
|
-
new messageBox().message({ content: message, type: 'error' })
|
|
79
|
-
// if (config.errorTip) {
|
|
80
|
-
// Message({
|
|
81
|
-
// message: message,
|
|
82
|
-
// type: 'error',
|
|
83
|
-
// duration: 5 * 1000
|
|
84
|
-
// });
|
|
85
|
-
// }
|
|
86
|
-
return Promise.reject(error);
|
|
87
|
-
}
|
|
88
97
|
);
|
|
89
98
|
|
|
90
99
|
export default service;
|
package/src/assets/js/utils.js
CHANGED
|
Binary file
|
|
Binary file
|