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 -} +