From 87a1c4e833ac89cb17d4cfde138aa19cc21dc840 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Fri, 11 Aug 2023 11:01:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=80=E8=AF=B7=E7=99=BB=E8=AE=B0=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E8=A7=81=E9=9D=A2=E4=BC=9A=E6=98=AF=E5=90=A6=E5=BC=80?= =?UTF-8?q?=E5=A7=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/login.ts | 5 ++++- src/api/request.ts | 2 +- src/pages/meeting/meeting.tsx | 29 ++++++++++++----------------- types/user.d.ts | 7 +------ 4 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/api/login.ts b/src/api/login.ts index 8ff1394..edde65f 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -14,6 +14,9 @@ export const loginApi = { return request("/api/v1/auth/login/meeting", "GET"); }, testLogin() { - return request('/token/18708100736', "GET") + return request('/token/15882685759', "GET") + }, + meetingInfo(id: string) { + return request(`/api/v1/meetings/meeting/${id}/info`, "GET") } } diff --git a/src/api/request.ts b/src/api/request.ts index 4620604..b7b0f1a 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -81,7 +81,7 @@ export function request( try { const data = res?.data as any if (data?.code === 0 && res?.statusCode === 200) { - resolve(data?.data || []) + resolve(data?.data) } else if (res.statusCode === 401) { Taro.showModal({ title: "登录过期,需重新登陆", diff --git a/src/pages/meeting/meeting.tsx b/src/pages/meeting/meeting.tsx index 1c0cb9d..9eccae2 100644 --- a/src/pages/meeting/meeting.tsx +++ b/src/pages/meeting/meeting.tsx @@ -7,7 +7,7 @@ import {getCurrentInstance} from "@tarojs/runtime"; import {regexTel} from "@/utils/regu"; const Meeting: FC = () => { - const {depid, start_time, end_time} = getCurrentInstance()?.router?.params as unknown as Offline + const {meeting_id} = getCurrentInstance()?.router?.params as unknown as { meeting_id: string } const {setUser, setToken, setCompany} = Profile.useContainer() const [h5params, setH5Params] = useState(null) const router = useRouter() @@ -18,22 +18,17 @@ const Meeting: FC = () => { }) }, []) - Taro.useLoad(() => { - const time = Date.now() - if (!depid - || !start_time - || !end_time - || time > new Date(end_time).getTime() - || time < new Date(start_time).getTime()) { - Taro.showModal({ - title: '二维码已过期', - success() { - Taro.reLaunch({url: '/pages/login/login'}) - } - }) - return - } + loginApi.meetingInfo(meeting_id).then(res => { + if (res !== 1) { + Taro.showModal({ + title: '二维码已过期', + success() { + Taro.reLaunch({url: '/pages/login/login'}) + } + }) + } + }) }) function submit(e) { @@ -82,7 +77,7 @@ const Meeting: FC = () => { } return ( - +
diff --git a/types/user.d.ts b/types/user.d.ts index 9231255..7aefccd 100644 --- a/types/user.d.ts +++ b/types/user.d.ts @@ -95,9 +95,4 @@ interface HourHistory extends Curriculum { } -interface Offline { - depid: number - start_time: number - end_time: number - path: string -} +