主持人参会页面
This commit is contained in:
@ -1,7 +1,13 @@
|
||||
import { createWebHistory, createRouter } from "vue-router";
|
||||
import store from "@/store";
|
||||
import { whitelistJoinMeeting } from "@/api/meeting";
|
||||
import _ from "lodash";
|
||||
import cryptoJs from "crypto-js";
|
||||
|
||||
import {
|
||||
whitelistJoinMeeting,
|
||||
registerJoinUser,
|
||||
visitorJoinUser,
|
||||
} from "@/api/meeting";
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
@ -20,6 +26,16 @@ const router = createRouter({
|
||||
name: "Meeting",
|
||||
component: () => import("@/views/meeting.vue"),
|
||||
},
|
||||
// {
|
||||
// path: "/host/:meetingId/:hostinfo",
|
||||
// name: "Host",
|
||||
// component: () => import("@/views/host.vue"),
|
||||
// },
|
||||
{
|
||||
path: "/host/:meetingId/:pwd/:username/:nickname",
|
||||
name: "Host",
|
||||
component: () => import("@/views/host.vue"),
|
||||
},
|
||||
{
|
||||
path: "/:pathMatch(.*)*",
|
||||
name: "NotFound",
|
||||
@ -33,10 +49,32 @@ router.beforeEach(async (to) => {
|
||||
if (!store.state.meeting.id && to.params.meetingId) {
|
||||
await store.dispatch("getMeetingInfo", to.params.meetingId);
|
||||
}
|
||||
// 前往主持人页面
|
||||
if (to.name === "Host") {
|
||||
console.log("host");
|
||||
// const bytes = cryptoJs.AES.decrypt(to.params.hostinfo, "secret");
|
||||
// const decryptedData = JSON.parse(bytes.toString(cryptoJs.enc.Utf8));
|
||||
store.commit("setJoinUser", {
|
||||
nickname: to.params.nickname,
|
||||
username: to.params.username,
|
||||
});
|
||||
store.commit("setPassword", to.params.pwd);
|
||||
return true;
|
||||
}
|
||||
// 如果要前往参会页面
|
||||
if (to.name === "Meeting") {
|
||||
// 如果是白名单模式
|
||||
// 如果要去的页面会议号于 vuex中的不一样,则清除数据
|
||||
if (to.params.meetingId !== store.state.joinUser.meetingId) {
|
||||
store.commit("setJoinUser", {});
|
||||
}
|
||||
// 如果参会方式发生更改,则清除数据
|
||||
if (store.state.meeting.joinType !== store.state.joinType) {
|
||||
store.commit("setJoinUser", {});
|
||||
store.commit("setJoinType", store.state.meeting.joinType);
|
||||
return `/verify/${to.params.meetingId}`;
|
||||
}
|
||||
if (store.state.meeting.joinType === "1") {
|
||||
// 如果是白名单模式
|
||||
if (store.state.joinUser.icCard) {
|
||||
// 检测输入的IC卡号是否在白名单范围内,是则放行,否则返回原地址
|
||||
try {
|
||||
@ -55,9 +93,16 @@ router.beforeEach(async (to) => {
|
||||
return `/verify/${to.params.meetingId}`;
|
||||
}
|
||||
} else {
|
||||
if (!store.state.password) {
|
||||
if (_.isEmpty(store.state.joinUser)) {
|
||||
return `/verify/${to.params.meetingId}`;
|
||||
} else {
|
||||
if (store.state.meeting.joinType === "2") {
|
||||
const { data } = await registerJoinUser(store.state.joinUser);
|
||||
store.commit("setPassword", data);
|
||||
} else {
|
||||
const { data } = await visitorJoinUser(store.state.joinUser);
|
||||
store.commit("setPassword", data);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user