|
@@ -1,94 +1,47 @@
|
|
|
-<script setup lang="ts">
|
|
|
+<script setup lang='ts'>
|
|
|
import type { type_dyaw_xlfw_zxhd, type_dyaw_xlfw_zxhd_log, type_archives_item } from '~/types';
|
|
|
-import { Search } from '@element-plus/icons-vue'
|
|
|
import user from '~/store/user';
|
|
|
-import router from '@/router';
|
|
|
-let dyaw_xlfw_zxhd = $ref<type_dyaw_xlfw_zxhd | undefined>()
|
|
|
-let dyaw_xlfw_zxhd_list = $ref<type_dyaw_xlfw_zxhd[] | undefined>()
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-const searchValue = $ref('搜索')
|
|
|
-watch(
|
|
|
- () => searchValue,
|
|
|
- async (val, oldVal) => {
|
|
|
- if (oldVal === '搜索') return;
|
|
|
- dyaw_xlfw_zxhd_list = (await request({
|
|
|
- url: '/dyaw/xlfw_zxhd/index',
|
|
|
- data: {
|
|
|
- dxz_tea_user_id: user.user_id,
|
|
|
- dxz_stu_user_realname: searchValue === '搜索' ? undefined : searchValue,
|
|
|
- limit: 20,
|
|
|
- last_msg: 1
|
|
|
+import type { TSocketRes } from '~/utils/ws';
|
|
|
+import { type } from 'os';
|
|
|
+// ==========
|
|
|
+// chat audio/video
|
|
|
+// ==========
|
|
|
+
|
|
|
+let RtcDialogRef = $ref<typeof import("~/components/rtc-dialog/index.vue")['default']>()
|
|
|
+
|
|
|
+const ws2 = createSocket(
|
|
|
+ { teacher: user.user_id, student: '*' },
|
|
|
+ {
|
|
|
+ message(socketRes: TSocketRes<type_dyaw_xlfw_zxhd_log & { operate: CHAT_OPERATION }>) {
|
|
|
+ if (socketRes.from_client_name.endsWith('student')) {
|
|
|
+ // infoList.push(socketRes.content)
|
|
|
+ if (socketRes.content.dxzl_tea_user_id === user.user_id) {
|
|
|
+ console.log('RtcDialogRef : ', RtcDialogRef)
|
|
|
+ RtcDialogRef!.publisher(socketRes.content)
|
|
|
+ }
|
|
|
}
|
|
|
- })).data.page_data
|
|
|
+ }
|
|
|
}
|
|
|
)
|
|
|
+onMounted(() => {
|
|
|
+ RtcDialogRef!.init(ws2)
|
|
|
+})
|
|
|
|
|
|
-
|
|
|
-// let timer: NodeJS.Timeout;
|
|
|
-// (async function loop() {
|
|
|
-// dyaw_xlfw_zxhd_list = (await request({
|
|
|
-// url: '/dyaw/xlfw_zxhd/index',
|
|
|
-// data: {
|
|
|
-// dxz_tea_user_id: user.user_id,
|
|
|
-// dxz_stu_user_realname: searchValue === '搜索' ? undefined : searchValue,
|
|
|
-// limit: 20,
|
|
|
-// last_msg: 1
|
|
|
-// }
|
|
|
-// })).data.page_data
|
|
|
-// if (dyaw_xlfw_zxhd !== undefined) {
|
|
|
-// const temp = dyaw_xlfw_zxhd_list!.find(item => item.dxz_stu_user_id === dyaw_xlfw_zxhd!.dxz_stu_user_id)
|
|
|
-// if (temp?.dxz_id !== dyaw_xlfw_zxhd?.dxz_id) {
|
|
|
-// dyaw_xlfw_zxhd = temp
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// timer = setTimeout(async () => {
|
|
|
-// await loop();
|
|
|
-// }, 60 * 1000);
|
|
|
-// })();
|
|
|
-
|
|
|
-function handleClickStuCard(stu: type_dyaw_xlfw_zxhd) {
|
|
|
- sessionStorage.setItem('dyaw_xlfw_zxhd', JSON.stringify(stu))
|
|
|
- router.push({
|
|
|
- name: 'teacher_consult_chat',
|
|
|
- })
|
|
|
+function openRtcDialog(dyaw_xlfw_zxhd: type_dyaw_xlfw_zxhd, type: 'audio' | 'video') {
|
|
|
+ RtcDialogRef!.open(dyaw_xlfw_zxhd, type)
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-// onBeforeUnmount(() => {
|
|
|
-// clearInterval(timer)
|
|
|
-// })
|
|
|
|
|
|
-function onClickLeft() {
|
|
|
- router.back()
|
|
|
-}
|
|
|
|
|
|
+const updateFnList = $ref<Function[]>([])
|
|
|
+function emitUpdateInfo(info: type_dyaw_xlfw_zxhd_log, isUpdate?: boolean) {
|
|
|
+ updateFnList.forEach(fn => fn(info, isUpdate))
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <van-nav-bar title="咨询页面" left-text="" left-arrow @click-left="onClickLeft"
|
|
|
- style="--van-nav-bar-background:#397FF6;--van-nav-bar-icon-color:#fff;--van-nav-bar-title-text-color:#fff;--van-nav-bar-title-font-size:18px;--van-nav-bar-text-color:#fff;" />
|
|
|
- <div class="p-10px flex-auto flex flex-col justify-start bg-white space-y-4">
|
|
|
- <el-input autocomplete="off" name="searchValue" v-model="searchValue" size="large" :prefix-icon="Search"
|
|
|
- @focus="searchValue = ''" clearable placeholder="搜索"
|
|
|
- :style="`${searchValue === '搜索' && '--ep-input-text-color:var(--ep-text-color-placeholder);'}`"></el-input>
|
|
|
-
|
|
|
- <remote-list url="/dyaw/xlfw_zxhd/index" loop :d="{
|
|
|
- dxz_tea_user_id: user.user_id,
|
|
|
- dxz_stu_user_realname: searchValue === '搜索' ? undefined : searchValue,
|
|
|
- limit: 20,
|
|
|
- last_msg: 1
|
|
|
- }" class="mt-2 flex-auto">
|
|
|
- <template #default="{ row: item }">
|
|
|
- <chat-stu-card :d="item" @click="handleClickStuCard(item)" class="h-68px"
|
|
|
- style="border-bottom: 1px solid #f3f4f6;"></chat-stu-card>
|
|
|
- </template>
|
|
|
- </remote-list>
|
|
|
- </div>
|
|
|
+ <RouterView @openRtcDialog="openRtcDialog" :update-fn-list="updateFnList"></RouterView>
|
|
|
+ <rtc-dialog ref="RtcDialogRef" @update-info="emitUpdateInfo"></rtc-dialog>
|
|
|
</template>
|
|
|
-
|
|
|
-<style scoped lang="scss">
|
|
|
-</style>
|