|
@@ -1,10 +1,11 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import type { type_dyaw_xlfw_zxhd, type_dyaw_xlfw_zxhd_log } from '~/types';
|
|
|
|
|
|
+import type { type_dyaw_xlfw_zxhd, type_dyaw_xlfw_zxhd_log, type_archives_item } from '~/types';
|
|
import { Search } from '@element-plus/icons-vue'
|
|
import { Search } from '@element-plus/icons-vue'
|
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus'
|
|
import user from '~/store/user';
|
|
import user from '~/store/user';
|
|
import { createSocket, socketSend } from '~/utils/ws';
|
|
import { createSocket, socketSend } from '~/utils/ws';
|
|
import type { TSocketRes } from '~/utils/ws';
|
|
import type { TSocketRes } from '~/utils/ws';
|
|
-
|
|
|
|
|
|
+import { formatTimestamp } from '~/utils/time';
|
|
let dyaw_xlfw_zxhd = $ref<type_dyaw_xlfw_zxhd | undefined>()
|
|
let dyaw_xlfw_zxhd = $ref<type_dyaw_xlfw_zxhd | undefined>()
|
|
let dyaw_xlfw_zxhd_list = $ref<type_dyaw_xlfw_zxhd[] | undefined>()
|
|
let dyaw_xlfw_zxhd_list = $ref<type_dyaw_xlfw_zxhd[] | undefined>()
|
|
|
|
|
|
@@ -23,12 +24,28 @@ let timer: NodeJS.Timeout;
|
|
})();
|
|
})();
|
|
|
|
|
|
const searchValue = $ref('')
|
|
const searchValue = $ref('')
|
|
|
|
+watch(
|
|
|
|
+ () => searchValue,
|
|
|
|
+ async () => {
|
|
|
|
+ dyaw_xlfw_zxhd_list = (await request({
|
|
|
|
+ url: '/dyaw/xlfw_zxhd/index',
|
|
|
|
+ data: {
|
|
|
|
+ dxz_tea_user_id: user.user_id,
|
|
|
|
+ dxz_stu_user_realname: searchValue,
|
|
|
|
+ limit: 20,
|
|
|
|
+ }
|
|
|
|
+ })).data.page_data
|
|
|
|
+ }
|
|
|
|
+)
|
|
|
|
|
|
let infoList = $ref<Array<type_dyaw_xlfw_zxhd_log>>([])
|
|
let infoList = $ref<Array<type_dyaw_xlfw_zxhd_log>>([])
|
|
let inputValue = $ref('')
|
|
let inputValue = $ref('')
|
|
|
|
+let isSending = $ref(false)
|
|
let TinyRef = $ref<typeof import('~/components/tinymce-area/index.vue')['default']>()
|
|
let TinyRef = $ref<typeof import('~/components/tinymce-area/index.vue')['default']>()
|
|
async function handleClickSend() {
|
|
async function handleClickSend() {
|
|
if (!dyaw_xlfw_zxhd) return;
|
|
if (!dyaw_xlfw_zxhd) return;
|
|
|
|
+ if (isSending) return;
|
|
|
|
+ isSending = true
|
|
const reqDate = {
|
|
const reqDate = {
|
|
dxz_id: dyaw_xlfw_zxhd.dxz_id,
|
|
dxz_id: dyaw_xlfw_zxhd.dxz_id,
|
|
dxzl_stu_user_id: dyaw_xlfw_zxhd.dxz_stu_user_id,
|
|
dxzl_stu_user_id: dyaw_xlfw_zxhd.dxz_stu_user_id,
|
|
@@ -39,12 +56,12 @@ async function handleClickSend() {
|
|
dxzl_type: inputValue.includes('><img') ? '2' : '1'
|
|
dxzl_type: inputValue.includes('><img') ? '2' : '1'
|
|
}
|
|
}
|
|
|
|
|
|
- infoList.push({
|
|
|
|
- create_user_id: user.user_id,
|
|
|
|
- create_dateline: Date.now().toString().slice(0, 10),
|
|
|
|
|
|
+ // infoList.push({
|
|
|
|
+ // create_user_id: user.user_id,
|
|
|
|
+ // create_dateline: Date.now().toString().slice(0, 10),
|
|
|
|
|
|
- ...reqDate
|
|
|
|
- })
|
|
|
|
|
|
+ // ...reqDate
|
|
|
|
+ // })
|
|
TinyRef?.clear()
|
|
TinyRef?.clear()
|
|
// console.log('inputValue :>> ', inputValue);
|
|
// console.log('inputValue :>> ', inputValue);
|
|
request({
|
|
request({
|
|
@@ -54,19 +71,24 @@ async function handleClickSend() {
|
|
}
|
|
}
|
|
}).then(res => {
|
|
}).then(res => {
|
|
if (res.code === '1') {
|
|
if (res.code === '1') {
|
|
- socketSend(ws!, {
|
|
|
|
|
|
+ const fullSendData = {
|
|
create_user_id: user.user_id,
|
|
create_user_id: user.user_id,
|
|
create_dateline: Date.now().toString().slice(0, 10),
|
|
create_dateline: Date.now().toString().slice(0, 10),
|
|
- ...reqDate
|
|
|
|
- })
|
|
|
|
|
|
+ ...reqDate,
|
|
|
|
+ dxzl_id: `${res.data.insert_id}`
|
|
|
|
+ }
|
|
|
|
+ infoList.push(fullSendData)
|
|
|
|
+ socketSend(ws!, fullSendData)
|
|
|
|
+ isSending = false
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
let ws = $ref<WebSocket>()
|
|
let ws = $ref<WebSocket>()
|
|
|
|
|
|
-
|
|
|
|
|
|
+let cardLoading = $ref(false)
|
|
function handleClickStuCard(stu: type_dyaw_xlfw_zxhd) {
|
|
function handleClickStuCard(stu: type_dyaw_xlfw_zxhd) {
|
|
|
|
+ cardLoading = true
|
|
dyaw_xlfw_zxhd = stu
|
|
dyaw_xlfw_zxhd = stu
|
|
stu.dxz_unread_msg_num = "0"
|
|
stu.dxz_unread_msg_num = "0"
|
|
ws?.close()
|
|
ws?.close()
|
|
@@ -79,6 +101,7 @@ function handleClickStuCard(stu: type_dyaw_xlfw_zxhd) {
|
|
}).then(res => {
|
|
}).then(res => {
|
|
if (res.code === '1') {
|
|
if (res.code === '1') {
|
|
infoList = res.data.page_data.reverse()
|
|
infoList = res.data.page_data.reverse()
|
|
|
|
+ cardLoading = false
|
|
ws = createSocket(
|
|
ws = createSocket(
|
|
{ teacher: user.user_id, student: stu.dxz_stu_user_id },
|
|
{ teacher: user.user_id, student: stu.dxz_stu_user_id },
|
|
{
|
|
{
|
|
@@ -89,9 +112,28 @@ function handleClickStuCard(stu: type_dyaw_xlfw_zxhd) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
)
|
|
)
|
|
|
|
+
|
|
|
|
+ handleQueryArchives()
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+}
|
|
|
|
|
|
|
|
+let ifScroll = $ref(true)
|
|
|
|
+function handleLoadMoreInfo() {
|
|
|
|
+ request({
|
|
|
|
+ url: '/dyaw/xlfw_zxhd_log/index',
|
|
|
|
+ data: {
|
|
|
|
+ dxzl_stu_user_id: dyaw_xlfw_zxhd?.dxz_stu_user_id,
|
|
|
|
+ dxzl_tea_user_id: user.user_id,
|
|
|
|
+ zxhd_log_id: infoList[0].dxzl_id
|
|
|
|
+ }
|
|
|
|
+ }).then(res => {
|
|
|
|
+ if (res.code === '1') {
|
|
|
|
+ ifScroll = false
|
|
|
|
+ if (res.data.page_data.length === 0) return ElMessage.info('暂无更多消息');
|
|
|
|
+ infoList.unshift(...res.data.page_data.reverse())
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
const scrollbarRef = $ref<HTMLElement>()
|
|
const scrollbarRef = $ref<HTMLElement>()
|
|
@@ -104,7 +146,8 @@ watch(
|
|
() => (infoList),
|
|
() => (infoList),
|
|
() => {
|
|
() => {
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
- scrollToBottom()
|
|
|
|
|
|
+ ifScroll && scrollToBottom();
|
|
|
|
+ ifScroll = true
|
|
})
|
|
})
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -116,14 +159,52 @@ watch(
|
|
onBeforeUnmount(() => {
|
|
onBeforeUnmount(() => {
|
|
clearInterval(timer)
|
|
clearInterval(timer)
|
|
})
|
|
})
|
|
|
|
+
|
|
|
|
+const ArchivesCardRef = $ref<typeof import('~/components/archives-card/index.vue')['default']>()
|
|
|
|
+function handleSubmitArchives() {
|
|
|
|
+ ElMessageBox.confirm('一次咨询只能提交一次档案,请确认完毕后点击提交', '提示')
|
|
|
|
+ .then(() => {
|
|
|
|
+ request({
|
|
|
|
+ url: '/dyaw/xlfw_xsda_dajl/add',
|
|
|
|
+ data: {
|
|
|
|
+ dyaw_xlfw_xsda_dajl: ArchivesCardRef!.form
|
|
|
|
+ }
|
|
|
|
+ }).then(res => {
|
|
|
|
+ if (res.code === '1') {
|
|
|
|
+
|
|
|
|
+ handleQueryArchives()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ ElMessage({
|
|
|
|
+ type: 'info',
|
|
|
|
+ message: '取消提交',
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+let archivesList = $ref<type_archives_item[]>([])
|
|
|
|
+function handleQueryArchives() {
|
|
|
|
+ request({
|
|
|
|
+ url: '/dyaw/xlfw_xsda_dajl/index',
|
|
|
|
+ data: {
|
|
|
|
+ user_id: dyaw_xlfw_zxhd!.dxz_stu_user_id
|
|
|
|
+ }
|
|
|
|
+ }).then(res => {
|
|
|
|
+ if (res.code === '1') {
|
|
|
|
+ archivesList = res.data.page_data
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
<div class="h-640px bg-hex-f2f2f295 flex justify-center divide-x">
|
|
<div class="h-640px bg-hex-f2f2f295 flex justify-center divide-x">
|
|
- <div class="w-320px p-10px h-full flex flex-col justify-between bg-white">
|
|
|
|
- <el-input v-model="searchValue" size="large" :prefix-icon="Search"></el-input>
|
|
|
|
|
|
+ <div class="w-320px p-10px h-full flex flex-col justify-start bg-white space-y-4">
|
|
|
|
+ <el-input v-model="searchValue" size="large" :prefix-icon="Search" clearable></el-input>
|
|
<div
|
|
<div
|
|
- class="h-580px flex flex-col divide scrollbar scrollbar-thin scrollbar-thumb-rounded-md scrollbar-thumb-gray-200 scrollbar-track-transparent">
|
|
|
|
|
|
+ class="max-h-520px flex flex-col flex-none divide-y scrollbar scrollbar-thin scrollbar-thumb-rounded-md scrollbar-thumb-gray-200 scrollbar-track-transparent">
|
|
<chat-stu-card v-for="item in dyaw_xlfw_zxhd_list" :d="item" @click="handleClickStuCard(item)"
|
|
<chat-stu-card v-for="item in dyaw_xlfw_zxhd_list" :d="item" @click="handleClickStuCard(item)"
|
|
class="h-68px"></chat-stu-card>
|
|
class="h-68px"></chat-stu-card>
|
|
</div>
|
|
</div>
|
|
@@ -135,8 +216,12 @@ onBeforeUnmount(() => {
|
|
{{ dyaw_xlfw_zxhd.dxz_stu_school_name }} {{ dyaw_xlfw_zxhd.dxz_class_name }}</span>
|
|
{{ dyaw_xlfw_zxhd.dxz_stu_school_name }} {{ dyaw_xlfw_zxhd.dxz_class_name }}</span>
|
|
</div>
|
|
</div>
|
|
<div ref="scrollbarRef"
|
|
<div ref="scrollbarRef"
|
|
- class="bg-hex-fff8fb space-y-2 h-410px p-6 scrollbar scrollbar-thin scrollbar-thumb-rounded-md scrollbar-thumb-gray-200 scrollbar-track-transparent">
|
|
|
|
- <info-item v-for="item in infoList" :left="item.create_user_id === user.user_id" :d="item"></info-item>
|
|
|
|
|
|
+ class="bg-hex-fff8fb space-y-2 h-410px py-2 px-6 scrollbar scrollbar-thin scrollbar-thumb-rounded-md scrollbar-thumb-gray-200 scrollbar-track-transparent">
|
|
|
|
+ <div v-show="!cardLoading" @click="handleLoadMoreInfo"
|
|
|
|
+ class="w-full text-center text-sm text-blue-400 hover:underline underline-blue-400 cursor-pointer">查看更多
|
|
|
|
+ </div>
|
|
|
|
+ <info-item v-for="item in infoList" :key="item.dxzl_id" :left="item.create_user_id === user.user_id"
|
|
|
|
+ :d="item"></info-item>
|
|
</div>
|
|
</div>
|
|
<div class="bg-white h-180px p-5px flex flex-col justify-between">
|
|
<div class="bg-white h-180px p-5px flex flex-col justify-between">
|
|
<tinymce-area v-model="inputValue" ref="TinyRef"></tinymce-area>
|
|
<tinymce-area v-model="inputValue" ref="TinyRef"></tinymce-area>
|
|
@@ -155,11 +240,23 @@ onBeforeUnmount(() => {
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div
|
|
<div
|
|
- class="w-400px h-full bg-white overflow-y-auto flex flex-col items-center px-30px py-4 divide-y scrollbar scrollbar-thin scrollbar-thumb-rounded-md scrollbar-thumb-gray-200 scrollbar-track-transparent">
|
|
|
|
- <div class="w-full"></div>
|
|
|
|
- <div>
|
|
|
|
-
|
|
|
|
|
|
+ class="w-400px h-full bg-white overflow-y-auto flex flex-col items-center px-2 py-2 divide-y scrollbar scrollbar-thin scrollbar-thumb-rounded-md scrollbar-thumb-gray-200 scrollbar-track-transparent">
|
|
|
|
+ <div v-if="dyaw_xlfw_zxhd" :key="dyaw_xlfw_zxhd.dxz_stu_user_id">
|
|
|
|
+ <div class="w-full"
|
|
|
|
+ v-if="archivesList && (archivesList.length === 0 || dyaw_xlfw_zxhd.dxz_id !== archivesList[0].dxz_id)">
|
|
|
|
+ <archives-card ref="ArchivesCardRef"
|
|
|
|
+ :d="{ dxz_id: dyaw_xlfw_zxhd.dxz_id, user_id: dyaw_xlfw_zxhd.dxz_stu_user_id, dxxd_lfzxm: dyaw_xlfw_zxhd.dxz_stu_user_realname, dxxd_jfls: dyaw_xlfw_zxhd.dxz_tea_user_realname, dxxd_school_name: dyaw_xlfw_zxhd.dxz_stu_school_name, dxxd_class_name: dyaw_xlfw_zxhd.dxz_class_name, dxxd_date: formatTimestamp(dyaw_xlfw_zxhd.create_dateline) }"></archives-card>
|
|
|
|
+ <div class="flex_center py-2">
|
|
|
|
+ <el-button @click="handleSubmitArchives" type="primary" size="small">提交</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="bg-hex-FFF7FA py-2">
|
|
|
|
+ <div class="flex_center text-lg">历史档案</div>
|
|
|
|
+ <el-empty v-show="archivesList.length === 0" :image-size="60" description="暂无历史档案" ></el-empty>
|
|
|
|
+ <archives-card disabled v-for="item in archivesList" :d="item" :key="item.dxz_id"></archives-card>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|