|
@@ -1,18 +1,15 @@
|
|
<template>
|
|
<template>
|
|
<u-navbar :autoBack="false" :placeholder="true" :safeAreaInsetTop="true" :bgColor="proxy.$settingStore.themeColor.color">
|
|
<u-navbar :autoBack="false" :placeholder="true" :safeAreaInsetTop="true" :bgColor="proxy.$settingStore.themeColor.color">
|
|
- <template #left >
|
|
|
|
|
|
+ <template #left>
|
|
<view class="u-navbar__content__left__item">
|
|
<view class="u-navbar__content__left__item">
|
|
- <view class="u-navbar__content__left__item__title" style="color: #fff">
|
|
|
|
- 消息
|
|
|
|
- </view>
|
|
|
|
|
|
+ <view class="u-navbar__content__left__item__title" style="color: #fff"> 消息 </view>
|
|
</view>
|
|
</view>
|
|
<view class="u-navbar__content__left__item topBadge">
|
|
<view class="u-navbar__content__left__item topBadge">
|
|
<u-badge numberType="overflow" max="99" :value="infoList.total || 0"></u-badge>
|
|
<u-badge numberType="overflow" max="99" :value="infoList.total || 0"></u-badge>
|
|
</view>
|
|
</view>
|
|
- <view class="u-navbar__content__left__item" @click="clearMsg" v-if="infoList.total >0">
|
|
|
|
|
|
+ <view class="u-navbar__content__left__item" @click="clearMsg" v-if="infoList.total > 0">
|
|
<image class="image-bg-top" src="/static/images/common/clear.png" />
|
|
<image class="image-bg-top" src="/static/images/common/clear.png" />
|
|
</view>
|
|
</view>
|
|
-
|
|
|
|
</template>
|
|
</template>
|
|
<template #right>
|
|
<template #right>
|
|
<!-- <view class="u-navbar__content__right__item">
|
|
<!-- <view class="u-navbar__content__right__item">
|
|
@@ -27,13 +24,13 @@
|
|
</template>
|
|
</template>
|
|
</u-navbar>
|
|
</u-navbar>
|
|
|
|
|
|
- <scroll-view class="info-container bg-white " scroll-y :style="`height: calc(100vh - (50px + ${proxy.$settingStore.barHightTop} + ${proxy.$settingStore.tabBarHeight}));position: relative;`">
|
|
|
|
|
|
+ <scroll-view class="info-container bg-white" scroll-y :style="`height: calc(100vh - (50px + ${proxy.$settingStore.barHightTop} + ${proxy.$settingStore.tabBarHeight}));position: relative;`">
|
|
<view class="content-area list-cell list-cell-arrow" v-for="item in infoList.infoTypeStatic" :key="item" @tap="goAppMessage(`/pages/common/appMessage/index?type=${item.type}`)">
|
|
<view class="content-area list-cell list-cell-arrow" v-for="item in infoList.infoTypeStatic" :key="item" @tap="goAppMessage(`/pages/common/appMessage/index?type=${item.type}`)">
|
|
<view class="content-area-avatar">
|
|
<view class="content-area-avatar">
|
|
<image class="image-bg" :src="item.img" />
|
|
<image class="image-bg" :src="item.img" />
|
|
<view class="uni_top_right font12" style="margin: auto 0">
|
|
<view class="uni_top_right font12" style="margin: auto 0">
|
|
- <u-badge numberType="overflow" max="99" :value="item.notReadCount"></u-badge>
|
|
|
|
- </view>
|
|
|
|
|
|
+ <u-badge numberType="overflow" max="99" :value="item.notReadCount"></u-badge>
|
|
|
|
+ </view>
|
|
</view>
|
|
</view>
|
|
<view class="content-area-child">
|
|
<view class="content-area-child">
|
|
<view class="uni-item mb5 ml10">
|
|
<view class="uni-item mb5 ml10">
|
|
@@ -52,68 +49,68 @@
|
|
<script setup>
|
|
<script setup>
|
|
/*----------------------------------依赖引入-----------------------------------*/
|
|
/*----------------------------------依赖引入-----------------------------------*/
|
|
import { onLoad, onShow } from "@dcloudio/uni-app";
|
|
import { onLoad, onShow } from "@dcloudio/uni-app";
|
|
-import { reactive, getCurrentInstance, toRefs } from "vue";
|
|
|
|
|
|
+import { reactive, getCurrentInstance, toRefs } from "vue";
|
|
/*----------------------------------接口引入-----------------------------------*/
|
|
/*----------------------------------接口引入-----------------------------------*/
|
|
-import { getMceReceiveStatic, getDictList, updateMceReceiveStatus } from "@/api/mine/info.js";
|
|
|
|
|
|
+import { getMceReceiveStatic, updateMceReceiveStatus } from "@/api/mine/info.js";
|
|
/*----------------------------------组件引入-----------------------------------*/
|
|
/*----------------------------------组件引入-----------------------------------*/
|
|
/*----------------------------------store引入-----------------------------------*/
|
|
/*----------------------------------store引入-----------------------------------*/
|
|
/*----------------------------------公共方法引入-----------------------------------*/
|
|
/*----------------------------------公共方法引入-----------------------------------*/
|
|
-import { storage_msgType } from "@/utils/storage";
|
|
|
|
|
|
+import { storage_msgType } from "@/utils/storage";
|
|
/*----------------------------------公共变量-----------------------------------*/
|
|
/*----------------------------------公共变量-----------------------------------*/
|
|
const { proxy } = getCurrentInstance();
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
+const { sys_message_type } = proxy.useDict("sys_message_type");
|
|
/*----------------------------------变量声明-----------------------------------*/
|
|
/*----------------------------------变量声明-----------------------------------*/
|
|
|
|
|
|
const data = reactive({
|
|
const data = reactive({
|
|
infoList: {
|
|
infoList: {
|
|
- infoTypeStatic:[],
|
|
|
|
- total:0
|
|
|
|
- }
|
|
|
|
|
|
+ infoTypeStatic: [],
|
|
|
|
+ total: 0,
|
|
|
|
+ },
|
|
});
|
|
});
|
|
|
|
|
|
const { infoList } = toRefs(data);
|
|
const { infoList } = toRefs(data);
|
|
|
|
|
|
function init() {
|
|
function init() {
|
|
getMceReceiveStatic().then((res) => {
|
|
getMceReceiveStatic().then((res) => {
|
|
- getDictList({
|
|
|
|
- dictType: "sys_message_type",
|
|
|
|
- }).then((res1) => {
|
|
|
|
- let receiveStatic = { infoTypeStatic:res.data.infoTypeStatic ,total:res.data.notReadCount }
|
|
|
|
- let dictList = res1.data.rows
|
|
|
|
- if(receiveStatic.infoTypeStatic.length>0){
|
|
|
|
- for (let i = 0; i < receiveStatic.infoTypeStatic.length; i++) {
|
|
|
|
- for (let j = 0; j < dictList.length; j++) {
|
|
|
|
- if(receiveStatic.infoTypeStatic[i].infoType == dictList[j].dictValue){
|
|
|
|
- receiveStatic.infoTypeStatic[i].label = dictList[j].dictLabel
|
|
|
|
- receiveStatic.infoTypeStatic[i].type = dictList[j].dictValue
|
|
|
|
- if(receiveStatic.infoTypeStatic[i].infoType == 1){
|
|
|
|
- receiveStatic.infoTypeStatic[i].img = "/static/images/common/noticeMessage.png"
|
|
|
|
- }
|
|
|
|
- if(receiveStatic.infoTypeStatic[i].infoType == 2){
|
|
|
|
- receiveStatic.infoTypeStatic[i].img = "/static/images/common/inspectionMessage.png"
|
|
|
|
- }
|
|
|
|
- if(receiveStatic.infoTypeStatic[i].infoType == 3){
|
|
|
|
- receiveStatic.infoTypeStatic[i].img = "/static/images/common/meetingMessage.png"
|
|
|
|
- }
|
|
|
|
- if(receiveStatic.infoTypeStatic[i].infoType == 4){
|
|
|
|
- receiveStatic.infoTypeStatic[i].img = "/static/images/common/alarmMessage.png"
|
|
|
|
- }
|
|
|
|
|
|
+ let receiveStatic = { infoTypeStatic: res.data.infoTypeStatic, total: res.data.notReadCount };
|
|
|
|
+ let dictList = sys_message_type.value;
|
|
|
|
+ if (receiveStatic.infoTypeStatic.length > 0) {
|
|
|
|
+ for (let i = 0; i < receiveStatic.infoTypeStatic.length; i++) {
|
|
|
|
+ for (let j = 0; j < dictList.length; j++) {
|
|
|
|
+ if (receiveStatic.infoTypeStatic[i].infoType == dictList[j].value) {
|
|
|
|
+ receiveStatic.infoTypeStatic[i].label = dictList[j].label;
|
|
|
|
+ receiveStatic.infoTypeStatic[i].type = dictList[j].value;
|
|
|
|
+ if (receiveStatic.infoTypeStatic[i].infoType == 1) {
|
|
|
|
+ receiveStatic.infoTypeStatic[i].img = "/static/images/common/noticeMessage.png";
|
|
|
|
+ }
|
|
|
|
+ if (receiveStatic.infoTypeStatic[i].infoType == 2) {
|
|
|
|
+ receiveStatic.infoTypeStatic[i].img = "/static/images/common/inspectionMessage.png";
|
|
|
|
+ }
|
|
|
|
+ if (receiveStatic.infoTypeStatic[i].infoType == 3) {
|
|
|
|
+ receiveStatic.infoTypeStatic[i].img = "/static/images/common/meetingMessage.png";
|
|
|
|
+ }
|
|
|
|
+ if (receiveStatic.infoTypeStatic[i].infoType == 4) {
|
|
|
|
+ receiveStatic.infoTypeStatic[i].img = "/static/images/common/alarmMessage.png";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- infoList.value = receiveStatic
|
|
|
|
- storage_msgType.set("msgType",receiveStatic)
|
|
|
|
- });
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ proxy.$setting.setBadge(res.data.notReadCount); // 设置角标值
|
|
|
|
+ infoList.value = receiveStatic;
|
|
|
|
+ storage_msgType.set("msgType", receiveStatic);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* 清除消息
|
|
* 清除消息
|
|
*/
|
|
*/
|
|
-function clearMsg(){
|
|
|
|
- if(infoList.value.total >0){
|
|
|
|
- updateMceReceiveStatus({id:0}).then(() => {
|
|
|
|
- init()
|
|
|
|
- })
|
|
|
|
|
|
+function clearMsg() {
|
|
|
|
+ if (infoList.value.total > 0) {
|
|
|
|
+ updateMceReceiveStatus({ id: 0 }).then(() => {
|
|
|
|
+ proxy.$setting.setBadge(0); // 设置角标值
|
|
|
|
+ init();
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function goAppMessage(path) {
|
|
function goAppMessage(path) {
|
|
@@ -122,7 +119,7 @@ function goAppMessage(path) {
|
|
|
|
|
|
function handleIconClick(type) {
|
|
function handleIconClick(type) {
|
|
if (type === "设置") {
|
|
if (type === "设置") {
|
|
- proxy.$tab.navigateTo("/pages/mine/msg/index")
|
|
|
|
|
|
+ proxy.$tab.navigateTo("/pages/mine/msg/index");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -136,16 +133,16 @@ onLoad(() => {
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
-.topBadge{
|
|
|
|
- margin-top:-14px;
|
|
|
|
- margin-left:0px;
|
|
|
|
|
|
+.topBadge {
|
|
|
|
+ margin-top: -14px;
|
|
|
|
+ margin-left: 0px;
|
|
}
|
|
}
|
|
-.image-bg-top{
|
|
|
|
- width:15px;
|
|
|
|
- height:19px;
|
|
|
|
|
|
+.image-bg-top {
|
|
|
|
+ width: 15px;
|
|
|
|
+ height: 19px;
|
|
}
|
|
}
|
|
.info-container {
|
|
.info-container {
|
|
- padding:0 12px;
|
|
|
|
|
|
+ padding: 0 12px;
|
|
.content-area {
|
|
.content-area {
|
|
display: flex;
|
|
display: flex;
|
|
padding: 13px 13px 13px 0px;
|
|
padding: 13px 13px 13px 0px;
|
|
@@ -157,10 +154,10 @@ onLoad(() => {
|
|
width: 40px;
|
|
width: 40px;
|
|
height: 40px;
|
|
height: 40px;
|
|
}
|
|
}
|
|
- .uni_top_right{
|
|
|
|
|
|
+ .uni_top_right {
|
|
position: absolute;
|
|
position: absolute;
|
|
- right:-10px;
|
|
|
|
- top:-4px;
|
|
|
|
|
|
+ right: -10px;
|
|
|
|
+ top: -4px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -186,7 +183,7 @@ onLoad(() => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-.list-cell-arrow::before{
|
|
|
|
- right:10rpx
|
|
|
|
|
|
+.list-cell-arrow::before {
|
|
|
|
+ right: 10rpx;
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|