|
|
@@ -10,7 +10,7 @@
|
|
10
|
10
|
<wInput v-model="phoneData" type="text" maxlength="11" placeholder="用户名" :focus="isFocus"></wInput>
|
|
11
|
11
|
<wInput v-model="passData" type="password" maxlength="11" placeholder="密码"></wInput>
|
|
12
|
12
|
</view>
|
|
13
|
|
-
|
|
|
13
|
+
|
|
14
|
14
|
<wButton class="wbutton" text="登 录" :rotate="isRotate" @click="startLogin"></wButton>
|
|
15
|
15
|
<!-- <wButton class="wbutton" text="用户注册" @click="registerStart"></wButton> -->
|
|
16
|
16
|
<!-- <view class="registerStyle" @click="registerStart"></view> -->
|
|
|
@@ -19,7 +19,6 @@
|
|
19
|
19
|
</template>
|
|
20
|
20
|
|
|
21
|
21
|
<script>
|
|
22
|
|
-
|
|
23
|
22
|
import wInput from '@/components/watch-login/watch-input.vue' //input
|
|
24
|
23
|
import wButton from '@/components/watch-login/watch-button.vue' //button
|
|
25
|
24
|
// import CryptoJS from '@/static/js/crypto-js/crypto-js.js'
|
|
|
@@ -27,8 +26,9 @@
|
|
27
|
26
|
// import { encrypt, decrypt } from "@/utils/jsencrypt";
|
|
28
|
27
|
import pageData from '../myTask/repairList/addRepair/pageData.js'
|
|
29
|
28
|
const sm2 = require('sm-crypto').sm2
|
|
30
|
|
- const cipherMode = 0 // 1 - C1C3C2,0 - C1C2C3,默认为1
|
|
31
|
|
- const publicKey = "042DBA45E7B03394F603CADAFCDDEC854D3E01A4E9C52CD799B85B1A14BDB970137AE58BA553D79F058604DC1CD4B77DE5408BA3308E767584100C2B663510C819"
|
|
|
29
|
+ const cipherMode = 0 // 1 - C1C3C2,0 - C1C2C3,默认为1
|
|
|
30
|
+ const publicKey =
|
|
|
31
|
+ "042DBA45E7B03394F603CADAFCDDEC854D3E01A4E9C52CD799B85B1A14BDB970137AE58BA553D79F058604DC1CD4B77DE5408BA3308E767584100C2B663510C819"
|
|
32
|
32
|
const privateKey = "BF1F907B4E0487F798DC80AFD7BC2A6201E8514233002272EA3BE2FC6F797843"
|
|
33
|
33
|
// let pwd= sm2.doEncrypt(800100, publicKey, cipherMode) // sm2加密
|
|
34
|
34
|
// console.log(pwd)
|
|
|
@@ -36,7 +36,7 @@
|
|
36
|
36
|
export default {
|
|
37
|
37
|
data() {
|
|
38
|
38
|
return {
|
|
39
|
|
- isAllow:"",
|
|
|
39
|
+ isAllow: "",
|
|
40
|
40
|
//logo图片 base64
|
|
41
|
41
|
logoImage: '/static/login-icon.png',
|
|
42
|
42
|
phoneData: '', //用户/电话
|
|
|
@@ -54,7 +54,7 @@
|
|
54
|
54
|
},
|
|
55
|
55
|
|
|
56
|
56
|
methods: {
|
|
57
|
|
- updatePass(){
|
|
|
57
|
+ updatePass() {
|
|
58
|
58
|
const reg = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,20}$/;
|
|
59
|
59
|
const pass = uni.getStorageSync('loginpass');
|
|
60
|
60
|
if (!reg.test(pass)) {
|
|
|
@@ -72,9 +72,30 @@
|
|
72
|
72
|
}
|
|
73
|
73
|
}
|
|
74
|
74
|
});
|
|
|
75
|
+ } else {
|
|
|
76
|
+ this.isLongPass()
|
|
|
77
|
+ }
|
|
|
78
|
+ },
|
|
|
79
|
+ isLongPass() {
|
|
|
80
|
+ const changePwdFlag = uni.getStorageSync('changePwdFlag')
|
|
|
81
|
+ if(changePwdFlag == 1){
|
|
|
82
|
+ uni.showModal({
|
|
|
83
|
+ title: '提示',
|
|
|
84
|
+ content: '您的密码已经超三个月未修改,请更新密码!',
|
|
|
85
|
+ showCancel: false,
|
|
|
86
|
+ success: function(res) {
|
|
|
87
|
+ if (res.confirm) {
|
|
|
88
|
+ uni.navigateTo({
|
|
|
89
|
+ url: "/pages/setting/fontSizeSettingPass/fontSizeSettingPass"
|
|
|
90
|
+ })
|
|
|
91
|
+ } else if (res.cancel) {
|
|
|
92
|
+ console.log('取消');
|
|
|
93
|
+ }
|
|
|
94
|
+ }
|
|
|
95
|
+ });
|
|
75
|
96
|
}else{
|
|
76
|
97
|
this.getAllowDept()
|
|
77
|
|
- }
|
|
|
98
|
+ }
|
|
78
|
99
|
},
|
|
79
|
100
|
startLogin(e) {
|
|
80
|
101
|
this.saveDept()
|
|
|
@@ -96,77 +117,78 @@
|
|
96
|
117
|
let params = {
|
|
97
|
118
|
"usercode": this.phoneData,
|
|
98
|
119
|
"password": sm2.doEncrypt(md5.hex_md5(this.passData), publicKey, cipherMode),
|
|
99
|
|
- "loginway":"phone"
|
|
|
120
|
+ "loginway": "phone"
|
|
100
|
121
|
}
|
|
101
|
|
-
|
|
102
|
|
-
|
|
103
|
|
- this.$mStore.dispatch("Login", params).then((e)=>{
|
|
|
122
|
+
|
|
|
123
|
+
|
|
|
124
|
+ this.$mStore.dispatch("Login", params).then((e) => {
|
|
104
|
125
|
this.isRotate = false
|
|
105
|
|
- if(e.state.toLowerCase() == 'success') {
|
|
106
|
|
- uni.setStorageSync('loginpass', this.passData)
|
|
107
|
|
- uni.setStorageSync('token', e.data)
|
|
108
|
|
- uni.setStorageSync('loginway','phone')
|
|
109
|
|
-
|
|
110
|
|
- }else{
|
|
|
126
|
+ if (e.state.toLowerCase() == 'success') {
|
|
|
127
|
+ uni.setStorageSync('loginpass', this.passData)
|
|
|
128
|
+ uni.setStorageSync('token', e.data.token)
|
|
|
129
|
+ uni.setStorageSync('loginway', 'phone')
|
|
|
130
|
+ uni.setStorageSync('userCode', e.data.usercode)
|
|
|
131
|
+ uni.setStorageSync('changePwdFlag', e.data.changePwdFlag)
|
|
|
132
|
+ } else {
|
|
111
|
133
|
this.$mHelper.toast(e.message)
|
|
112
|
|
- return
|
|
|
134
|
+ return
|
|
113
|
135
|
}
|
|
114
|
|
-
|
|
115
|
|
- this.$mStore.dispatch("GetInfo").then((e)=>{
|
|
|
136
|
+
|
|
|
137
|
+ this.$mStore.dispatch("GetInfo").then((e) => {
|
|
116
|
138
|
uni.setStorageSync('roleCode', e.data.Role.F_RoleCode)
|
|
117
|
139
|
uni.setStorageSync('userName', e.data.User.F_UserName)
|
|
118
|
|
- if(e.data.Dept){
|
|
|
140
|
+ if (e.data.Dept) {
|
|
119
|
141
|
uni.setStorageSync('deptId', e.data.Dept.F_DeptId)
|
|
120
|
142
|
uni.setStorageSync('deptName', e.data.Dept.F_DeptName)
|
|
121
|
143
|
}
|
|
122
|
|
-
|
|
|
144
|
+
|
|
123
|
145
|
uni.setStorageSync('userCode', e.data.User.F_UserCode)
|
|
124
|
146
|
uni.setStorageSync('userId', e.data.User.F_UserId.toString())
|
|
125
|
147
|
uni.setStorageSync('storageAllowUserDept', e.data.User.F_AllowDepartment)
|
|
126
|
|
- const code = uni.getStorageSync("roleCode");
|
|
|
148
|
+ const code = uni.getStorageSync("roleCode");
|
|
127
|
149
|
this.updatePass()
|
|
128
|
|
-
|
|
129
|
|
- if(!uni.getStorageSync('fontSizeValue')){
|
|
|
150
|
+ // this.isLongPass()
|
|
|
151
|
+ if (!uni.getStorageSync('fontSizeValue')) {
|
|
130
|
152
|
uni.setStorageSync('fontSizeValue', 1)
|
|
131
|
|
- }
|
|
132
|
|
- // ||code == 'GLY' || code == 'DDZX'
|
|
|
153
|
+ }
|
|
|
154
|
+ // ||code == 'GLY' || code == 'DDZX'
|
|
133
|
155
|
// if(code == 'WXY' || code == 'DDZX'|| code == 'GLY' || code == 'jcgn' || code == 'GQY' ||
|
|
134
|
156
|
// code == 'SJ' || code == 'WXBZZ' || code == 'APRY' || code == 'APRY') {}else{
|
|
135
|
157
|
// this.$mHelper.toast("没有登录权限");
|
|
136
|
158
|
// return;
|
|
137
|
159
|
// }
|
|
138
|
160
|
})
|
|
139
|
|
- }).catch((e)=>{
|
|
|
161
|
+ }).catch((e) => {
|
|
140
|
162
|
this.isRotate = false
|
|
141
|
163
|
})
|
|
142
|
|
-
|
|
|
164
|
+
|
|
143
|
165
|
},
|
|
144
|
|
- getAllowDept(){
|
|
145
|
|
- const params = {}
|
|
146
|
|
- this.$http.get('Index/GetUserDept', params).then(res=>{
|
|
147
|
|
- if(res.message == '需要选择科室'){
|
|
148
|
|
- this.isAllow = "1"
|
|
149
|
|
- }else{
|
|
150
|
|
- this.isAllow = "0"
|
|
151
|
|
- }
|
|
152
|
|
- uni.setStorageSync('isAllow', this.isAllow)
|
|
153
|
|
- uni.switchTab({
|
|
154
|
|
- url: '/pages/myTask/myTask'
|
|
155
|
|
- });
|
|
156
|
|
- })
|
|
|
166
|
+ getAllowDept() {
|
|
|
167
|
+ const params = {}
|
|
|
168
|
+ this.$http.get('Index/GetUserDept', params).then(res => {
|
|
|
169
|
+ if (res.message == '需要选择科室') {
|
|
|
170
|
+ this.isAllow = "1"
|
|
|
171
|
+ } else {
|
|
|
172
|
+ this.isAllow = "0"
|
|
|
173
|
+ }
|
|
|
174
|
+ uni.setStorageSync('isAllow', this.isAllow)
|
|
|
175
|
+ uni.switchTab({
|
|
|
176
|
+ url: '/pages/myTask/myTask'
|
|
|
177
|
+ });
|
|
|
178
|
+ })
|
|
157
|
179
|
},
|
|
158
|
|
- registerStart(){
|
|
|
180
|
+ registerStart() {
|
|
159
|
181
|
uni.navigateTo({
|
|
160
|
182
|
url: '/pages/register/register'
|
|
161
|
183
|
})
|
|
162
|
184
|
},
|
|
163
|
|
- saveDept(){
|
|
|
185
|
+ saveDept() {
|
|
164
|
186
|
pageData.getDet((res, data) => {
|
|
165
|
|
- uni.setStorageSync('deptTreeData',JSON.stringify(res))
|
|
166
|
|
- uni.setStorageSync('deptAllList',JSON.stringify(data))
|
|
|
187
|
+ uni.setStorageSync('deptTreeData', JSON.stringify(res))
|
|
|
188
|
+ uni.setStorageSync('deptAllList', JSON.stringify(data))
|
|
167
|
189
|
})
|
|
168
|
190
|
}
|
|
169
|
|
-
|
|
|
191
|
+
|
|
170
|
192
|
}
|
|
171
|
193
|
}
|
|
172
|
194
|
</script>
|
|
|
@@ -174,14 +196,16 @@
|
|
174
|
196
|
<style>
|
|
175
|
197
|
@import url("@/components/watch-login/css/icon.css");
|
|
176
|
198
|
@import url("@/pages/login/css/main.css");
|
|
177
|
|
- .wbutton{
|
|
|
199
|
+
|
|
|
200
|
+ .wbutton {
|
|
178
|
201
|
margin-top: 30px;
|
|
179
|
202
|
}
|
|
180
|
|
- .registerStyle{
|
|
181
|
|
- color: blue;
|
|
182
|
|
- text-align: center;
|
|
183
|
|
- height: 30px;
|
|
184
|
|
- line-height: 30px;
|
|
185
|
|
- margin-top: 20px;
|
|
|
203
|
+
|
|
|
204
|
+ .registerStyle {
|
|
|
205
|
+ color: blue;
|
|
|
206
|
+ text-align: center;
|
|
|
207
|
+ height: 30px;
|
|
|
208
|
+ line-height: 30px;
|
|
|
209
|
+ margin-top: 20px;
|
|
186
|
210
|
}
|
|
187
|
|
-</style>
|
|
|
211
|
+</style>
|