eoss-ui 0.6.38 → 0.6.39
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/lib/button-group.js +535 -374
- package/lib/button.js +535 -374
- package/lib/checkbox-group.js +536 -375
- package/lib/config/api.js +31 -19
- package/lib/data-table-form.js +547 -386
- package/lib/data-table.js +547 -382
- package/lib/date-picker.js +535 -374
- package/lib/dialog.js +535 -374
- package/lib/eoss-ui.common.js +11182 -4328
- package/lib/error-page.js +4 -4
- package/lib/flow-group.js +553 -377
- package/lib/flow-list.js +621 -460
- package/lib/flow.js +9822 -2988
- package/lib/form.js +540 -379
- package/lib/handle-user.js +536 -375
- package/lib/handler.js +536 -375
- package/lib/icon.js +536 -375
- package/lib/index.js +1 -1
- package/lib/input-number.js +535 -374
- package/lib/input.js +535 -374
- package/lib/layout.js +2 -2
- package/lib/login.js +550 -389
- package/lib/main.js +704 -543
- package/lib/nav.js +535 -374
- package/lib/notify.js +127 -109
- package/lib/page.js +535 -374
- package/lib/pagination.js +535 -374
- package/lib/player.js +535 -374
- package/lib/qr-code.js +548 -387
- package/lib/radio-group.js +536 -375
- package/lib/retrial-auth.js +538 -377
- package/lib/select-ganged.js +536 -375
- package/lib/select.js +536 -375
- package/lib/selector-panel.js +558 -396
- package/lib/selector.js +539 -378
- package/lib/sizer.js +541 -380
- package/lib/steps.js +535 -374
- package/lib/switch.js +535 -374
- package/lib/table-form.js +535 -374
- package/lib/tabs.js +539 -378
- package/lib/theme-chalk/flow.css +1 -1
- package/lib/theme-chalk/index.css +1 -1
- package/lib/tips.js +536 -375
- package/lib/tree-group.js +535 -374
- package/lib/tree.js +536 -375
- package/lib/upload.js +545 -384
- package/lib/utils/util.js +411 -268
- package/lib/wujie.js +535 -374
- package/lib/wxlogin.js +535 -374
- package/package.json +159 -158
- package/packages/button/index.js +5 -5
- package/packages/button/src/main.vue +418 -418
- package/packages/button-group/index.js +5 -5
- package/packages/button-group/src/main.vue +298 -298
- package/packages/calendar/index.js +5 -5
- package/packages/card/index.js +5 -5
- package/packages/card/src/main.vue +156 -156
- package/packages/cascader/index.js +5 -5
- package/packages/cascader/src/main.vue +168 -168
- package/packages/checkbox-group/index.js +5 -5
- package/packages/checkbox-group/src/main.vue +333 -333
- package/packages/clients/index.js +5 -5
- package/packages/clients/src/main.vue +144 -144
- package/packages/data-table/index.js +5 -5
- package/packages/data-table/src/children.vue +39 -39
- package/packages/data-table/src/column.vue +983 -983
- package/packages/data-table/src/main.vue +1820 -1816
- package/packages/data-table/src/sizer.vue +195 -195
- package/packages/data-table-form/index.js +5 -5
- package/packages/data-table-form/src/checkbox.vue +101 -101
- package/packages/data-table-form/src/colgroup.vue +17 -17
- package/packages/data-table-form/src/main.vue +181 -181
- package/packages/data-table-form/src/radio.vue +65 -65
- package/packages/data-table-form/src/table.vue +233 -233
- package/packages/data-table-form/src/tbody.vue +336 -336
- package/packages/data-table-form/src/thead.vue +68 -68
- package/packages/date-picker/index.js +5 -5
- package/packages/date-picker/src/main.vue +236 -236
- package/packages/dialog/index.js +5 -5
- package/packages/enterprise/index.js +5 -5
- package/packages/enterprise/src/main.vue +66 -66
- package/packages/error-page/index.js +5 -5
- package/packages/error-page/src/main.vue +44 -44
- package/packages/flow/index.js +5 -5
- package/packages/flow/src/component/CommonOpinions.vue +345 -341
- package/packages/flow/src/component/CustomPreset.vue +322 -322
- package/packages/flow/src/component/FileList.vue +99 -99
- package/packages/flow/src/component/Preset.vue +255 -255
- package/packages/flow/src/component/SendMsg.vue +229 -229
- package/packages/flow/src/component/TimeLimit.vue +190 -190
- package/packages/flow/src/component/taskUnionExamine.vue +603 -547
- package/packages/flow/src/form.vue +121 -121
- package/packages/flow/src/freeStartFlow.vue +2843 -0
- package/packages/flow/src/main.vue +2864 -2731
- package/packages/flow/src/processForm.vue +1007 -954
- package/packages/flow/src/processReject.vue +293 -293
- package/packages/flow/src/reset.vue +901 -0
- package/packages/flow/src/selectUser.vue +5 -0
- package/packages/flow/src/startTaskRead.vue +596 -596
- package/packages/flow/src/table.vue +58 -58
- package/packages/flow-group/index.js +5 -5
- package/packages/flow-group/src/main.vue +688 -684
- package/packages/flow-list/index.js +5 -5
- package/packages/flow-list/src/main.vue +1172 -1172
- package/packages/form/index.js +5 -5
- package/packages/form/src/main.vue +3584 -3584
- package/packages/form/src/table.vue +1420 -1420
- package/packages/handle-user/index.js +5 -5
- package/packages/handle-user/src/main.vue +138 -138
- package/packages/handler/index.js +5 -5
- package/packages/handler/src/main.vue +388 -388
- package/packages/icon/index.js +5 -5
- package/packages/icon/src/main.vue +101 -101
- package/packages/icons/index.js +5 -5
- package/packages/icons/src/main.vue +81 -81
- package/packages/input/index.js +5 -5
- package/packages/input/src/main.vue +356 -356
- package/packages/input-number/index.js +5 -5
- package/packages/input-number/src/main.vue +106 -106
- package/packages/label/index.js +5 -5
- package/packages/label/src/main.vue +457 -457
- package/packages/layout/index.js +5 -5
- package/packages/layout/src/item.vue +152 -152
- package/packages/layout/src/main.vue +31 -31
- package/packages/login/index.js +5 -5
- package/packages/login/src/main.vue +1892 -1894
- package/packages/login/src/resetPassword.vue +562 -562
- package/packages/main/index.js +5 -5
- package/packages/main/src/default/message.vue +249 -249
- package/packages/main/src/default/notice.vue +157 -157
- package/packages/main/src/default/userinfo.vue +505 -505
- package/packages/main/src/public/online.vue +89 -89
- package/packages/main/src/public/search.vue +454 -454
- package/packages/main/src/public/settings.vue +221 -221
- package/packages/main/src/simplicity/apps.vue +388 -388
- package/packages/main/src/simplicity/avatar.vue +82 -82
- package/packages/main/src/simplicity/handler.vue +221 -221
- package/packages/main/src/simplicity/index.vue +1993 -1993
- package/packages/main/src/simplicity/lists.vue +84 -84
- package/packages/main/src/simplicity/menu-list.vue +128 -128
- package/packages/main/src/simplicity/message.vue +259 -259
- package/packages/main/src/simplicity/notice.vue +190 -190
- package/packages/main/src/simplicity/router-page.vue +45 -45
- package/packages/main/src/simplicity/sub-menu.vue +241 -241
- package/packages/main/src/simplicity/user.vue +257 -257
- package/packages/main/src/simplicity/userinfo.vue +312 -312
- package/packages/menu/index.js +5 -5
- package/packages/menu/src/main.vue +536 -536
- package/packages/nav/index.js +5 -5
- package/packages/nav/src/main.vue +402 -402
- package/packages/notify/index.js +5 -5
- package/packages/notify/src/main.vue +538 -538
- package/packages/page/index.js +5 -5
- package/packages/page/src/main.vue +167 -167
- package/packages/pagination/index.js +5 -5
- package/packages/pagination/src/main.vue +96 -96
- package/packages/player/index.js +5 -5
- package/packages/player/src/main.vue +194 -194
- package/packages/qr-code/index.js +5 -5
- package/packages/qr-code/src/main.vue +170 -170
- package/packages/radio-group/index.js +6 -6
- package/packages/radio-group/src/main.vue +319 -319
- package/packages/retrial-auth/index.js +5 -5
- package/packages/retrial-auth/src/main.vue +280 -280
- package/packages/select/index.js +5 -5
- package/packages/select/src/main.vue +775 -775
- package/packages/select-ganged/index.js +5 -5
- package/packages/select-ganged/src/main.vue +724 -724
- package/packages/selector/index.js +5 -5
- package/packages/selector/src/main.vue +677 -677
- package/packages/selector-panel/index.js +5 -5
- package/packages/selector-panel/src/main.vue +1028 -1027
- package/packages/selector-panel/src/selection.vue +177 -177
- package/packages/selector-panel/src/tree.vue +129 -129
- package/packages/sizer/index.js +5 -5
- package/packages/sizer/src/main.vue +254 -254
- package/packages/steps/index.js +5 -5
- package/packages/steps/src/main.vue +181 -181
- package/packages/switch/index.js +5 -5
- package/packages/switch/src/main.vue +154 -154
- package/packages/table-form/index.js +5 -5
- package/packages/tabs/index.js +5 -5
- package/packages/tabs/src/main.vue +788 -788
- package/packages/tabs-panel/index.js +5 -5
- package/packages/tabs-panel/src/main.vue +29 -29
- package/packages/theme-chalk/lib/flow.css +1 -1
- package/packages/theme-chalk/lib/index.css +1 -1
- package/packages/theme-chalk/src/base.scss +260 -260
- package/packages/theme-chalk/src/button-group.scss +175 -175
- package/packages/theme-chalk/src/button.scss +24 -24
- package/packages/theme-chalk/src/calendar.scss +113 -113
- package/packages/theme-chalk/src/card.scss +99 -99
- package/packages/theme-chalk/src/checkbox-group.scss +8 -8
- package/packages/theme-chalk/src/clients.scss +87 -87
- package/packages/theme-chalk/src/data-table-form.scss +67 -67
- package/packages/theme-chalk/src/data-table.scss +293 -293
- package/packages/theme-chalk/src/date-picker.scss +7 -7
- package/packages/theme-chalk/src/dialog.scss +77 -77
- package/packages/theme-chalk/src/enterprise.scss +5 -5
- package/packages/theme-chalk/src/error-page.scss +18 -18
- package/packages/theme-chalk/src/flow-group.scss +110 -110
- package/packages/theme-chalk/src/flow-list.scss +36 -36
- package/packages/theme-chalk/src/flow.scss +310 -308
- package/packages/theme-chalk/src/form.scss +496 -496
- package/packages/theme-chalk/src/handle-user.scss +40 -40
- package/packages/theme-chalk/src/handler.scss +143 -143
- package/packages/theme-chalk/src/icon.scss +1760 -1760
- package/packages/theme-chalk/src/icons.scss +99 -99
- package/packages/theme-chalk/src/input.scss +9 -9
- package/packages/theme-chalk/src/label.scss +24 -24
- package/packages/theme-chalk/src/layout.scss +46 -46
- package/packages/theme-chalk/src/login.scss +939 -939
- package/packages/theme-chalk/src/main.scss +632 -632
- package/packages/theme-chalk/src/menu.scss +222 -222
- package/packages/theme-chalk/src/mixins/color.scss +117 -117
- package/packages/theme-chalk/src/nav.scss +125 -125
- package/packages/theme-chalk/src/page.scss +3 -3
- package/packages/theme-chalk/src/pagination.scss +29 -29
- package/packages/theme-chalk/src/player.scss +9 -9
- package/packages/theme-chalk/src/qr-code.scss +17 -17
- package/packages/theme-chalk/src/radio-group.scss +9 -9
- package/packages/theme-chalk/src/retrial-auth.scss +38 -38
- package/packages/theme-chalk/src/select-ganged.scss +8 -8
- package/packages/theme-chalk/src/select.scss +8 -8
- package/packages/theme-chalk/src/selector-panel.scss +204 -204
- package/packages/theme-chalk/src/selector.scss +91 -91
- package/packages/theme-chalk/src/simplicity.scss +1262 -1262
- package/packages/theme-chalk/src/sizer.scss +36 -36
- package/packages/theme-chalk/src/steps.scss +88 -88
- package/packages/theme-chalk/src/switch.scss +3 -3
- package/packages/theme-chalk/src/table-form.scss +1 -1
- package/packages/theme-chalk/src/tabs.scss +87 -87
- package/packages/theme-chalk/src/tips.scss +7 -7
- package/packages/theme-chalk/src/toolbar.scss +179 -179
- package/packages/theme-chalk/src/tree-group.scss +72 -72
- package/packages/theme-chalk/src/tree.scss +165 -165
- package/packages/theme-chalk/src/upload.scss +167 -167
- package/packages/theme-chalk/src/wxlogin.scss +3 -3
- package/packages/tips/index.js +5 -5
- package/packages/tips/src/main.vue +141 -141
- package/packages/toolbar/index.js +5 -5
- package/packages/toolbar/src/main.vue +430 -430
- package/packages/tree/index.js +5 -5
- package/packages/tree-group/index.js +5 -5
- package/packages/upload/index.js +5 -5
- package/packages/upload/src/main.vue +1334 -1334
- package/packages/upload/src/picture.js +15 -15
- package/packages/wujie/index.js +5 -5
- package/packages/wujie/src/main.vue +145 -145
- package/packages/wxlogin/index.js +5 -5
- package/packages/wxlogin/src/main.vue +128 -128
- package/src/config/api.js +248 -236
- package/src/config/image.js +2 -2
- package/src/index.js +1 -1
- package/src/utils/bus.js +3 -3
- package/src/utils/date-util.js +312 -312
- package/src/utils/http.js +50 -50
- package/src/utils/rules.js +18 -18
- package/src/utils/store.js +21 -21
- package/src/utils/util.js +398 -258
- package/src/utils/webSocket.js +107 -107
package/src/utils/util.js
CHANGED
|
@@ -26,6 +26,7 @@ const $darkColorCount = 4;
|
|
|
26
26
|
const publicKey = 'abcdefghijklmnopqrstuvwxyz12345678';
|
|
27
27
|
let loginMsg;
|
|
28
28
|
let initAuth;
|
|
29
|
+
let $_http;
|
|
29
30
|
|
|
30
31
|
const JSONbigToString = JSONbig({ storeAsString: true });
|
|
31
32
|
import { MessageBox, Loading } from 'eoss-element';
|
|
@@ -89,290 +90,293 @@ const ajax = function ({
|
|
|
89
90
|
} else {
|
|
90
91
|
method = method.toLowerCase();
|
|
91
92
|
}
|
|
92
|
-
let
|
|
93
|
-
|
|
94
|
-
baseURL:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
let http = $_http;
|
|
94
|
+
if (!http) {
|
|
95
|
+
let baseURL = host === true ? getStorage('host') : host === false ? '' : host;
|
|
96
|
+
http = axios.create({
|
|
97
|
+
baseURL: baseURL,
|
|
98
|
+
timeout: 99000,
|
|
99
|
+
transformResponse: [
|
|
100
|
+
function (data) {
|
|
101
|
+
try {
|
|
102
|
+
return JSONbigToString.parse(data);
|
|
103
|
+
} catch (err) {
|
|
104
|
+
return data;
|
|
105
|
+
}
|
|
102
106
|
}
|
|
107
|
+
]
|
|
108
|
+
});
|
|
109
|
+
// 请求拦截
|
|
110
|
+
http.interceptors.request.use(
|
|
111
|
+
(config) => {
|
|
112
|
+
config.headers.common = getStorage();
|
|
113
|
+
// 根据请求的信息(请求方式,url,请求get/post数据),产生map的key
|
|
114
|
+
// let requestKey = getRequestKey(config);
|
|
115
|
+
// // 判断请求是否重复
|
|
116
|
+
// if (pendingRequest.has(requestKey)) {
|
|
117
|
+
// // 取消上次请求
|
|
118
|
+
// let cancel = pendingRequest.get(requestKey);
|
|
119
|
+
// cancel();
|
|
120
|
+
// // 删除请求信息
|
|
121
|
+
// pendingRequest.delete(requestKey);
|
|
122
|
+
// }
|
|
123
|
+
// // 把请求信息,添加请求到map当中
|
|
124
|
+
// // 生成取消方法
|
|
125
|
+
// config.cancelToken =
|
|
126
|
+
// config.cancelToken ||
|
|
127
|
+
// new axios.CancelToken(cancel => {
|
|
128
|
+
// // 把取消方法添加到map
|
|
129
|
+
// if (!pendingRequest.has(requestKey)) {
|
|
130
|
+
// pendingRequest.set(requestKey, cancel);
|
|
131
|
+
// }
|
|
132
|
+
// });
|
|
133
|
+
return config;
|
|
134
|
+
},
|
|
135
|
+
(err) => {
|
|
136
|
+
return err;
|
|
103
137
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// 根据请求的信息(请求方式,url,请求get/post数据),产生map的key
|
|
111
|
-
// let requestKey = getRequestKey(config);
|
|
112
|
-
// // 判断请求是否重复
|
|
113
|
-
// if (pendingRequest.has(requestKey)) {
|
|
114
|
-
// // 取消上次请求
|
|
115
|
-
// let cancel = pendingRequest.get(requestKey);
|
|
116
|
-
// cancel();
|
|
117
|
-
// // 删除请求信息
|
|
118
|
-
// pendingRequest.delete(requestKey);
|
|
119
|
-
// }
|
|
120
|
-
// // 把请求信息,添加请求到map当中
|
|
121
|
-
// // 生成取消方法
|
|
122
|
-
// config.cancelToken =
|
|
123
|
-
// config.cancelToken ||
|
|
124
|
-
// new axios.CancelToken(cancel => {
|
|
125
|
-
// // 把取消方法添加到map
|
|
126
|
-
// if (!pendingRequest.has(requestKey)) {
|
|
127
|
-
// pendingRequest.set(requestKey, cancel);
|
|
128
|
-
// }
|
|
129
|
-
// });
|
|
130
|
-
return config;
|
|
131
|
-
},
|
|
132
|
-
(err) => {
|
|
133
|
-
return err;
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
// 响应拦截
|
|
137
|
-
http.interceptors.response.use(
|
|
138
|
-
(response) => {
|
|
139
|
-
// delPendingRequest(response.config);
|
|
140
|
-
loading && loading.close();
|
|
141
|
-
if (
|
|
142
|
-
response.headers.authorization &&
|
|
143
|
-
response.headers.authorization !== getStorage('token')
|
|
144
|
-
) {
|
|
138
|
+
);
|
|
139
|
+
// 响应拦截
|
|
140
|
+
http.interceptors.response.use(
|
|
141
|
+
(response) => {
|
|
142
|
+
// delPendingRequest(response.config);
|
|
143
|
+
loading && loading.close();
|
|
145
144
|
if (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
localStorage.getItem('Authorization')
|
|
145
|
+
response.headers.authorization &&
|
|
146
|
+
response.headers.authorization !== getStorage('token')
|
|
149
147
|
) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
'
|
|
156
|
-
response.headers.authorization
|
|
157
|
-
|
|
148
|
+
if (
|
|
149
|
+
localStorage.getItem('storage') === 'localStorage' ||
|
|
150
|
+
localStorage.getItem('token') ||
|
|
151
|
+
localStorage.getItem('Authorization')
|
|
152
|
+
) {
|
|
153
|
+
localStorage.setItem('token', response.headers.authorization);
|
|
154
|
+
localStorage.setItem('Authorization', response.headers.authorization);
|
|
155
|
+
} else {
|
|
156
|
+
sessionStorage.setItem('token', response.headers.authorization);
|
|
157
|
+
sessionStorage.setItem(
|
|
158
|
+
'Authorization',
|
|
159
|
+
response.headers.authorization
|
|
160
|
+
);
|
|
161
|
+
}
|
|
158
162
|
}
|
|
159
|
-
}
|
|
160
|
-
if (
|
|
161
|
-
(response.headers.ssId ||
|
|
162
|
-
response.headers.Ssid ||
|
|
163
|
-
response.headers.ssid) &&
|
|
164
|
-
(response.headers.ssId ||
|
|
165
|
-
response.headers.SsId ||
|
|
166
|
-
response.headers.ssid) !== getStorage('ssId')
|
|
167
|
-
) {
|
|
168
163
|
if (
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
(response.headers.ssId ||
|
|
165
|
+
response.headers.Ssid ||
|
|
166
|
+
response.headers.ssid) &&
|
|
167
|
+
(response.headers.ssId ||
|
|
168
|
+
response.headers.SsId ||
|
|
169
|
+
response.headers.ssid) !== getStorage('ssId')
|
|
171
170
|
) {
|
|
172
|
-
|
|
173
|
-
'
|
|
174
|
-
|
|
171
|
+
if (
|
|
172
|
+
localStorage.getItem('storage') === 'localStorage' ||
|
|
173
|
+
localStorage.getItem('ssId')
|
|
174
|
+
) {
|
|
175
|
+
localStorage.setItem(
|
|
176
|
+
'ssId',
|
|
177
|
+
response.headers.ssId ||
|
|
175
178
|
response.headers.SsId ||
|
|
176
179
|
response.headers.ssid
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
);
|
|
181
|
+
} else {
|
|
182
|
+
sessionStorage.setItem(
|
|
183
|
+
'ssId',
|
|
184
|
+
response.headers.ssId ||
|
|
182
185
|
response.headers.SsId ||
|
|
183
186
|
response.headers.ssid
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
if (response.status === 200) {
|
|
188
|
-
if (
|
|
189
|
-
response.data.rCode === 64 ||
|
|
190
|
-
response.data.rCode === 65 ||
|
|
191
|
-
response.data.rCode === 67 ||
|
|
192
|
-
response.data.rCode === 69
|
|
193
|
-
) {
|
|
194
|
-
removeStorage([
|
|
195
|
-
'Authorization',
|
|
196
|
-
'token',
|
|
197
|
-
'ssId',
|
|
198
|
-
'userId',
|
|
199
|
-
'userName',
|
|
200
|
-
'deviceUnique',
|
|
201
|
-
'menus',
|
|
202
|
-
'useCaseCodes',
|
|
203
|
-
'mainConfig',
|
|
204
|
-
'jump',
|
|
205
|
-
'showLaunch'
|
|
206
|
-
]);
|
|
207
|
-
let href = '';
|
|
208
|
-
try {
|
|
209
|
-
href = win.top.location.href;
|
|
210
|
-
} catch (error) {
|
|
211
|
-
href = win.location.href;
|
|
187
|
+
);
|
|
212
188
|
}
|
|
189
|
+
}
|
|
190
|
+
if (response.status === 200) {
|
|
213
191
|
if (
|
|
214
|
-
|
|
215
|
-
|
|
192
|
+
response.data.rCode === 64 ||
|
|
193
|
+
response.data.rCode === 65 ||
|
|
194
|
+
response.data.rCode === 67 ||
|
|
195
|
+
response.data.rCode === 69
|
|
216
196
|
) {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
197
|
+
removeStorage([
|
|
198
|
+
'Authorization',
|
|
199
|
+
'token',
|
|
200
|
+
'ssId',
|
|
201
|
+
'userId',
|
|
202
|
+
'userName',
|
|
203
|
+
'deviceUnique',
|
|
204
|
+
'menus',
|
|
205
|
+
'useCaseCodes',
|
|
206
|
+
'mainConfig',
|
|
207
|
+
'jump',
|
|
208
|
+
'showLaunch'
|
|
209
|
+
]);
|
|
210
|
+
let href = '';
|
|
211
|
+
try {
|
|
212
|
+
href = win.top.location.href;
|
|
213
|
+
} catch (error) {
|
|
214
|
+
href = win.location.href;
|
|
215
|
+
}
|
|
216
|
+
if (
|
|
217
|
+
href.indexOf('#/login') === -1 &&
|
|
218
|
+
href.indexOf('/login.html') === -1
|
|
219
|
+
) {
|
|
220
|
+
let remind = sessionStorage.getItem('remind');
|
|
221
|
+
if (!remind) {
|
|
222
|
+
clearTimeout(loginMsg);
|
|
223
|
+
loginMsg = setTimeout(() => {
|
|
224
|
+
sessionStorage.setItem('remind', 1);
|
|
225
|
+
MessageBox.confirm(
|
|
226
|
+
response.data.rCode === 69
|
|
227
|
+
? '该账号在其他地方已登陆!'
|
|
228
|
+
: '登录已过期,请重新登录!',
|
|
229
|
+
'提示',
|
|
230
|
+
response.data.rCode === 69
|
|
231
|
+
? {
|
|
229
232
|
confirmButtonText: '确定',
|
|
230
233
|
closeOnClickModal: false,
|
|
231
234
|
type: 'warning'
|
|
232
235
|
}
|
|
233
|
-
|
|
236
|
+
: {
|
|
234
237
|
confirmButtonText: '确定',
|
|
235
238
|
cancelButtonText: '取消',
|
|
236
239
|
closeOnClickModal: false,
|
|
237
240
|
type: 'warning'
|
|
238
241
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
242
|
+
)
|
|
243
|
+
.then(() => {
|
|
244
|
+
try {
|
|
245
|
+
const loginPage =
|
|
246
|
+
getStorage('login') || getStorage('loginPage');
|
|
247
|
+
if (loginPage) {
|
|
248
|
+
let src;
|
|
249
|
+
if (!startWith(loginPage, ['http', '/'], true)) {
|
|
250
|
+
let pathname = win.top.location.pathname;
|
|
251
|
+
if (pathname !== '/') {
|
|
252
|
+
pathname = pathname.split('/');
|
|
253
|
+
pathname.splice(pathname.length - 1);
|
|
254
|
+
pathname = pathname.join('/');
|
|
255
|
+
src = pathname + '/' + loginPage.replace('./', '');
|
|
256
|
+
} else {
|
|
257
|
+
src = pathname + loginPage.replace('./', '');
|
|
258
|
+
}
|
|
253
259
|
} else {
|
|
254
|
-
src =
|
|
260
|
+
src = loginPage;
|
|
255
261
|
}
|
|
262
|
+
win.top.location.href = src;
|
|
263
|
+
} else if (
|
|
264
|
+
win.top.location.href.indexOf('main.html') > -1
|
|
265
|
+
) {
|
|
266
|
+
win.top.location.href = './login.html';
|
|
256
267
|
} else {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
const hash = win.top.location.hash;
|
|
266
|
-
if (hash) {
|
|
267
|
-
const len = win.top.location.href.indexOf(hash);
|
|
268
|
-
win.top.location.href =
|
|
269
|
-
win.location.href.slice(0, len) + '#/login';
|
|
270
|
-
} else {
|
|
271
|
-
win.top.location.href = '/login.html';
|
|
268
|
+
const hash = win.top.location.hash;
|
|
269
|
+
if (hash) {
|
|
270
|
+
const len = win.top.location.href.indexOf(hash);
|
|
271
|
+
win.top.location.href =
|
|
272
|
+
win.location.href.slice(0, len) + '#/login';
|
|
273
|
+
} else {
|
|
274
|
+
win.top.location.href = '/login.html';
|
|
275
|
+
}
|
|
272
276
|
}
|
|
277
|
+
} catch (error) {
|
|
278
|
+
win.postMessage({ type: 1 }, '*');
|
|
273
279
|
}
|
|
274
|
-
}
|
|
275
|
-
|
|
280
|
+
})
|
|
281
|
+
.catch((e) => {
|
|
282
|
+
sessionStorage.removeItem('remind');
|
|
283
|
+
});
|
|
284
|
+
}, 2000);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
} else if (response.data.rCode === 61) {
|
|
288
|
+
clearTimeout(initAuth);
|
|
289
|
+
initAuth = setTimeout(() => {
|
|
290
|
+
MessageBox({
|
|
291
|
+
title: '请进行二次鉴权',
|
|
292
|
+
closeOnClickModal: false,
|
|
293
|
+
closeOnPressEscape: false,
|
|
294
|
+
showConfirmButton: false,
|
|
295
|
+
dangerouslyUseHTMLString: true,
|
|
296
|
+
scroll: false,
|
|
297
|
+
customClass: 'es-retrial-auth-msg',
|
|
298
|
+
render: (h, msgBox) => {
|
|
299
|
+
return h('es-retrial-auth', {
|
|
300
|
+
ref: 'auth',
|
|
301
|
+
props: {
|
|
302
|
+
reload:
|
|
303
|
+
response.data.results.reload ||
|
|
304
|
+
response.data.results.refresh,
|
|
305
|
+
group: response.data.results.retrialAuthGroupIds,
|
|
306
|
+
type: response.data.results.retrialAuthType,
|
|
307
|
+
msgBox: msgBox
|
|
276
308
|
}
|
|
277
|
-
})
|
|
278
|
-
.catch((e) => {
|
|
279
|
-
sessionStorage.removeItem('remind');
|
|
280
309
|
});
|
|
281
|
-
|
|
282
|
-
|
|
310
|
+
},
|
|
311
|
+
callback: (res, obj) => {
|
|
312
|
+
obj.$children.forEach((item) => {
|
|
313
|
+
item.clearTimeouts && item.clearTimeouts();
|
|
314
|
+
return;
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}, 1000);
|
|
283
319
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
initAuth = setTimeout(() => {
|
|
287
|
-
MessageBox({
|
|
288
|
-
title: '请进行二次鉴权',
|
|
289
|
-
closeOnClickModal: false,
|
|
290
|
-
closeOnPressEscape: false,
|
|
291
|
-
showConfirmButton: false,
|
|
292
|
-
dangerouslyUseHTMLString: true,
|
|
293
|
-
scroll: false,
|
|
294
|
-
customClass: 'es-retrial-auth-msg',
|
|
295
|
-
render: (h, msgBox) => {
|
|
296
|
-
return h('es-retrial-auth', {
|
|
297
|
-
ref: 'auth',
|
|
298
|
-
props: {
|
|
299
|
-
reload:
|
|
300
|
-
response.data.results.reload ||
|
|
301
|
-
response.data.results.refresh,
|
|
302
|
-
group: response.data.results.retrialAuthGroupIds,
|
|
303
|
-
type: response.data.results.retrialAuthType,
|
|
304
|
-
msgBox: msgBox
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
},
|
|
308
|
-
callback: (res, obj) => {
|
|
309
|
-
obj.$children.forEach((item) => {
|
|
310
|
-
item.clearTimeouts && item.clearTimeouts();
|
|
311
|
-
return;
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
}, 1000);
|
|
320
|
+
// eslint-disable-next-line no-undef
|
|
321
|
+
return Promise.resolve(JSON.parse(JSON.stringify(response.data)));
|
|
316
322
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
323
|
+
},
|
|
324
|
+
(error) => {
|
|
325
|
+
loading && loading.close();
|
|
326
|
+
// if (!axios.isCancel(error)) {
|
|
327
|
+
// delPendingRequest(error.config || {});
|
|
328
|
+
// }
|
|
329
|
+
if (error && error.response) {
|
|
330
|
+
if (error.response.status) {
|
|
331
|
+
switch (error.response.status) {
|
|
332
|
+
case 400:
|
|
333
|
+
error.message = '错误请求';
|
|
334
|
+
break;
|
|
335
|
+
case 401:
|
|
336
|
+
error.message = '未授权,请重新登录';
|
|
337
|
+
break;
|
|
338
|
+
case 403:
|
|
339
|
+
error.message = '服务器错误';
|
|
340
|
+
break;
|
|
341
|
+
case 404:
|
|
342
|
+
error.message = '网络请求不存在';
|
|
343
|
+
break;
|
|
344
|
+
case 405:
|
|
345
|
+
error.message = '请求方法错误';
|
|
346
|
+
break;
|
|
347
|
+
case 408:
|
|
348
|
+
error.message = '请求超时';
|
|
349
|
+
break;
|
|
350
|
+
case 500:
|
|
351
|
+
error.message = '服务器错误';
|
|
352
|
+
break;
|
|
353
|
+
case 501:
|
|
354
|
+
error.message = '网络未实现';
|
|
355
|
+
break;
|
|
356
|
+
case 502:
|
|
357
|
+
error.message = '网络错误';
|
|
358
|
+
break;
|
|
359
|
+
case 503:
|
|
360
|
+
error.message = '服务不可用';
|
|
361
|
+
break;
|
|
362
|
+
case 504:
|
|
363
|
+
error.message = '网络超时';
|
|
364
|
+
break;
|
|
365
|
+
case 505:
|
|
366
|
+
error.message = 'http版本不支持该请求';
|
|
367
|
+
break;
|
|
368
|
+
default:
|
|
369
|
+
error.message = `连接错误${error.response.status}`;
|
|
370
|
+
}
|
|
371
|
+
} else {
|
|
372
|
+
error.message = '无法请求,请联系管理员';
|
|
367
373
|
}
|
|
368
|
-
} else {
|
|
369
|
-
error.message = '无法请求,请联系管理员';
|
|
370
374
|
}
|
|
375
|
+
// eslint-disable-next-line no-undef
|
|
376
|
+
return Promise.reject(error);
|
|
371
377
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
);
|
|
378
|
+
);
|
|
379
|
+
}
|
|
376
380
|
let userId = getStorage('userId');
|
|
377
381
|
if (
|
|
378
382
|
!Object.prototype.hasOwnProperty.call(data, 'userId') &&
|
|
@@ -481,7 +485,142 @@ const ajax = function ({
|
|
|
481
485
|
...configs
|
|
482
486
|
});
|
|
483
487
|
};
|
|
488
|
+
/**
|
|
489
|
+
* ajaxStream
|
|
490
|
+
* @desc:ajax流式请求
|
|
491
|
+
* @author huangbo
|
|
492
|
+
* @date 2022年5月7日
|
|
493
|
+
* @param {Object} [controller] - controller
|
|
494
|
+
* @param {String} [method] - 请求类型
|
|
495
|
+
* @param {String} [url] - 请求地址
|
|
496
|
+
* @param {String} [host] - host
|
|
497
|
+
* @param {Object} [data] - 请求参数
|
|
498
|
+
* @param {Object} [params] - 请求参数
|
|
499
|
+
**/
|
|
500
|
+
const ajaxStream = function ({ controller, method = 'post', host, url, data, params, progress, success, fail, final, ...configs }) {
|
|
501
|
+
try {
|
|
502
|
+
// 如果有正在进行的请求,取消它
|
|
503
|
+
if (controller) {
|
|
504
|
+
controller.abort();
|
|
505
|
+
}
|
|
506
|
+
controller = new AbortController();
|
|
507
|
+
const baseURL = host || getStorage('baseHost') || '';
|
|
508
|
+
let userId = getStorage('userId');
|
|
509
|
+
if (
|
|
510
|
+
data && !Object.prototype.hasOwnProperty.call(data, 'userId') &&
|
|
511
|
+
userId
|
|
512
|
+
) {
|
|
513
|
+
data.userId = userId;
|
|
514
|
+
}
|
|
515
|
+
if (
|
|
516
|
+
params && !Object.prototype.hasOwnProperty.call(params, 'userId') &&
|
|
517
|
+
userId
|
|
518
|
+
) {
|
|
519
|
+
params.userId = getStorage('userId');
|
|
520
|
+
}
|
|
521
|
+
let info = {
|
|
522
|
+
|
|
523
|
+
};
|
|
524
|
+
let partialData = '';
|
|
525
|
+
let lastProcessedIndex = 0;
|
|
526
|
+
let done = false;
|
|
527
|
+
ajax({
|
|
528
|
+
timeout: 990000,
|
|
529
|
+
format: false,
|
|
530
|
+
method,
|
|
531
|
+
url: baseURL + url,
|
|
532
|
+
signal: controller.signal,
|
|
533
|
+
responseType: 'text',
|
|
534
|
+
data,
|
|
535
|
+
params,
|
|
536
|
+
...configs,
|
|
537
|
+
onDownloadProgress: progressEvent => {
|
|
538
|
+
// 获取从上次处理后新增的数据
|
|
539
|
+
const currentResponse = (progressEvent.event || progressEvent).currentTarget.responseText;
|
|
540
|
+
const chunk = currentResponse.slice(lastProcessedIndex);
|
|
541
|
+
|
|
542
|
+
// 更新偏移量
|
|
543
|
+
lastProcessedIndex = currentResponse.length;
|
|
544
|
+
|
|
545
|
+
// 假设数据是以 'data:' 开头的 SSE 格式
|
|
546
|
+
partialData += chunk;
|
|
547
|
+
const lines = partialData.split('\n');
|
|
548
|
+
let remainingData = ''; // 用于保存未完整处理的部分数据
|
|
549
|
+
lines.forEach(line => {
|
|
550
|
+
if (line.startsWith('data:')) {
|
|
551
|
+
const data = line.replace('data:', '').trim();
|
|
552
|
+
if (data) {
|
|
553
|
+
try {
|
|
554
|
+
// 假设数据是 JSON 格式
|
|
555
|
+
const parsedData = JSON.parse(data);
|
|
556
|
+
info.time = parsedData.time;
|
|
557
|
+
info.conversationId = parsedData.conversationId;
|
|
558
|
+
|
|
559
|
+
// 使用正则表达式匹配 <think> 标签
|
|
560
|
+
const thinkRegex = /<think>([\s\S]*?)<\/think>([\s\S]*)?/;
|
|
561
|
+
const match = parsedData.message.match(thinkRegex);
|
|
562
|
+
if (match) {
|
|
563
|
+
const thinkContent = match[1] ? match[1].trim() : ''; // <think> 标签内的数据
|
|
564
|
+
const content = match[2] ? match[2].trim() : ''; // <think> 标签后的数据
|
|
565
|
+
// 更新 AI 消息内容
|
|
566
|
+
info.thinkContent += thinkContent;
|
|
567
|
+
info.content += content;
|
|
568
|
+
} else {
|
|
569
|
+
// 如果没有 <think> 标签,直接将消息内容赋值到 content
|
|
570
|
+
info.content += parsedData.message;
|
|
571
|
+
}
|
|
572
|
+
done = parsedData.done;
|
|
573
|
+
} catch (parseError) {
|
|
574
|
+
console.error('解析数据出错:', parseError);
|
|
575
|
+
}
|
|
576
|
+
// Promise.resolve({message: info, controller});
|
|
577
|
+
}
|
|
578
|
+
} else {
|
|
579
|
+
// 保存未处理完的部分数据
|
|
580
|
+
remainingData += line + '\n';
|
|
581
|
+
}
|
|
582
|
+
});
|
|
484
583
|
|
|
584
|
+
// 将未完整处理的数据保留到 partialData 中
|
|
585
|
+
partialData = remainingData;
|
|
586
|
+
progress && progress({ message: info, controller, done });
|
|
587
|
+
}
|
|
588
|
+
}).then(() => {
|
|
589
|
+
// 处理请求完成后的信息
|
|
590
|
+
const originalText = info.content;
|
|
591
|
+
const regex = /<think>([\s\S]*?)<\/think>([\s\S]*)/;
|
|
592
|
+
const match = originalText.match(regex);
|
|
593
|
+
if (match) {
|
|
594
|
+
info.thinkContent = match ? match[1].trim() : '';
|
|
595
|
+
info.content = match ? match[2].trim() : '';
|
|
596
|
+
}
|
|
597
|
+
success && success({ message: info, controller });
|
|
598
|
+
})
|
|
599
|
+
.catch(() => {
|
|
600
|
+
// 处理请求完成后的信息
|
|
601
|
+
const originalText = info.content || '';
|
|
602
|
+
const regex = /<think>([\s\S]*?)<\/think>([\s\S]*)/;
|
|
603
|
+
const match = originalText.match(regex);
|
|
604
|
+
if (match) {
|
|
605
|
+
info.thinkContent = match ? match[1].trim() : '';
|
|
606
|
+
info.content = match ? match[2].trim() : '';
|
|
607
|
+
}
|
|
608
|
+
fail && fail({ status: 1, message: info, controller });
|
|
609
|
+
});
|
|
610
|
+
} catch (error) {
|
|
611
|
+
console.error('聊天请求出错:', error);
|
|
612
|
+
let errorMessage = '抱歉,发生了一个错误,请稍后再试。';
|
|
613
|
+
if (error.code === 'ERR_NETWORK') {
|
|
614
|
+
errorMessage = '网络连接错误,请检查服务器是否正在运行或网络连接是否正常。';
|
|
615
|
+
} else if (error.response) {
|
|
616
|
+
errorMessage = `服务器错误 (${error.response.status}): ${error.response.data || '未知错误'
|
|
617
|
+
}`;
|
|
618
|
+
}
|
|
619
|
+
fail && fail({ status: 0, message: { role: 'assistant', content: errorMessage }, controller });
|
|
620
|
+
} finally {
|
|
621
|
+
final && final({ status: -1, message: null, controller });
|
|
622
|
+
}
|
|
623
|
+
};
|
|
485
624
|
/**
|
|
486
625
|
* arrUnique
|
|
487
626
|
* @desc:数组元素对象去重
|
|
@@ -552,7 +691,7 @@ const browser = function () {
|
|
|
552
691
|
* @author huangbo
|
|
553
692
|
* @date 2022年5月7日
|
|
554
693
|
**/
|
|
555
|
-
const busEmit = function (vm = this, {method, args}) {
|
|
694
|
+
const busEmit = function (vm = this, { method, args }) {
|
|
556
695
|
const bus = win.$wujie ? win.$wujie.bus : vm.bus || vm.$root.Bus;
|
|
557
696
|
bus && bus.$emit(method, args);
|
|
558
697
|
window.postMessage({ method, query: args }, '*');
|
|
@@ -1430,7 +1569,7 @@ const getMainConfig = function (callback) {
|
|
|
1430
1569
|
callback(res.results);
|
|
1431
1570
|
}
|
|
1432
1571
|
})
|
|
1433
|
-
.catch(() => {});
|
|
1572
|
+
.catch(() => { });
|
|
1434
1573
|
};
|
|
1435
1574
|
|
|
1436
1575
|
/**
|
|
@@ -2219,7 +2358,7 @@ const isLogined = function ({
|
|
|
2219
2358
|
removeStorage();
|
|
2220
2359
|
}
|
|
2221
2360
|
})
|
|
2222
|
-
.catch(() => {});
|
|
2361
|
+
.catch(() => { });
|
|
2223
2362
|
return;
|
|
2224
2363
|
}
|
|
2225
2364
|
let pathname = '';
|
|
@@ -2252,7 +2391,7 @@ const isLogined = function ({
|
|
|
2252
2391
|
Object.prototype.hasOwnProperty.call(to.query, 'serverId') &&
|
|
2253
2392
|
Object.prototype.hasOwnProperty.call(to.query, 'authType')
|
|
2254
2393
|
) {
|
|
2255
|
-
let loadingInstance = Loading.service({text: '页面加载中', spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.65)'});
|
|
2394
|
+
let loadingInstance = Loading.service({ text: '页面加载中', spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.65)' });
|
|
2256
2395
|
ajax({
|
|
2257
2396
|
method: 'post',
|
|
2258
2397
|
url: authCenter,
|
|
@@ -2372,7 +2511,7 @@ const isLogined = function ({
|
|
|
2372
2511
|
})
|
|
2373
2512
|
.catch((e) => {
|
|
2374
2513
|
loadingInstance.close();
|
|
2375
|
-
});
|
|
2514
|
+
});
|
|
2376
2515
|
} else if (
|
|
2377
2516
|
token ||
|
|
2378
2517
|
to.path === '/' ||
|
|
@@ -3244,10 +3383,10 @@ const watermark = function (option) {
|
|
|
3244
3383
|
};
|
|
3245
3384
|
let options = option
|
|
3246
3385
|
? extend(
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3386
|
+
true,
|
|
3387
|
+
config,
|
|
3388
|
+
typeof option === 'string' ? { html: option } : option
|
|
3389
|
+
)
|
|
3251
3390
|
: config;
|
|
3252
3391
|
let wrap = document.getElementById('watermark');
|
|
3253
3392
|
if (!wrap) {
|
|
@@ -3327,6 +3466,7 @@ const watermark = function (option) {
|
|
|
3327
3466
|
|
|
3328
3467
|
export default {
|
|
3329
3468
|
ajax,
|
|
3469
|
+
ajaxStream,
|
|
3330
3470
|
arrUnique,
|
|
3331
3471
|
average,
|
|
3332
3472
|
browser,
|