diff --git a/src/renderer/src/api/apiService.js b/src/renderer/src/api/apiService.js index 0b28e0d..d5d1668 100644 --- a/src/renderer/src/api/apiService.js +++ b/src/renderer/src/api/apiService.js @@ -26,3 +26,13 @@ export class imChat { // 获取腾讯im-chat appid 签名 static getTxCloudSign = data => ApiService.publicHttp('/system/user/txCloudSign', data) } + +// zdg: url跳转-后端存储 +export class toLink { + // 设置链接-返回key(默认15分钟有效时间) + static setLink = url => ApiService.publicHttp(`/smarttalk/toLink`, {url}, 'post', null, 'form') + // 获取链接 + static getLink = key => ApiService.publicHttp(`/smarttalk/toLink/${key}`) + // 删除链接-缓存 + static delLink = key => ApiService.publicHttp(`/smarttalk/toLink/${key}`, null, 'delete') +} diff --git a/src/renderer/src/components/ai-chart/index.vue b/src/renderer/src/components/ai-chart/index.vue index 18b00f5..5234683 100644 --- a/src/renderer/src/components/ai-chart/index.vue +++ b/src/renderer/src/components/ai-chart/index.vue @@ -122,7 +122,8 @@ const outerAi = [ title: '教学大模型', secondTit: '中小学基础教学大模型', img: new URL('../../../src/assets/images/ai-02.png', import.meta.url).href, - disabled: true, + path: '/ais/aimoss' + }, { id: 3, diff --git a/src/renderer/src/plugins/shareStore.js b/src/renderer/src/plugins/shareStore.js index c4c2567..ba893d2 100644 --- a/src/renderer/src/plugins/shareStore.js +++ b/src/renderer/src/plugins/shareStore.js @@ -57,7 +57,7 @@ function stateSyncWatch(storeName, newState) { const diffData = findDifferences(oldState, newState) if(!_.keys(diffData).length) return // 没有变化就终止执行 // 数据处理: 找出差异 - console.log('state-change-diffData', diffData) + // console.log('state-change-diffData', diffData) try { let pinaValue = {} // store pina状态管理需要的数据格式 // 数据转换处理 @@ -116,7 +116,7 @@ function stateSyncInit(wid, store) { function sessionWatch(store) { const unsubscribe = sessionStore.onDidAnyChange((newV, oldV) => { if (newV !== oldV) { - console.log('session-change', newV, oldV) + // console.log('session-change', newV, oldV) // 通知主线程更新 // ipcRenderer?.invoke('pinia-state-change', storeName, jsonStr) } @@ -129,7 +129,7 @@ function stateChange(store) { const storeName = store.$id ipcRenderer?.on('pinia-state-set', (e, sName, jsonStr) => { if (sName == storeName) { // 更新对应数据 - console.log('state-set', jsonStr, sName) + // console.log('state-set', jsonStr, sName) const curJson = circularSafeStringify(store.$state) // 当前数据 const isUp = curJson != jsonStr // 不同的时候才写入,不然会导致触发数据变化监听,导致死循环 if (!isUp) return diff --git a/src/renderer/src/views/prepare/container/class-start.vue b/src/renderer/src/views/prepare/container/class-start.vue index f2a73e4..ed30234 100644 --- a/src/renderer/src/views/prepare/container/class-start.vue +++ b/src/renderer/src/views/prepare/container/class-start.vue @@ -85,12 +85,14 @@ import vueQr from 'vue-qr/src/packages/vue-qr.vue' // 插件: 二维码 import imChat from '@/views/tool/components/imChat.vue' // im-chat-子组件 import MsgEnum from '@/plugins/imChat/msgEnum' // 消息头-相关定义(nuem) import * as commUtil from '@/utils/comm' // 工具类-通用 -import { toLinkWeb, getStaticUrl } from '@/utils/tool' +import { toLinkWeb, getStaticUrl } from '@/utils/tool' // 工具类-主进程相关 import * as Http_ClassManage from '@/api/classManage' // api接口 import * as Http_Classcourse from '@/api/teaching/classcourse' // api接口 -import * as Http_Entpcoursefile from '@/api/education/entpcoursefile' // api接口 +import * as Http_Entpcoursefile from '@/api/education/entpcoursefile' // api接口 +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 const userStore = useUserStore() @@ -189,9 +191,9 @@ const getClassList = async () => { }) if (res.code == 200) { listData.classList = (res.rows || []).map(o => { - if(!!o.classstudentlist) { // 学生列表转为数组 - o.classstudentlist = JSON.parse('[' + o.classstudentlist + ']') - } + // if(!!o.classstudentlist) { // 学生列表转为数组 + // o.classstudentlist = JSON.parse('[' + o.classstudentlist + ']') + // } return o }); // 默认选中第一项 @@ -277,11 +279,34 @@ const classTeachingStart = async () => { } } // 获取二维码地址 -const getQrUrl = () => { +const getQrUrl = async() => { const { classcourseid:id } = teacherForm.form - const { userName } = userStore.user + const { userName, userId } = userStore.user if (!id||!userName) return - const qrCodeUrl = `wxlogin?username=${userName}&nextaction=classteaching&id=${id}` + // 原始方法(需要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}` + } teacherForm.form.qrUrl = baseUrl + qrCodeUrl } diff --git a/src/renderer/src/views/prepare/index.vue b/src/renderer/src/views/prepare/index.vue index a872138..40469a7 100644 --- a/src/renderer/src/views/prepare/index.vue +++ b/src/renderer/src/views/prepare/index.vue @@ -711,7 +711,10 @@ export default { .page-center-wrap{ flex: 1; height: 100%; - padding: 0 10px; + padding: 0 5px; + margin: 0 5px; + border-radius: 10px; + background-color: white; .prepare-center-jxkj{ height: 100%; display: flex;