master
秦子超 2024-07-01 13:56:47 +08:00
commit 9bd7ce6ca9
4 changed files with 71802 additions and 131 deletions

View File

@ -38,7 +38,7 @@
<script> <script>
import CryptoJS from 'crypto-js' import CryptoJS from 'crypto-js'
import { onMounted } from "vue"
let checked = false let checked = false
export default { 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: { methods: {
handleChange (formData) { handleChange (formData) {
checked = !checked checked = !checked
@ -88,11 +99,15 @@ export default {
// //
if (formData.checked === true) { if (formData.checked === true) {
uni.setStorageSync('loginChecked', true)
uni.setStorageSync('loginName', postForm.loginName) uni.setStorageSync('loginName', postForm.loginName)
uni.setStorageSync('password',formData.password)
uni.setStorageSync('secretKey', postForm.secretKey) uni.setStorageSync('secretKey', postForm.secretKey)
} else { } else {
uni.setStorageSync('loginChecked', false)
uni.removeStorageSync('loginName') uni.removeStorageSync('loginName')
uni.removeStorageSync('secretKey') uni.removeStorageSync('secretKey')
uni.removeStorageSync('password')
this.formData.username = '' this.formData.username = ''
this.formData.password = '' this.formData.password = ''
} }

View File

@ -81,13 +81,22 @@
// console.log('click',index,func[index].url) // console.log('click',index,func[index].url)
}, },
logout(){ logout(){
uni.removeStorageSync('loginName') if(uni.getStorageSync('loginChecked')===true){
uni.removeStorageSync('secretKey') uni.redirectTo({
uni.removeStorageSync('Gs-Token') url: '/pages/login/login'
uni.removeStorageSync('value') })
uni.redirectTo({ } else {
url: '/pages/login/login' 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