订单列表对接
This commit is contained in:
@@ -5,10 +5,12 @@ import {
|
||||
SET_ADMINUSERINFO,
|
||||
SET_TOKEN,
|
||||
SET_SESSIONKEY,
|
||||
SET_SORTCODE,
|
||||
CLEAR_TOKEN,
|
||||
CLEAR_USERINFO,
|
||||
CLEAR_SESSIONKEY,
|
||||
CLEAR_ADMINUSERINFO,
|
||||
CLEAR_SORTCODE
|
||||
} from '../constants/userInfo'
|
||||
|
||||
export type UserParam = {
|
||||
@@ -36,14 +38,20 @@ export type UserAdminParam = {
|
||||
user_name?: string,
|
||||
wechat_user_open_id?: number
|
||||
is_authorize_name?: false|true,
|
||||
is_authorize_phone?: false|true
|
||||
is_authorize_phone?: false|true,
|
||||
}
|
||||
|
||||
export type SortCodeParam = {
|
||||
shareShortDetail?: string, //详情分享页面短码
|
||||
shareShortPage?: string, //右上角分享页面短码
|
||||
}
|
||||
|
||||
export type DataParam = {
|
||||
token?: string
|
||||
session_key?: string,
|
||||
userInfo: UserParam,
|
||||
adminUserInfo: UserAdminParam
|
||||
adminUserInfo: UserAdminParam,
|
||||
sort_code: SortCodeParam
|
||||
}
|
||||
|
||||
type Action = {
|
||||
@@ -52,14 +60,16 @@ type Action = {
|
||||
}
|
||||
|
||||
|
||||
|
||||
const INIT_USER = {
|
||||
userInfo: Taro.getStorageSync('userInfo')?JSON.parse(Taro.getStorageSync('userInfo')):null,
|
||||
adminUserInfo: Taro.getStorageSync('adminUserInfo')?JSON.parse(Taro.getStorageSync('adminUserInfo')):null,
|
||||
token: Taro.getStorageSync('token')||'',
|
||||
session_key: Taro.getStorageSync('session_key')||'',
|
||||
sort_code: Taro.getStorageSync('sort_code')?JSON.parse(Taro.getStorageSync('sort_code')):null,
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default function counter (state = INIT_USER, action: Action) {
|
||||
const {type, data} = action
|
||||
switch (type) {
|
||||
@@ -75,6 +85,9 @@ export default function counter (state = INIT_USER, action: Action) {
|
||||
case SET_SESSIONKEY:
|
||||
Taro.setStorageSync('session_key',data?.session_key)
|
||||
return {...state,...data}
|
||||
case SET_SORTCODE:
|
||||
Taro.setStorageSync('sort_code',JSON.stringify(data?.sort_code))
|
||||
return {...state,...data}
|
||||
case CLEAR_TOKEN:
|
||||
Taro.removeStorageSync('token')
|
||||
return {...state, token:''}
|
||||
@@ -87,6 +100,9 @@ export default function counter (state = INIT_USER, action: Action) {
|
||||
case CLEAR_ADMINUSERINFO:
|
||||
Taro.removeStorageSync('adminUserInfo')
|
||||
return {...state, adminUserInfo: null}
|
||||
case CLEAR_SORTCODE:
|
||||
Taro.removeStorageSync('sort_code')
|
||||
return {...state, sortCode: null}
|
||||
default:
|
||||
return state
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user