邀请登记判断见面会是否开始

main
king 1 year ago
parent 14cbc8584f
commit 87a1c4e833
  1. 5
      src/api/login.ts
  2. 2
      src/api/request.ts
  3. 29
      src/pages/meeting/meeting.tsx
  4. 7
      types/user.d.ts

@ -14,6 +14,9 @@ export const loginApi = {
return request<LoginParams>("/api/v1/auth/login/meeting", "GET"); return request<LoginParams>("/api/v1/auth/login/meeting", "GET");
}, },
testLogin() { testLogin() {
return request('/token/18708100736', "GET") return request('/token/15882685759', "GET")
},
meetingInfo(id: string) {
return request(`/api/v1/meetings/meeting/${id}/info`, "GET")
} }
} }

@ -81,7 +81,7 @@ export function request<T = unknown>(
try { try {
const data = res?.data as any const data = res?.data as any
if (data?.code === 0 && res?.statusCode === 200) { if (data?.code === 0 && res?.statusCode === 200) {
resolve(data?.data || []) resolve(data?.data)
} else if (res.statusCode === 401) { } else if (res.statusCode === 401) {
Taro.showModal({ Taro.showModal({
title: "登录过期,需重新登陆", title: "登录过期,需重新登陆",

@ -7,7 +7,7 @@ import {getCurrentInstance} from "@tarojs/runtime";
import {regexTel} from "@/utils/regu"; import {regexTel} from "@/utils/regu";
const Meeting: FC = () => { 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 {setUser, setToken, setCompany} = Profile.useContainer()
const [h5params, setH5Params] = useState<LoginParams | null>(null) const [h5params, setH5Params] = useState<LoginParams | null>(null)
const router = useRouter() const router = useRouter()
@ -18,22 +18,17 @@ const Meeting: FC = () => {
}) })
}, []) }, [])
Taro.useLoad(() => { Taro.useLoad(() => {
const time = Date.now() loginApi.meetingInfo(meeting_id).then(res => {
if (!depid if (res !== 1) {
|| !start_time Taro.showModal({
|| !end_time title: '二维码已过期',
|| time > new Date(end_time).getTime() success() {
|| time < new Date(start_time).getTime()) { Taro.reLaunch({url: '/pages/login/login'})
Taro.showModal({ }
title: '二维码已过期', })
success() { }
Taro.reLaunch({url: '/pages/login/login'}) })
}
})
return
}
}) })
function submit(e) { function submit(e) {
@ -82,7 +77,7 @@ const Meeting: FC = () => {
} }
return ( return (
<View className='h-10 bg-white p-2'> <View className='h-10 bg-white px-2'>
<Form className='form' onSubmit={submit}> <Form className='form' onSubmit={submit}>
<View className='item'> <View className='item'>

7
types/user.d.ts vendored

@ -95,9 +95,4 @@ interface HourHistory extends Curriculum {
} }
interface Offline {
depid: number
start_time: number
end_time: number
path: string
}

Loading…
Cancel
Save