system-clients 3.1.74-ls → 3.1.75-ls
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/package.json +1 -1
- package/src/plugins/GetLoginInfoService.js +120 -91
package/package.json
CHANGED
|
@@ -1,45 +1,50 @@
|
|
|
1
1
|
import Vue from 'vue'
|
|
2
|
-
import JSEncrypt from 'jsencrypt'
|
|
3
2
|
import {HttpResetClass} from 'vue-client'
|
|
3
|
+
import cryptJS from './EncryptUtil'
|
|
4
4
|
|
|
5
|
-
let loginGen = async function (name, password) {
|
|
5
|
+
let loginGen = async function (name, password, cue) {
|
|
6
6
|
let data = {name: name, password: password}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB');
|
|
10
|
-
console.log(data)
|
|
11
|
-
|
|
12
|
-
let getLogin = await Vue.resetpost('/rs/logic/getLogin', data, {resolveMsg: null, rejectMsg: null}, 'RSA')
|
|
7
|
+
data = '$' + cryptJS.RSAEncrypt(JSON.stringify(data))
|
|
8
|
+
const getLogin = await Vue.resetpost('/rs/logic/getLogin', data, {resolveMsg: null, rejectMsg: null})
|
|
13
9
|
if (getLogin.data.states === '登录成功') {
|
|
10
|
+
//获取jwt
|
|
11
|
+
Vue.$login.jwt = getLogin.data.jwt
|
|
12
|
+
Vue.$login.jwtNew = getLogin.data.jwtNew
|
|
13
|
+
if (getLogin.data.s) {
|
|
14
|
+
Vue.$login['v3-session-key'] = cryptJS.RSADecrypt(getLogin.data.s)
|
|
15
|
+
}
|
|
14
16
|
// 调用远程登录服务,获取所有有权访问的功能
|
|
15
17
|
data = {username: name, password: password}
|
|
16
|
-
data =
|
|
17
|
-
|
|
18
|
+
data = cryptJS.RSAEncrypt(JSON.stringify(data))
|
|
19
|
+
const resource = await Vue.resetpost(`/rs/user/userLogin/客服系统`, data, {
|
|
18
20
|
resolveMsg: null,
|
|
19
21
|
rejectMsg: null
|
|
20
22
|
})
|
|
23
|
+
// 兼容旧版ldao
|
|
24
|
+
if ((JSON.stringify(resource.data).startsWith("{") || JSON.stringify(resource.data).startsWith("[")) && resource.data.code && resource.data.msg && resource.data.code !== 200) {
|
|
25
|
+
throw {status: 555, data: resource.data.msg}
|
|
26
|
+
}
|
|
21
27
|
console.log('登陆获取Util', JSON.stringify(resource.data))
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
|
|
29
|
+
// 兼容旧版ldao,旧版不返回code
|
|
30
|
+
if ((JSON.stringify(resource.data).startsWith("{") || JSON.stringify(resource.data).startsWith("[")) && resource.data.code && resource.data.msg) {
|
|
31
|
+
Vue.$login.f = resource.data.data
|
|
32
|
+
} else {
|
|
33
|
+
Vue.$login.f = resource.data
|
|
34
|
+
}
|
|
25
35
|
// 把登录用户添加到cookie里
|
|
26
36
|
Vue.cookie.set('loginId', Vue.$login.f.id)
|
|
27
|
-
|
|
28
37
|
try {
|
|
29
38
|
//获取有权限的功能树
|
|
30
39
|
let hasRight = await Vue.resetpost(`/rs/search`, {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
resolveMsg: null,
|
|
36
|
-
rejectMsg: null
|
|
37
|
-
})
|
|
40
|
+
source: "tool.getFullTree(this.getRights().where(row.getType() == $function$))",
|
|
41
|
+
userid: Vue.$login.f.id
|
|
42
|
+
}, {resolveMsg: null, rejectMsg: null})
|
|
38
43
|
console.log('有权限功能返回数据', JSON.stringify(hasRight.data))
|
|
39
44
|
//准备替换功能树
|
|
40
|
-
var fun=[]
|
|
45
|
+
var fun = []
|
|
41
46
|
hasRight.data[0].children[0].children.forEach((item) => {
|
|
42
|
-
if(item.name
|
|
47
|
+
if (item.name === '客服系统') {
|
|
43
48
|
item.children.forEach((item1) => {
|
|
44
49
|
fun.push(item1)
|
|
45
50
|
})
|
|
@@ -47,8 +52,8 @@ let loginGen = async function (name, password) {
|
|
|
47
52
|
})
|
|
48
53
|
// console.log('替换前', JSON.stringify(Vue.$login.f.functions))
|
|
49
54
|
// console.log('替换后', JSON.stringify(fun))
|
|
50
|
-
Vue.$login.f.functions=fun
|
|
51
|
-
}catch (error) {
|
|
55
|
+
Vue.$login.f.functions = fun
|
|
56
|
+
} catch (error) {
|
|
52
57
|
}
|
|
53
58
|
if (Vue.$login.f.id !== '11') {
|
|
54
59
|
try {
|
|
@@ -62,9 +67,9 @@ let loginGen = async function (name, password) {
|
|
|
62
67
|
areaTemp.push({label: getAllArea.data[i].name, value: getAllArea.data[i]})
|
|
63
68
|
}
|
|
64
69
|
Vue.$login.f.f_allArea = areaTemp
|
|
65
|
-
}catch (error) {
|
|
66
|
-
Vue.$login.f.f_allArea =[]
|
|
67
|
-
console.log('获取区县',error)
|
|
70
|
+
} catch (error) {
|
|
71
|
+
Vue.$login.f.f_allArea = []
|
|
72
|
+
console.log('获取区县', error)
|
|
68
73
|
}
|
|
69
74
|
// 获取抄表员
|
|
70
75
|
try {
|
|
@@ -77,11 +82,11 @@ let loginGen = async function (name, password) {
|
|
|
77
82
|
gasman.push(getGasman.data[i])
|
|
78
83
|
}
|
|
79
84
|
Vue.$login.f.f_gasman = gasman
|
|
80
|
-
}catch (error) {
|
|
85
|
+
} catch (error) {
|
|
81
86
|
Vue.$login.f.f_gasman = []
|
|
82
|
-
console.log('抄表员模块',error)
|
|
87
|
+
console.log('抄表员模块', error)
|
|
83
88
|
}
|
|
84
|
-
//
|
|
89
|
+
// 获取安装人
|
|
85
90
|
try {
|
|
86
91
|
let getInstallman = await Vue.resetpost('/rs/search', {
|
|
87
92
|
source: 'this.getParentByType($organization$).getChildByName($安装员$).getUsers()',
|
|
@@ -93,9 +98,9 @@ let loginGen = async function (name, password) {
|
|
|
93
98
|
installman.push(getInstallman.data[i])
|
|
94
99
|
}
|
|
95
100
|
Vue.$login.f.f_installman = installman
|
|
96
|
-
}catch (error) {
|
|
97
|
-
Vue.$login.f.f_installman =[]
|
|
98
|
-
console.log('安装人模块',error)
|
|
101
|
+
} catch (error) {
|
|
102
|
+
Vue.$login.f.f_installman = []
|
|
103
|
+
console.log('安装人模块', error)
|
|
99
104
|
}
|
|
100
105
|
// 获取换表员
|
|
101
106
|
// try {
|
|
@@ -112,20 +117,22 @@ let loginGen = async function (name, password) {
|
|
|
112
117
|
// Vue.$login.f.f_changemeterman = []
|
|
113
118
|
// console.log('换表员模块',error)
|
|
114
119
|
// }
|
|
115
|
-
|
|
120
|
+
// 获取资源服务权限
|
|
116
121
|
try {
|
|
117
|
-
let getLic = await Vue.resetpost('/rs/search', {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
let getLic = await Vue.resetpost('/rs/search', {
|
|
123
|
+
data: {
|
|
124
|
+
source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($资源操作$) != -1)',
|
|
125
|
+
userid: Vue.$login.f.id
|
|
126
|
+
}
|
|
127
|
+
}, {resolveMsg: null, rejectMsg: null})
|
|
128
|
+
let arry = []
|
|
129
|
+
getLic.data.forEach((item) => {
|
|
130
|
+
arry.push(item.name)
|
|
131
|
+
})
|
|
132
|
+
Vue.$login.f.lics = arry
|
|
133
|
+
} catch (error) {
|
|
127
134
|
Vue.$login.f.f_gasman = []
|
|
128
|
-
console.log('资源服务权限',error)
|
|
135
|
+
console.log('资源服务权限', error)
|
|
129
136
|
}
|
|
130
137
|
// // 票据使用人
|
|
131
138
|
// try {
|
|
@@ -167,28 +174,37 @@ let loginGen = async function (name, password) {
|
|
|
167
174
|
let r = viewDetails.data
|
|
168
175
|
Vue.$login.r = []
|
|
169
176
|
r.forEach(x => Vue.$login.r.push(x.name))
|
|
170
|
-
}catch (error) {
|
|
177
|
+
} catch (error) {
|
|
171
178
|
Vue.$login.r = []
|
|
172
|
-
console.log('加载模块失败',error)
|
|
179
|
+
console.log('加载模块失败', error)
|
|
173
180
|
}
|
|
174
181
|
// 调用登录后处理
|
|
175
|
-
for(let proc of Vue.$login.afterLogin) {
|
|
182
|
+
for (let proc of Vue.$login.afterLogin) {
|
|
176
183
|
await proc(Vue.$login.f)
|
|
177
184
|
}
|
|
178
185
|
// 定时发送心跳
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
186
|
+
if (cue) {
|
|
187
|
+
setInterval(() => {
|
|
188
|
+
let http = new HttpResetClass()
|
|
189
|
+
//暂时不出现不出现异地登录校验
|
|
190
|
+
http.load('POST', `rs/user/access/${Vue.$login.f.id}`, {}, {
|
|
191
|
+
resolveMsg: null,
|
|
192
|
+
rejectMsg: null
|
|
193
|
+
}).then((req) => {
|
|
194
|
+
if (req.data.forcestate && req.data.forcestate == 1) {
|
|
195
|
+
Vue.showMessage("您被强制下线!", ['confirm']).then((res) => {
|
|
196
|
+
location.reload()
|
|
197
|
+
})
|
|
198
|
+
} else if (req.data.status == 710) {
|
|
199
|
+
Vue.showMessage(req.data.msg + ",您将被强制退出系统", ['confirm']).then((res) => {
|
|
200
|
+
if (res === 'confirm') {
|
|
201
|
+
location.reload()
|
|
202
|
+
}
|
|
203
|
+
})
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
}, 2 * 60 * 1000)
|
|
207
|
+
}
|
|
192
208
|
}
|
|
193
209
|
|
|
194
210
|
} else {
|
|
@@ -203,25 +219,38 @@ let GetLoginInfoService = {
|
|
|
203
219
|
afterLogin: [],
|
|
204
220
|
//验证码开关
|
|
205
221
|
Verification: true,
|
|
206
|
-
|
|
222
|
+
//构建时间开关
|
|
223
|
+
versionTime: true,
|
|
224
|
+
//
|
|
225
|
+
SinglePageToken: {},
|
|
226
|
+
//登录信息展示开关
|
|
227
|
+
depPrompt: true,
|
|
228
|
+
install(Vue, options) {
|
|
207
229
|
// 给vue增添对话框显示方法
|
|
208
230
|
Vue.$login = Vue.prototype.$login = GetLoginInfoService
|
|
209
231
|
},
|
|
210
232
|
|
|
211
|
-
f: {
|
|
212
|
-
|
|
213
|
-
},
|
|
233
|
+
f: {},
|
|
214
234
|
|
|
215
235
|
/**
|
|
216
236
|
* 登录
|
|
217
237
|
* @param name
|
|
218
238
|
* @param password
|
|
239
|
+
* @param cue true/false 是/否显示异地登录
|
|
219
240
|
*/
|
|
220
|
-
login
|
|
221
|
-
|
|
241
|
+
login(name, password, cue) {
|
|
242
|
+
if (cue === undefined || cue === null || cue === '') {
|
|
243
|
+
cue = true
|
|
244
|
+
}
|
|
245
|
+
Vue.$login.SinglePageToken = cryptJS.AESEncrypt(JSON.stringify({
|
|
246
|
+
name,
|
|
247
|
+
password,
|
|
248
|
+
now: Date.now()
|
|
249
|
+
}), "3KMKqvgwR8ULbR8Z")
|
|
250
|
+
return loginGen(name, password, cue)
|
|
222
251
|
},
|
|
223
252
|
|
|
224
|
-
convertToIn
|
|
253
|
+
convertToIn(val) {
|
|
225
254
|
let temp = ''
|
|
226
255
|
if (val instanceof Array) {
|
|
227
256
|
if (val.length >= 1) {
|
|
@@ -235,26 +264,26 @@ let GetLoginInfoService = {
|
|
|
235
264
|
return temp
|
|
236
265
|
},
|
|
237
266
|
|
|
238
|
-
toStandardYearMonth
|
|
267
|
+
toStandardYearMonth() {
|
|
239
268
|
let dt = new Date()
|
|
240
269
|
let month = dt.getMonth() + 1
|
|
241
270
|
return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month)
|
|
242
271
|
},
|
|
243
272
|
|
|
244
|
-
toStandardYearMonth1
|
|
273
|
+
toStandardYearMonth1() {
|
|
245
274
|
let dt = new Date()
|
|
246
275
|
let month = dt.getMonth() + 1
|
|
247
276
|
return dt.getFullYear() + (month < 10 ? '0' + month : month)
|
|
248
277
|
},
|
|
249
278
|
|
|
250
|
-
toStandardDateString
|
|
279
|
+
toStandardDateString() {
|
|
251
280
|
let dt = new Date()
|
|
252
281
|
let month = dt.getMonth() + 1
|
|
253
282
|
let date = dt.getDate()
|
|
254
283
|
return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
|
|
255
284
|
},
|
|
256
285
|
|
|
257
|
-
toStartAndEndDateString
|
|
286
|
+
toStartAndEndDateString() {
|
|
258
287
|
let dt = new Date()
|
|
259
288
|
let month = dt.getMonth() + 1
|
|
260
289
|
// let date = dt.getDate()
|
|
@@ -263,7 +292,7 @@ let GetLoginInfoService = {
|
|
|
263
292
|
// return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
|
|
264
293
|
},
|
|
265
294
|
|
|
266
|
-
toStandardTimeString
|
|
295
|
+
toStandardTimeString() {
|
|
267
296
|
let dt = new Date()
|
|
268
297
|
let month = dt.getMonth() + 1
|
|
269
298
|
let date = dt.getDate()
|
|
@@ -274,7 +303,7 @@ let GetLoginInfoService = {
|
|
|
274
303
|
' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
|
|
275
304
|
},
|
|
276
305
|
|
|
277
|
-
guid
|
|
306
|
+
guid() {
|
|
278
307
|
let buf = new Uint16Array(8)
|
|
279
308
|
window.crypto.getRandomValues(buf)
|
|
280
309
|
let S4 = function (num) {
|
|
@@ -287,7 +316,7 @@ let GetLoginInfoService = {
|
|
|
287
316
|
return (S4(buf[0]) + S4(buf[1]) + S4(buf[2]) + S4(buf[3]) + S4(buf[4]) + S4(buf[5]) + S4(buf[6]) + S4(buf[7]))
|
|
288
317
|
},
|
|
289
318
|
|
|
290
|
-
choices
|
|
319
|
+
choices(role, param, hasBlank = false, blankHint = '请选择') {
|
|
291
320
|
if (role == 'view') {
|
|
292
321
|
Vue.getParams(param, [null])
|
|
293
322
|
} else {
|
|
@@ -306,7 +335,7 @@ let GetLoginInfoService = {
|
|
|
306
335
|
}
|
|
307
336
|
},
|
|
308
337
|
|
|
309
|
-
required
|
|
338
|
+
required(param) {
|
|
310
339
|
if (typeof param === 'number' && param == 0)
|
|
311
340
|
return false
|
|
312
341
|
if (!param)
|
|
@@ -318,16 +347,16 @@ let GetLoginInfoService = {
|
|
|
318
347
|
return false
|
|
319
348
|
},
|
|
320
349
|
|
|
321
|
-
isInt
|
|
350
|
+
isInt(n) {
|
|
322
351
|
return !window.isNaN(n) && n % 1 === 0
|
|
323
352
|
},
|
|
324
353
|
|
|
325
|
-
isFloat
|
|
354
|
+
isFloat(n) {
|
|
326
355
|
return !window.isNaN(n)
|
|
327
356
|
},
|
|
328
357
|
|
|
329
358
|
// this will convert all true/false to boolean
|
|
330
|
-
booleanFilter
|
|
359
|
+
booleanFilter(paper) {
|
|
331
360
|
for (let key in paper) {
|
|
332
361
|
if (!paper.hasOwnProperty(key))
|
|
333
362
|
continue
|
|
@@ -340,7 +369,7 @@ let GetLoginInfoService = {
|
|
|
340
369
|
}
|
|
341
370
|
},
|
|
342
371
|
// recursively traverse through each path
|
|
343
|
-
ratifyPics
|
|
372
|
+
ratifyPics(paper) {
|
|
344
373
|
for (let key in paper) {
|
|
345
374
|
if (key.endsWith('_path')) {
|
|
346
375
|
if (!paper[key]) {
|
|
@@ -355,7 +384,7 @@ let GetLoginInfoService = {
|
|
|
355
384
|
},
|
|
356
385
|
|
|
357
386
|
// load script and other stuff
|
|
358
|
-
loadscript
|
|
387
|
+
loadscript(type, fileName) {
|
|
359
388
|
return new Promise((resolve, reject) => {
|
|
360
389
|
let element
|
|
361
390
|
if (type == 'css') {
|
|
@@ -382,11 +411,11 @@ let GetLoginInfoService = {
|
|
|
382
411
|
})
|
|
383
412
|
},
|
|
384
413
|
// 不能选择器中截取掉多余的字符
|
|
385
|
-
orgName
|
|
414
|
+
orgName(name) {
|
|
386
415
|
return name.substring(10)
|
|
387
416
|
},
|
|
388
417
|
|
|
389
|
-
getNowDate
|
|
418
|
+
getNowDate(name) {
|
|
390
419
|
// 求取当前时间的工具
|
|
391
420
|
let myweekday = ''
|
|
392
421
|
let year = ''
|
|
@@ -401,7 +430,7 @@ let GetLoginInfoService = {
|
|
|
401
430
|
return year + '年' + mymonth + '月' + myday + '日 ' + week[myweekday]
|
|
402
431
|
},
|
|
403
432
|
|
|
404
|
-
addDate
|
|
433
|
+
addDate(date, days) {
|
|
405
434
|
// 求取当前时间的工具
|
|
406
435
|
let endDate = new Date(date)
|
|
407
436
|
endDate = endDate.valueOf()
|
|
@@ -418,7 +447,7 @@ let GetLoginInfoService = {
|
|
|
418
447
|
},
|
|
419
448
|
|
|
420
449
|
// 通过地址栏的参数获取参数内容
|
|
421
|
-
getUrlParames
|
|
450
|
+
getUrlParames(param) {
|
|
422
451
|
var query = window.location.search
|
|
423
452
|
var iLen = param.length
|
|
424
453
|
var iStart = query.indexOf(param)
|
|
@@ -434,7 +463,7 @@ let GetLoginInfoService = {
|
|
|
434
463
|
},
|
|
435
464
|
|
|
436
465
|
// 从地址栏获取加密的参数
|
|
437
|
-
getUrlCompileParames
|
|
466
|
+
getUrlCompileParames(param) {
|
|
438
467
|
let code = unescape(window.location.search.slice(1, window.location.search.length))
|
|
439
468
|
let query = String.fromCharCode(code.charCodeAt(0) - code.length)
|
|
440
469
|
for (var i = 1; i < code.length; i++) {
|
|
@@ -454,7 +483,7 @@ let GetLoginInfoService = {
|
|
|
454
483
|
},
|
|
455
484
|
|
|
456
485
|
// 对字符串进行加密
|
|
457
|
-
compileStr
|
|
486
|
+
compileStr(code) {
|
|
458
487
|
let c = String.fromCharCode(code.charCodeAt(0) + code.length)
|
|
459
488
|
for (let i = 1; i < code.length; i++) {
|
|
460
489
|
c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
|
|
@@ -462,7 +491,7 @@ let GetLoginInfoService = {
|
|
|
462
491
|
return escape(c)
|
|
463
492
|
},
|
|
464
493
|
// 字符串进行解密
|
|
465
|
-
uncompileStr
|
|
494
|
+
uncompileStr(code) {
|
|
466
495
|
code = unescape(code)
|
|
467
496
|
let c = String.fromCharCode(code.charCodeAt(0) - code.length)
|
|
468
497
|
for (var i = 1; i < code.length; i++) {
|
|
@@ -471,7 +500,7 @@ let GetLoginInfoService = {
|
|
|
471
500
|
return c
|
|
472
501
|
},
|
|
473
502
|
|
|
474
|
-
dateDescripte
|
|
503
|
+
dateDescripte(date) {
|
|
475
504
|
let nowTime = new Date().getTime()
|
|
476
505
|
let oldTime = new Date(date).getTime()
|
|
477
506
|
let timeDiff = nowTime - oldTime
|
|
@@ -504,7 +533,7 @@ let GetLoginInfoService = {
|
|
|
504
533
|
return des
|
|
505
534
|
},
|
|
506
535
|
|
|
507
|
-
nextMonth20
|
|
536
|
+
nextMonth20(date) {
|
|
508
537
|
let ds = date.split('-')
|
|
509
538
|
let nextMonth = ds[1] - 0 + 1
|
|
510
539
|
return ds[0] + '-' + (nextMonth < 10 ? '0' + nextMonth : nextMonth) + '-20 00:00:00'
|