|
@@ -4,6 +4,7 @@
|
|
|
title="系统公告"
|
|
|
v-model="value"
|
|
|
width="460px"
|
|
|
+ :align-center="true"
|
|
|
:before-close="handleClose"
|
|
|
>
|
|
|
<div class="title">
|
|
@@ -18,7 +19,7 @@
|
|
|
</div>
|
|
|
<template #footer>
|
|
|
<span class="dialog-footer">
|
|
|
- <el-button
|
|
|
+ <!-- <el-button
|
|
|
size="small"
|
|
|
@click="index--"
|
|
|
:disabled="data.length < 2 || index == 0"
|
|
@@ -29,7 +30,7 @@
|
|
|
@click="index++"
|
|
|
:disabled="data.length == index + 1"
|
|
|
>下一条</el-button
|
|
|
- >
|
|
|
+ > -->
|
|
|
<!-- <el-button
|
|
|
type="primary"
|
|
|
size="small"
|
|
@@ -81,7 +82,7 @@ import { ElMessageBox, ElNotification } from 'element-plus'
|
|
|
import {
|
|
|
getToken
|
|
|
} from '@/utils/auth'
|
|
|
-
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
defineProps({
|
|
|
modelValue: {
|
|
|
type: Object,
|
|
@@ -115,14 +116,9 @@ let noticeData = ref([
|
|
|
// address: '上海市普陀区金沙江路 1516 弄',
|
|
|
// },
|
|
|
])
|
|
|
-const index = ref(1)
|
|
|
-const data = ref([
|
|
|
- { title: '11', content: '11' },
|
|
|
- { title: '22', content: '22' },
|
|
|
- { title: '33', content: '33' },
|
|
|
- { title: '44', content: '44' },
|
|
|
-])
|
|
|
-const value = ref(false)
|
|
|
+let index = ref(0)
|
|
|
+let data = ref([])
|
|
|
+let value = ref(false)
|
|
|
const moreFn = () => {
|
|
|
noticeTableModal.value = true
|
|
|
}
|
|
@@ -130,10 +126,16 @@ const moreFn = () => {
|
|
|
const confirm = () => {
|
|
|
value.value = false
|
|
|
}
|
|
|
+// proxy.post('sendMeg/page',{
|
|
|
+// pageNum:1,
|
|
|
+// pageSize:30,
|
|
|
+// }).then(res=>{
|
|
|
+// data.value = res.rows
|
|
|
+// })
|
|
|
|
|
|
const socketInit = () => {
|
|
|
window.ws = new WebSocket(
|
|
|
- 'ws://36.134.91.96:9898/test-api/webStock/' +
|
|
|
+ 'ws://'+ import.meta.env.VITE_APP_IP +':9898/test-api/webStock/' +
|
|
|
getToken()
|
|
|
// 'ws://192.168.1.97:8300/webStock/' + window.localStorage.getItem('token')
|
|
|
)
|
|
@@ -144,14 +146,12 @@ const socketInit = () => {
|
|
|
}
|
|
|
window.ws.onmessage = function (e) {
|
|
|
//当客户端收到服务端发来的消息时,触发onmessage事件,参数e.data包含server传递过来的数据
|
|
|
-
|
|
|
- var msg = JSON.parse(e.data)
|
|
|
- console.log(msg)
|
|
|
- //系统消息
|
|
|
- if (msg.data.type == 1) {
|
|
|
- data.value = msg.data
|
|
|
- value.value = true
|
|
|
- }
|
|
|
+ //在data.value前面插入
|
|
|
+ console.log(JSON.parse(e.data).data)
|
|
|
+ data.value.unshift({title:"最新公告",content:JSON.parse(e.data).data})
|
|
|
+ index.value = 0
|
|
|
+ value.value = true
|
|
|
+
|
|
|
|
|
|
}
|
|
|
window.ws.onclose = function (e) {
|