cloudcc-ccdk 0.4.10 → 0.5.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/README.md +344 -344
- package/lib/ccdk.js +771 -779
- package/lib/ccdk.min.js +1 -1
- package/package.json +31 -30
package/lib/ccdk.js
CHANGED
|
@@ -1,74 +1,72 @@
|
|
|
1
|
-
import CryptoJS from 'crypto-js
|
|
2
|
-
import UTF8 from 'crypto-js/enc-utf8';
|
|
3
|
-
import PAD from 'crypto-js/pad-pkcs7';
|
|
1
|
+
import CryptoJS from 'crypto-js';
|
|
4
2
|
import Vue from 'vue';
|
|
5
3
|
import axios from 'axios';
|
|
6
4
|
import { Message, MessageBox, Notification } from 'element-ui';
|
|
7
5
|
import Cookies from 'js-cookie';
|
|
8
6
|
|
|
9
|
-
/**
|
|
10
|
-
* 加密
|
|
11
|
-
* @param {String} data 数据
|
|
12
|
-
* @param {String} key 密钥
|
|
13
|
-
* @param {String} iv 偏移量
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
function getAesString(data, key, iv) {
|
|
17
|
-
key =
|
|
18
|
-
iv =
|
|
19
|
-
let encrypted = CryptoJS.encrypt(data, key, {
|
|
20
|
-
iv: iv,
|
|
21
|
-
padding:
|
|
22
|
-
});
|
|
23
|
-
return encrypted.toString(); //返回的是base64格式的密文
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 解密
|
|
28
|
-
* @param {String} encrypted 密文
|
|
29
|
-
* @param {String} key 密钥
|
|
30
|
-
* @param {String} iv 偏移量
|
|
31
|
-
* @returns
|
|
32
|
-
*/
|
|
33
|
-
function getDAesString(encrypted, key, iv) {
|
|
34
|
-
key =
|
|
35
|
-
iv =
|
|
36
|
-
let decrypted = CryptoJS.decrypt(encrypted, key, {
|
|
37
|
-
iv: iv,
|
|
38
|
-
padding:
|
|
39
|
-
});
|
|
40
|
-
return decrypted.toString(
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* CryptoJS加密
|
|
45
|
-
* @param {String} data 数据
|
|
46
|
-
* @param {String} key 密钥
|
|
47
|
-
* @param {String} iv 偏移量
|
|
48
|
-
* @returns 加密的数据
|
|
49
|
-
*/
|
|
50
|
-
function encrypt(data, key = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", iv = 1) {
|
|
51
|
-
data = JSON.stringify(data);
|
|
52
|
-
var encrypted = getAesString(data, key, iv); //密文
|
|
53
|
-
return encrypted;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* CryptoJS解密
|
|
58
|
-
* @param {String} data 加密的数据
|
|
59
|
-
* @param {String} key 密钥
|
|
60
|
-
* @param {String} iv 偏移量
|
|
61
|
-
* @returns 解密的数据
|
|
62
|
-
*/
|
|
63
|
-
function decrypt(data, key = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", iv = 1) {
|
|
64
|
-
try {
|
|
65
|
-
var decryptedStr = getDAesString(data, key, iv);
|
|
66
|
-
if (!decryptedStr) return null
|
|
67
|
-
return JSON.parse(decryptedStr);
|
|
68
|
-
} catch (error) {
|
|
69
|
-
console.trace("解密密码错误", error);
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
7
|
+
/**
|
|
8
|
+
* 加密
|
|
9
|
+
* @param {String} data 数据
|
|
10
|
+
* @param {String} key 密钥
|
|
11
|
+
* @param {String} iv 偏移量
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
function getAesString(data, key, iv) {
|
|
15
|
+
key = CryptoJS.enc.Utf8.parse(key);
|
|
16
|
+
iv = CryptoJS.enc.Utf8.parse(iv);
|
|
17
|
+
let encrypted = CryptoJS.AES.encrypt(data, key, {
|
|
18
|
+
iv: iv,
|
|
19
|
+
padding: CryptoJS.pad.Pkcs7,
|
|
20
|
+
});
|
|
21
|
+
return encrypted.toString(); //返回的是base64格式的密文
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 解密
|
|
26
|
+
* @param {String} encrypted 密文
|
|
27
|
+
* @param {String} key 密钥
|
|
28
|
+
* @param {String} iv 偏移量
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
function getDAesString(encrypted, key, iv) {
|
|
32
|
+
key = CryptoJS.enc.Utf8.parse(key);
|
|
33
|
+
iv = CryptoJS.enc.Utf8.parse(iv);
|
|
34
|
+
let decrypted = CryptoJS.AES.decrypt(encrypted, key, {
|
|
35
|
+
iv: iv,
|
|
36
|
+
padding: CryptoJS.pad.Pkcs7,
|
|
37
|
+
});
|
|
38
|
+
return decrypted.toString(CryptoJS.enc.Utf8);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* CryptoJS加密
|
|
43
|
+
* @param {String} data 数据
|
|
44
|
+
* @param {String} key 密钥
|
|
45
|
+
* @param {String} iv 偏移量
|
|
46
|
+
* @returns 加密的数据
|
|
47
|
+
*/
|
|
48
|
+
function encrypt(data, key = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", iv = 1) {
|
|
49
|
+
data = JSON.stringify(data);
|
|
50
|
+
var encrypted = getAesString(data, key, iv); //密文
|
|
51
|
+
return encrypted;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* CryptoJS解密
|
|
56
|
+
* @param {String} data 加密的数据
|
|
57
|
+
* @param {String} key 密钥
|
|
58
|
+
* @param {String} iv 偏移量
|
|
59
|
+
* @returns 解密的数据
|
|
60
|
+
*/
|
|
61
|
+
function decrypt(data, key = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", iv = 1) {
|
|
62
|
+
try {
|
|
63
|
+
var decryptedStr = getDAesString(data, key, iv);
|
|
64
|
+
if (!decryptedStr) return null
|
|
65
|
+
return JSON.parse(decryptedStr);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
console.trace("解密密码错误", error);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
72
70
|
}
|
|
73
71
|
|
|
74
72
|
var Crypto = /*#__PURE__*/Object.freeze({
|
|
@@ -77,27 +75,27 @@ var Crypto = /*#__PURE__*/Object.freeze({
|
|
|
77
75
|
decrypt: decrypt
|
|
78
76
|
});
|
|
79
77
|
|
|
80
|
-
// 当前应用存储标识
|
|
81
|
-
const APPLICATION_DETAIL = 'applicaton_current';
|
|
82
|
-
/**
|
|
83
|
-
* 获得当前访问的应用对象
|
|
84
|
-
*/
|
|
85
|
-
function getApplicaton() {
|
|
86
|
-
let detail = localStorage.getItem(Crypto.encrypt(APPLICATION_DETAIL));
|
|
87
|
-
if (detail) {
|
|
88
|
-
return JSON.parse(detail)
|
|
89
|
-
}
|
|
90
|
-
return ''
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* 设置应用对象信息
|
|
95
|
-
* @param {object} detail 应用对象
|
|
96
|
-
*/
|
|
97
|
-
function setApplication(detail = '') {
|
|
98
|
-
if (detail) {
|
|
99
|
-
localStorage.setItem(Crypto.encrypt(APPLICATION_DETAIL), JSON.stringify(detail));
|
|
100
|
-
}
|
|
78
|
+
// 当前应用存储标识
|
|
79
|
+
const APPLICATION_DETAIL = 'applicaton_current';
|
|
80
|
+
/**
|
|
81
|
+
* 获得当前访问的应用对象
|
|
82
|
+
*/
|
|
83
|
+
function getApplicaton() {
|
|
84
|
+
let detail = localStorage.getItem(Crypto.encrypt(APPLICATION_DETAIL));
|
|
85
|
+
if (detail) {
|
|
86
|
+
return JSON.parse(detail)
|
|
87
|
+
}
|
|
88
|
+
return ''
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 设置应用对象信息
|
|
93
|
+
* @param {object} detail 应用对象
|
|
94
|
+
*/
|
|
95
|
+
function setApplication(detail = '') {
|
|
96
|
+
if (detail) {
|
|
97
|
+
localStorage.setItem(Crypto.encrypt(APPLICATION_DETAIL), JSON.stringify(detail));
|
|
98
|
+
}
|
|
101
99
|
}
|
|
102
100
|
|
|
103
101
|
var CCApplication = /*#__PURE__*/Object.freeze({
|
|
@@ -106,29 +104,29 @@ var CCApplication = /*#__PURE__*/Object.freeze({
|
|
|
106
104
|
setApplication: setApplication
|
|
107
105
|
});
|
|
108
106
|
|
|
109
|
-
window.ccBus = new Vue;
|
|
110
|
-
/**
|
|
111
|
-
* 发布信息
|
|
112
|
-
* @param {string} event 事件名称
|
|
113
|
-
* @param {...any} args 参数列表
|
|
114
|
-
*/
|
|
115
|
-
function $emit(event, ...args) {
|
|
116
|
-
window.ccBus.$emit(event, ...args);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* 订阅消息
|
|
120
|
-
* @param {string} event 事件名称
|
|
121
|
-
* @param {function} callback 回调方法
|
|
122
|
-
*/
|
|
123
|
-
function $on(event, callback) {
|
|
124
|
-
window.ccBus.$on(event, callback);
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* 取消订阅
|
|
128
|
-
* @param {string} event 事件名称
|
|
129
|
-
*/
|
|
130
|
-
function $off(event) {
|
|
131
|
-
window.ccBus.$off(event);
|
|
107
|
+
window.ccBus = new Vue;
|
|
108
|
+
/**
|
|
109
|
+
* 发布信息
|
|
110
|
+
* @param {string} event 事件名称
|
|
111
|
+
* @param {...any} args 参数列表
|
|
112
|
+
*/
|
|
113
|
+
function $emit(event, ...args) {
|
|
114
|
+
window.ccBus.$emit(event, ...args);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* 订阅消息
|
|
118
|
+
* @param {string} event 事件名称
|
|
119
|
+
* @param {function} callback 回调方法
|
|
120
|
+
*/
|
|
121
|
+
function $on(event, callback) {
|
|
122
|
+
window.ccBus.$on(event, callback);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* 取消订阅
|
|
126
|
+
* @param {string} event 事件名称
|
|
127
|
+
*/
|
|
128
|
+
function $off(event) {
|
|
129
|
+
window.ccBus.$off(event);
|
|
132
130
|
}
|
|
133
131
|
|
|
134
132
|
var CCBus = /*#__PURE__*/Object.freeze({
|
|
@@ -138,57 +136,57 @@ var CCBus = /*#__PURE__*/Object.freeze({
|
|
|
138
136
|
$off: $off
|
|
139
137
|
});
|
|
140
138
|
|
|
141
|
-
// 电话对象
|
|
142
|
-
let ccCall = new Map();
|
|
143
|
-
// 电话服务商当前对象
|
|
144
|
-
let currentCall;
|
|
145
|
-
/**
|
|
146
|
-
* 初始化电话条
|
|
147
|
-
* @param {string} id 电话服务商唯一标识
|
|
148
|
-
* @param {object} callClient 电话对象
|
|
149
|
-
*/
|
|
150
|
-
function init$1(id, callClient) {
|
|
151
|
-
if (id && callClient) {
|
|
152
|
-
ccCall.set(id, callClient);
|
|
153
|
-
currentCall = callClient;
|
|
154
|
-
return currentCall
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* 拨打电话
|
|
161
|
-
* @param {string} id 电话服务商唯一标识
|
|
162
|
-
* @param {object} options 配置信息
|
|
163
|
-
*/
|
|
164
|
-
function call(id, options) {
|
|
165
|
-
let call;
|
|
166
|
-
if (id) {
|
|
167
|
-
call = ccCall.get(id);
|
|
168
|
-
} else {
|
|
169
|
-
call = currentCall;
|
|
170
|
-
}
|
|
171
|
-
if (call) {
|
|
172
|
-
call.call(options);
|
|
173
|
-
}
|
|
174
|
-
return call
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* 打开通话面板
|
|
178
|
-
* @param {string} id 电话服务商唯一标识
|
|
179
|
-
* @param {object} options 配置信息
|
|
180
|
-
*/
|
|
181
|
-
function openCallPanel(id, options) {
|
|
182
|
-
let call;
|
|
183
|
-
if (id) {
|
|
184
|
-
call = ccCall.get(id);
|
|
185
|
-
} else {
|
|
186
|
-
call = currentCall;
|
|
187
|
-
}
|
|
188
|
-
if (call) {
|
|
189
|
-
call.openCallPanel(options);
|
|
190
|
-
}
|
|
191
|
-
return call
|
|
139
|
+
// 电话对象
|
|
140
|
+
let ccCall = new Map();
|
|
141
|
+
// 电话服务商当前对象
|
|
142
|
+
let currentCall;
|
|
143
|
+
/**
|
|
144
|
+
* 初始化电话条
|
|
145
|
+
* @param {string} id 电话服务商唯一标识
|
|
146
|
+
* @param {object} callClient 电话对象
|
|
147
|
+
*/
|
|
148
|
+
function init$1(id, callClient) {
|
|
149
|
+
if (id && callClient) {
|
|
150
|
+
ccCall.set(id, callClient);
|
|
151
|
+
currentCall = callClient;
|
|
152
|
+
return currentCall
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* 拨打电话
|
|
159
|
+
* @param {string} id 电话服务商唯一标识
|
|
160
|
+
* @param {object} options 配置信息
|
|
161
|
+
*/
|
|
162
|
+
function call(id, options) {
|
|
163
|
+
let call;
|
|
164
|
+
if (id) {
|
|
165
|
+
call = ccCall.get(id);
|
|
166
|
+
} else {
|
|
167
|
+
call = currentCall;
|
|
168
|
+
}
|
|
169
|
+
if (call) {
|
|
170
|
+
call.call(options);
|
|
171
|
+
}
|
|
172
|
+
return call
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* 打开通话面板
|
|
176
|
+
* @param {string} id 电话服务商唯一标识
|
|
177
|
+
* @param {object} options 配置信息
|
|
178
|
+
*/
|
|
179
|
+
function openCallPanel(id, options) {
|
|
180
|
+
let call;
|
|
181
|
+
if (id) {
|
|
182
|
+
call = ccCall.get(id);
|
|
183
|
+
} else {
|
|
184
|
+
call = currentCall;
|
|
185
|
+
}
|
|
186
|
+
if (call) {
|
|
187
|
+
call.openCallPanel(options);
|
|
188
|
+
}
|
|
189
|
+
return call
|
|
192
190
|
}
|
|
193
191
|
|
|
194
192
|
var CCCall = /*#__PURE__*/Object.freeze({
|
|
@@ -198,26 +196,26 @@ var CCCall = /*#__PURE__*/Object.freeze({
|
|
|
198
196
|
openCallPanel: openCallPanel
|
|
199
197
|
});
|
|
200
198
|
|
|
201
|
-
/**
|
|
202
|
-
* 获取基础url
|
|
203
|
-
* @returns 基础地址
|
|
204
|
-
*/
|
|
205
|
-
function getBaseUrl() {
|
|
206
|
-
return window.gw.BASE_URL
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* 获取网关对象
|
|
210
|
-
* @returns 网关对象
|
|
211
|
-
*/
|
|
212
|
-
function getGw() {
|
|
213
|
-
return window.gw;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* 获取服务对象
|
|
217
|
-
* @returns 服务对象
|
|
218
|
-
*/
|
|
219
|
-
function getSvc() {
|
|
220
|
-
return window.Glod;
|
|
199
|
+
/**
|
|
200
|
+
* 获取基础url
|
|
201
|
+
* @returns 基础地址
|
|
202
|
+
*/
|
|
203
|
+
function getBaseUrl() {
|
|
204
|
+
return window.gw.BASE_URL
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* 获取网关对象
|
|
208
|
+
* @returns 网关对象
|
|
209
|
+
*/
|
|
210
|
+
function getGw() {
|
|
211
|
+
return window.gw;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* 获取服务对象
|
|
215
|
+
* @returns 服务对象
|
|
216
|
+
*/
|
|
217
|
+
function getSvc() {
|
|
218
|
+
return window.Glod;
|
|
221
219
|
}
|
|
222
220
|
|
|
223
221
|
var CCConfig = /*#__PURE__*/Object.freeze({
|
|
@@ -227,76 +225,76 @@ var CCConfig = /*#__PURE__*/Object.freeze({
|
|
|
227
225
|
getSvc: getSvc
|
|
228
226
|
});
|
|
229
227
|
|
|
230
|
-
const service = axios.create({
|
|
231
|
-
timeout: 60000,
|
|
232
|
-
headers: {
|
|
233
|
-
'Content-Type': 'application/json; charset=utf-8',
|
|
234
|
-
},
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
service.interceptors.request.use(
|
|
238
|
-
config => {
|
|
239
|
-
config.headers['accessToken'] = window.$CCDK.CCToken.getToken();
|
|
240
|
-
return config
|
|
241
|
-
},
|
|
242
|
-
error => {
|
|
243
|
-
Promise.reject(error);
|
|
244
|
-
}
|
|
245
|
-
);
|
|
246
|
-
|
|
247
|
-
service.interceptors.response.use(
|
|
248
|
-
response => {
|
|
249
|
-
const code = response.data.code || 200;
|
|
250
|
-
if (code !== 200) {
|
|
251
|
-
return Promise.reject(null == response.data.msg ? "未知异常" : response.data.msg)
|
|
252
|
-
} else {
|
|
253
|
-
return response.data
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
error => {
|
|
257
|
-
return Promise.reject(error)
|
|
258
|
-
}
|
|
259
|
-
);
|
|
260
|
-
function get(url, data = {}, responseType = '') {
|
|
261
|
-
return service({
|
|
262
|
-
url: url,
|
|
263
|
-
method: 'get',
|
|
264
|
-
params: data,
|
|
265
|
-
responseType: responseType
|
|
266
|
-
})
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
function post(url, data = {}, responseType = '') {
|
|
270
|
-
return service({
|
|
271
|
-
url: url,
|
|
272
|
-
method: 'post',
|
|
273
|
-
data: data,
|
|
274
|
-
responseType: responseType
|
|
275
|
-
})
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
function put(url, data = {}) {
|
|
279
|
-
return service({
|
|
280
|
-
url: url,
|
|
281
|
-
method: 'put',
|
|
282
|
-
data: data
|
|
283
|
-
})
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
function postParams(url, data = {}) {
|
|
287
|
-
return service({
|
|
288
|
-
url: url,
|
|
289
|
-
method: 'post',
|
|
290
|
-
params: data
|
|
291
|
-
})
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
function patch(url, data = {}) {
|
|
295
|
-
return service({
|
|
296
|
-
url: url,
|
|
297
|
-
method: 'patch',
|
|
298
|
-
data: data
|
|
299
|
-
})
|
|
228
|
+
const service = axios.create({
|
|
229
|
+
timeout: 60000,
|
|
230
|
+
headers: {
|
|
231
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
232
|
+
},
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
service.interceptors.request.use(
|
|
236
|
+
config => {
|
|
237
|
+
config.headers['accessToken'] = window.$CCDK.CCToken.getToken();
|
|
238
|
+
return config
|
|
239
|
+
},
|
|
240
|
+
error => {
|
|
241
|
+
Promise.reject(error);
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
service.interceptors.response.use(
|
|
246
|
+
response => {
|
|
247
|
+
const code = response.data.code || 200;
|
|
248
|
+
if (code !== 200) {
|
|
249
|
+
return Promise.reject(null == response.data.msg ? "未知异常" : response.data.msg)
|
|
250
|
+
} else {
|
|
251
|
+
return response.data
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
error => {
|
|
255
|
+
return Promise.reject(error)
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
function get(url, data = {}, responseType = '') {
|
|
259
|
+
return service({
|
|
260
|
+
url: url,
|
|
261
|
+
method: 'get',
|
|
262
|
+
params: data,
|
|
263
|
+
responseType: responseType
|
|
264
|
+
})
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function post(url, data = {}, responseType = '') {
|
|
268
|
+
return service({
|
|
269
|
+
url: url,
|
|
270
|
+
method: 'post',
|
|
271
|
+
data: data,
|
|
272
|
+
responseType: responseType
|
|
273
|
+
})
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function put(url, data = {}) {
|
|
277
|
+
return service({
|
|
278
|
+
url: url,
|
|
279
|
+
method: 'put',
|
|
280
|
+
data: data
|
|
281
|
+
})
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function postParams(url, data = {}) {
|
|
285
|
+
return service({
|
|
286
|
+
url: url,
|
|
287
|
+
method: 'post',
|
|
288
|
+
params: data
|
|
289
|
+
})
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function patch(url, data = {}) {
|
|
293
|
+
return service({
|
|
294
|
+
url: url,
|
|
295
|
+
method: 'patch',
|
|
296
|
+
data: data
|
|
297
|
+
})
|
|
300
298
|
}
|
|
301
299
|
|
|
302
300
|
var CCHttp = /*#__PURE__*/Object.freeze({
|
|
@@ -308,64 +306,64 @@ var CCHttp = /*#__PURE__*/Object.freeze({
|
|
|
308
306
|
postParams: postParams
|
|
309
307
|
});
|
|
310
308
|
|
|
311
|
-
/**
|
|
312
|
-
* 下载js,并挂载到document上
|
|
313
|
-
* @param {string} src js下载路径
|
|
314
|
-
* @param {object} scriptOption script配置参数
|
|
315
|
-
* @returns
|
|
316
|
-
*/
|
|
317
|
-
function loadJs(src, scriptOption) {
|
|
318
|
-
return new Promise((resolve, reject) => {
|
|
319
|
-
let scriptTemp = document.createElement('script');
|
|
320
|
-
if (scriptOption) {
|
|
321
|
-
Object.assign(scriptTemp, scriptOption);
|
|
322
|
-
}
|
|
323
|
-
scriptTemp.type = "text/javascript";
|
|
324
|
-
scriptTemp.src = src;
|
|
325
|
-
document.body.appendChild(scriptTemp);
|
|
326
|
-
|
|
327
|
-
scriptTemp.onload = () => {
|
|
328
|
-
resolve();
|
|
329
|
-
};
|
|
330
|
-
scriptTemp.onerror = () => {
|
|
331
|
-
reject();
|
|
332
|
-
};
|
|
333
|
-
})
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* 创建加载js组件
|
|
337
|
-
*/
|
|
338
|
-
function createLoadJsComponent() {
|
|
339
|
-
Vue.component('cc-load-script', {
|
|
340
|
-
render: function (createElement) {
|
|
341
|
-
var self = this;
|
|
342
|
-
return createElement('script', {
|
|
343
|
-
attrs: {
|
|
344
|
-
type: 'text/javascript',
|
|
345
|
-
src: this.src
|
|
346
|
-
},
|
|
347
|
-
on: {
|
|
348
|
-
load: function (event) {
|
|
349
|
-
self.$emit('load', event);
|
|
350
|
-
},
|
|
351
|
-
error: function (event) {
|
|
352
|
-
self.$emit('error', event);
|
|
353
|
-
},
|
|
354
|
-
readystatechange: function (event) {
|
|
355
|
-
if (this.readyState == 'complete') {
|
|
356
|
-
self.$emit('load', event);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
},
|
|
362
|
-
props: {
|
|
363
|
-
src: {
|
|
364
|
-
type: String,
|
|
365
|
-
required: true
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
});
|
|
309
|
+
/**
|
|
310
|
+
* 下载js,并挂载到document上
|
|
311
|
+
* @param {string} src js下载路径
|
|
312
|
+
* @param {object} scriptOption script配置参数
|
|
313
|
+
* @returns
|
|
314
|
+
*/
|
|
315
|
+
function loadJs(src, scriptOption) {
|
|
316
|
+
return new Promise((resolve, reject) => {
|
|
317
|
+
let scriptTemp = document.createElement('script');
|
|
318
|
+
if (scriptOption) {
|
|
319
|
+
Object.assign(scriptTemp, scriptOption);
|
|
320
|
+
}
|
|
321
|
+
scriptTemp.type = "text/javascript";
|
|
322
|
+
scriptTemp.src = src;
|
|
323
|
+
document.body.appendChild(scriptTemp);
|
|
324
|
+
|
|
325
|
+
scriptTemp.onload = () => {
|
|
326
|
+
resolve();
|
|
327
|
+
};
|
|
328
|
+
scriptTemp.onerror = () => {
|
|
329
|
+
reject();
|
|
330
|
+
};
|
|
331
|
+
})
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* 创建加载js组件
|
|
335
|
+
*/
|
|
336
|
+
function createLoadJsComponent() {
|
|
337
|
+
Vue.component('cc-load-script', {
|
|
338
|
+
render: function (createElement) {
|
|
339
|
+
var self = this;
|
|
340
|
+
return createElement('script', {
|
|
341
|
+
attrs: {
|
|
342
|
+
type: 'text/javascript',
|
|
343
|
+
src: this.src
|
|
344
|
+
},
|
|
345
|
+
on: {
|
|
346
|
+
load: function (event) {
|
|
347
|
+
self.$emit('load', event);
|
|
348
|
+
},
|
|
349
|
+
error: function (event) {
|
|
350
|
+
self.$emit('error', event);
|
|
351
|
+
},
|
|
352
|
+
readystatechange: function (event) {
|
|
353
|
+
if (this.readyState == 'complete') {
|
|
354
|
+
self.$emit('load', event);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
},
|
|
360
|
+
props: {
|
|
361
|
+
src: {
|
|
362
|
+
type: String,
|
|
363
|
+
required: true
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
});
|
|
369
367
|
}
|
|
370
368
|
|
|
371
369
|
var CCLoad = /*#__PURE__*/Object.freeze({
|
|
@@ -374,75 +372,75 @@ var CCLoad = /*#__PURE__*/Object.freeze({
|
|
|
374
372
|
createLoadJsComponent: createLoadJsComponent
|
|
375
373
|
});
|
|
376
374
|
|
|
377
|
-
/**
|
|
378
|
-
* 添加一个一级菜单
|
|
379
|
-
* @param {object} options 菜单配置
|
|
380
|
-
*/
|
|
381
|
-
function addMenu1(options) {
|
|
382
|
-
window.$CCDK.CCBus.$emit('addMenu1', options);
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* 添加一个二级菜单
|
|
386
|
-
* @param {object} options 菜单配置
|
|
387
|
-
*/
|
|
388
|
-
function addMenu2(options) {
|
|
389
|
-
window.$CCDK.CCBus.$emit('addMenu2', options);
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* 删除一个一级菜单
|
|
393
|
-
* @param {object} options 菜单配置
|
|
394
|
-
*/
|
|
395
|
-
function deleteMenu1(options) {
|
|
396
|
-
window.$CCDK.CCBus.$emit('deleteMenu1', options);
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* 删除一个二级菜单
|
|
400
|
-
* @param {object} options 菜单配置
|
|
401
|
-
*/
|
|
402
|
-
function deleteMenu2(options) {
|
|
403
|
-
window.$CCDK.CCBus.$emit('deleteMenu2', options);
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* 刷新一个一级菜单
|
|
407
|
-
* @param {object} options 菜单配置
|
|
408
|
-
*/
|
|
409
|
-
function refreshMenu1(options) {
|
|
410
|
-
window.$CCDK.CCBus.$emit('refreshMenu1', options);
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* 刷新一个二级菜单
|
|
414
|
-
* @param {object} options 菜单配置
|
|
415
|
-
*/
|
|
416
|
-
function refreshMenu2(options) {
|
|
417
|
-
window.$CCDK.CCBus.$emit('refreshMenu2', options);
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* 替换一个一级菜单
|
|
421
|
-
* @param {object} options 菜单配置
|
|
422
|
-
*/
|
|
423
|
-
function replaceMenu1(options) {
|
|
424
|
-
window.$CCDK.CCBus.$emit('replaceMenu1', options);
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* 替换一个二级菜单
|
|
428
|
-
* @param {object} options 菜单配置
|
|
429
|
-
*/
|
|
430
|
-
function replaceMenu2(options) {
|
|
431
|
-
window.$CCDK.CCBus.$emit('replaceMenu2', options);
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* 定位到已经打开的一级菜单
|
|
435
|
-
* @param {object} options 菜单配置
|
|
436
|
-
*/
|
|
437
|
-
function reOpenMenu1(options) {
|
|
438
|
-
window.$CCDK.CCBus.$emit('reOpenMenu1', options);
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* 定位到当前一级菜单下已经打开的二级菜单(前提是当前在二级菜单下)
|
|
442
|
-
* @param {object} options 菜单配置
|
|
443
|
-
*/
|
|
444
|
-
function reOpenMenu2(options) {
|
|
445
|
-
window.$CCDK.CCBus.$emit('reOpenMenu2', options);
|
|
375
|
+
/**
|
|
376
|
+
* 添加一个一级菜单
|
|
377
|
+
* @param {object} options 菜单配置
|
|
378
|
+
*/
|
|
379
|
+
function addMenu1(options) {
|
|
380
|
+
window.$CCDK.CCBus.$emit('addMenu1', options);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* 添加一个二级菜单
|
|
384
|
+
* @param {object} options 菜单配置
|
|
385
|
+
*/
|
|
386
|
+
function addMenu2(options) {
|
|
387
|
+
window.$CCDK.CCBus.$emit('addMenu2', options);
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* 删除一个一级菜单
|
|
391
|
+
* @param {object} options 菜单配置
|
|
392
|
+
*/
|
|
393
|
+
function deleteMenu1(options) {
|
|
394
|
+
window.$CCDK.CCBus.$emit('deleteMenu1', options);
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* 删除一个二级菜单
|
|
398
|
+
* @param {object} options 菜单配置
|
|
399
|
+
*/
|
|
400
|
+
function deleteMenu2(options) {
|
|
401
|
+
window.$CCDK.CCBus.$emit('deleteMenu2', options);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* 刷新一个一级菜单
|
|
405
|
+
* @param {object} options 菜单配置
|
|
406
|
+
*/
|
|
407
|
+
function refreshMenu1(options) {
|
|
408
|
+
window.$CCDK.CCBus.$emit('refreshMenu1', options);
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* 刷新一个二级菜单
|
|
412
|
+
* @param {object} options 菜单配置
|
|
413
|
+
*/
|
|
414
|
+
function refreshMenu2(options) {
|
|
415
|
+
window.$CCDK.CCBus.$emit('refreshMenu2', options);
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* 替换一个一级菜单
|
|
419
|
+
* @param {object} options 菜单配置
|
|
420
|
+
*/
|
|
421
|
+
function replaceMenu1(options) {
|
|
422
|
+
window.$CCDK.CCBus.$emit('replaceMenu1', options);
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* 替换一个二级菜单
|
|
426
|
+
* @param {object} options 菜单配置
|
|
427
|
+
*/
|
|
428
|
+
function replaceMenu2(options) {
|
|
429
|
+
window.$CCDK.CCBus.$emit('replaceMenu2', options);
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* 定位到已经打开的一级菜单
|
|
433
|
+
* @param {object} options 菜单配置
|
|
434
|
+
*/
|
|
435
|
+
function reOpenMenu1(options) {
|
|
436
|
+
window.$CCDK.CCBus.$emit('reOpenMenu1', options);
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* 定位到当前一级菜单下已经打开的二级菜单(前提是当前在二级菜单下)
|
|
440
|
+
* @param {object} options 菜单配置
|
|
441
|
+
*/
|
|
442
|
+
function reOpenMenu2(options) {
|
|
443
|
+
window.$CCDK.CCBus.$emit('reOpenMenu2', options);
|
|
446
444
|
}
|
|
447
445
|
|
|
448
446
|
var CCMenu = /*#__PURE__*/Object.freeze({
|
|
@@ -459,43 +457,43 @@ var CCMenu = /*#__PURE__*/Object.freeze({
|
|
|
459
457
|
reOpenMenu2: reOpenMenu2
|
|
460
458
|
});
|
|
461
459
|
|
|
462
|
-
/**
|
|
463
|
-
* 消息提示框
|
|
464
|
-
* @param {string} text 提示文字,支持vhtml渲染
|
|
465
|
-
* @param {string} type 消息类别
|
|
466
|
-
* @param {number} duration 持续时间
|
|
467
|
-
* @param {boolean} showClose 是否显示消息关闭按钮
|
|
468
|
-
* @param {boolean} center 文字是否剧中
|
|
469
|
-
*/
|
|
470
|
-
function showMessage(text, type = 'info', duration = 3000, showClose = false, center = false) {
|
|
471
|
-
Message({
|
|
472
|
-
message: text,
|
|
473
|
-
type,
|
|
474
|
-
duration,
|
|
475
|
-
showClose,
|
|
476
|
-
center
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* 提示确认框
|
|
481
|
-
* @param {string} text 提示信息
|
|
482
|
-
* @param {string} title 标题
|
|
483
|
-
* @param {object} options 配置信息
|
|
484
|
-
*/
|
|
485
|
-
function showConfirm(text, title, options = {}, confirm = () => { }, reject = () => { }) {
|
|
486
|
-
MessageBox.confirm(text, title, options).then(() => {
|
|
487
|
-
confirm();
|
|
488
|
-
}).catch(() => {
|
|
489
|
-
reject();
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* 提示消息框
|
|
495
|
-
* @param {object} options 配置信息
|
|
496
|
-
*/
|
|
497
|
-
function showNotification(options = {}) {
|
|
498
|
-
Notification(options);
|
|
460
|
+
/**
|
|
461
|
+
* 消息提示框
|
|
462
|
+
* @param {string} text 提示文字,支持vhtml渲染
|
|
463
|
+
* @param {string} type 消息类别
|
|
464
|
+
* @param {number} duration 持续时间
|
|
465
|
+
* @param {boolean} showClose 是否显示消息关闭按钮
|
|
466
|
+
* @param {boolean} center 文字是否剧中
|
|
467
|
+
*/
|
|
468
|
+
function showMessage(text, type = 'info', duration = 3000, showClose = false, center = false) {
|
|
469
|
+
Message({
|
|
470
|
+
message: text,
|
|
471
|
+
type,
|
|
472
|
+
duration,
|
|
473
|
+
showClose,
|
|
474
|
+
center
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* 提示确认框
|
|
479
|
+
* @param {string} text 提示信息
|
|
480
|
+
* @param {string} title 标题
|
|
481
|
+
* @param {object} options 配置信息
|
|
482
|
+
*/
|
|
483
|
+
function showConfirm(text, title, options = {}, confirm = () => { }, reject = () => { }) {
|
|
484
|
+
MessageBox.confirm(text, title, options).then(() => {
|
|
485
|
+
confirm();
|
|
486
|
+
}).catch(() => {
|
|
487
|
+
reject();
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* 提示消息框
|
|
493
|
+
* @param {object} options 配置信息
|
|
494
|
+
*/
|
|
495
|
+
function showNotification(options = {}) {
|
|
496
|
+
Notification(options);
|
|
499
497
|
}
|
|
500
498
|
|
|
501
499
|
var CCMessage = /*#__PURE__*/Object.freeze({
|
|
@@ -505,99 +503,99 @@ var CCMessage = /*#__PURE__*/Object.freeze({
|
|
|
505
503
|
showNotification: showNotification
|
|
506
504
|
});
|
|
507
505
|
|
|
508
|
-
// 对象详情存储标识
|
|
509
|
-
const OBJECT_DETAIL = 'cc_object_detail';
|
|
510
|
-
// 对象存储标识
|
|
511
|
-
const OBJECT = 'cc_object';
|
|
512
|
-
// 列表视图存储标识
|
|
513
|
-
const OBJECT_LIST = 'cc_object_list';
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* 获得当前标准对象信息
|
|
517
|
-
*/
|
|
518
|
-
function getObject( ) {
|
|
519
|
-
let detail = localStorage.getItem(Crypto.encrypt(OBJECT));
|
|
520
|
-
if (detail) {
|
|
521
|
-
return JSON.parse(detail)
|
|
522
|
-
}
|
|
523
|
-
return ''
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
* 设置当前标准对象信息
|
|
528
|
-
* @param {object} detail 对象数据
|
|
529
|
-
*/
|
|
530
|
-
function setObject(detail = '') {
|
|
531
|
-
if (detail) {
|
|
532
|
-
localStorage.setItem(Crypto.encrypt(OBJECT), JSON.stringify(detail));
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
/**
|
|
537
|
-
* 获得当前标准对象的详细信息
|
|
538
|
-
* @param {String} apiname: 查找字段的apiname
|
|
539
|
-
*/
|
|
540
|
-
function getObjectDetail(apiname) {
|
|
541
|
-
let detail = localStorage.getItem(Crypto.encrypt(OBJECT_DETAIL));
|
|
542
|
-
if (detail) {
|
|
543
|
-
if(apiname){
|
|
544
|
-
let detailObj = JSON.parse(detail).detail;
|
|
545
|
-
let targetField = undefined;
|
|
546
|
-
if(Array.isArray(detailObj)){
|
|
547
|
-
targetField = detailObj.find(item=>item.apiname===apiname);
|
|
548
|
-
}
|
|
549
|
-
return targetField
|
|
550
|
-
}else {
|
|
551
|
-
return JSON.parse(detail)
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
return ''
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
/**
|
|
558
|
-
* 设置当前标准对象的详细信息,默认两个小时有效期
|
|
559
|
-
* @param {object} detail 对象详细数据
|
|
560
|
-
*/
|
|
561
|
-
function setObjectDetail(detail = '') {
|
|
562
|
-
if (detail) {
|
|
563
|
-
// 减少detail.detail层级
|
|
564
|
-
if(Array.isArray(detail.detail)){
|
|
565
|
-
let data = [];
|
|
566
|
-
detail.detail.forEach(item=>{
|
|
567
|
-
if(item && Array.isArray(item.data)){
|
|
568
|
-
item.data.forEach(itemData=>{
|
|
569
|
-
if(itemData.left && !Array.isArray(itemData.left)){
|
|
570
|
-
data.push(itemData.left);
|
|
571
|
-
}
|
|
572
|
-
if(itemData.right && !Array.isArray(itemData.right)){
|
|
573
|
-
data.push(itemData.right);
|
|
574
|
-
}
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
|
-
if(data.length > 0){detail.detail = data;}
|
|
579
|
-
}
|
|
580
|
-
localStorage.setItem(Crypto.encrypt(OBJECT_DETAIL), JSON.stringify(detail));
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* 设置当前标准对象列表选中的信息
|
|
585
|
-
* @param {object} detail 选中数据
|
|
586
|
-
*/
|
|
587
|
-
function setObjectList(detail = {}) {
|
|
588
|
-
if (detail.ids) {
|
|
589
|
-
localStorage.setItem(Crypto.encrypt(OBJECT_LIST), JSON.stringify(detail));
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
/**
|
|
593
|
-
* 获得当前标准对象列表选中的信息
|
|
594
|
-
*/
|
|
595
|
-
function getObjectList() {
|
|
596
|
-
let detail = localStorage.getItem(Crypto.encrypt(OBJECT_LIST));
|
|
597
|
-
if (detail) {
|
|
598
|
-
return JSON.parse(detail)
|
|
599
|
-
}
|
|
600
|
-
return {ids:[]}
|
|
506
|
+
// 对象详情存储标识
|
|
507
|
+
const OBJECT_DETAIL = 'cc_object_detail';
|
|
508
|
+
// 对象存储标识
|
|
509
|
+
const OBJECT = 'cc_object';
|
|
510
|
+
// 列表视图存储标识
|
|
511
|
+
const OBJECT_LIST = 'cc_object_list';
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* 获得当前标准对象信息
|
|
515
|
+
*/
|
|
516
|
+
function getObject( ) {
|
|
517
|
+
let detail = localStorage.getItem(Crypto.encrypt(OBJECT));
|
|
518
|
+
if (detail) {
|
|
519
|
+
return JSON.parse(detail)
|
|
520
|
+
}
|
|
521
|
+
return ''
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* 设置当前标准对象信息
|
|
526
|
+
* @param {object} detail 对象数据
|
|
527
|
+
*/
|
|
528
|
+
function setObject(detail = '') {
|
|
529
|
+
if (detail) {
|
|
530
|
+
localStorage.setItem(Crypto.encrypt(OBJECT), JSON.stringify(detail));
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* 获得当前标准对象的详细信息
|
|
536
|
+
* @param {String} apiname: 查找字段的apiname
|
|
537
|
+
*/
|
|
538
|
+
function getObjectDetail(apiname) {
|
|
539
|
+
let detail = localStorage.getItem(Crypto.encrypt(OBJECT_DETAIL));
|
|
540
|
+
if (detail) {
|
|
541
|
+
if(apiname){
|
|
542
|
+
let detailObj = JSON.parse(detail).detail;
|
|
543
|
+
let targetField = undefined;
|
|
544
|
+
if(Array.isArray(detailObj)){
|
|
545
|
+
targetField = detailObj.find(item=>item.apiname===apiname);
|
|
546
|
+
}
|
|
547
|
+
return targetField
|
|
548
|
+
}else {
|
|
549
|
+
return JSON.parse(detail)
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
return ''
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* 设置当前标准对象的详细信息,默认两个小时有效期
|
|
557
|
+
* @param {object} detail 对象详细数据
|
|
558
|
+
*/
|
|
559
|
+
function setObjectDetail(detail = '') {
|
|
560
|
+
if (detail) {
|
|
561
|
+
// 减少detail.detail层级
|
|
562
|
+
if(Array.isArray(detail.detail)){
|
|
563
|
+
let data = [];
|
|
564
|
+
detail.detail.forEach(item=>{
|
|
565
|
+
if(item && Array.isArray(item.data)){
|
|
566
|
+
item.data.forEach(itemData=>{
|
|
567
|
+
if(itemData.left && !Array.isArray(itemData.left)){
|
|
568
|
+
data.push(itemData.left);
|
|
569
|
+
}
|
|
570
|
+
if(itemData.right && !Array.isArray(itemData.right)){
|
|
571
|
+
data.push(itemData.right);
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
if(data.length > 0){detail.detail = data;}
|
|
577
|
+
}
|
|
578
|
+
localStorage.setItem(Crypto.encrypt(OBJECT_DETAIL), JSON.stringify(detail));
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* 设置当前标准对象列表选中的信息
|
|
583
|
+
* @param {object} detail 选中数据
|
|
584
|
+
*/
|
|
585
|
+
function setObjectList(detail = {}) {
|
|
586
|
+
if (detail.ids) {
|
|
587
|
+
localStorage.setItem(Crypto.encrypt(OBJECT_LIST), JSON.stringify(detail));
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* 获得当前标准对象列表选中的信息
|
|
592
|
+
*/
|
|
593
|
+
function getObjectList() {
|
|
594
|
+
let detail = localStorage.getItem(Crypto.encrypt(OBJECT_LIST));
|
|
595
|
+
if (detail) {
|
|
596
|
+
return JSON.parse(detail)
|
|
597
|
+
}
|
|
598
|
+
return {ids:[]}
|
|
601
599
|
}
|
|
602
600
|
|
|
603
601
|
var CCObject = /*#__PURE__*/Object.freeze({
|
|
@@ -610,172 +608,165 @@ var CCObject = /*#__PURE__*/Object.freeze({
|
|
|
610
608
|
setObjectDetail: setObjectDetail
|
|
611
609
|
});
|
|
612
610
|
|
|
613
|
-
/**
|
|
614
|
-
* 用于保存打开的页面集合
|
|
615
|
-
*/
|
|
616
|
-
let pageList = new Map();
|
|
617
|
-
/**
|
|
618
|
-
* 打开对象视图页面
|
|
619
|
-
* @param {object} obj 对象信息
|
|
620
|
-
* @param {object} options 配置信息
|
|
621
|
-
*/
|
|
622
|
-
function openListPage(obj, options = {}) {
|
|
623
|
-
let pageId = options.pageId||Math.random().toString(16).slice(2);
|
|
624
|
-
window.$CCDK.CCBus.$emit('openListPage', pageId, obj, options);
|
|
625
|
-
return pageId;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
* 打开数据详情页
|
|
630
|
-
* @param {object} obj 对象体
|
|
631
|
-
* @param {string} id 数据id
|
|
632
|
-
* @param {object} options 配置信息
|
|
633
|
-
*/
|
|
634
|
-
function openDetailPage(obj, id, options = {}) {
|
|
635
|
-
let pageId = options.pageId||Math.random().toString(16).slice(2);
|
|
636
|
-
window.$CCDK.CCBus.$emit('openDetailPage', pageId, obj, id, options);
|
|
637
|
-
return pageId;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
/**
|
|
641
|
-
* 打开创建页面
|
|
642
|
-
* @param {object} obj 对象体
|
|
643
|
-
* @param {object} options 配置信息
|
|
644
|
-
*/
|
|
645
|
-
function openCreatePage(obj, options = {}) {
|
|
646
|
-
let pageId = options.pageId||Math.random().toString(16).slice(2);
|
|
647
|
-
window.$CCDK.CCBus.$emit('openCreatePage', pageId, obj, options);
|
|
648
|
-
return pageId;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* 打开修改页面
|
|
653
|
-
* @param {object} obj 对象体
|
|
654
|
-
* @param {string} id 数据id
|
|
655
|
-
* @param {object} options 配置信息
|
|
656
|
-
*/
|
|
657
|
-
function openEditPage(obj, id, options = {}) {
|
|
658
|
-
let pageId = options.pageId||Math.random().toString(16).slice(2);
|
|
659
|
-
window.$CCDK.CCBus.$emit('openEditPage', pageId, obj, id, options);
|
|
660
|
-
return pageId;
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* 打开自定义页面
|
|
664
|
-
* @param {object} obj 自定义页面参数
|
|
665
|
-
* @param {object} options 配置信息
|
|
666
|
-
*/
|
|
667
|
-
function openCustomPage(obj, options = {}) {
|
|
668
|
-
let pageId = options.pageId||Math.random().toString(16).slice(2);
|
|
669
|
-
window.$CCDK.CCBus.$emit('openCustomPage', pageId, obj, options);
|
|
670
|
-
return pageId;
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
/**
|
|
674
|
-
* 通过页面id,重新打开某个页面
|
|
675
|
-
* @param {string} pageId 页面id
|
|
676
|
-
* @param {object} options 配置信息
|
|
677
|
-
*/
|
|
678
|
-
function reOpenPage(pageId, options) {
|
|
679
|
-
let page;
|
|
680
|
-
if (pageId) {
|
|
681
|
-
page = pageList.get(pageId);
|
|
682
|
-
}
|
|
683
|
-
if (page) {
|
|
684
|
-
page.reOpenPage();
|
|
685
|
-
if (options.refresh) {
|
|
686
|
-
page.refresh();
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
/**
|
|
692
|
-
* 将打开的页面添加到集合中
|
|
693
|
-
* @param {string} id 唯一ID
|
|
694
|
-
* @param {object} page 页面对象
|
|
695
|
-
*/
|
|
696
|
-
function addPage(id, page) {
|
|
697
|
-
if (id && page) {
|
|
698
|
-
pageList.set(id, page);
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
/**
|
|
703
|
-
* 删除某个页面
|
|
704
|
-
* @param {string} pageId 唯一ID
|
|
705
|
-
*/
|
|
706
|
-
function deletePage(pageId) {
|
|
707
|
-
if (pageId) {
|
|
708
|
-
pageList.delete(pageId);
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
/**
|
|
712
|
-
* 更改页面数据
|
|
713
|
-
* @param {string} id 唯一ID
|
|
714
|
-
* @param {object} page 页面对象
|
|
715
|
-
*/
|
|
716
|
-
function updatePage(id, page) {
|
|
717
|
-
if (id && page) {
|
|
718
|
-
pageList.set(id, page);
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
/**
|
|
723
|
-
* 通过页面id查询页面
|
|
724
|
-
* @param {string} pageId 唯一ID
|
|
725
|
-
*/
|
|
726
|
-
function searchPage(pageId) {
|
|
727
|
-
return pageList.get(pageId)
|
|
728
|
-
}
|
|
729
|
-
/**
|
|
730
|
-
* 关闭页面,如果pageId为null,那么关闭当前页面
|
|
731
|
-
* 如果pageId为all,关闭所有一级菜单
|
|
732
|
-
* @param {string} pageId 页面id
|
|
733
|
-
*/
|
|
734
|
-
function close$1(pageId = '') {
|
|
735
|
-
let page;
|
|
736
|
-
if(pageId === 'all'){
|
|
737
|
-
page = [...pageList.values()];
|
|
738
|
-
page.forEach(item => {
|
|
739
|
-
if(item){
|
|
740
|
-
item.close();
|
|
741
|
-
}
|
|
742
|
-
});
|
|
743
|
-
}else if (pageId) {
|
|
744
|
-
page = pageList.get(pageId);
|
|
745
|
-
} else {
|
|
746
|
-
if (pageList.size > 0) {
|
|
747
|
-
page = [...pageList.values()][pageList.size - 1];
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
if (page) {
|
|
751
|
-
page.close();
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
/**
|
|
755
|
-
*
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
function getCurrentPage() {
|
|
773
|
-
// 当前选中菜单的树形结构
|
|
774
|
-
let currentMenuTree = localStorage.getItem('current_page');
|
|
775
|
-
if (currentMenuTree) {
|
|
776
|
-
return JSON.parse(currentMenuTree)
|
|
777
|
-
}
|
|
778
|
-
return ''
|
|
611
|
+
/**
|
|
612
|
+
* 用于保存打开的页面集合
|
|
613
|
+
*/
|
|
614
|
+
let pageList = new Map();
|
|
615
|
+
/**
|
|
616
|
+
* 打开对象视图页面
|
|
617
|
+
* @param {object} obj 对象信息
|
|
618
|
+
* @param {object} options 配置信息
|
|
619
|
+
*/
|
|
620
|
+
function openListPage(obj, options = {}) {
|
|
621
|
+
let pageId = options.pageId||Math.random().toString(16).slice(2);
|
|
622
|
+
window.$CCDK.CCBus.$emit('openListPage', pageId, obj, options);
|
|
623
|
+
return pageId;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* 打开数据详情页
|
|
628
|
+
* @param {object} obj 对象体
|
|
629
|
+
* @param {string} id 数据id
|
|
630
|
+
* @param {object} options 配置信息
|
|
631
|
+
*/
|
|
632
|
+
function openDetailPage(obj, id, options = {}) {
|
|
633
|
+
let pageId = options.pageId||Math.random().toString(16).slice(2);
|
|
634
|
+
window.$CCDK.CCBus.$emit('openDetailPage', pageId, obj, id, options);
|
|
635
|
+
return pageId;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* 打开创建页面
|
|
640
|
+
* @param {object} obj 对象体
|
|
641
|
+
* @param {object} options 配置信息
|
|
642
|
+
*/
|
|
643
|
+
function openCreatePage(obj, options = {}) {
|
|
644
|
+
let pageId = options.pageId||Math.random().toString(16).slice(2);
|
|
645
|
+
window.$CCDK.CCBus.$emit('openCreatePage', pageId, obj, options);
|
|
646
|
+
return pageId;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* 打开修改页面
|
|
651
|
+
* @param {object} obj 对象体
|
|
652
|
+
* @param {string} id 数据id
|
|
653
|
+
* @param {object} options 配置信息
|
|
654
|
+
*/
|
|
655
|
+
function openEditPage(obj, id, options = {}) {
|
|
656
|
+
let pageId = options.pageId||Math.random().toString(16).slice(2);
|
|
657
|
+
window.$CCDK.CCBus.$emit('openEditPage', pageId, obj, id, options);
|
|
658
|
+
return pageId;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* 打开自定义页面
|
|
662
|
+
* @param {object} obj 自定义页面参数
|
|
663
|
+
* @param {object} options 配置信息
|
|
664
|
+
*/
|
|
665
|
+
function openCustomPage(obj, options = {}) {
|
|
666
|
+
let pageId = options.pageId||Math.random().toString(16).slice(2);
|
|
667
|
+
window.$CCDK.CCBus.$emit('openCustomPage', pageId, obj, options);
|
|
668
|
+
return pageId;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* 通过页面id,重新打开某个页面
|
|
673
|
+
* @param {string} pageId 页面id
|
|
674
|
+
* @param {object} options 配置信息
|
|
675
|
+
*/
|
|
676
|
+
function reOpenPage(pageId, options) {
|
|
677
|
+
let page;
|
|
678
|
+
if (pageId) {
|
|
679
|
+
page = pageList.get(pageId);
|
|
680
|
+
}
|
|
681
|
+
if (page) {
|
|
682
|
+
page.reOpenPage();
|
|
683
|
+
if (options.refresh) {
|
|
684
|
+
page.refresh();
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* 将打开的页面添加到集合中
|
|
691
|
+
* @param {string} id 唯一ID
|
|
692
|
+
* @param {object} page 页面对象
|
|
693
|
+
*/
|
|
694
|
+
function addPage(id, page) {
|
|
695
|
+
if (id && page) {
|
|
696
|
+
pageList.set(id, page);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* 删除某个页面
|
|
702
|
+
* @param {string} pageId 唯一ID
|
|
703
|
+
*/
|
|
704
|
+
function deletePage(pageId) {
|
|
705
|
+
if (pageId) {
|
|
706
|
+
pageList.delete(pageId);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* 更改页面数据
|
|
711
|
+
* @param {string} id 唯一ID
|
|
712
|
+
* @param {object} page 页面对象
|
|
713
|
+
*/
|
|
714
|
+
function updatePage(id, page) {
|
|
715
|
+
if (id && page) {
|
|
716
|
+
pageList.set(id, page);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* 通过页面id查询页面
|
|
722
|
+
* @param {string} pageId 唯一ID
|
|
723
|
+
*/
|
|
724
|
+
function searchPage(pageId) {
|
|
725
|
+
return pageList.get(pageId)
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* 关闭页面,如果pageId为null,那么关闭当前页面
|
|
729
|
+
* 如果pageId为all,关闭所有一级菜单
|
|
730
|
+
* @param {string} pageId 页面id
|
|
731
|
+
*/
|
|
732
|
+
function close$1(pageId = '') {
|
|
733
|
+
let page;
|
|
734
|
+
if(pageId === 'all'){
|
|
735
|
+
page = [...pageList.values()];
|
|
736
|
+
page.forEach(item => {
|
|
737
|
+
if(item){
|
|
738
|
+
item.close();
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
}else if (pageId) {
|
|
742
|
+
page = pageList.get(pageId);
|
|
743
|
+
} else {
|
|
744
|
+
if (pageList.size > 0) {
|
|
745
|
+
page = [...pageList.values()][pageList.size - 1];
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
if (page) {
|
|
749
|
+
page.close();
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* 刷新当前页面
|
|
754
|
+
*/
|
|
755
|
+
function refresh() {
|
|
756
|
+
window.$CCDK.CCBus.$emit('refresh');
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* 获取当前一二级选中菜单的树形结构
|
|
760
|
+
* @param {object} obj 自定义页面参数
|
|
761
|
+
* @param {object} options 配置信息
|
|
762
|
+
*/
|
|
763
|
+
function getCurrentPage() {
|
|
764
|
+
// 当前选中菜单的树形结构
|
|
765
|
+
let currentMenuTree = localStorage.getItem('current_page');
|
|
766
|
+
if (currentMenuTree) {
|
|
767
|
+
return JSON.parse(currentMenuTree)
|
|
768
|
+
}
|
|
769
|
+
return ''
|
|
779
770
|
}
|
|
780
771
|
|
|
781
772
|
var CCPage = /*#__PURE__*/Object.freeze({
|
|
@@ -795,24 +786,24 @@ var CCPage = /*#__PURE__*/Object.freeze({
|
|
|
795
786
|
getCurrentPage: getCurrentPage
|
|
796
787
|
});
|
|
797
788
|
|
|
798
|
-
/**
|
|
799
|
-
* 初始化侧边区域
|
|
800
|
-
* @param {object} options 自定义页面配置
|
|
801
|
-
*/
|
|
802
|
-
function init(options) {
|
|
803
|
-
window.$CCDK.CCBus.$emit('initSide', options);
|
|
804
|
-
}
|
|
805
|
-
/**
|
|
806
|
-
* 打开侧边区域
|
|
807
|
-
*/
|
|
808
|
-
function open() {
|
|
809
|
-
window.$CCDK.CCBus.$emit('openSide');
|
|
810
|
-
}
|
|
811
|
-
/**
|
|
812
|
-
* 关闭侧边区域
|
|
813
|
-
*/
|
|
814
|
-
function close() {
|
|
815
|
-
window.$CCDK.CCBus.$emit('closeSide');
|
|
789
|
+
/**
|
|
790
|
+
* 初始化侧边区域
|
|
791
|
+
* @param {object} options 自定义页面配置
|
|
792
|
+
*/
|
|
793
|
+
function init(options) {
|
|
794
|
+
window.$CCDK.CCBus.$emit('initSide', options);
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* 打开侧边区域
|
|
798
|
+
*/
|
|
799
|
+
function open() {
|
|
800
|
+
window.$CCDK.CCBus.$emit('openSide');
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* 关闭侧边区域
|
|
804
|
+
*/
|
|
805
|
+
function close() {
|
|
806
|
+
window.$CCDK.CCBus.$emit('closeSide');
|
|
816
807
|
}
|
|
817
808
|
|
|
818
809
|
var CCSide = /*#__PURE__*/Object.freeze({
|
|
@@ -822,19 +813,19 @@ var CCSide = /*#__PURE__*/Object.freeze({
|
|
|
822
813
|
close: close
|
|
823
814
|
});
|
|
824
815
|
|
|
825
|
-
/**
|
|
826
|
-
* 获得一级域名
|
|
827
|
-
* 比如:xx.com、xx.cn、xx.com.cn、xx.net.cn、xx.org.cn
|
|
828
|
-
*/
|
|
829
|
-
function getDomain() {
|
|
830
|
-
// 倒数第二位域名
|
|
831
|
-
let lastTow = document.domain.split('.').slice(-2, -1)[0];
|
|
832
|
-
// 如果倒数第二位是这些关键字,那么需要取倒数三位域名
|
|
833
|
-
if (lastTow == 'com' || lastTow == 'org' || lastTow == 'net') {
|
|
834
|
-
return "." + document.domain.split('.').slice(-3).join('.')
|
|
835
|
-
} else {
|
|
836
|
-
return "." + document.domain.split('.').slice(-2).join('.')
|
|
837
|
-
}
|
|
816
|
+
/**
|
|
817
|
+
* 获得一级域名
|
|
818
|
+
* 比如:xx.com、xx.cn、xx.com.cn、xx.net.cn、xx.org.cn
|
|
819
|
+
*/
|
|
820
|
+
function getDomain() {
|
|
821
|
+
// 倒数第二位域名
|
|
822
|
+
let lastTow = document.domain.split('.').slice(-2, -1)[0];
|
|
823
|
+
// 如果倒数第二位是这些关键字,那么需要取倒数三位域名
|
|
824
|
+
if (lastTow == 'com' || lastTow == 'org' || lastTow == 'net') {
|
|
825
|
+
return "." + document.domain.split('.').slice(-3).join('.')
|
|
826
|
+
} else {
|
|
827
|
+
return "." + document.domain.split('.').slice(-2).join('.')
|
|
828
|
+
}
|
|
838
829
|
}
|
|
839
830
|
|
|
840
831
|
var CCUtils = /*#__PURE__*/Object.freeze({
|
|
@@ -842,83 +833,84 @@ var CCUtils = /*#__PURE__*/Object.freeze({
|
|
|
842
833
|
getDomain: getDomain
|
|
843
834
|
});
|
|
844
835
|
|
|
845
|
-
// cookie存储标识
|
|
846
|
-
const TOKEN = "cc_token";
|
|
847
|
-
/**
|
|
848
|
-
* 获取URL中参数的数据
|
|
849
|
-
* @param {name} 参数名
|
|
850
|
-
*/
|
|
851
|
-
function getUrlQuery(name) {
|
|
852
|
-
var reg = new RegExp(name + "=([^&]*)(&|$)");
|
|
853
|
-
var r = window.location.href.match(reg);
|
|
854
|
-
let res = null;
|
|
855
|
-
if (r != null) res = r[1].trim();
|
|
856
|
-
return res;
|
|
857
|
-
}
|
|
858
|
-
/**
|
|
859
|
-
* 获取token:优先级-url最高,cc_token-cookies第二,binding-cookies第三
|
|
860
|
-
* @param {String} urlName 获取token的url名称
|
|
861
|
-
* @returns
|
|
862
|
-
*/
|
|
863
|
-
function getToken(urlName = "binding") {
|
|
864
|
-
let token = getUrlQuery(urlName) || Cookies.get(Crypto.encrypt(TOKEN)) || Cookies.get(urlName);
|
|
865
|
-
// 如果存在token,那么存储到cookies中,刷新有效期
|
|
866
|
-
if (token) {
|
|
867
|
-
setToken(token);
|
|
868
|
-
}
|
|
869
|
-
return token
|
|
870
|
-
}
|
|
871
|
-
/**
|
|
872
|
-
* 存储token
|
|
873
|
-
* @param {String} token token
|
|
874
|
-
* @param {String} domain 域名
|
|
875
|
-
*/
|
|
876
|
-
function setToken(token, domain = getDomain()) {
|
|
877
|
-
Cookies.set(Crypto.encrypt(TOKEN), token, { domain: domain, expires: 1 / 12 });
|
|
878
|
-
Cookies.set(Crypto.encrypt(TOKEN), token, { expires: 1 / 12 });
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
/**
|
|
882
|
-
* 清除Token数据
|
|
883
|
-
* @param {String} domain 域名
|
|
884
|
-
*/
|
|
885
|
-
function clearToken(domain = getDomain()) {
|
|
886
|
-
Cookies.remove(Crypto.encrypt(TOKEN), { domain: domain });
|
|
887
|
-
Cookies.remove(Crypto.encrypt(TOKEN));
|
|
836
|
+
// cookie存储标识
|
|
837
|
+
const TOKEN = "cc_token";
|
|
838
|
+
/**
|
|
839
|
+
* 获取URL中参数的数据
|
|
840
|
+
* @param {name} 参数名
|
|
841
|
+
*/
|
|
842
|
+
function getUrlQuery(name) {
|
|
843
|
+
var reg = new RegExp(name + "=([^&]*)(&|$)");
|
|
844
|
+
var r = window.location.href.match(reg);
|
|
845
|
+
let res = null;
|
|
846
|
+
if (r != null) res = r[1].trim();
|
|
847
|
+
return res;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* 获取token:优先级-url最高,cc_token-cookies第二,binding-cookies第三
|
|
851
|
+
* @param {String} urlName 获取token的url名称
|
|
852
|
+
* @returns
|
|
853
|
+
*/
|
|
854
|
+
function getToken(urlName = "binding") {
|
|
855
|
+
let token = getUrlQuery(urlName) || Cookies.get(Crypto.encrypt(TOKEN)) || Cookies.get(urlName);
|
|
856
|
+
// 如果存在token,那么存储到cookies中,刷新有效期
|
|
857
|
+
if (token) {
|
|
858
|
+
setToken(token);
|
|
859
|
+
}
|
|
860
|
+
return token
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* 存储token
|
|
864
|
+
* @param {String} token token
|
|
865
|
+
* @param {String} domain 域名
|
|
866
|
+
*/
|
|
867
|
+
function setToken(token, domain = getDomain()) {
|
|
868
|
+
Cookies.set(Crypto.encrypt(TOKEN), token, { domain: domain, expires: 1 / 12 });
|
|
869
|
+
Cookies.set(Crypto.encrypt(TOKEN), token, { expires: 1 / 12 });
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* 清除Token数据
|
|
874
|
+
* @param {String} domain 域名
|
|
875
|
+
*/
|
|
876
|
+
function clearToken(domain = getDomain()) {
|
|
877
|
+
Cookies.remove(Crypto.encrypt(TOKEN), { domain: domain });
|
|
878
|
+
Cookies.remove(Crypto.encrypt(TOKEN));
|
|
888
879
|
}
|
|
889
880
|
|
|
890
881
|
var CCToken = /*#__PURE__*/Object.freeze({
|
|
891
882
|
__proto__: null,
|
|
892
883
|
setToken: setToken,
|
|
893
884
|
getToken: getToken,
|
|
894
|
-
clearToken: clearToken
|
|
885
|
+
clearToken: clearToken,
|
|
886
|
+
getUrlQuery: getUrlQuery
|
|
895
887
|
});
|
|
896
888
|
|
|
897
|
-
// cookie存储标识
|
|
898
|
-
const USER_INFO = "cc_user_info";
|
|
899
|
-
|
|
900
|
-
/**
|
|
901
|
-
* 存储用户信息
|
|
902
|
-
* @param {String} userInfo 用户信息
|
|
903
|
-
* @param {String} domain 域名
|
|
904
|
-
*/
|
|
905
|
-
function setUserInfo(userInfo, domain = getDomain()) {
|
|
906
|
-
Cookies.set(Crypto.encrypt(USER_INFO), Crypto.encrypt(userInfo), { domain: domain, expires: 1 / 12 });
|
|
907
|
-
Cookies.set(Crypto.encrypt(USER_INFO), Crypto.encrypt(userInfo), { expires: 1 / 12 });
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
/**
|
|
911
|
-
* 获取用户信息
|
|
912
|
-
* @returns {String} 用户信息
|
|
913
|
-
*/
|
|
914
|
-
function getUserInfo() {
|
|
915
|
-
// 加密的用户信息
|
|
916
|
-
let encryptUserInfo = Cookies.get(Crypto.encrypt(USER_INFO));
|
|
917
|
-
if (encryptUserInfo) {
|
|
918
|
-
return Crypto.decrypt(encryptUserInfo)
|
|
919
|
-
} else {
|
|
920
|
-
return ""
|
|
921
|
-
}
|
|
889
|
+
// cookie存储标识
|
|
890
|
+
const USER_INFO = "cc_user_info";
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* 存储用户信息
|
|
894
|
+
* @param {String} userInfo 用户信息
|
|
895
|
+
* @param {String} domain 域名
|
|
896
|
+
*/
|
|
897
|
+
function setUserInfo(userInfo, domain = getDomain()) {
|
|
898
|
+
Cookies.set(Crypto.encrypt(USER_INFO), Crypto.encrypt(userInfo), { domain: domain, expires: 1 / 12 });
|
|
899
|
+
Cookies.set(Crypto.encrypt(USER_INFO), Crypto.encrypt(userInfo), { expires: 1 / 12 });
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* 获取用户信息
|
|
904
|
+
* @returns {String} 用户信息
|
|
905
|
+
*/
|
|
906
|
+
function getUserInfo() {
|
|
907
|
+
// 加密的用户信息
|
|
908
|
+
let encryptUserInfo = Cookies.get(Crypto.encrypt(USER_INFO));
|
|
909
|
+
if (encryptUserInfo) {
|
|
910
|
+
return Crypto.decrypt(encryptUserInfo)
|
|
911
|
+
} else {
|
|
912
|
+
return ""
|
|
913
|
+
}
|
|
922
914
|
}
|
|
923
915
|
|
|
924
916
|
var CCUser = /*#__PURE__*/Object.freeze({
|
|
@@ -927,11 +919,11 @@ var CCUser = /*#__PURE__*/Object.freeze({
|
|
|
927
919
|
getUserInfo: getUserInfo
|
|
928
920
|
});
|
|
929
921
|
|
|
930
|
-
// application应用
|
|
931
|
-
|
|
932
|
-
// 获取ccdk版本
|
|
933
|
-
function getVersion() {
|
|
934
|
-
return "V0.4.7"
|
|
922
|
+
// application应用
|
|
923
|
+
|
|
924
|
+
// 获取ccdk版本
|
|
925
|
+
function getVersion() {
|
|
926
|
+
return "V0.4.7"
|
|
935
927
|
}
|
|
936
928
|
|
|
937
929
|
export { CCApplication, CCBus, CCCall, CCConfig, Crypto as CCCrypto, CCHttp, CCLoad, CCMenu, CCMessage, CCObject, CCPage, CCSide, CCToken, CCUser, CCUtils, getVersion };
|