| | |
| | | UsernameKey, |
| | | SuccessRedirect, |
| | | FailRedirect, |
| | | customerIdKey |
| | | BaFailRedirect, |
| | | customerIdKey, |
| | | nameKey |
| | | } from './status.config.js'; |
| | | |
| | | const SetStorage = (key) => (value) => uni.setStorageSync(key, value); |
| | |
| | | export const setToken = SetStorage(TokenKey); |
| | | export const setRefreshToken = SetStorage(RefreshToken); |
| | | export const setUsernameKey = SetStorage(UsernameKey); |
| | | export const setCustomerId = SetStorage(customerIdKey) |
| | | export const setCustomerId = SetStorage(customerIdKey); |
| | | export const setName = SetStorage(nameKey) |
| | | export const redirectHome = (path) => { |
| | | uni.switchTab({ |
| | | url: path || SuccessRedirect |
| | | }) |
| | | } |
| | | export const redirectLogin = (path) => { |
| | | let data=uni.getStorageSync('userList')?JSON.parse(uni.getStorageSync('userList')):[]; |
| | | let remberPassWord=uni.getStorageSync('remberPassWord')?uni.getStorageSync('remberPassWord'):[]; |
| | | uni.clearStorageSync(); |
| | | uni.setStorageSync("userList", JSON.stringify(data)) |
| | | uni.setStorageSync("remberPassWord", remberPassWord) |
| | | uni.reLaunch({ |
| | | url: path || FailRedirect |
| | | }) |
| | | } |
| | | |
| | | export const redirectabLogin = (path) => { |
| | | let data=uni.getStorageSync('userList')?JSON.parse(uni.getStorageSync('userList')):[]; |
| | | let remberPassWord=uni.getStorageSync('remberPassWord')?uni.getStorageSync('remberPassWord'):[]; |
| | | uni.clearStorageSync(); |
| | | uni.setStorageSync("userList", JSON.stringify(data)) |
| | | uni.setStorageSync("remberPassWord", remberPassWord) |
| | | uni.reLaunch({ |
| | | url: path || BaFailRedirect |
| | | }) |
| | | } |
| | | |
| | | |
| | | // 获取用户状态 |
| | | export const getStatesOne = (key) => uni.getStorageSync(key); |
| | | |