🎈 perf(尝试解决正式环境首次进入白屏问题):
This commit is contained in:
parent
3e7b70c190
commit
ac56bfbd6d
13
.eslintrc
13
.eslintrc
@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": ["taro/react","@aaronghx/eslint-config-react"],
|
"extends": [
|
||||||
|
"taro/react",
|
||||||
|
"@aaronghx/eslint-config-react"
|
||||||
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-console": "off",
|
"no-console": "off",
|
||||||
"@typescript-eslint/no-shadow": "off",
|
"@typescript-eslint/no-shadow": "off",
|
||||||
@ -9,6 +12,10 @@
|
|||||||
"import/first": "off",
|
"import/first": "off",
|
||||||
"react/no-children-prop": "off",
|
"react/no-children-prop": "off",
|
||||||
"import/no-commonjs": "off",
|
"import/no-commonjs": "off",
|
||||||
"react/display-name": "off"
|
"react/display-name": "off",
|
||||||
|
"no-use-before-define": "off",
|
||||||
|
"@typescript-eslint/no-use-before-define": [
|
||||||
|
"error"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ const SideBar = ({
|
|||||||
const getClassData = async(id) => {
|
const getClassData = async(id) => {
|
||||||
const res = await fetchData({ id })
|
const res = await fetchData({ id })
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
if (res.data?.list.length > 0) {
|
if (res.data?.list?.length > 0) {
|
||||||
res.data.list = [{ id: -1, name: '全部' }, ...res.data.list]
|
res.data.list = [{ id: -1, name: '全部' }, ...res.data.list]
|
||||||
}
|
}
|
||||||
setClassList(() => res.data?.list)
|
setClassList(() => res.data?.list)
|
||||||
@ -130,8 +130,8 @@ const SideBar = ({
|
|||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<View className={styles.sideBar_con} style={{ paddingTop: classList.length > 0 ? '90rpx' : '20rpx' }}>
|
<View className={styles.sideBar_con} style={{ paddingTop: classList?.length > 0 ? '90rpx' : '20rpx' }}>
|
||||||
{classList.length > 0 && (
|
{classList?.length > 0 && (
|
||||||
<View className={styles.product_class} style={{ height: openClass ? '100%' : '' }}>
|
<View className={styles.product_class} style={{ height: openClass ? '100%' : '' }}>
|
||||||
<ProductClass list={classList} open={openClass} onOpenClick={val => setOpenClass(val)} onSelect={getSelectClass} defaultSelectId={classId} />
|
<ProductClass list={classList} open={openClass} onOpenClick={val => setOpenClass(val)} onSelect={getSelectClass} defaultSelectId={classId} />
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@ -155,7 +155,7 @@ export const useRequest = (
|
|||||||
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 result = await Taro.request(q as any)
|
||||||
@ -181,14 +181,14 @@ export const useRequest = (
|
|||||||
})
|
})
|
||||||
console.log('错误::', msg)
|
console.log('错误::', msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (statusCode === 401) {
|
if (statusCode === 401) {
|
||||||
removeToken()
|
removeToken()
|
||||||
removeSessionKey()
|
removeSessionKey()
|
||||||
removeUserInfo()
|
removeUserInfo()
|
||||||
login()
|
login()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: `错误:${showStatus(statusCode)}`,
|
title: `错误:${showStatus(statusCode)}`,
|
||||||
@ -196,7 +196,7 @@ export const useRequest = (
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
stateRef.current.success = false
|
stateRef.current.success = false
|
||||||
stateRef.current.error = true
|
stateRef.current.error = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user