uu
This commit is contained in:
parent
0714cf5e11
commit
29dccd2b2a
@ -82,6 +82,7 @@ async function handleResponse(options) {
|
||||
} else {
|
||||
if ( code == 401) { // 统一判断需要认证, 并作页面跳转
|
||||
setSessionXToken()
|
||||
msg = '登录失效,请重新登录'
|
||||
showToast(msg)
|
||||
goto("login/login", 2)
|
||||
return reject({
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
placeholder-style="color: #FFF;"></u-input>
|
||||
</view>
|
||||
<view class="mt-30">
|
||||
<u-checkbox-group placement="column" v-model="remberPassport">
|
||||
<u-checkbox-group placement="column" v-model="submitParams.remberPassport">
|
||||
<u-checkbox size="28" labelSize="28" label="记住密码"
|
||||
:name="true"
|
||||
label-color="#fff" activeColor="#fff" iconColor="#B12D29" iconSize="20"></u-checkbox>
|
||||
@ -46,6 +46,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { USERKEY } from "@/store/actionKey"
|
||||
import { getSessionLoginInfo, setSessionLoginInfo } from "@/session"
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@ -53,10 +54,10 @@
|
||||
data() {
|
||||
return {
|
||||
submitParams: {
|
||||
username: '25001108',
|
||||
password: 'q123456'
|
||||
username: '',
|
||||
password: '',
|
||||
remberPassport: []
|
||||
},
|
||||
remberPassport: [true]
|
||||
}
|
||||
},
|
||||
onShareAppMessage() {
|
||||
@ -64,15 +65,21 @@
|
||||
title: '',
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
let info = getSessionLoginInfo()
|
||||
let { remberPassport } = info
|
||||
if(remberPassport[0]) {
|
||||
Object.assign(this.submitParams, info)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async handleLogin() {
|
||||
const { remberPassport, submitParams } = this
|
||||
if(remberPassport[0]) {
|
||||
}
|
||||
const { submitParams } = this
|
||||
this.showLoading()
|
||||
try{
|
||||
await this.$store.dispatch(USERKEY.LOGIN, submitParams)
|
||||
await this.$store.dispatch(USERKEY.GETUSERINFO)
|
||||
setSessionLoginInfo(submitParams)
|
||||
this.goto("tabBar/home/home")
|
||||
}catch(e){
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { XTOKEN_KEY, USERINFO_KEY, BLUETOOTH_KEY } from "./key"
|
||||
import { XTOKEN_KEY, USERINFO_KEY, BLUETOOTH_KEY, LOGININFO_KEY } from "./key"
|
||||
|
||||
export const setSessionXToken = (val = '')=> {
|
||||
uni.setStorageSync(XTOKEN_KEY, val)
|
||||
@ -23,4 +23,14 @@ export const setSessionBluetoothInfo = (val = {})=> {
|
||||
|
||||
export const getSessionBluetoothInfo = ()=> {
|
||||
return uni.getStorageSync(BLUETOOTH_KEY) || {}
|
||||
}
|
||||
|
||||
export const setSessionLoginInfo = (val = {})=> {
|
||||
uni.setStorageSync(LOGININFO_KEY, val)
|
||||
}
|
||||
|
||||
export const getSessionLoginInfo = ()=> {
|
||||
return uni.getStorageSync(LOGININFO_KEY) || {
|
||||
remberPassport: []
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
export const XTOKEN_KEY = 'XTOKEN_KEY'
|
||||
export const USERINFO_KEY = 'USERINFO_KEY'
|
||||
export const BLUETOOTH_KEY = 'BLUETOOTH_KEY'
|
||||
export const BLUETOOTH_KEY = 'BLUETOOTH_KEY'
|
||||
export const LOGININFO_KEY = 'LOGININFO_KEY'
|
||||
Loading…
Reference in New Issue
Block a user