2022-06-08 14:51:11 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="messageBox">
|
|
|
|
|
|
<!-- <div @click="send" style="line-height: 60px;">发送消息</div> -->
|
2023-03-24 18:07:01 +08:00
|
|
|
|
<el-popover v-if="showQrCode" placement="bottom" class="header-btn" width="200" trigger="click">
|
|
|
|
|
|
<div id="qrCode" ref="qrCodeDiv"></div>
|
2024-10-26 17:09:33 +08:00
|
|
|
|
<el-button class="btn" slot="reference">
|
|
|
|
|
|
车辆录入二维码
|
|
|
|
|
|
<i class="el-icon-arrow-down"></i>
|
|
|
|
|
|
</el-button>
|
2023-03-24 18:07:01 +08:00
|
|
|
|
</el-popover>
|
2024-10-26 17:09:33 +08:00
|
|
|
|
<p
|
|
|
|
|
|
class="header-btn"
|
|
|
|
|
|
@click="goMsgCenter"
|
|
|
|
|
|
@mouseover="showDialog = true"
|
|
|
|
|
|
@mouseleave="showDialog = false"
|
|
|
|
|
|
>
|
2022-06-08 14:51:11 +08:00
|
|
|
|
<i class="el-icon-message-solid"></i> 消息
|
|
|
|
|
|
</p>
|
2024-10-26 17:09:33 +08:00
|
|
|
|
<i class="redDot" v-show="newsStatus"></i>
|
2022-06-08 14:51:11 +08:00
|
|
|
|
<div
|
|
|
|
|
|
class="messageList whiteBlock"
|
|
|
|
|
|
v-show="showDialog && messageList.length > 0"
|
|
|
|
|
|
@mouseover="showDialog = true"
|
|
|
|
|
|
@mouseleave="showDialog = false"
|
|
|
|
|
|
>
|
|
|
|
|
|
<ul>
|
|
|
|
|
|
<li v-for="item in messageList" :key="item.id">{{ item.title }}</li>
|
|
|
|
|
|
<li class="last" @click="goMsgCenter">查看所有 >></li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- <span @click="sendmes">发送消息</span> -->
|
2024-10-26 17:09:33 +08:00
|
|
|
|
<el-dialog
|
|
|
|
|
|
:title="dialogTitle"
|
|
|
|
|
|
:modal-append-to-body="false"
|
|
|
|
|
|
:visible.sync="messsageCenterDialog"
|
|
|
|
|
|
width="80%"
|
|
|
|
|
|
class="dialog-wrap"
|
|
|
|
|
|
>
|
2024-07-24 17:28:28 +08:00
|
|
|
|
<div style="height: 738px">
|
2022-06-08 14:51:11 +08:00
|
|
|
|
<messageCenter></messageCenter>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2024-10-26 17:09:33 +08:00
|
|
|
|
import { getNoticeListApi } from "@/assets/js/api/company/project";
|
|
|
|
|
|
import messageCenter from "./../views/messageV2.vue";
|
|
|
|
|
|
import mqtt from "mqtt";
|
|
|
|
|
|
import mqttX from "xhl-mqttx";
|
|
|
|
|
|
import QRCode from "qrcodejs2";
|
|
|
|
|
|
import axios from "axios";
|
2022-06-08 14:51:11 +08:00
|
|
|
|
const options = {
|
|
|
|
|
|
connectTimeout: 40000,
|
|
|
|
|
|
clientId:
|
2024-10-26 17:09:33 +08:00
|
|
|
|
"mqttjs_" +
|
2022-06-08 14:51:11 +08:00
|
|
|
|
Math.random()
|
|
|
|
|
|
.toString(16)
|
|
|
|
|
|
.substr(2, 8),
|
2024-10-26 17:09:33 +08:00
|
|
|
|
username: "root",
|
|
|
|
|
|
password: "123456",
|
2022-06-08 14:51:11 +08:00
|
|
|
|
clean: true
|
2024-10-26 17:09:33 +08:00
|
|
|
|
};
|
|
|
|
|
|
var client = null;
|
|
|
|
|
|
let i = 0;
|
2022-06-08 14:51:11 +08:00
|
|
|
|
// var client = mqtt.connect("mqtt://139.159.226.224:1883", options);
|
|
|
|
|
|
export default {
|
2023-03-24 18:07:01 +08:00
|
|
|
|
components: {
|
2022-06-08 14:51:11 +08:00
|
|
|
|
messageCenter
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2023-03-24 18:07:01 +08:00
|
|
|
|
showQrCode: false,
|
2024-10-26 17:09:33 +08:00
|
|
|
|
showUrl: "",
|
2022-06-08 14:51:11 +08:00
|
|
|
|
messsageCenterDialog: false,
|
2024-10-26 17:09:33 +08:00
|
|
|
|
dialogTitle: "消息中心",
|
2022-06-08 14:51:11 +08:00
|
|
|
|
messageList: [],
|
|
|
|
|
|
showDialog: false,
|
2024-10-26 17:09:33 +08:00
|
|
|
|
userId: "",
|
|
|
|
|
|
topicName: "topic",
|
|
|
|
|
|
toDayDate: "",
|
2022-06-08 14:51:11 +08:00
|
|
|
|
soundList: [],
|
2023-03-24 18:07:01 +08:00
|
|
|
|
typeList: [
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "高空火警",
|
|
|
|
|
|
value: "8"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "考勤提醒",
|
|
|
|
|
|
value: "1"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "防疫人员通知",
|
|
|
|
|
|
value: "2"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "防疫车辆通知",
|
|
|
|
|
|
value: "3"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "访客通知",
|
|
|
|
|
|
value: "16"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "混凝土监测",
|
|
|
|
|
|
value: "4"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "卸料平台",
|
|
|
|
|
|
value: "5"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "配电箱",
|
|
|
|
|
|
value: "6"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "扬尘",
|
|
|
|
|
|
value: "7"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "标养室",
|
|
|
|
|
|
value: "9"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "安全检查",
|
|
|
|
|
|
value: "10"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "质量检查",
|
|
|
|
|
|
value: "11"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "塔吊",
|
|
|
|
|
|
value: "12"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "升降机",
|
|
|
|
|
|
value: "13"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "电表",
|
|
|
|
|
|
value: "14"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-10-26 17:09:33 +08:00
|
|
|
|
label: "水表",
|
|
|
|
|
|
value: "15"
|
2023-03-24 18:07:01 +08:00
|
|
|
|
}
|
2024-10-26 17:09:33 +08:00
|
|
|
|
],
|
|
|
|
|
|
// 消息状态
|
|
|
|
|
|
newsStatus: false
|
|
|
|
|
|
};
|
2022-06-08 14:51:11 +08:00
|
|
|
|
},
|
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
|
// console.log(client)
|
2023-03-24 18:07:01 +08:00
|
|
|
|
if (client) {
|
2024-10-26 17:09:33 +08:00
|
|
|
|
client.unsubscribe(this.topicName + this.userId, options);
|
|
|
|
|
|
client.end();
|
2022-06-08 14:51:11 +08:00
|
|
|
|
}
|
2024-10-26 17:09:33 +08:00
|
|
|
|
client = null;
|
|
|
|
|
|
console.log(client);
|
2022-06-08 14:51:11 +08:00
|
|
|
|
// client = null
|
2023-04-28 18:05:59 +08:00
|
|
|
|
// mqttX.unsubscribe(this.topicName + this.userId);
|
2022-06-08 14:51:11 +08:00
|
|
|
|
},
|
|
|
|
|
|
mounted() {
|
2024-10-26 17:09:33 +08:00
|
|
|
|
this.selectNowDate();
|
|
|
|
|
|
if (localStorage.getItem("soundList")) {
|
|
|
|
|
|
this.soundList = JSON.parse(localStorage.getItem("soundList"));
|
2022-06-08 14:51:11 +08:00
|
|
|
|
}
|
2024-10-26 17:09:33 +08:00
|
|
|
|
if (process.env.NODE_ENV == "development") {
|
|
|
|
|
|
this.userId = this.$store.state.userInfo.userId;
|
|
|
|
|
|
this.topicName = this.$store.state.userInfo.scope;
|
2023-05-13 17:00:19 +08:00
|
|
|
|
// // client = mqtt.connect("ws://182.90.224.147:8083/mqtt", options);
|
2024-10-26 17:09:33 +08:00
|
|
|
|
client = mqtt.connect(mqttUrl, options);
|
|
|
|
|
|
this.getData();
|
|
|
|
|
|
this.mqttMSG();
|
|
|
|
|
|
} else if (process.env.NODE_ENV == "debug") {
|
|
|
|
|
|
} else if (process.env.NODE_ENV == "production") {
|
|
|
|
|
|
this.userId = this.$store.state.userInfo.userId;
|
|
|
|
|
|
this.topicName = this.$store.state.userInfo.scope;
|
2023-05-13 17:00:19 +08:00
|
|
|
|
// client = mqtt.connect("ws://182.90.224.147:8083/mqtt", options);
|
2024-10-26 17:09:33 +08:00
|
|
|
|
client = mqtt.connect(mqttUrl, options);
|
|
|
|
|
|
this.getData();
|
|
|
|
|
|
this.mqttMSG();
|
2022-06-08 14:51:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-04-28 18:05:59 +08:00
|
|
|
|
watch: {
|
|
|
|
|
|
$route: {
|
|
|
|
|
|
handler(newVal) {
|
2024-10-26 17:09:33 +08:00
|
|
|
|
if (newVal.path == "/project/quality/makeAnAppointment") {
|
2023-04-28 18:05:59 +08:00
|
|
|
|
this.showQrCode = true;
|
|
|
|
|
|
this.bindQRCode();
|
2024-10-26 17:09:33 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.showQrCode = false;
|
2023-04-28 18:05:59 +08:00
|
|
|
|
}
|
2024-10-26 17:09:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-04-28 18:05:59 +08:00
|
|
|
|
},
|
2022-06-08 14:51:11 +08:00
|
|
|
|
methods: {
|
2023-03-24 18:07:01 +08:00
|
|
|
|
//生成车辆录入二维码
|
|
|
|
|
|
bindQRCode: function() {
|
2024-10-26 17:09:33 +08:00
|
|
|
|
document.getElementById("qrCode").innerHTML = "";
|
|
|
|
|
|
let httpUrl = window.location.origin;
|
|
|
|
|
|
let projectSn = this.$store.state.projectSn;
|
|
|
|
|
|
let baseUrl = axios.defaults.baseURL;
|
|
|
|
|
|
let newBaseUrl = baseUrl.slice(0, baseUrl.length - 1);
|
2023-03-24 18:07:01 +08:00
|
|
|
|
setTimeout(() => {
|
2023-04-28 18:05:59 +08:00
|
|
|
|
var qrcode = new QRCode(this.$refs.qrCodeDiv, {
|
2024-10-26 17:09:33 +08:00
|
|
|
|
text:
|
|
|
|
|
|
httpUrl +
|
|
|
|
|
|
"/doc/h52/index.html?projectSn=" +
|
|
|
|
|
|
projectSn +
|
|
|
|
|
|
"&baseUrl=" +
|
|
|
|
|
|
newBaseUrl,
|
2023-04-28 18:05:59 +08:00
|
|
|
|
// text:"下午好",
|
|
|
|
|
|
width: 200,
|
|
|
|
|
|
height: 200,
|
2024-10-26 17:09:33 +08:00
|
|
|
|
colorDark: "#333333", //二维码颜色
|
|
|
|
|
|
colorLight: "#ffffff", //二维码背景色
|
2023-04-28 18:05:59 +08:00
|
|
|
|
correctLevel: QRCode.CorrectLevel.L //容错率,L/M/H
|
2024-10-26 17:09:33 +08:00
|
|
|
|
});
|
|
|
|
|
|
}, 0);
|
2023-03-24 18:07:01 +08:00
|
|
|
|
},
|
2022-06-08 14:51:11 +08:00
|
|
|
|
// sendmes(){
|
|
|
|
|
|
// console.log(1)
|
|
|
|
|
|
// this.$emit('sendMsg', {type: 8})
|
|
|
|
|
|
// },
|
|
|
|
|
|
// 获取当前时间 返回YYYY-MM-DD HH:mm:ss
|
2023-03-24 18:07:01 +08:00
|
|
|
|
selectNowDate() {
|
|
|
|
|
|
var date = new Date(),
|
|
|
|
|
|
year = date.getFullYear(),
|
|
|
|
|
|
month = date.getMonth() + 1,
|
|
|
|
|
|
day = date.getDate(),
|
|
|
|
|
|
hours = date.getHours(), //获取当前小时数(0-23)
|
|
|
|
|
|
minutes = date.getMinutes(), //获取当前分钟数(0-59)
|
2024-10-26 17:09:33 +08:00
|
|
|
|
seconds = date.getSeconds();
|
|
|
|
|
|
month >= 1 && month <= 9 ? (month = "0" + month) : "";
|
|
|
|
|
|
day >= 0 && day <= 9 ? (day = "0" + day) : "";
|
|
|
|
|
|
hours >= 0 && hours <= 9 ? (hours = "0" + hours) : "";
|
|
|
|
|
|
minutes >= 0 && minutes <= 9 ? (minutes = "0" + minutes) : "";
|
|
|
|
|
|
seconds >= 0 && seconds <= 9 ? (seconds = "0" + seconds) : "";
|
2023-03-24 18:07:01 +08:00
|
|
|
|
// var timer = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes+ ':' + seconds;
|
2024-10-26 17:09:33 +08:00
|
|
|
|
var timer = year + "-" + month + "-" + day;
|
|
|
|
|
|
this.toDayDate = timer;
|
|
|
|
|
|
console.log(timer);
|
2023-03-24 18:07:01 +08:00
|
|
|
|
// return timer;
|
|
|
|
|
|
},
|
2022-06-08 14:51:11 +08:00
|
|
|
|
// send(){
|
|
|
|
|
|
// this.$emit('sendMsg')
|
|
|
|
|
|
// },
|
|
|
|
|
|
goMsgCenter() {
|
|
|
|
|
|
// this.$router.push('/msgCenter')
|
|
|
|
|
|
// let routeUrl = this.$router.resolve({
|
|
|
|
|
|
// path: "/msgCenter",
|
|
|
|
|
|
// });
|
2023-03-24 18:07:01 +08:00
|
|
|
|
|
2022-06-08 14:51:11 +08:00
|
|
|
|
// window.open(routeUrl.href, "_blank");
|
2024-10-26 17:09:33 +08:00
|
|
|
|
this.messsageCenterDialog = true;
|
|
|
|
|
|
this.getData();
|
2022-06-08 14:51:11 +08:00
|
|
|
|
},
|
|
|
|
|
|
mqttMSG() {
|
2023-03-24 18:07:01 +08:00
|
|
|
|
//
|
|
|
|
|
|
// connectTimeout: 40000,
|
|
|
|
|
|
// clientId:
|
|
|
|
|
|
// "mqttjs_" +
|
|
|
|
|
|
// Math.random()
|
|
|
|
|
|
// .toString(16)
|
|
|
|
|
|
// .substr(2, 8),
|
|
|
|
|
|
// username: "mqttjs_" +
|
|
|
|
|
|
// Math.random()
|
|
|
|
|
|
// .toString(16)
|
|
|
|
|
|
// .substr(2, 8),
|
|
|
|
|
|
// password: "123456",
|
|
|
|
|
|
// clean: true
|
2024-10-26 17:09:33 +08:00
|
|
|
|
console.log("mqtt");
|
2023-03-24 18:07:01 +08:00
|
|
|
|
// let _this = this
|
|
|
|
|
|
// mqttX.init({
|
|
|
|
|
|
// id:"mqttjs_" +
|
|
|
|
|
|
// Math.random()
|
|
|
|
|
|
// .toString(16)
|
|
|
|
|
|
// .substr(2, 8),
|
|
|
|
|
|
// ip: '139.159.226.224',
|
|
|
|
|
|
// port: 8083,
|
|
|
|
|
|
// success:function(){
|
|
|
|
|
|
// console.log("mqttx连接成功",_this.topicName + _this.userId);
|
|
|
|
|
|
// ;
|
|
|
|
|
|
// mqttX.subscribe(_this.topicName + _this.userId,[0]);
|
|
|
|
|
|
// },
|
|
|
|
|
|
// error:function(){
|
|
|
|
|
|
// ;
|
|
|
|
|
|
// console.log("mqttx连接失败");
|
|
|
|
|
|
// },
|
|
|
|
|
|
// connectLost:function(){
|
|
|
|
|
|
// console.log("mqttx连接丢失");
|
|
|
|
|
|
// },
|
|
|
|
|
|
// onMessage:function(message){
|
|
|
|
|
|
// console.log("mqttx",message.payloadString);
|
|
|
|
|
|
// console.log(message);
|
|
|
|
|
|
// // console.log("收到来自", topic, "的消息", message.payloadString.toString());
|
|
|
|
|
|
// message = JSON.parse(message.payloadString);
|
|
|
|
|
|
// // if(message.content){
|
|
|
|
|
|
// // if(message.content.indexOf("火点检测") > -1 || message.content.indexOf("温度报警") > -1){
|
|
|
|
|
|
// // this.$emit('sendMsg')
|
|
|
|
|
|
// // }
|
|
|
|
|
|
// // }
|
|
|
|
|
|
// _this.$emit('sendMsg', message)
|
|
|
|
|
|
// _this.$notify({
|
|
|
|
|
|
// title: message.title,
|
|
|
|
|
|
// message: message.content,
|
|
|
|
|
|
// });
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
2022-06-08 14:51:11 +08:00
|
|
|
|
// mqtt连接 +"/#" +workerId
|
2024-10-26 17:09:33 +08:00
|
|
|
|
client.on("connect", e => {
|
2024-10-30 19:12:04 +08:00
|
|
|
|
console.log('连接成功:', this.topicName + this.userId)
|
2023-04-28 18:05:59 +08:00
|
|
|
|
client.subscribe(this.topicName + this.userId, { qos: 0 }, error => {
|
2022-06-08 14:51:11 +08:00
|
|
|
|
if (!error) {
|
2023-07-06 21:53:07 +08:00
|
|
|
|
// console.log('订阅成功')
|
2022-06-08 14:51:11 +08:00
|
|
|
|
} else {
|
2024-10-26 17:09:33 +08:00
|
|
|
|
console.log("订阅失败");
|
2022-06-08 14:51:11 +08:00
|
|
|
|
}
|
2024-10-26 17:09:33 +08:00
|
|
|
|
});
|
|
|
|
|
|
});
|
2022-06-08 14:51:11 +08:00
|
|
|
|
// 接收消息处理
|
2024-10-26 17:09:33 +08:00
|
|
|
|
client.on("message", (topic, message) => {
|
2022-06-08 14:51:11 +08:00
|
|
|
|
// console.log(message);
|
2024-10-26 17:09:33 +08:00
|
|
|
|
console.log("收到来自", topic, "的消息", message.toString());
|
|
|
|
|
|
message = JSON.parse(message);
|
2022-06-08 14:51:11 +08:00
|
|
|
|
// if(message.content){
|
|
|
|
|
|
// if(message.content.indexOf("火点检测") > -1 || message.content.indexOf("温度报警") > -1){
|
|
|
|
|
|
// this.$emit('sendMsg')
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
2024-10-30 19:12:04 +08:00
|
|
|
|
this.getData()
|
2024-06-13 18:43:12 +08:00
|
|
|
|
setTimeout(() => {
|
2024-10-26 17:09:33 +08:00
|
|
|
|
this.$emit("sendMsg", message);
|
2024-06-13 18:43:12 +08:00
|
|
|
|
this.$notify({
|
|
|
|
|
|
title: message.title,
|
|
|
|
|
|
message: message.content,
|
2024-10-26 17:09:33 +08:00
|
|
|
|
position: "bottom-right"
|
|
|
|
|
|
});
|
|
|
|
|
|
}, 500);
|
|
|
|
|
|
});
|
2022-06-08 14:51:11 +08:00
|
|
|
|
// 断开发起重连
|
|
|
|
|
|
// client.on("reconnect", (error) => {
|
|
|
|
|
|
// console.log("正在重连:", error);
|
|
|
|
|
|
// });
|
|
|
|
|
|
// 链接异常处理
|
2024-10-26 17:09:33 +08:00
|
|
|
|
client.on("error", error => {
|
|
|
|
|
|
console.log("连接失败:", error);
|
|
|
|
|
|
});
|
2022-06-08 14:51:11 +08:00
|
|
|
|
},
|
|
|
|
|
|
getData() {
|
|
|
|
|
|
getNoticeListApi({
|
|
|
|
|
|
accountId: this.userId,
|
|
|
|
|
|
startTime: this.toDayDate,
|
|
|
|
|
|
endTime: this.toDayDate,
|
|
|
|
|
|
pageNo: 1,
|
2023-04-28 18:05:59 +08:00
|
|
|
|
pageSize: 10
|
|
|
|
|
|
}).then(res => {
|
2024-10-26 17:09:33 +08:00
|
|
|
|
// console.log("res.result.records", res.result.records);
|
|
|
|
|
|
this.messageList = res.result.records;
|
|
|
|
|
|
|
|
|
|
|
|
// 判断是否有消息未读
|
|
|
|
|
|
if (res.result.records.length > 0) {
|
|
|
|
|
|
this.newsStatus = res.result.records.some(item => item.isRead !== 1);
|
|
|
|
|
|
|
|
|
|
|
|
// console.log("==========================this.newsStatus=======================", this.newsStatus);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2023-04-28 18:05:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-10-26 17:09:33 +08:00
|
|
|
|
};
|
2022-06-08 14:51:11 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
|
.header-btn {
|
|
|
|
|
|
line-height: 60px;
|
2023-03-24 18:07:01 +08:00
|
|
|
|
.btn {
|
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
}
|
2022-06-08 14:51:11 +08:00
|
|
|
|
}
|
2023-03-24 18:07:01 +08:00
|
|
|
|
.dialog-wrap {
|
|
|
|
|
|
/deep/.el-dialog {
|
2024-07-24 17:28:28 +08:00
|
|
|
|
height: 90%;
|
2022-06-08 14:51:11 +08:00
|
|
|
|
margin: 0 !important;
|
|
|
|
|
|
// position: absolute;
|
2024-07-24 17:28:28 +08:00
|
|
|
|
top: 50%;
|
2022-06-08 14:51:11 +08:00
|
|
|
|
left: 50%;
|
|
|
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.messageBox {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
}
|
|
|
|
|
|
.redDot {
|
|
|
|
|
|
display: block;
|
|
|
|
|
|
width: 6px;
|
|
|
|
|
|
height: 6px;
|
|
|
|
|
|
background-color: #f7b500;
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
right: 30px;
|
|
|
|
|
|
top: 15px;
|
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
box-shadow: 0px 0px 2px 3px rgba(247, 181, 0, 0.5);
|
|
|
|
|
|
}
|
|
|
|
|
|
.messageList {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 60px;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
width: 200px;
|
|
|
|
|
|
// height: 200px;
|
|
|
|
|
|
// border-radius: 3px;
|
|
|
|
|
|
box-shadow: 0 4px 6px 0px #606e9a;
|
|
|
|
|
|
z-index: 2;
|
|
|
|
|
|
background-color: #343d5f;
|
|
|
|
|
|
ul {
|
|
|
|
|
|
margin: 8px 15px;
|
|
|
|
|
|
}
|
|
|
|
|
|
li {
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
// padding: 3px 0px;
|
|
|
|
|
|
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
line-height: 24px;
|
|
|
|
|
|
// &:last-child{
|
|
|
|
|
|
// border-bottom: none;
|
|
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
.last {
|
|
|
|
|
|
margin-top: 8px;
|
|
|
|
|
|
padding-top: 5px;
|
|
|
|
|
|
border-top: 1px solid rgba(255, 255, 255, 0.2);
|
|
|
|
|
|
text-decoration: underline;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
color: @--color-primary;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|