合并ws
commit
9bd7ce6ca9
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
<script>
|
||||
import CryptoJS from 'crypto-js'
|
||||
|
||||
import { onMounted } from "vue"
|
||||
let checked = false
|
||||
|
||||
export default {
|
||||
|
|
@ -51,6 +51,17 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
console.log(uni.getStorageSync('loginChecked'));
|
||||
|
||||
if (uni.getStorageSync('loginChecked')===true){
|
||||
this.formData = {
|
||||
username: uni.getStorageSync('loginName'),
|
||||
password: uni.getStorageSync('password'),
|
||||
checked: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleChange (formData) {
|
||||
checked = !checked
|
||||
|
|
@ -88,11 +99,15 @@ export default {
|
|||
|
||||
//记住密码功能
|
||||
if (formData.checked === true) {
|
||||
uni.setStorageSync('loginChecked', true)
|
||||
uni.setStorageSync('loginName', postForm.loginName)
|
||||
uni.setStorageSync('password',formData.password)
|
||||
uni.setStorageSync('secretKey', postForm.secretKey)
|
||||
} else {
|
||||
uni.setStorageSync('loginChecked', false)
|
||||
uni.removeStorageSync('loginName')
|
||||
uni.removeStorageSync('secretKey')
|
||||
uni.removeStorageSync('password')
|
||||
this.formData.username = ''
|
||||
this.formData.password = ''
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,13 +81,22 @@
|
|||
// console.log('click',index,func[index].url)
|
||||
},
|
||||
logout(){
|
||||
uni.removeStorageSync('loginName')
|
||||
uni.removeStorageSync('secretKey')
|
||||
uni.removeStorageSync('Gs-Token')
|
||||
uni.removeStorageSync('value')
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
if(uni.getStorageSync('loginChecked')===true){
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
} else {
|
||||
uni.removeStorageSync('loginName')
|
||||
uni.removeStorageSync('secretKey')
|
||||
uni.removeStorageSync('Gs-Token')
|
||||
uni.removeStorageSync('value')
|
||||
uni.removeStorageSync('password')
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue