|
|
@@ -28,10 +28,10 @@
|
|
|
title="公告"></message-list>
|
|
|
|
|
|
<!-- 消息列表 -->
|
|
|
- <message-list ref="msgListRef" @readMsg="setMsgRead" :unReadNum="unReadNum" :list="messages" @clickSegment="getMessageData"
|
|
|
- @clickItem="handleToMessageDetail" @scrollToBottom="getMessagePage" :defaultCurrent="1" :pSize="5"
|
|
|
- :pageNo="1" :anime="true" :open="true" :segments="{ '全部': '', '未读': '0', '已读': '1' }"
|
|
|
- title="消息"></message-list>
|
|
|
+ <message-list ref="msgListRef" @readMsg="setMsgRead" :unReadNum="unReadNum" :list="messages"
|
|
|
+ @clickSegment="getMessageData" @clickItem="handleToMessageDetail" @scrollToBottom="getMessagePage"
|
|
|
+ :defaultCurrent="1" :pSize="5" :pageNo="1" :anime="true" :open="true"
|
|
|
+ :segments="{ '全部': '', '未读': '0', '已读': '1' }" title="消息"></message-list>
|
|
|
|
|
|
<!-- AI咨询按钮 -->
|
|
|
<view class="fab_button">
|
|
|
@@ -43,7 +43,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
- import { onBeforeMount, onMounted, ref } from 'vue';
|
|
|
+ import { onBeforeMount, onMounted, onUpdated, ref } from 'vue';
|
|
|
import { onLoad } from '@dcloudio/uni-app'
|
|
|
import { getMessageList, getNoticeList, getUnReadMessageNum, setMsgIsRead } from '@/api/message.js';
|
|
|
import { getUserProcess, getUnProcessNum } from '@/api/process';
|
|
|
@@ -52,18 +52,19 @@
|
|
|
import processList from '@/components/ygoa/processList.vue'
|
|
|
import messageList from '@/components/ygoa/messageList.vue'
|
|
|
import { useUserStore } from '@/store/user.js'
|
|
|
+ import { showConfirm } from '@/utils/common';
|
|
|
const userStore = useUserStore()
|
|
|
|
|
|
onLoad((options) => {
|
|
|
// 是否跳转打卡页
|
|
|
if (options.to == 'clockIn') toClockIn()
|
|
|
})
|
|
|
- onBeforeMount(()=>{
|
|
|
-
|
|
|
- })
|
|
|
- onMounted(() => {
|
|
|
+ onUpdated(()=>{
|
|
|
showTarBarBadge();
|
|
|
})
|
|
|
+ // onMounted(() => {
|
|
|
+ // showTarBarBadge();
|
|
|
+ // })
|
|
|
// 跳转打卡页
|
|
|
function toClockIn() {
|
|
|
// 确认是否跳转打卡页
|
|
|
@@ -72,41 +73,54 @@
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-//子组件
|
|
|
- const msgListRef=ref(null)
|
|
|
+ //子组件
|
|
|
+ const msgListRef = ref(null)
|
|
|
//设置消息已读
|
|
|
function setMsgRead() {
|
|
|
- const params = {
|
|
|
- currentUser: userStore.user.useId,
|
|
|
- isRead: "0",
|
|
|
- pSize: unReadNum.value,
|
|
|
- type: "",
|
|
|
- p: 1,
|
|
|
- }
|
|
|
- getMessageList(params).then(({ returnParams }) => {
|
|
|
- const unReadMsgIds= returnParams.ids === "" ? "" : returnParams.ids + ",";
|
|
|
- setMsgIsRead(unReadMsgIds).then((res) => {
|
|
|
- if (Number.isInteger(res)) {
|
|
|
- switch (res) {
|
|
|
- case -1:
|
|
|
- $modal.msgError('操作失败')
|
|
|
- break
|
|
|
- case -2:
|
|
|
- case 0:
|
|
|
- $modal.msg('不存在未读消息')
|
|
|
- break
|
|
|
- default:
|
|
|
- $modal.msgSuccess('操作成功')
|
|
|
- //刷新页面
|
|
|
- msgListRef.value.reload();// 调用子组件刷新数据
|
|
|
- showTarBarBadge();
|
|
|
- }
|
|
|
- } else {
|
|
|
- $modal.msgError('jssesionid失效')
|
|
|
+ $modal.confirm('是否一键已读').then(res => {
|
|
|
+ if (res) {
|
|
|
+ const params = {
|
|
|
+ currentUser: userStore.user.useId,
|
|
|
+ isRead: "0",
|
|
|
+ pSize: unReadNum.value,
|
|
|
+ type: "",
|
|
|
+ p: 1,
|
|
|
}
|
|
|
- })
|
|
|
+ getMessageList(params).then(({ returnParams }) => {
|
|
|
+ const unReadMsgIds = returnParams.ids === "" ? "" : returnParams.ids + ",";
|
|
|
+ setMsgIsRead(unReadMsgIds).then((res) => {
|
|
|
+ if (Number.isInteger(res)) {
|
|
|
+ switch (res) {
|
|
|
+ case -1:
|
|
|
+ $modal.msgError('操作失败')
|
|
|
+ break
|
|
|
+ case -2:
|
|
|
+ case 0:
|
|
|
+ $modal.msg('不存在未读消息')
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ $modal.msgSuccess('操作成功')
|
|
|
+ //刷新页面
|
|
|
+ msgListRef.value.reload();// 调用子组件刷新数据
|
|
|
+ // showTarBarBadge();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // $modal.msgError('jssesionid失效')
|
|
|
+ showConfirm('jssesionid失效,您可以继续留在该页面,或者重新登录?').then(res => {
|
|
|
+ if (res.confirm) {
|
|
|
+ userStore.LogOut().then(res => {
|
|
|
+ uni.reLaunch({ url: '/pages/login' })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 待办列表
|
|
|
@@ -250,7 +264,7 @@
|
|
|
function showTarBarBadge() {
|
|
|
getUnProcessNum(userStore.user.useId, "").then(res => {
|
|
|
if ("failed" == res.returnMsg) {
|
|
|
- $modal.msgError('待办流程数获取失败')
|
|
|
+ $modal.showToast('待办流程数获取失败')
|
|
|
return
|
|
|
} else {
|
|
|
unProcessNum.value = parseInt(res.returnParams.total, 10);
|