diff --git a/src/common/constant.js b/src/common/constant.js index 2289265..42b4b0b 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -4,13 +4,13 @@ // export const BASE_URL = `http://10.0.0.5:50001/lymarket` // export const BASE_URL = `http://192.168.0.89:40001/lymarket` // export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞 -export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境 +// export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境 // export const BASE_URL = `http://192.168.1.30:40001/lymarket` // 发 // export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发 // export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境 // export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境 // export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞 -// export const BASE_URL = `http://192.168.1.224:50002/lymarket` // 添 +export const BASE_URL = `http://192.168.1.224:50002/lymarket` // 添 // export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰 // CDN diff --git a/src/constants/userInfo.ts b/src/constants/userInfo.ts index 88982c6..14f529a 100644 --- a/src/constants/userInfo.ts +++ b/src/constants/userInfo.ts @@ -7,4 +7,5 @@ export const CLEAR_TOKEN = 'clearToken' export const CLEAR_SESSIONKEY = 'clearSessionkey' export const CLEAR_USERINFO = 'clearUserInfo' export const CLEAR_ADMINUSERINFO = 'clearAdminUserInfo' -export const CLEAR_SORTCODE = 'clearSortCode' \ No newline at end of file +export const CLEAR_SORTCODE = 'clearSortCode' +export const LOGIN_STATUS = 'loginStatus' \ No newline at end of file diff --git a/src/reducers/userInfo.ts b/src/reducers/userInfo.ts index 928c4fa..a57e43a 100644 --- a/src/reducers/userInfo.ts +++ b/src/reducers/userInfo.ts @@ -10,7 +10,8 @@ import { CLEAR_USERINFO, CLEAR_SESSIONKEY, CLEAR_ADMINUSERINFO, - CLEAR_SORTCODE + CLEAR_SORTCODE, + LOGIN_STATUS } from '../constants/userInfo' export type UserParam = { @@ -53,6 +54,7 @@ export type DataParam = { userInfo: UserParam, adminUserInfo: UserAdminParam, sort_code: SortCodeParam + logingStatus?: false //登录状态 true 正在登录 } type Action = { @@ -67,6 +69,7 @@ const INIT_USER = { token: Taro.getStorageSync('token')||'', session_key: Taro.getStorageSync('session_key')||'', sort_code: Taro.getStorageSync('sort_code')?JSON.parse(Taro.getStorageSync('sort_code')):null, + logingStatus: false } export default function counter (state = INIT_USER, action: Action) { @@ -102,6 +105,8 @@ export default function counter (state = INIT_USER, action: Action) { case CLEAR_SORTCODE: Taro.removeStorageSync('sort_code') return {...state, sortCode: null} + case LOGIN_STATUS: + return {...state, ...data} default: return state } diff --git a/src/use/useHttp.ts b/src/use/useHttp.ts index 2f38afc..07312f4 100644 --- a/src/use/useHttp.ts +++ b/src/use/useHttp.ts @@ -85,6 +85,8 @@ const showStatus = (status) => { return `${message},请检查网络或联系管理员!` } +//登录状态 +const loginStatus: false|true = false // true:登录中 /** * axios 请求状态封装,返回响应式数据 fetch(), loading, error, code, msg 等常用方法/状态 @@ -133,7 +135,6 @@ export const useRequest = (options:option = { const fetchData = async (sub_options?:any) => { stateRef.current.loading = true setState((e) => ({...e, loading:true})) - console.log('tf:::', stateRef.current.loading) stateRef.current.query = { ...sub_options, ...options.pagination && { @@ -161,7 +162,6 @@ export const useRequest = (options:option = { } } const result = await Taro.request(q as any) - const { statusCode } = result const { code,