From f10af4f1ccab623668d792b942d34a2d4ed5b587 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Mon, 14 Aug 2023 16:48:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.config.ts | 1 + src/components/video/video.tsx | 7 ++++++- src/config.ts | 3 ++- src/hooks/unique_ident.ts | 4 ++-- src/pages/business/test/test.tsx | 2 +- src/pages/business/videoInfo/videoInfo.tsx | 2 -- src/pages/preview/preview.config.ts | 4 ++++ src/pages/preview/preview.tsx | 14 ++++++++++++++ src/store/profile.ts | 2 +- 9 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 src/pages/preview/preview.config.ts create mode 100644 src/pages/preview/preview.tsx diff --git a/src/app.config.ts b/src/app.config.ts index 2de26e7..9126b65 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -5,6 +5,7 @@ export default defineAppConfig({ 'pages/login/login', 'pages/check/check', 'pages/my/my', + 'pages/preview/preview', ], window: { backgroundTextStyle: 'light', diff --git a/src/components/video/video.tsx b/src/components/video/video.tsx index 9190a13..7dd0f60 100644 --- a/src/components/video/video.tsx +++ b/src/components/video/video.tsx @@ -47,7 +47,8 @@ const HVideo: FC = (opt: HVideoOptions) => { if (process.env.TARO_ENV === 'h5') { try { document?.exitFullscreen().then() - } catch (e) {} + } catch (e) { + } } video?.exitFullScreen() @@ -106,6 +107,10 @@ const HVideo: FC = (opt: HVideoOptions) => { } }) + Taro.useUnload(() => { + unique_ident.del(currentTime, Date.now()) + }) + return ( <> diff --git a/src/config.ts b/src/config.ts index 2446555..080b3d1 100644 --- a/src/config.ts +++ b/src/config.ts @@ -2,5 +2,6 @@ export const whiteList: string[] = [ '/pages/check/check', '/pages/login/login', - '/pages/meeting/meeting' + '/pages/meeting/meeting', + '/pages/preview/preview', ] diff --git a/src/hooks/unique_ident.ts b/src/hooks/unique_ident.ts index 5425783..995bff8 100644 --- a/src/hooks/unique_ident.ts +++ b/src/hooks/unique_ident.ts @@ -31,8 +31,8 @@ function put(duration?: number, start_date?: number, upload = true) { } } -function del() { - put() +function del(duration?: number, start_date?: number, upload = true) { + put(duration, start_date, upload) const data: HourCacheParam | undefined = Taro.getStorageSync(KEY) if (data) { curriculum.delCache(data.courseId) diff --git a/src/pages/business/test/test.tsx b/src/pages/business/test/test.tsx index b4e92de..86cb7bb 100644 --- a/src/pages/business/test/test.tsx +++ b/src/pages/business/test/test.tsx @@ -40,7 +40,7 @@ const Test = () => { useEffect(() => { if (answers.length) { - unique_ident.put(0, Date.now()) + unique_ident.put(undefined, Date.now()) const isPass = answers.every(d => d) curriculum.recordText(hourId, { diff --git a/src/pages/business/videoInfo/videoInfo.tsx b/src/pages/business/videoInfo/videoInfo.tsx index 966a132..fbac408 100644 --- a/src/pages/business/videoInfo/videoInfo.tsx +++ b/src/pages/business/videoInfo/videoInfo.tsx @@ -7,7 +7,6 @@ import Course from "./components/course"; import Taro from "@tarojs/taro"; import eventsIndex from "@/hooks/eventsIndex"; import {formatMinute} from "@/utils/time"; -import unique_ident from "@/hooks/unique_ident"; import videoEvents from "@/hooks/videoEvents"; @@ -102,7 +101,6 @@ const VideoInfo: FC = () => { Taro.useUnload(() => { - unique_ident.del() videoEvents.videoOff() }) return ( diff --git a/src/pages/preview/preview.config.ts b/src/pages/preview/preview.config.ts new file mode 100644 index 0000000..767c5c8 --- /dev/null +++ b/src/pages/preview/preview.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText:'医学道', + onReachBottomDistance: 30 +}) diff --git a/src/pages/preview/preview.tsx b/src/pages/preview/preview.tsx new file mode 100644 index 0000000..3d73d19 --- /dev/null +++ b/src/pages/preview/preview.tsx @@ -0,0 +1,14 @@ +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 425e13e..7e3723d 100644 --- a/src/store/profile.ts +++ b/src/store/profile.ts @@ -42,7 +42,7 @@ function useProfile() { if (data?.token == null) { if (!whiteList.includes(Taro.getCurrentInstance().router?.path?.split('?')?.[0] || '')) { - Taro.reLaunch({url: '/pages/login/login'}) + Taro.reLaunch({url: '/pages/preview/preview'}) } }