system-clients 3.2.95-temp-1 → 3.2.96-temp
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 +116 -17
- package/src/system.js +6 -2
package/package.json
CHANGED
|
@@ -2,21 +2,33 @@ import Vue from 'vue'
|
|
|
2
2
|
import {HttpResetClass} from 'vue-client'
|
|
3
3
|
import cryptJS from './EncryptUtil'
|
|
4
4
|
|
|
5
|
-
let loginGen = async function (
|
|
6
|
-
let data = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (getLogin.data) {
|
|
5
|
+
let loginGen = async function (name, password, cue) {
|
|
6
|
+
let data = {name: name, password: password}
|
|
7
|
+
data = '$' + cryptJS.RSAEncrypt(JSON.stringify(data))
|
|
8
|
+
const getLogin = await Vue.resetpost('/rs/logic/getLogin', data, {resolveMsg: null, rejectMsg: null})
|
|
9
|
+
if (getLogin.data.states === '登录成功') {
|
|
11
10
|
//获取jwt
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
Vue.$login.jwt = getLogin.data.jwt
|
|
12
|
+
Vue.$login.jwtNew = getLogin.data.jwtNew
|
|
13
|
+
// 调用远程登录服务,获取所有有权访问的功能
|
|
14
|
+
data = {username: name, password: password}
|
|
15
|
+
data = cryptJS.RSAEncrypt(JSON.stringify(data))
|
|
16
|
+
const resource = await Vue.resetpost(`/rs/user/userLogin/客服系统`, data, {
|
|
17
|
+
resolveMsg: null,
|
|
18
|
+
rejectMsg: null
|
|
19
|
+
})
|
|
20
|
+
// 兼容旧版ldao
|
|
21
|
+
if ((JSON.stringify(resource.data).startsWith("{") || JSON.stringify(resource.data).startsWith("[")) && resource.data.code && resource.data.msg && resource.data.code !== 200) {
|
|
22
|
+
throw {status: 555, data: resource.data.msg}
|
|
23
|
+
}
|
|
24
|
+
console.log('登陆获取Util', JSON.stringify(resource.data))
|
|
25
|
+
|
|
26
|
+
// 兼容旧版ldao,旧版不返回code
|
|
27
|
+
if ((JSON.stringify(resource.data).startsWith("{") || JSON.stringify(resource.data).startsWith("[")) && resource.data.code && resource.data.msg) {
|
|
28
|
+
Vue.$login.f = resource.data.data
|
|
29
|
+
} else {
|
|
30
|
+
Vue.$login.f = resource.data
|
|
18
31
|
}
|
|
19
|
-
Vue.$login.jwtNew = getLogin.data.access_token
|
|
20
32
|
// 把登录用户添加到cookie里
|
|
21
33
|
Vue.cookie.set('loginId', Vue.$login.f.id)
|
|
22
34
|
try {
|
|
@@ -25,6 +37,7 @@ let loginGen = async function (username, password, cue) {
|
|
|
25
37
|
source: "tool.getFullTree(this.getRights().where(row.getType() == $function$))",
|
|
26
38
|
userid: Vue.$login.f.id
|
|
27
39
|
}, { resolveMsg: null, rejectMsg: null })
|
|
40
|
+
console.log('有权限功能返回数据', JSON.stringify(hasRight.data))
|
|
28
41
|
//准备替换功能树
|
|
29
42
|
var fun = []
|
|
30
43
|
hasRight.data[0].children[0].children.forEach((item) => {
|
|
@@ -34,6 +47,8 @@ let loginGen = async function (username, password, cue) {
|
|
|
34
47
|
})
|
|
35
48
|
}
|
|
36
49
|
})
|
|
50
|
+
// console.log('替换前', JSON.stringify(Vue.$login.f.functions))
|
|
51
|
+
// console.log('替换后', JSON.stringify(fun))
|
|
37
52
|
Vue.$login.f.functions = fun
|
|
38
53
|
} catch (error) {
|
|
39
54
|
}
|
|
@@ -84,6 +99,21 @@ let loginGen = async function (username, password, cue) {
|
|
|
84
99
|
Vue.$login.f.f_installman = []
|
|
85
100
|
console.log('安装人模块', error)
|
|
86
101
|
}
|
|
102
|
+
// 获取换表员
|
|
103
|
+
// try {
|
|
104
|
+
// let getChangeMeterman = await Vue.resetpost('/rs/search', {
|
|
105
|
+
// source: 'this.getParentByType($organization$).getChildByName($换表员$).getUsers()',
|
|
106
|
+
// userid: Vue.$login.f.id
|
|
107
|
+
// }, {resolveMsg: null, rejectMsg: null})
|
|
108
|
+
// let changemeterman = []
|
|
109
|
+
// for (let i = 0; i < getChangeMeterman.data.length; i++) {
|
|
110
|
+
// changemeterman.push(getChangeMeterman.data[i])
|
|
111
|
+
// }
|
|
112
|
+
// Vue.$login.f.f_changemeterman = changemeterman
|
|
113
|
+
// }catch (error) {
|
|
114
|
+
// Vue.$login.f.f_changemeterman = []
|
|
115
|
+
// console.log('换表员模块',error)
|
|
116
|
+
// }
|
|
87
117
|
// 获取资源服务权限
|
|
88
118
|
try {
|
|
89
119
|
let getLic = await Vue.resetpost('/rs/search', {
|
|
@@ -101,6 +131,37 @@ let loginGen = async function (username, password, cue) {
|
|
|
101
131
|
Vue.$login.f.f_gasman = []
|
|
102
132
|
console.log('资源服务权限', error)
|
|
103
133
|
}
|
|
134
|
+
// // 票据使用人
|
|
135
|
+
// try {
|
|
136
|
+
// let getPaperUseman = await Vue.resetpost('/rs/search', {
|
|
137
|
+
// source: 'this.getParentByType($organization$).getChildByName($票据使用人$).getUsers()',
|
|
138
|
+
// userid: Vue.$login.f.id
|
|
139
|
+
// }, {resolveMsg: null, rejectMsg: null})
|
|
140
|
+
// let perperuseman = []
|
|
141
|
+
// for (let i = 0; i < getPaperUseman.data.length; i++) {
|
|
142
|
+
// perperuseman.push(getPaperUseman.data[i])
|
|
143
|
+
// }
|
|
144
|
+
// Vue.$login.f.f_paperUseman = perperuseman
|
|
145
|
+
// }catch (error) {
|
|
146
|
+
// Vue.$login.f.f_paperUseman = []
|
|
147
|
+
// console.log('票据使用人模块',error)
|
|
148
|
+
//
|
|
149
|
+
// }
|
|
150
|
+
// // 票据分配人
|
|
151
|
+
// try {
|
|
152
|
+
// let getPaperAllotman = await Vue.resetpost('/rs/search', {
|
|
153
|
+
// source: 'this.getParentByType($organization$).getChildByName($票据分配人$).getUsers()',
|
|
154
|
+
// userid: Vue.$login.f.id
|
|
155
|
+
// }, {resolveMsg: null, rejectMsg: null})
|
|
156
|
+
// let paperallotman = []
|
|
157
|
+
// for (let i = 0; i < getPaperAllotman.data.length; i++) {
|
|
158
|
+
// paperallotman.push(getPaperAllotman.data[i])
|
|
159
|
+
// }
|
|
160
|
+
// Vue.$login.f.f_paperAllotman = paperallotman
|
|
161
|
+
// }catch (error) {
|
|
162
|
+
// Vue.$login.f.f_paperAllotman = []
|
|
163
|
+
// console.log('票据分配人模块',error)
|
|
164
|
+
// }
|
|
104
165
|
// TODO 处理界面细节
|
|
105
166
|
try {
|
|
106
167
|
let viewDetails = await Vue.resetpost('rs/search', {
|
|
@@ -118,6 +179,11 @@ let loginGen = async function (username, password, cue) {
|
|
|
118
179
|
for (let proc of Vue.$login.afterLogin) {
|
|
119
180
|
await proc(Vue.$login.f)
|
|
120
181
|
}
|
|
182
|
+
// 启动未操作下线计时器(30分钟)
|
|
183
|
+
if(Vue.$login.autoLoginout){
|
|
184
|
+
Vue.$login.startInactivityTimer(Vue.$login.autoLoginTimeOut)
|
|
185
|
+
}
|
|
186
|
+
|
|
121
187
|
// 定时发送心跳
|
|
122
188
|
if (cue) {
|
|
123
189
|
setInterval(() => {
|
|
@@ -144,10 +210,7 @@ let loginGen = async function (username, password, cue) {
|
|
|
144
210
|
}
|
|
145
211
|
|
|
146
212
|
} else {
|
|
147
|
-
let error = {status: 401, data:
|
|
148
|
-
if (getLogin.data.code !== 500) {
|
|
149
|
-
error = {status: getLogin.data.code, data: getLogin.data.msg}
|
|
150
|
-
}
|
|
213
|
+
let error = {status: 401, data: getLogin.data.states}
|
|
151
214
|
// 抛出错误
|
|
152
215
|
throw error
|
|
153
216
|
}
|
|
@@ -160,6 +223,9 @@ let GetLoginInfoService = {
|
|
|
160
223
|
Verification: true,
|
|
161
224
|
//构建时间开关
|
|
162
225
|
versionTime: true,
|
|
226
|
+
//长时间未操作退出开关
|
|
227
|
+
autoLoginout: false,
|
|
228
|
+
autoLoginTimeOut:30*60*1000,
|
|
163
229
|
//
|
|
164
230
|
SinglePageToken : {},
|
|
165
231
|
//登录信息展示开关
|
|
@@ -472,6 +538,39 @@ let GetLoginInfoService = {
|
|
|
472
538
|
let ds = date.split('-')
|
|
473
539
|
let nextMonth = ds[1] - 0 + 1
|
|
474
540
|
return ds[0] + '-' + (nextMonth < 10 ? '0' + nextMonth : nextMonth) + '-20 00:00:00'
|
|
541
|
+
},
|
|
542
|
+
/**
|
|
543
|
+
* 启动未操作强制下线计时器
|
|
544
|
+
* @param timeout 超时时间(毫秒),默认30分钟
|
|
545
|
+
*/
|
|
546
|
+
startInactivityTimer(timeout) {
|
|
547
|
+
// 清除已有的定时器
|
|
548
|
+
if (this._inactivityTimer) {
|
|
549
|
+
clearTimeout(this._inactivityTimer);
|
|
550
|
+
}
|
|
551
|
+
// 事件处理函数
|
|
552
|
+
const resetTimer = () => {
|
|
553
|
+
clearTimeout(this._inactivityTimer);
|
|
554
|
+
this._inactivityTimer = setTimeout(() => {
|
|
555
|
+
// 强制下线逻辑
|
|
556
|
+
// Vue.cookie.delete('loginId');
|
|
557
|
+
Vue.$login.f = {};
|
|
558
|
+
Vue.showMessage("长时间未操作,您已被强制下线", ['confirm']).then(() => {
|
|
559
|
+
location.reload();
|
|
560
|
+
});
|
|
561
|
+
}, timeout);
|
|
562
|
+
};
|
|
563
|
+
// 需要监听的事件
|
|
564
|
+
const events = ['mousemove', 'keydown', 'mousedown', 'scroll', 'touchstart'];
|
|
565
|
+
// 只绑定一次
|
|
566
|
+
if (!this._inactivityListenerAdded) {
|
|
567
|
+
events.forEach(event => {
|
|
568
|
+
window.addEventListener(event, resetTimer, true);
|
|
569
|
+
});
|
|
570
|
+
this._inactivityListenerAdded = true;
|
|
571
|
+
}
|
|
572
|
+
// 初始化计时器
|
|
573
|
+
resetTimer();
|
|
475
574
|
}
|
|
476
575
|
}
|
|
477
576
|
|
package/src/system.js
CHANGED
|
@@ -28,7 +28,7 @@ import TestResSelect from './components/server/TestResSelect'
|
|
|
28
28
|
import RoleSelector from "./components/server/RoleSelector";
|
|
29
29
|
|
|
30
30
|
// BAinformation备案信息展示(空不展示, 传入什么展示什么,可以传标签)
|
|
31
|
-
export default function (val,filiale, {showLogin = false, show_daiBan = false, show_yiDi= false, BAinformation = null,showVersionTime=true} = {}) {
|
|
31
|
+
export default function (val,filiale, {showLogin = false, show_daiBan = false, show_yiDi= false, BAinformation = null,showVersionTime=true,autoLoginout = false, autoLoginTimeOut=30*60*1000} = {}) {
|
|
32
32
|
console.log(val,filiale,showLogin)
|
|
33
33
|
//验证码开关赋值
|
|
34
34
|
if(val!=null){
|
|
@@ -44,6 +44,10 @@ export default function (val,filiale, {showLogin = false, show_daiBan = false, s
|
|
|
44
44
|
GetLoginInfoService.showDaiBan=show_daiBan
|
|
45
45
|
//展示异地登录
|
|
46
46
|
GetLoginInfoService.showYiDi=show_yiDi
|
|
47
|
+
//自动登出
|
|
48
|
+
GetLoginInfoService.autoLoginout = autoLoginout
|
|
49
|
+
//自动登出时长(默认30分钟)
|
|
50
|
+
GetLoginInfoService.autoLoginTimeOut = autoLoginTimeOut
|
|
47
51
|
// 备案信息复制
|
|
48
52
|
GetLoginInfoService.BAinformation = BAinformation
|
|
49
53
|
Vue.use(GetLoginInfoService)
|
|
@@ -65,7 +69,7 @@ export default function (val,filiale, {showLogin = false, show_daiBan = false, s
|
|
|
65
69
|
//资源选择
|
|
66
70
|
Vue.component('res-select', ResSelect)
|
|
67
71
|
Vue.component('res-select-group', ResSelectGroup)
|
|
68
|
-
|
|
72
|
+
//资源选择测试
|
|
69
73
|
Vue.component('test-res-select', TestResSelect)
|
|
70
74
|
|
|
71
75
|
// 参数管理(新)
|