签名获取

This commit is contained in:
cxc
2022-05-06 23:11:47 +08:00
parent 1178a907e0
commit d22348bd24
2 changed files with 25 additions and 23 deletions

View File

@ -7,6 +7,14 @@ export function getMeetingDetailById(id) {
method: "get",
});
}
// 生成签名
export function generateSignature(params) {
return request({
url: `/app/generateSignature`,
method: "get",
params,
});
}
// 添加预约
export function newAppointment(data) {
return request({

View File

@ -69,7 +69,7 @@
<script setup>
import { computed, reactive, watch, ref, onMounted } from "vue";
import { useStore } from "vuex";
import { signMeeting } from "@/api/meeting";
import { signMeeting, generateSignature } from "@/api/meeting";
import wangEditor from "@/components/wangEditor";
import questions from "@/components/questions";
import messageList from "@/components/messageList";
@ -134,7 +134,7 @@ const meetingConfig = reactive({
meetingNumber: store.getters.meetingNumber,
passWord: store.state.password,
role: 0,
signatureEndpoint: "http://120.26.107.74:4000",
// signatureEndpoint: "http://120.26.107.74:4000",
userEmail: "",
userName: joinAccount.value,
// pass in the registrant's token if your meeting or webinar requires registration. More info here:
@ -158,28 +158,21 @@ const checkMedia = async () => {
}
return result;
};
// const signature = ref("");
const getSignature = async () => {
const res = await checkMedia();
if (!res.audio || !res.video) {
return ElMessageBox.alert(
`摄像头状态 : ${res.video ? "可用" : "禁用"}\n麦克风状态 : ${
res.audio ? "可用" : "禁用"
}`
);
}
console.log(res);
axios
.post(meetingConfig.signatureEndpoint, {
meetingNumber: meetingConfig.meetingNumber,
role: meetingConfig.role,
})
.then((res) => {
console.log(res.data.signature);
startMeeting(res.data.signature);
})
.catch((error) => {
console.log(error);
});
const { sign } = await generateSignature({
meetingNumber: store.getters.meetingNumber,
});
// signature.value = sign;
startMeeting(sign);
// const res = await checkMedia();
// if (!res.audio || !res.video) {
// return ElMessageBox.alert(
// `摄像头状态 : ${res.video ? "可用" : "禁用"}\n麦克风状态 : ${
// res.audio ? "可用" : "禁用"
// }`
// );
// }
};
const startMeeting = async (signature) => {
@ -317,6 +310,7 @@ watch(inSharing, (newVal) => {
).style.flexDirection = "";
}
});
getSignature();
// 建立websocket连接