apt上课-无需登录
This commit is contained in:
parent
68cf2bae1f
commit
eaf9d508d4
|
@ -26,3 +26,13 @@ export class imChat {
|
||||||
// 获取腾讯im-chat appid 签名
|
// 获取腾讯im-chat appid 签名
|
||||||
static getTxCloudSign = data => ApiService.publicHttp('/system/user/txCloudSign', data)
|
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')
|
||||||
|
}
|
||||||
|
|
|
@ -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 imChat from '@/views/tool/components/imChat.vue' // im-chat-子组件
|
||||||
import MsgEnum from '@/plugins/imChat/msgEnum' // 消息头-相关定义(nuem)
|
import MsgEnum from '@/plugins/imChat/msgEnum' // 消息头-相关定义(nuem)
|
||||||
import * as commUtil from '@/utils/comm' // 工具类-通用
|
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_ClassManage from '@/api/classManage' // api接口
|
||||||
import * as Http_Classcourse from '@/api/teaching/classcourse' // 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 useUserStore from "@/store/modules/user" // 状态管理:user
|
||||||
|
import CryptoJS from 'crypto-js'
|
||||||
|
|
||||||
const baseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
const baseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
@ -189,9 +191,9 @@ const getClassList = async () => {
|
||||||
})
|
})
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
listData.classList = (res.rows || []).map(o => {
|
listData.classList = (res.rows || []).map(o => {
|
||||||
if(!!o.classstudentlist) { // 学生列表转为数组
|
// if(!!o.classstudentlist) { // 学生列表转为数组
|
||||||
o.classstudentlist = JSON.parse('[' + o.classstudentlist + ']')
|
// o.classstudentlist = JSON.parse('[' + o.classstudentlist + ']')
|
||||||
}
|
// }
|
||||||
return o
|
return o
|
||||||
});
|
});
|
||||||
// 默认选中第一项
|
// 默认选中第一项
|
||||||
|
@ -277,11 +279,34 @@ const classTeachingStart = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 获取二维码地址
|
// 获取二维码地址
|
||||||
const getQrUrl = () => {
|
const getQrUrl = async() => {
|
||||||
const { classcourseid:id } = teacherForm.form
|
const { classcourseid:id } = teacherForm.form
|
||||||
const { userName } = userStore.user
|
const { userName, userId } = userStore.user
|
||||||
if (!id||!userName) return
|
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
|
teacherForm.form.qrUrl = baseUrl + qrCodeUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue