|
@@ -3,7 +3,9 @@ import request from '~/utils/request';
|
|
|
// import { getFullUrl } from '~/utils/helper';
|
|
|
// import CommonHeader from "@/components/CommonHeader/index.vue";;
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
-
|
|
|
+import { ArrowLeft, ArrowRight } from '@element-plus/icons-vue';
|
|
|
+import { user } from '~/store/user';
|
|
|
+// import socket from 'socket.io';
|
|
|
const props = defineProps({
|
|
|
id: String
|
|
|
})
|
|
@@ -29,6 +31,7 @@ request({
|
|
|
|
|
|
let data_zy = $ref([])
|
|
|
let page = $ref(1)
|
|
|
+let tPage = 0
|
|
|
function queryZy() {
|
|
|
request({
|
|
|
url: '/yzy/zy_ssys_dtjl/index',
|
|
@@ -39,9 +42,66 @@ function queryZy() {
|
|
|
}).then(res => {
|
|
|
if (res.code === '1') {
|
|
|
data_zy = res.data.page_data
|
|
|
+ tPage = res.data.total_page
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+queryZy()
|
|
|
+
|
|
|
+function prevPage() {
|
|
|
+ if (page > 1) {
|
|
|
+ page--;
|
|
|
+ queryZy()
|
|
|
+ }
|
|
|
+}
|
|
|
+function nextPage() {
|
|
|
+ if (page < tPage) {
|
|
|
+ page++;
|
|
|
+ queryZy()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+let dialogVisible = $ref(false)
|
|
|
+
|
|
|
+const ws = new WebSocket("wss://socket.bozedu.net/")
|
|
|
+
|
|
|
+ws.addEventListener('message', (e) => {
|
|
|
+ console.log('message :>> ', e);
|
|
|
+ if (e.message) {
|
|
|
+ try {
|
|
|
+ const data = JSON.parse(e.message)
|
|
|
+ if (data.type === 'say' && data.content === 'refresh_work') {
|
|
|
+ console.log('refresh_work :>> ');
|
|
|
+ queryZy()
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+})
|
|
|
+
|
|
|
+ws.addEventListener('error', (err) => {
|
|
|
+ console.error('ws error :>> ', err);
|
|
|
+})
|
|
|
+
|
|
|
+ws.addEventListener('open', (e) => {
|
|
|
+ ws.send(JSON.stringify({
|
|
|
+ "type": "login",
|
|
|
+ "client_id": user.user_id,
|
|
|
+ "client_name": user.user_id,
|
|
|
+ "room_id": props.id
|
|
|
+ }))
|
|
|
+
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ ws.close()
|
|
|
+})
|
|
|
|
|
|
</script>
|
|
|
|
|
@@ -76,22 +136,30 @@ function queryZy() {
|
|
|
</div>
|
|
|
|
|
|
<div class="w-full flex justify-between items-center">
|
|
|
- <el-button type="primary" :icon="ArrowLeft" circle size="large" />
|
|
|
+ <el-button type="primary" :icon="ArrowLeft" circle size="large" @click="prevPage" />
|
|
|
|
|
|
- <div class="flex-auto flex justify-start items-center">
|
|
|
- <div class="w-19/100 mx-4 flex flex-col cursor-pointer" v-for="i in data_zy">
|
|
|
- <div class="w-full flex-none overflow-hidden rounded-xl">
|
|
|
- <file-preview :url="i.yzsd_file" alt="" class="w-full h-full" />
|
|
|
+ <div class="flex-auto flex justify-start items-center h-200px">
|
|
|
+ <template v-if="data_zy.length">
|
|
|
+ <div class="w-19/100 h-full mx-4 flex flex-col cursor-pointer" v-for="i in data_zy">
|
|
|
+ <div class="w-full flex-none overflow-hidden rounded-xl">
|
|
|
+ <file-preview :url="i.yzsd_file" alt="" class="w-full h-full" @click="dialogVisible=true" />
|
|
|
+ </div>
|
|
|
+ <div class="p-2">
|
|
|
+ {{ i.yzsd_xsxm }}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div class="p-2">
|
|
|
- {{ i.yzsd_xsxm }}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ </template>
|
|
|
+ <el-empty class="w-full" v-else></el-empty>
|
|
|
</div>
|
|
|
|
|
|
- <el-button type="primary" :icon="ArrowRight" circle size="large" />
|
|
|
+ <el-button type="primary" :icon="ArrowRight" circle size="large" @click="nextPage" />
|
|
|
</div>
|
|
|
|
|
|
+ <el-dialog v-model="dialogVisible">
|
|
|
+ <file-preview :url="dialogData.yzsd_file" alt="" class="w-full h-full" @click="dialogVisible=true" />
|
|
|
+
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|