system-clients 3.1.101-aode → 3.1.103-aode
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/components/server/Login.vue +725 -725
- package/src/components/server/ModifyPw.vue +112 -112
- package/src/plugins/GetLoginInfoService.js +108 -89
@@ -1,112 +1,112 @@
|
|
1
|
-
<template>
|
2
|
-
<div>
|
3
|
-
<validator name="v">
|
4
|
-
<modal :show.sync="show" v-ref:modal backdrop="false">
|
5
|
-
<header slot="modal-header" class="modal-header">
|
6
|
-
<button type="button" class="close" @click="rest"><span>×</span></button>
|
7
|
-
<h4 class="modal-title">修改密码</h4>
|
8
|
-
</header>
|
9
|
-
<article slot="modal-body" class="modal-body modifystyle auto form-horizontal">
|
10
|
-
<div class="has-feedback form-group"
|
11
|
-
:class="{'has-warning':$v.password.required,'has-error': $v.password.required,
|
12
|
-
'has-success':!$v.password.required}">
|
13
|
-
<label for="password" class="col-sm-4 col-sm-offset-1 control-label">原始密码: </label>
|
14
|
-
<div class="col-sm-4">
|
15
|
-
<input type="password" v-model="deliver.password" class="form-control" id="password" v-validate:password="{ required: true}">
|
16
|
-
<span class="glyphicon glyphicon-ok form-control-feedback" v-if="!$v.password.required"></span>
|
17
|
-
<span v-if="$v.password.required">不能为空</span>
|
18
|
-
</div>
|
19
|
-
</div>
|
20
|
-
<div class="has-feedback form-group"
|
21
|
-
:class="{'has-warning':$v.newpassword.required,'has-error':$v.newpassword.strongpassword && !($v.newpassword.required),
|
22
|
-
'has-success': !$v.newpassword.required && !$v.newpassword.strongpassword }">
|
23
|
-
<label for="newpassword" class="col-sm-4 col-sm-offset-1 control-label">新的密码: </label>
|
24
|
-
<div class="col-sm-4">
|
25
|
-
<input type="password" v-model="deliver.newpassword" class="form-control" id="newpassword" v-validate:newpassword='{required:true, strongpassword: true}'>
|
26
|
-
<span class="glyphicon glyphicon-ok form-control-feedback" v-if="!$v.newpassword.required && !($v.newpassword.strongpassword && !($v.newpassword.required))"></span>
|
27
|
-
<span v-if="$v.newpassword.required">不能为空</span>
|
28
|
-
<span v-if="$v.newpassword.strongpassword && !($v.newpassword.required)">密码必须包含英文大小写、阿拉伯数字、字符</span>
|
29
|
-
</div>
|
30
|
-
</div>
|
31
|
-
<div class="has-feedback form-group"
|
32
|
-
:class="{'has-warning':$v.affirmpassword.required,'has-error':$v.affirmpassword.equalValid && !($v.affirmpassword.required),
|
33
|
-
'has-success': !$v.affirmpassword.required && !($v.affirmpassword.equalValid && !($v.affirmpassword.required))}">
|
34
|
-
<label for="affirmpassword" class="col-sm-4 col-sm-offset-1 control-label">确认密码: </label>
|
35
|
-
<div class="col-sm-4">
|
36
|
-
<input type="password" v-model="deliver.affirmpassword" class="form-control" id="affirmpassword" v-validate:affirmpassword="{ required: true, equalValid: deliver.newpassword }">
|
37
|
-
<span class="glyphicon glyphicon-ok form-control-feedback" v-if="!$v.affirmpassword.required && !($v.affirmpassword.equalValid && !($v.affirmpassword.required))"></span>
|
38
|
-
<span v-if="$v.affirmpassword.required">不能为空</span>
|
39
|
-
<span v-if="$v.affirmpassword.equalValid && !($v.affirmpassword.required)">两次密码不一致 !!</span>
|
40
|
-
</div>
|
41
|
-
</div>
|
42
|
-
</article>
|
43
|
-
|
44
|
-
<footer slot="modal-footer" class="modal-footer">
|
45
|
-
<button type="button" class="btn btn-success" @click='confirm' :disabled="!$v.valid">确认</button>
|
46
|
-
<button type="button" class="btn btn-default" @click='rest'>取消</button>
|
47
|
-
</footer>
|
48
|
-
</modal>
|
49
|
-
</validator>
|
50
|
-
</div>
|
51
|
-
|
52
|
-
|
53
|
-
</template>
|
54
|
-
<script>
|
55
|
-
import co from 'co'
|
56
|
-
import validator from '../../plugins/validation';
|
57
|
-
|
58
|
-
let saveGen = function * (self) {
|
59
|
-
self.deliver.ename = self.functions.ename
|
60
|
-
// let res = yield self.$post('rs/user/entity', {data: self.deliver})
|
61
|
-
// let res = yield self.$post('rs/db/modifypassword', {data: self.deliver})
|
62
|
-
// let res = yield self.$resetpost('/rs/db/modifypwd', {data: self.deliver})
|
63
|
-
// Util.f.password = self.deliver.newpassword
|
64
|
-
let res = yield self.$resetpost('/rs/user/modifypwd', {data: self.deliver }, { resolveMsg: null, rejectMsg: '请求错误,修改密码失败!' })
|
65
|
-
self.$login.f.password = self.deliver.newpassword
|
66
|
-
if (res.data) {
|
67
|
-
console.log("修改密码返回:" , res.data)
|
68
|
-
if (res.data.
|
69
|
-
self.deliver.password = ''
|
70
|
-
self.deliver.newpassword = ''
|
71
|
-
self.deliver.affirmpassword = ''
|
72
|
-
self.show = false
|
73
|
-
self.$showAlert("修改密码成功", 'success', 2000)
|
74
|
-
} else {
|
75
|
-
self.$showAlert("修改密码失败,原因:" + res.data.msg, 'warning', 2000)
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
export default {
|
80
|
-
title: '系统管理-密码修改',
|
81
|
-
data () {
|
82
|
-
return {
|
83
|
-
deliver: {
|
84
|
-
password: '',
|
85
|
-
newpassword: '',
|
86
|
-
affirmpassword: ''
|
87
|
-
},
|
88
|
-
functions: this.$login.f
|
89
|
-
}
|
90
|
-
},
|
91
|
-
props: ['show'],
|
92
|
-
methods: {
|
93
|
-
confirm () {
|
94
|
-
let gen = saveGen(this)
|
95
|
-
co(gen)
|
96
|
-
},
|
97
|
-
rest () {
|
98
|
-
this.show = false
|
99
|
-
this.deliver = {password: '', newpassword: '', affirmpassword: ''}
|
100
|
-
}
|
101
|
-
}
|
102
|
-
}
|
103
|
-
</script>
|
104
|
-
<style>
|
105
|
-
/*修改密码body界面样式*/
|
106
|
-
.modifystyle {
|
107
|
-
background: #FCFEEE;
|
108
|
-
}
|
109
|
-
.modifystyle span{
|
110
|
-
color: red;
|
111
|
-
}
|
112
|
-
</style>
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<validator name="v">
|
4
|
+
<modal :show.sync="show" v-ref:modal backdrop="false">
|
5
|
+
<header slot="modal-header" class="modal-header">
|
6
|
+
<button type="button" class="close" @click="rest"><span>×</span></button>
|
7
|
+
<h4 class="modal-title">修改密码</h4>
|
8
|
+
</header>
|
9
|
+
<article slot="modal-body" class="modal-body modifystyle auto form-horizontal">
|
10
|
+
<div class="has-feedback form-group"
|
11
|
+
:class="{'has-warning':$v.password.required,'has-error': $v.password.required,
|
12
|
+
'has-success':!$v.password.required}">
|
13
|
+
<label for="password" class="col-sm-4 col-sm-offset-1 control-label">原始密码: </label>
|
14
|
+
<div class="col-sm-4">
|
15
|
+
<input type="password" v-model="deliver.password" class="form-control" id="password" v-validate:password="{ required: true}">
|
16
|
+
<span class="glyphicon glyphicon-ok form-control-feedback" v-if="!$v.password.required"></span>
|
17
|
+
<span v-if="$v.password.required">不能为空</span>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
<div class="has-feedback form-group"
|
21
|
+
:class="{'has-warning':$v.newpassword.required,'has-error':$v.newpassword.strongpassword && !($v.newpassword.required),
|
22
|
+
'has-success': !$v.newpassword.required && !$v.newpassword.strongpassword }">
|
23
|
+
<label for="newpassword" class="col-sm-4 col-sm-offset-1 control-label">新的密码: </label>
|
24
|
+
<div class="col-sm-4">
|
25
|
+
<input type="password" v-model="deliver.newpassword" class="form-control" id="newpassword" v-validate:newpassword='{required:true, strongpassword: true}'>
|
26
|
+
<span class="glyphicon glyphicon-ok form-control-feedback" v-if="!$v.newpassword.required && !($v.newpassword.strongpassword && !($v.newpassword.required))"></span>
|
27
|
+
<span v-if="$v.newpassword.required">不能为空</span>
|
28
|
+
<span v-if="$v.newpassword.strongpassword && !($v.newpassword.required)">密码必须包含英文大小写、阿拉伯数字、字符</span>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
<div class="has-feedback form-group"
|
32
|
+
:class="{'has-warning':$v.affirmpassword.required,'has-error':$v.affirmpassword.equalValid && !($v.affirmpassword.required),
|
33
|
+
'has-success': !$v.affirmpassword.required && !($v.affirmpassword.equalValid && !($v.affirmpassword.required))}">
|
34
|
+
<label for="affirmpassword" class="col-sm-4 col-sm-offset-1 control-label">确认密码: </label>
|
35
|
+
<div class="col-sm-4">
|
36
|
+
<input type="password" v-model="deliver.affirmpassword" class="form-control" id="affirmpassword" v-validate:affirmpassword="{ required: true, equalValid: deliver.newpassword }">
|
37
|
+
<span class="glyphicon glyphicon-ok form-control-feedback" v-if="!$v.affirmpassword.required && !($v.affirmpassword.equalValid && !($v.affirmpassword.required))"></span>
|
38
|
+
<span v-if="$v.affirmpassword.required">不能为空</span>
|
39
|
+
<span v-if="$v.affirmpassword.equalValid && !($v.affirmpassword.required)">两次密码不一致 !!</span>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</article>
|
43
|
+
|
44
|
+
<footer slot="modal-footer" class="modal-footer">
|
45
|
+
<button type="button" class="btn btn-success" @click='confirm' :disabled="!$v.valid">确认</button>
|
46
|
+
<button type="button" class="btn btn-default" @click='rest'>取消</button>
|
47
|
+
</footer>
|
48
|
+
</modal>
|
49
|
+
</validator>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
|
53
|
+
</template>
|
54
|
+
<script>
|
55
|
+
import co from 'co'
|
56
|
+
import validator from '../../plugins/validation';
|
57
|
+
|
58
|
+
let saveGen = function * (self) {
|
59
|
+
self.deliver.ename = self.functions.ename
|
60
|
+
// let res = yield self.$post('rs/user/entity', {data: self.deliver})
|
61
|
+
// let res = yield self.$post('rs/db/modifypassword', {data: self.deliver})
|
62
|
+
// let res = yield self.$resetpost('/rs/db/modifypwd', {data: self.deliver})
|
63
|
+
// Util.f.password = self.deliver.newpassword
|
64
|
+
let res = yield self.$resetpost('/rs/user/modifypwd', {data: self.deliver }, { resolveMsg: null, rejectMsg: '请求错误,修改密码失败!' })
|
65
|
+
self.$login.f.password = self.deliver.newpassword
|
66
|
+
if (res.data) {
|
67
|
+
console.log("修改密码返回:" , res.data)
|
68
|
+
if (res.data===true || res.data==='true') {
|
69
|
+
self.deliver.password = ''
|
70
|
+
self.deliver.newpassword = ''
|
71
|
+
self.deliver.affirmpassword = ''
|
72
|
+
self.show = false
|
73
|
+
self.$showAlert("修改密码成功", 'success', 2000)
|
74
|
+
} else {
|
75
|
+
self.$showAlert("修改密码失败,原因:" + res.data.msg, 'warning', 2000)
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
export default {
|
80
|
+
title: '系统管理-密码修改',
|
81
|
+
data () {
|
82
|
+
return {
|
83
|
+
deliver: {
|
84
|
+
password: '',
|
85
|
+
newpassword: '',
|
86
|
+
affirmpassword: ''
|
87
|
+
},
|
88
|
+
functions: this.$login.f
|
89
|
+
}
|
90
|
+
},
|
91
|
+
props: ['show'],
|
92
|
+
methods: {
|
93
|
+
confirm () {
|
94
|
+
let gen = saveGen(this)
|
95
|
+
co(gen)
|
96
|
+
},
|
97
|
+
rest () {
|
98
|
+
this.show = false
|
99
|
+
this.deliver = {password: '', newpassword: '', affirmpassword: ''}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
</script>
|
104
|
+
<style>
|
105
|
+
/*修改密码body界面样式*/
|
106
|
+
.modifystyle {
|
107
|
+
background: #FCFEEE;
|
108
|
+
}
|
109
|
+
.modifystyle span{
|
110
|
+
color: red;
|
111
|
+
}
|
112
|
+
</style>
|
@@ -7,21 +7,19 @@ let loginGen = async function (name, password) {
|
|
7
7
|
// rsa加密
|
8
8
|
let encrypt = new JSEncrypt();
|
9
9
|
encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB');
|
10
|
-
|
10
|
+
console.log(data)
|
11
|
+
|
12
|
+
let getLogin = await Vue.resetpost('/rs/logic/getLogin', data, {resolveMsg: null, rejectMsg: null}, 'RSA')
|
11
13
|
if (getLogin.data.states === '登录成功') {
|
12
14
|
// 调用远程登录服务,获取所有有权访问的功能
|
13
15
|
data = {username: name, password: password}
|
14
16
|
data = encrypt.encrypt(JSON.stringify(data))
|
15
|
-
|
16
|
-
resolveMsg: null,
|
17
|
+
let resource = await Vue.resetpost(`/rs/user/userLogin/客服系统`, data, {
|
18
|
+
resolveMsg: null,
|
19
|
+
rejectMsg: null
|
17
20
|
})
|
18
|
-
|
19
|
-
|
20
|
-
throw {status: resource.data.code, data: resource.data.msg}
|
21
|
-
}
|
22
|
-
|
23
|
-
console.log('登陆获取Util', resource.data)
|
24
|
-
Vue.$login.f = resource.data.data
|
21
|
+
console.log('登陆获取Util', JSON.stringify(resource.data))
|
22
|
+
Vue.$login.f = resource.data
|
25
23
|
//获取jwt
|
26
24
|
Vue.$login.jwt = getLogin.data.jwt
|
27
25
|
// 把登录用户添加到cookie里
|
@@ -30,27 +28,33 @@ let loginGen = async function (name, password) {
|
|
30
28
|
try {
|
31
29
|
//获取有权限的功能树
|
32
30
|
let hasRight = await Vue.resetpost(`/rs/search`, {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
source: "tool.getFullTree(this.getRights().where(row.getType() == $function$))",
|
32
|
+
userid: Vue.$login.f.id
|
33
|
+
},
|
34
|
+
{
|
35
|
+
resolveMsg: null,
|
36
|
+
rejectMsg: null
|
37
|
+
})
|
37
38
|
console.log('有权限功能返回数据', JSON.stringify(hasRight.data))
|
38
39
|
//准备替换功能树
|
39
|
-
var fun
|
40
|
+
var fun=[]
|
40
41
|
hasRight.data[0].children[0].children.forEach((item) => {
|
41
|
-
if
|
42
|
+
if(item.name=='客服系统'){
|
42
43
|
item.children.forEach((item1) => {
|
43
44
|
fun.push(item1)
|
44
45
|
})
|
45
46
|
}
|
46
47
|
})
|
47
|
-
Vue.$login.f.functions
|
48
|
-
|
48
|
+
// console.log('替换前', JSON.stringify(Vue.$login.f.functions))
|
49
|
+
// console.log('替换后', JSON.stringify(fun))
|
50
|
+
Vue.$login.f.functions=fun
|
51
|
+
}catch (error) {
|
49
52
|
}
|
50
53
|
if (Vue.$login.f.id !== '11') {
|
51
54
|
try {
|
52
55
|
let getAllArea = await Vue.resetpost('/rs/search', {
|
53
|
-
source: 'this.getParentByType($organization$).getChildByName($片区$).getChildren()',
|
56
|
+
source: 'this.getParentByType($organization$).getChildByName($片区$).getChildren()',
|
57
|
+
userid: Vue.$login.f.id
|
54
58
|
}, {resolveMsg: null, rejectMsg: null})
|
55
59
|
|
56
60
|
let areaTemp = []
|
@@ -58,23 +62,24 @@ let loginGen = async function (name, password) {
|
|
58
62
|
areaTemp.push({label: getAllArea.data[i].name, value: getAllArea.data[i]})
|
59
63
|
}
|
60
64
|
Vue.$login.f.f_allArea = areaTemp
|
61
|
-
}
|
62
|
-
Vue.$login.f.f_allArea =
|
63
|
-
console.log('获取区县',
|
65
|
+
}catch (error) {
|
66
|
+
Vue.$login.f.f_allArea =[]
|
67
|
+
console.log('获取区县',error)
|
64
68
|
}
|
65
69
|
// 获取抄表员
|
66
70
|
try {
|
67
71
|
let getGasman = await Vue.resetpost('/rs/search', {
|
68
|
-
source: 'this.getParentByType($organization$).getChildByName($抄表员$).getUsers()',
|
72
|
+
source: 'this.getParentByType($organization$).getChildByName($抄表员$).getUsers()',
|
73
|
+
userid: Vue.$login.f.id
|
69
74
|
}, {resolveMsg: null, rejectMsg: null})
|
70
75
|
let gasman = []
|
71
76
|
for (let i = 0; i < getGasman.data.length; i++) {
|
72
77
|
gasman.push(getGasman.data[i])
|
73
78
|
}
|
74
79
|
Vue.$login.f.f_gasman = gasman
|
75
|
-
}
|
80
|
+
}catch (error) {
|
76
81
|
Vue.$login.f.f_gasman = []
|
77
|
-
console.log('抄表员模块',
|
82
|
+
console.log('抄表员模块',error)
|
78
83
|
}
|
79
84
|
// // 获取安装人
|
80
85
|
// try {
|
@@ -107,22 +112,20 @@ let loginGen = async function (name, password) {
|
|
107
112
|
// Vue.$login.f.f_changemeterman = []
|
108
113
|
// console.log('换表员模块',error)
|
109
114
|
// }
|
110
|
-
|
115
|
+
// 获取资源服务权限
|
111
116
|
try {
|
112
|
-
let getLic = await Vue.resetpost('/rs/search', {
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
Vue.$login.f.lics = arry
|
123
|
-
} catch (error) {
|
117
|
+
let getLic = await Vue.resetpost('/rs/search', {data: {
|
118
|
+
source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($资源操作$) != -1)',
|
119
|
+
userid: Vue.$login.f.id
|
120
|
+
}}, {resolveMsg: null, rejectMsg: null})
|
121
|
+
let arry=[]
|
122
|
+
getLic.data.forEach((item) => {
|
123
|
+
arry.push(item.name)
|
124
|
+
})
|
125
|
+
Vue.$login.f.lics=arry
|
126
|
+
}catch (error) {
|
124
127
|
Vue.$login.f.f_gasman = []
|
125
|
-
console.log('资源服务权限',
|
128
|
+
console.log('资源服务权限',error)
|
126
129
|
}
|
127
130
|
// // 票据使用人
|
128
131
|
// try {
|
@@ -164,56 +167,61 @@ let loginGen = async function (name, password) {
|
|
164
167
|
let r = viewDetails.data
|
165
168
|
Vue.$login.r = []
|
166
169
|
r.forEach(x => Vue.$login.r.push(x.name))
|
167
|
-
}
|
170
|
+
}catch (error) {
|
168
171
|
Vue.$login.r = []
|
169
|
-
console.log('加载模块失败',
|
172
|
+
console.log('加载模块失败',error)
|
170
173
|
}
|
171
174
|
// 调用登录后处理
|
172
|
-
for
|
175
|
+
for(let proc of Vue.$login.afterLogin) {
|
173
176
|
await proc(Vue.$login.f)
|
174
177
|
}
|
175
178
|
// 定时发送心跳
|
176
|
-
setInterval(()
|
179
|
+
setInterval(()=> {
|
177
180
|
let http = new HttpResetClass()
|
178
|
-
|
181
|
+
//暂时不出现不出现异地登录校验
|
179
182
|
http.load('POST', `rs/user/access/${Vue.$login.f.id}`, {}, {resolveMsg: null, rejectMsg: null}).then((req) => {
|
180
|
-
if
|
181
|
-
Vue.showMessage(req.data.msg
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
})
|
183
|
+
if(req.data.status==710){
|
184
|
+
// Vue.showMessage(req.data.msg+",您将被强制退出系统", ['confirm']).then((res) => {
|
185
|
+
// if (res === 'confirm') {
|
186
|
+
// location.reload()
|
187
|
+
// }
|
188
|
+
// })
|
186
189
|
}
|
187
190
|
})
|
188
191
|
}, 2 * 60 * 1000)
|
189
192
|
}
|
190
193
|
|
191
194
|
} else {
|
195
|
+
let error = {status: 401, data: getLogin.data.states}
|
192
196
|
// 抛出错误
|
193
|
-
throw
|
197
|
+
throw error
|
194
198
|
}
|
195
199
|
}
|
196
200
|
|
197
201
|
let GetLoginInfoService = {
|
198
202
|
// 登录后要处理的异步对象
|
199
|
-
afterLogin: [],
|
200
|
-
|
203
|
+
afterLogin: [],
|
204
|
+
//验证码开关
|
205
|
+
Verification: true,
|
206
|
+
install (Vue, options) {
|
201
207
|
// 给vue增添对话框显示方法
|
202
208
|
Vue.$login = Vue.prototype.$login = GetLoginInfoService
|
203
209
|
},
|
204
210
|
|
205
|
-
f: {
|
211
|
+
f: {
|
212
|
+
|
213
|
+
},
|
206
214
|
|
207
215
|
/**
|
208
216
|
* 登录
|
209
217
|
* @param name
|
210
218
|
* @param password
|
211
219
|
*/
|
212
|
-
login(name, password) {
|
220
|
+
login (name, password) {
|
213
221
|
return loginGen(name, password)
|
214
222
|
},
|
215
223
|
|
216
|
-
convertToIn(val) {
|
224
|
+
convertToIn (val) {
|
217
225
|
let temp = ''
|
218
226
|
if (val instanceof Array) {
|
219
227
|
if (val.length >= 1) {
|
@@ -227,44 +235,46 @@ let GetLoginInfoService = {
|
|
227
235
|
return temp
|
228
236
|
},
|
229
237
|
|
230
|
-
toStandardYearMonth() {
|
238
|
+
toStandardYearMonth () {
|
231
239
|
let dt = new Date()
|
232
240
|
let month = dt.getMonth() + 1
|
233
241
|
return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month)
|
234
242
|
},
|
235
243
|
|
236
|
-
toStandardYearMonth1() {
|
244
|
+
toStandardYearMonth1 () {
|
237
245
|
let dt = new Date()
|
238
246
|
let month = dt.getMonth() + 1
|
239
247
|
return dt.getFullYear() + (month < 10 ? '0' + month : month)
|
240
248
|
},
|
241
249
|
|
242
|
-
toStandardDateString() {
|
250
|
+
toStandardDateString () {
|
243
251
|
let dt = new Date()
|
244
252
|
let month = dt.getMonth() + 1
|
245
253
|
let date = dt.getDate()
|
246
254
|
return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
|
247
255
|
},
|
248
256
|
|
249
|
-
toStartAndEndDateString() {
|
257
|
+
toStartAndEndDateString () {
|
250
258
|
let dt = new Date()
|
251
259
|
let month = dt.getMonth() + 1
|
252
260
|
// let date = dt.getDate()
|
253
|
-
return [dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-01',
|
261
|
+
return [dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-01',
|
262
|
+
dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (new Date(dt.getFullYear(), month, 0).getDate())]
|
254
263
|
// return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
|
255
264
|
},
|
256
265
|
|
257
|
-
toStandardTimeString() {
|
266
|
+
toStandardTimeString () {
|
258
267
|
let dt = new Date()
|
259
268
|
let month = dt.getMonth() + 1
|
260
269
|
let date = dt.getDate()
|
261
270
|
let hour = dt.getHours()
|
262
271
|
let min = dt.getMinutes()
|
263
272
|
let sec = dt.getSeconds()
|
264
|
-
return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date) +
|
273
|
+
return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date) +
|
274
|
+
' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
|
265
275
|
},
|
266
276
|
|
267
|
-
guid() {
|
277
|
+
guid () {
|
268
278
|
let buf = new Uint16Array(8)
|
269
279
|
window.crypto.getRandomValues(buf)
|
270
280
|
let S4 = function (num) {
|
@@ -277,7 +287,7 @@ let GetLoginInfoService = {
|
|
277
287
|
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]))
|
278
288
|
},
|
279
289
|
|
280
|
-
choices(role, param, hasBlank = false, blankHint = '请选择') {
|
290
|
+
choices (role, param, hasBlank = false, blankHint = '请选择') {
|
281
291
|
if (role == 'view') {
|
282
292
|
Vue.getParams(param, [null])
|
283
293
|
} else {
|
@@ -296,35 +306,41 @@ let GetLoginInfoService = {
|
|
296
306
|
}
|
297
307
|
},
|
298
308
|
|
299
|
-
required(param) {
|
300
|
-
if (typeof param === 'number' && param == 0)
|
301
|
-
|
309
|
+
required (param) {
|
310
|
+
if (typeof param === 'number' && param == 0)
|
311
|
+
return false
|
312
|
+
if (!param)
|
313
|
+
return true
|
302
314
|
param = param + ''
|
303
315
|
param = param.trim()
|
304
|
-
if (!param)
|
316
|
+
if (!param)
|
317
|
+
return true
|
305
318
|
return false
|
306
319
|
},
|
307
320
|
|
308
|
-
isInt(n) {
|
321
|
+
isInt (n) {
|
309
322
|
return !window.isNaN(n) && n % 1 === 0
|
310
323
|
},
|
311
324
|
|
312
|
-
isFloat(n) {
|
325
|
+
isFloat (n) {
|
313
326
|
return !window.isNaN(n)
|
314
327
|
},
|
315
328
|
|
316
329
|
// this will convert all true/false to boolean
|
317
|
-
booleanFilter(paper) {
|
330
|
+
booleanFilter (paper) {
|
318
331
|
for (let key in paper) {
|
319
|
-
if (!paper.hasOwnProperty(key))
|
332
|
+
if (!paper.hasOwnProperty(key))
|
333
|
+
continue
|
320
334
|
if (typeof paper[key] == 'object' && paper[key] != null) {
|
321
335
|
booleanFilter(paper[key])
|
322
336
|
} else {
|
323
|
-
if (paper[key] === 'true' || paper[key] == 'false')
|
337
|
+
if (paper[key] === 'true' || paper[key] == 'false')
|
338
|
+
paper[key] = (paper[key] === 'true')
|
324
339
|
}
|
325
340
|
}
|
326
|
-
},
|
327
|
-
|
341
|
+
},
|
342
|
+
// recursively traverse through each path
|
343
|
+
ratifyPics (paper) {
|
328
344
|
for (let key in paper) {
|
329
345
|
if (key.endsWith('_path')) {
|
330
346
|
if (!paper[key]) {
|
@@ -339,7 +355,7 @@ let GetLoginInfoService = {
|
|
339
355
|
},
|
340
356
|
|
341
357
|
// load script and other stuff
|
342
|
-
loadscript(type, fileName) {
|
358
|
+
loadscript (type, fileName) {
|
343
359
|
return new Promise((resolve, reject) => {
|
344
360
|
let element
|
345
361
|
if (type == 'css') {
|
@@ -364,12 +380,13 @@ let GetLoginInfoService = {
|
|
364
380
|
document.body.appendChild(element)
|
365
381
|
}
|
366
382
|
})
|
367
|
-
},
|
368
|
-
|
383
|
+
},
|
384
|
+
// 不能选择器中截取掉多余的字符
|
385
|
+
orgName (name) {
|
369
386
|
return name.substring(10)
|
370
387
|
},
|
371
388
|
|
372
|
-
getNowDate(name) {
|
389
|
+
getNowDate (name) {
|
373
390
|
// 求取当前时间的工具
|
374
391
|
let myweekday = ''
|
375
392
|
let year = ''
|
@@ -384,7 +401,7 @@ let GetLoginInfoService = {
|
|
384
401
|
return year + '年' + mymonth + '月' + myday + '日 ' + week[myweekday]
|
385
402
|
},
|
386
403
|
|
387
|
-
addDate(date, days) {
|
404
|
+
addDate (date, days) {
|
388
405
|
// 求取当前时间的工具
|
389
406
|
let endDate = new Date(date)
|
390
407
|
endDate = endDate.valueOf()
|
@@ -395,12 +412,13 @@ let GetLoginInfoService = {
|
|
395
412
|
let hour = endDate.getHours()
|
396
413
|
let min = endDate.getMinutes()
|
397
414
|
let sec = endDate.getSeconds()
|
398
|
-
return endDate.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day) +
|
415
|
+
return endDate.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day) +
|
416
|
+
' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
|
399
417
|
// return a
|
400
418
|
},
|
401
419
|
|
402
420
|
// 通过地址栏的参数获取参数内容
|
403
|
-
getUrlParames(param) {
|
421
|
+
getUrlParames (param) {
|
404
422
|
var query = window.location.search
|
405
423
|
var iLen = param.length
|
406
424
|
var iStart = query.indexOf(param)
|
@@ -416,7 +434,7 @@ let GetLoginInfoService = {
|
|
416
434
|
},
|
417
435
|
|
418
436
|
// 从地址栏获取加密的参数
|
419
|
-
getUrlCompileParames(param) {
|
437
|
+
getUrlCompileParames (param) {
|
420
438
|
let code = unescape(window.location.search.slice(1, window.location.search.length))
|
421
439
|
let query = String.fromCharCode(code.charCodeAt(0) - code.length)
|
422
440
|
for (var i = 1; i < code.length; i++) {
|
@@ -436,14 +454,15 @@ let GetLoginInfoService = {
|
|
436
454
|
},
|
437
455
|
|
438
456
|
// 对字符串进行加密
|
439
|
-
compileStr(code) {
|
457
|
+
compileStr (code) {
|
440
458
|
let c = String.fromCharCode(code.charCodeAt(0) + code.length)
|
441
459
|
for (let i = 1; i < code.length; i++) {
|
442
460
|
c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
|
443
461
|
}
|
444
462
|
return escape(c)
|
445
|
-
},
|
446
|
-
|
463
|
+
},
|
464
|
+
// 字符串进行解密
|
465
|
+
uncompileStr (code) {
|
447
466
|
code = unescape(code)
|
448
467
|
let c = String.fromCharCode(code.charCodeAt(0) - code.length)
|
449
468
|
for (var i = 1; i < code.length; i++) {
|
@@ -452,7 +471,7 @@ let GetLoginInfoService = {
|
|
452
471
|
return c
|
453
472
|
},
|
454
473
|
|
455
|
-
dateDescripte(date) {
|
474
|
+
dateDescripte (date) {
|
456
475
|
let nowTime = new Date().getTime()
|
457
476
|
let oldTime = new Date(date).getTime()
|
458
477
|
let timeDiff = nowTime - oldTime
|
@@ -485,7 +504,7 @@ let GetLoginInfoService = {
|
|
485
504
|
return des
|
486
505
|
},
|
487
506
|
|
488
|
-
nextMonth20(date) {
|
507
|
+
nextMonth20 (date) {
|
489
508
|
let ds = date.split('-')
|
490
509
|
let nextMonth = ds[1] - 0 + 1
|
491
510
|
return ds[0] + '-' + (nextMonth < 10 ? '0' + nextMonth : nextMonth) + '-20 00:00:00'
|