✨ feat:首页大概
This commit is contained in:
@@ -2,7 +2,7 @@ import { useDispatch } from 'react-redux'
|
||||
import { SET_SHOPCOUNT, CLEAR_SHOPCOUNT } from '@/constants/common'
|
||||
import { DataParam } from '@/reducers/commonData'
|
||||
import { useCallback, useState } from 'react'
|
||||
import { GetShoppingCartApi } from '@/api/shopCart'
|
||||
// import { GetShoppingCartApi } from '@/api/shopCart'
|
||||
import { useSelector } from '@/reducers/hooks'
|
||||
export default () => {
|
||||
const commonData = useSelector((state) => state.commonData)
|
||||
@@ -16,10 +16,10 @@ export default () => {
|
||||
dispatch({ type: CLEAR_SHOPCOUNT })
|
||||
}
|
||||
|
||||
const { fetchData: fetchDataShopCount } = GetShoppingCartApi()
|
||||
// const { fetchData: fetchDataShopCount } = GetShoppingCartApi()
|
||||
const getShopCount = async () => {
|
||||
//获取购物车数据数量
|
||||
const { data } = await fetchDataShopCount()
|
||||
// const { data } = await fetchDataShopCount()
|
||||
let color_list = data.color_list || []
|
||||
setShopCount(color_list.length)
|
||||
}
|
||||
|
||||
+6
-6
@@ -145,18 +145,18 @@ export const useRequest = (
|
||||
...options,
|
||||
...{
|
||||
header: {
|
||||
Platform: 6,
|
||||
Platform: 3,
|
||||
Appid: WX_APPID,
|
||||
Authorization: token || stateRef.current.token,
|
||||
},
|
||||
},
|
||||
...(options.method?.toUpperCase() == 'GET'
|
||||
? {
|
||||
data: stateRef.current.query,
|
||||
}
|
||||
data: stateRef.current.query,
|
||||
}
|
||||
: {
|
||||
data: options.type?.toUpperCase() == 'FORMDATA' ? qs.stringify(stateRef.current.query) : stateRef.current.query,
|
||||
}),
|
||||
data: options.type?.toUpperCase() == 'FORMDATA' ? qs.stringify(stateRef.current.query) : stateRef.current.query,
|
||||
}),
|
||||
}
|
||||
const result = await Taro.request(q as any)
|
||||
const { statusCode } = result
|
||||
@@ -178,7 +178,7 @@ export const useRequest = (
|
||||
} else {
|
||||
if (statusCode === 401) {
|
||||
removeToken()
|
||||
removeSessionKey()
|
||||
// removeSessionKey()
|
||||
removeUserInfo()
|
||||
login()
|
||||
} else {
|
||||
|
||||
@@ -26,7 +26,7 @@ export default () => {
|
||||
const q = {
|
||||
url: BASE_URL + '/v1/mall/login',
|
||||
header: {
|
||||
"Platform": 6,
|
||||
"Platform": 3,
|
||||
"Appid": WX_APPID,
|
||||
},
|
||||
method: 'post',
|
||||
|
||||
Reference in New Issue
Block a user