From 61493a7f4efdfbc7389d562529ef041f18764031 Mon Sep 17 00:00:00 2001 From: zdg Date: Sun, 29 Sep 2024 15:13:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/prepare/container/class-start.vue | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/renderer/src/views/prepare/container/class-start.vue b/src/renderer/src/views/prepare/container/class-start.vue index 7df6a8f..3d64129 100644 --- a/src/renderer/src/views/prepare/container/class-start.vue +++ b/src/renderer/src/views/prepare/container/class-start.vue @@ -52,7 +52,7 @@
- + @@ -96,7 +96,7 @@ import * as Http_api from '@/api/apiService' // api接口 import useUserStore from "@/store/modules/user" // 状态管理:user import CryptoJS from 'crypto-js' -const baseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH +let baseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH const userStore = useUserStore() const visible = ref(false) // 是否打开窗口 const myClassActive = ref({}) // 我的课件:准备上课的APT课件 @@ -286,30 +286,30 @@ const getQrUrl = async() => { const { userName, userId } = userStore.user if (!id||!userName) return // 原始方法(需要wx登录) - const qrCodeUrl = `wxlogin?username=${userName}&nextaction=classteaching&id=${id}` - teacherForm.form.qrUrl = baseUrl + qrCodeUrl - // // const baseUrl = 'https://localhost:7860' - // // token跳转 - // const url = `/teaching/classteachingonmobile?classcourseid=${id}` // 跳转移动端-上课 - // let qrCodeUrl = '' // 移动端-二维码地址 - // try { - // // 走后端缓存url - // const res = await Http_api.toLink.setLink(url) // 设置链接-缓存 - // if (res.code == 200) { - // const redisKey = res.data - // const base64Key = CryptoJS.enc.Utf8.parse(redisKey).toString(CryptoJS.enc.Base64) // base64加密 - // const enStrUrl = encodeURIComponent(base64Key) // url转码 - // qrCodeUrl = `?_server=${enStrUrl}` - // teacherForm.form.qrUrl = baseUrl + qrCodeUrl - // } - // } catch (error) { // 异常, 直接加密token - // const jsonStr = JSON.stringify({ url, token: userStore.token }) // json数据:{url, token} - // const key = `Ax19i14Ga6qEDOkGTo` // AES加密-key - // const enStr = CryptoJS.AES.encrypt(jsonStr, key).toString() // AES加密-数据 - // const enStrUrl = encodeURIComponent(enStr) // url转码 - // qrCodeUrl = `?_web=${enStrUrl}` - // } + // const qrCodeUrl = `wxlogin?username=${userName}&nextaction=classteaching&id=${id}` // teacherForm.form.qrUrl = baseUrl + qrCodeUrl + // baseUrl = 'https://localhost:7860' + // token跳转 + const url = `/teaching/classteachingonmobile?classcourseid=${id}` // 跳转移动端-上课 + let qrCodeUrl = '' // 移动端-二维码地址 + try { + // 走后端缓存url + const res = await Http_api.toLink.setLink(url) // 设置链接-缓存 + if (res.code == 200) { + const redisKey = res.data + const base64Key = CryptoJS.enc.Utf8.parse(redisKey).toString(CryptoJS.enc.Base64) // base64加密 + const enStrUrl = encodeURIComponent(base64Key) // url转码 + qrCodeUrl = `${url}&_server=${enStrUrl}` + teacherForm.form.qrUrl = baseUrl + qrCodeUrl + } + } catch (error) { // 异常, 直接加密token + const jsonStr = JSON.stringify({ url, token: userStore.token }) // json数据:{url, token} + const key = `Ax19i14Ga6qEDOkGTo` // AES加密-key + const enStr = CryptoJS.AES.encrypt(jsonStr, key).toString() // AES加密-数据 + const enStrUrl = encodeURIComponent(enStr) // url转码 + qrCodeUrl = `${url}&?_web=${enStrUrl}` + } + teacherForm.form.qrUrl = baseUrl + qrCodeUrl } // 定时器监听