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