From f0a06b7fe9e3a843ddd750f9c3b54cc94a6b9bd5 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Fri, 25 Aug 2023 16:23:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=92=AD=E6=94=BE=E5=85=A8=E5=B1=80=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/request.ts | 2 +- src/components/video/video.tsx | 10 +++++++--- .../business/videoInfo/components/catalogue.tsx | 7 ++++--- src/pages/home/components/feature_recommended.tsx | 1 - src/pages/login/login.config.ts | 1 - src/pages/login/login.tsx | 14 +++++--------- src/pages/meeting/meeting.tsx | 2 +- src/pages/preview/videoFull/videoFull.tsx | 2 +- src/store/profile.ts | 2 +- 9 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/api/request.ts b/src/api/request.ts index 61b1757..3195e31 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -88,7 +88,7 @@ export function request( // showCancel: false, // success() { Taro.clearStorageSync() - Taro.reLaunch({url: '/pages/login/login'}) + Taro.redirectTo({url: '/pages/login/login'}) // } // }) } else { diff --git a/src/components/video/video.tsx b/src/components/video/video.tsx index 2a6ca6f..9924471 100644 --- a/src/components/video/video.tsx +++ b/src/components/video/video.tsx @@ -1,7 +1,7 @@ import {BaseEventOrig, Video, VideoProps} from "@tarojs/components"; import {HVideoOptions} from "@/components/video/type"; import Taro from "@tarojs/taro"; -import {FC, useState} from "react"; +import {FC, useEffect, useState} from "react"; import unique_ident from "@/hooks/unique_ident"; import videoEvents from "@/hooks/videoEvents"; @@ -12,6 +12,10 @@ const HVideo: FC = (opt: HVideoOptions) => { try { video = Taro.createVideoContext('myVideo') + } catch (e) { + } + + useEffect(() => { videoEvents.onSetVideoState(({name}) => { switch (name) { case "pause": @@ -22,8 +26,7 @@ const HVideo: FC = (opt: HVideoOptions) => { break } }) - } catch (e) { - } + }, []) function onTimeUpdate(event: BaseEventOrig) { const time = event.detail.currentTime @@ -66,6 +69,7 @@ const HVideo: FC = (opt: HVideoOptions) => { function onEnded() { if (currentTime + 1 > opt.duration) { opt.onEnded() + videoEvents.videoState('pause') } else { video?.seek(currentTime) unique_ident.remove() diff --git a/src/pages/business/videoInfo/components/catalogue.tsx b/src/pages/business/videoInfo/components/catalogue.tsx index 1bd3315..601d885 100644 --- a/src/pages/business/videoInfo/components/catalogue.tsx +++ b/src/pages/business/videoInfo/components/catalogue.tsx @@ -96,7 +96,8 @@ const Catalogue: FC = ({data, setHors, id, playId}) => { function learning() { const flats: Hour[] = Object.values(data?.hours || {}).flat(Infinity) as Hour[] - if ((data?.learn_hour_records?.length || undefined) == data?.learn_record?.hour_count && flats.length) { + if (!flats.length) return; + if (!data?.learn_hour_records?.length || data.learn_hour_records.length === data.learn_record?.hour_count) { if (flats[0].id === playId) { videoEvents.setVideoState('play') } else { @@ -174,8 +175,8 @@ const Catalogue: FC = ({data, setHors, id, playId}) => { { - playing ? 暂停 - : 立即学习 + playing ? {JSON.stringify(playing)}暂停 + : {JSON.stringify(playing)}立即学习 } setShow(true)}>... diff --git a/src/pages/home/components/feature_recommended.tsx b/src/pages/home/components/feature_recommended.tsx index 8de747f..afdf4c8 100644 --- a/src/pages/home/components/feature_recommended.tsx +++ b/src/pages/home/components/feature_recommended.tsx @@ -125,7 +125,6 @@ const FeatureRecommended: FC = () => { oldData[0].data = brand oldData[1].data = health oldData[2].data = kill - console.log(illness) oldData[3].data = illness setData(oldData) }) diff --git a/src/pages/login/login.config.ts b/src/pages/login/login.config.ts index 72e8cfc..2e697f0 100644 --- a/src/pages/login/login.config.ts +++ b/src/pages/login/login.config.ts @@ -1,4 +1,3 @@ export default definePageConfig({ - navigationStyle: 'custom', navigationBarTitleText: '登录' }) diff --git a/src/pages/login/login.tsx b/src/pages/login/login.tsx index 6024540..42ccd03 100644 --- a/src/pages/login/login.tsx +++ b/src/pages/login/login.tsx @@ -9,10 +9,6 @@ import {loginApi, LoginParams} from "@/api/login"; import MyButton from "@/components/button/MyButton"; const Login: FC = () => { - // const {statusBarHeight = 0} = Taro.getSystemInfoSync() - // const bbc = getMenuButtonBoundingClientRect(); - // const navHeight = bbc.bottom + (bbc.top - statusBarHeight) - statusBarHeight - const [isLoading, setLoading] = useState(false) const [error, setError] = useState(null) const {setUser, setToken, setCompany} = Profile.useContainer() @@ -78,11 +74,11 @@ const Login: FC = () => { } } - async function TESTLOGIN() { - const res = await loginApi.testLogin() - Taro.setStorageSync('profile', JSON.stringify(res)) - Taro.reLaunch({url: '/pages/home/home'}) - } + // async function TESTLOGIN() { + // const res = await loginApi.testLogin() + // Taro.setStorageSync('profile', JSON.stringify(res)) + // Taro.reLaunch({url: '/pages/home/home'}) + // } return ( diff --git a/src/pages/meeting/meeting.tsx b/src/pages/meeting/meeting.tsx index 16c8e89..ee6f97f 100644 --- a/src/pages/meeting/meeting.tsx +++ b/src/pages/meeting/meeting.tsx @@ -48,7 +48,7 @@ const MeetingLogin: FC = () => { Taro.showModal({ title: res.type === 0 ? '暂未开始' : '二维码已过期', success() { - Taro.reLaunch({url: '/pages/login/login'}) + Taro.redirectTo({url: '/pages/login/login'}) } }) return diff --git a/src/pages/preview/videoFull/videoFull.tsx b/src/pages/preview/videoFull/videoFull.tsx index 6651cd1..21a3c6c 100644 --- a/src/pages/preview/videoFull/videoFull.tsx +++ b/src/pages/preview/videoFull/videoFull.tsx @@ -49,7 +49,7 @@ const VideoFull: FC = () => { <> {params.title && {params.title}}