diff --git a/src/api/request.ts b/src/api/request.ts index 8778bc9..61b1757 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -83,14 +83,14 @@ export function request( if (data?.code === 0 && res?.statusCode === 200) { resolve(data?.data) } else if (res.statusCode === 401) { - Taro.showModal({ - title: "登录过期,需重新登陆", - showCancel: false, - success() { - Taro.clearStorageSync() - Taro.reLaunch({url: '/pages/login/login'}) - } - }) + // Taro.showModal({ + // title: "登录过期,需重新登陆", + // showCancel: false, + // success() { + Taro.clearStorageSync() + Taro.reLaunch({url: '/pages/login/login'}) + // } + // }) } else { reject(null) Taro.showToast({ diff --git a/src/app.config.ts b/src/app.config.ts index 2ac1731..9c0163b 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -1,11 +1,11 @@ export default defineAppConfig({ pages: [ + 'pages/home/home', 'pages/index/index', 'pages/meeting/meeting', 'pages/login/login', 'pages/check/check', 'pages/my/my', - 'pages/preview/preview', ], window: { backgroundTextStyle: 'light', @@ -18,7 +18,13 @@ export default defineAppConfig({ selectedColor: '#45D4A8', list: [ { - text: '课题', + text: '首页', + pagePath: 'pages/home/home', + iconPath: "static/tabs/home-unselect.png", + selectedIconPath: "static/tabs/home-selected.png", + }, + { + text: '学习', pagePath: 'pages/index/index', iconPath: "static/tabs/home-unselect.png", selectedIconPath: "static/tabs/home-selected.png", diff --git a/src/pages/home/home.config.ts b/src/pages/home/home.config.ts new file mode 100644 index 0000000..d178761 --- /dev/null +++ b/src/pages/home/home.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '首页', + navigationStyle: 'custom', +}) diff --git a/src/pages/home/home.tsx b/src/pages/home/home.tsx new file mode 100644 index 0000000..39eb775 --- /dev/null +++ b/src/pages/home/home.tsx @@ -0,0 +1,10 @@ +import {FC} from "react"; +import {View} from "@tarojs/components"; + +const Home: FC = () => { + return ( + 2 + ) +} + +export default Home diff --git a/src/pages/index/components/videoList.tsx b/src/pages/index/components/videoList.tsx index 5890586..10c422f 100644 --- a/src/pages/index/components/videoList.tsx +++ b/src/pages/index/components/videoList.tsx @@ -11,10 +11,9 @@ import eventsIndex from "@/hooks/eventsIndex"; interface Props { categoryKey: CoursesKey - ready: boolean } -export const VideoList: FC = ({categoryKey, ready}) => { +export const VideoList: FC = ({categoryKey}) => { const [data, setData] = useState({ is_finished: [], is_required: [], @@ -94,18 +93,14 @@ export const VideoList: FC = ({categoryKey, ready}) => { }) useDidShow(() => { - if (ready) { - getData().then() - getRecords().then() - } + getData().then() + getRecords().then() }) useEffect(() => { - if (ready) { - getData().then() - getRecords().then() - } - }, [page, ready]) + getData().then() + getRecords().then() + }, [page]) return ( {data?.[categoryKey]?.length ? data?.[categoryKey]?.map(c => diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 0bb30bf..dc9c625 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -5,9 +5,6 @@ import {VideoList} from "@/pages/index/components/videoList"; import Tabs, {OnChangOpt, TabList} from "@/components/tabs/tabs"; import {CoursesKey} from "@/api/public"; import Taro from '@tarojs/taro' -import {Profile} from '@/store' -// import {Search} from "./components/search"; - const Index: FC = () => { const globalData = Taro.getApp().globalData @@ -18,7 +15,6 @@ const Index: FC = () => { {title: "未完成", value: 'is_not_finished'}, ] const [categoryKey, setCategoryKey] = useState('is_required') - const {token} = Profile.useContainer() function tabChange(data: OnChangOpt) { setCategoryKey(data.tab?.value as CoursesKey) @@ -28,9 +24,8 @@ const Index: FC = () => { <> {process.env.TARO_ENV !== "h5" && 医学道} - {/**/} - + ) diff --git a/src/pages/login/login.tsx b/src/pages/login/login.tsx index c4cff69..d16f495 100644 --- a/src/pages/login/login.tsx +++ b/src/pages/login/login.tsx @@ -61,7 +61,7 @@ const Login: FC = () => { setToken(token) setCompany(company) setLoading(false) - Taro.switchTab({url: '/pages/index/index'}) + Taro.switchTab({url: '/pages/home/home'}) } else { Taro.setStorageSync('openid', catch_key) Taro.reLaunch({url: '/pages/check/check'}) @@ -81,7 +81,7 @@ const Login: FC = () => { async function TESTLOGIN() { const res = await loginApi.testLogin() Taro.setStorageSync('profile', JSON.stringify(res)) - Taro.reLaunch({url: '/pages/index/index'}) + Taro.reLaunch({url: '/pages/home/home'}) } return ( diff --git a/src/pages/preview/preview.config.ts b/src/pages/preview/preview.config.ts deleted file mode 100644 index 767c5c8..0000000 --- a/src/pages/preview/preview.config.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText:'医学道', - onReachBottomDistance: 30 -}) diff --git a/src/pages/preview/preview.tsx b/src/pages/preview/preview.tsx deleted file mode 100644 index 3d73d19..0000000 --- a/src/pages/preview/preview.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import {FC} from "react"; -import {View, Navigator} from "@tarojs/components"; - -const Preview: FC = () => { - return ( - - 预览..... - - 登录 - - ) -} - -export default Preview diff --git a/src/store/profile.ts b/src/store/profile.ts index 7e3723d..b3d21d0 100644 --- a/src/store/profile.ts +++ b/src/store/profile.ts @@ -1,7 +1,7 @@ import {useEffect, useState} from "react"; import {createContainer} from "unstated-next"; import Taro from "@tarojs/taro"; -import {whiteList} from "@/config"; +// import {whiteList} from "@/config"; function DataKey(data: any) { @@ -40,11 +40,11 @@ function useProfile() { } } - if (data?.token == null) { - if (!whiteList.includes(Taro.getCurrentInstance().router?.path?.split('?')?.[0] || '')) { - Taro.reLaunch({url: '/pages/preview/preview'}) - } - } + // if (data?.token == null) { + // if (!whiteList.includes(Taro.getCurrentInstance().router?.path?.split('?')?.[0] || '')) { + // Taro.reLaunch({url: '/pages/login/login'}) + // } + // } const [role, setRole] = useState(data?.role || null) const [user, setUser] = useState(data?.user || null)