This commit is contained in:
白了个白 2024-09-29 09:31:36 +08:00
commit e72710f027
1 changed files with 26 additions and 23 deletions

View File

@ -52,6 +52,7 @@
<div :title="value" v-if="!!value"> <div :title="value" v-if="!!value">
<vue-qr :text="value" :size="200" :margin="10" colorDark="green" colorLight="white" :logoSrc="getStaticUrl('/img/logo.png')" :logoScale="0.2" :dotScale="0.7"></vue-qr> <vue-qr :text="value" :size="200" :margin="10" colorDark="green" colorLight="white" :logoSrc="getStaticUrl('/img/logo.png')" :logoScale="0.2" :dotScale="0.7"></vue-qr>
</div> </div>
<!-- <el-button type="primary" :icon="Refresh" round title="刷新" @click="getQrUrl()" /> -->
<!-- <el-button type="warning" :loading="dt.loadingDel" @click="removeClasscourse()">删除记录</el-button>--> <!-- <el-button type="warning" :loading="dt.loadingDel" @click="removeClasscourse()">删除记录</el-button>-->
</template> </template>
<!-- 手机登录 --> <!-- 手机登录 -->
@ -80,6 +81,7 @@
<script setup> <script setup>
// //
import { onMounted, reactive, ref, watchEffect, watch, nextTick } from 'vue' // vue import { onMounted, reactive, ref, watchEffect, watch, nextTick } from 'vue' // vue
import { Refresh } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus' // ui: import { ElMessage, ElMessageBox } from 'element-plus' // ui:
import vueQr from 'vue-qr/src/packages/vue-qr.vue' // : 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-
@ -284,31 +286,32 @@ const getQrUrl = async() => {
const { userName, userId } = userStore.user const { userName, userId } = userStore.user
if (!id||!userName) return if (!id||!userName) return
// (wx) // (wx)
// const qrCodeUrl = `wxlogin?username=${userName}&nextaction=classteaching&id=${id}` 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
// // 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
} }
//
// ================== ======================= // ================== =======================
// im-chat: {type, data} // im-chat: {type, data}