|
@@ -1,7 +1,7 @@
|
|
|
<script setup>
|
|
|
import { user } from '~/store/index';
|
|
|
import downLoadFile1 from '@/utils/download'
|
|
|
-import mammoth from 'mammoth/mammoth.browser';
|
|
|
+import { ElRadioGroup, ElRadio, ElCheckboxGroup, ElCheckbox } from 'element-plus'
|
|
|
const props = defineProps({
|
|
|
id: String,
|
|
|
homework: String,
|
|
@@ -9,10 +9,11 @@ const props = defineProps({
|
|
|
dxa: String,
|
|
|
user_id: String,
|
|
|
zjr: String,
|
|
|
+ ks_id: String,
|
|
|
})
|
|
|
const chatBox = ref()
|
|
|
const ws = new WebSocket("wss://socket.txhlwxx.com")
|
|
|
-const emits = defineEmits(['filePre', 'edit', 'download', 'enter'])
|
|
|
+const emits = defineEmits(['filePre', 'edit'])
|
|
|
// let userList = ref(undefined)
|
|
|
const msgList = ref([])
|
|
|
|
|
@@ -22,29 +23,11 @@ let title = $ref('')
|
|
|
let filecontent = $ref('');
|
|
|
let fileName = $ref('');
|
|
|
let downItem = $ref('');
|
|
|
-let ban_id = $ref([]);
|
|
|
-let isBanned = $ref(false)
|
|
|
-let ban_me = $ref(false);
|
|
|
+
|
|
|
let login_data = $ref({});
|
|
|
let login_id = $ref([]);
|
|
|
-let wordText = $ref();
|
|
|
-function getWordText(url) {
|
|
|
- console.log(url);
|
|
|
- const xhr = new XMLHttpRequest();
|
|
|
- xhr.open("get", url, true);
|
|
|
- xhr.responseType = "arraybuffer";
|
|
|
- xhr.onload = () => {
|
|
|
- if (xhr.status == 200) {
|
|
|
- mammoth.convertToHtml({ arrayBuffer: new Uint8Array(xhr.response) }).then((resultObject) => {
|
|
|
- console.log(resultObject, 'rej');
|
|
|
- nextTick(() => {
|
|
|
- wordText = resultObject.value;
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- };
|
|
|
- xhr.send();
|
|
|
-}
|
|
|
+let testInfo = $ref([]);
|
|
|
+let answer = $ref();
|
|
|
ws.addEventListener('message', (e) => {
|
|
|
if (e.data) {
|
|
|
try {
|
|
@@ -63,18 +46,34 @@ ws.addEventListener('message', (e) => {
|
|
|
}
|
|
|
if (data.type === 'say') {
|
|
|
const [id, name] = data.from_client_name.split('|')
|
|
|
- const fileType = data.content?.split(";")[2]?.split('|')[1];
|
|
|
- fileName = data.content.split(";")[0];
|
|
|
- filecontent = data.content?.split(";")[2].split('|')[0];
|
|
|
+ console.log(data.content, 'cc');
|
|
|
+ let fileType
|
|
|
+ if (data.content.includes('|')) {
|
|
|
+ fileType = data.content?.split(";")[2]?.split('|')[1];
|
|
|
+ fileName = data.content.split(";")[0];
|
|
|
+ filecontent = data.content?.split(";")[2].split('|')[0];
|
|
|
+ }
|
|
|
+ // user.value.user_id !== props?.zjr
|
|
|
if (fileType && user.value.user_id !== props?.zjr) {
|
|
|
-
|
|
|
downItem = data.content
|
|
|
switch (fileType) {
|
|
|
case 'home':
|
|
|
title = '作业';
|
|
|
wordVisiable = true;
|
|
|
- let url = getFullUrl(filecontent)
|
|
|
- getWordText(url)
|
|
|
+ request({
|
|
|
+ url: '/txwx/question/index',
|
|
|
+ data: {
|
|
|
+ tq_id: props?.ks_id,
|
|
|
+ tqr_data_type: '4',
|
|
|
+ tqr_data_id: props?.id,
|
|
|
+ tqr_pos: '1'
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == '1') {
|
|
|
+ testInfo = res.data.page_data;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // let url = getFullUrl(filecontent)
|
|
|
break
|
|
|
case 'file':
|
|
|
title = '文件';
|
|
@@ -137,7 +136,7 @@ function download(item) {
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <div class="w-300px h-400px flex flex-col shadow chat">
|
|
|
+ <div class="w-300px h-400px flex flex-col shadow home">
|
|
|
<!-- v-if="user.user_id === props?.zjr" -->
|
|
|
<div v-if="user.user_id === props?.zjr" class="h-100 overflow-hidden overflow-y-auto flex-auto home_scroll" ref="chatBox">
|
|
|
<div class="right-nav ml-20px">
|
|
@@ -205,15 +204,39 @@ function download(item) {
|
|
|
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
- <el-dialog v-model="wordVisiable" :title="title">
|
|
|
- <div id="wordView" v-html="wordText"></div>
|
|
|
+ <el-dialog v-model="wordVisiable" :title="title">
|
|
|
+ <div v-if="testInfo.length > 0">
|
|
|
+ <div v-for="item in testInfo" :key="item.tq_id">
|
|
|
+ <div class="flex">
|
|
|
+ <div class="leading-loose" v-html="item.tq_content"></div>
|
|
|
+ <div class="min-w-60px">
|
|
|
+ <span class="py-3px px-10px rounded-10px bg-hex-1259A1 text-white text-12px">{{
|
|
|
+ item.tq_type_name }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <ElRadioGroup v-if="item.tq_type == '1'" class="my-10px" size="30" v-model="item.answer">
|
|
|
+ <el-radio size="30" class="mr-15px" v-for="e in item.tq_option_choosen" :label="e"><span
|
|
|
+ class="px-10px">{{ e }}</span></el-radio>
|
|
|
+ </ElRadioGroup>
|
|
|
+ <ElCheckboxGroup v-else-if="item.tq_type == '2'" v-model="item.answer">
|
|
|
+ <el-checkbox v-for="e in item.tq_option_choosen"><span class="px-10px">{{ e }}</span></el-checkbox>
|
|
|
+ </ElCheckboxGroup>
|
|
|
+ <ElRadioGroup v-else class="my-10px" size="30" v-model="item.answer">
|
|
|
+ <el-radio size="30" class="mr-15px" v-for="e in item.tq_option_choosen" :label="e"><span
|
|
|
+ class="px-10px">{{ e }}</span></el-radio>
|
|
|
+ </ElRadioGroup>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
</el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
$color: #1259A1;
|
|
|
|
|
|
+
|
|
|
.chat_li {
|
|
|
// background-color: rgba($color: #000000, $alpha: .4);
|
|
|
height: 40px;
|
|
@@ -309,4 +332,8 @@ $color: #1259A1;
|
|
|
background: rgba(108, 93, 211, 0.2);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+::v-deep .western {
|
|
|
+ line-height: 30px !important;
|
|
|
+}
|
|
|
</style>
|