From ce7bdf6065e66474c01a45e2bb967ead46cab541 Mon Sep 17 00:00:00 2001
From: 周宾 <2802492122@qq.com>
Date: 星期一, 22 十二月 2025 17:42:46 +0800
Subject: [PATCH] 海川开心-本地推送通知公告标题
---
src/pages/index.vue | 44 ++++++++++++++++++++++++--------------------
1 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/src/pages/index.vue b/src/pages/index.vue
index 8f96f6f..e5f9c59 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -154,9 +154,10 @@
nextTick,
reactive
} from 'vue';
+ import dayjs from "dayjs"
import {
userLoginFacotryList,
- noticesCount
+ noticesList
} from "@/api/login";
import modal from "@/plugins/modal";
import useUserStore from "@/store/modules/user";
@@ -567,14 +568,21 @@
uToastRef.value.success(`鐐瑰嚮浜嗙${name + 1}涓猔); // 娉ㄦ剰锛氳繖閲屽姞1鏄洜涓洪�氬父鎴戜滑鏄粠绗�1涓紑濮嬭鏁扮殑
}
};
- const isShowNoticesCount = ref(true)
+ const isShowNoticesList = ref(true)
// 鑾峰彇鍏憡鏁伴噺
- const getNoticesCount = () => {
- if(!isShowNoticesCount.value){
+ const getNoticesList = () => {
+ if(!isShowNoticesList.value){
return
}
- noticesCount({}).then(resp => {
- if (resp.code != 200 || !resp.data) {
+ const current_date = dayjs().format('YYYY-MM-DD')
+ noticesList({
+ current:-1,
+ size:-1,
+ status: 1,
+ current_date
+ }).then(resp => {
+ console.log('noticesList',resp)
+ if (resp.code != 200 || !resp.data||!resp.data.records||!resp.data.records.length) {
return
}
const res = uni.getAppAuthorizeSetting();
@@ -585,34 +593,31 @@
success: (res) => {
if (res.confirm) {
uni.openAppAuthorizeSetting({
- success: (res) => {
- console.log('openAppAuthorizeSetting',res)
- // if (res.authSetting['scope.push']) {
- // createPushMessage(resp.data)
- // }
- }
+ success: (res) => {}
});
}else{
- isShowNoticesCount.value = false
+ isShowNoticesList.value = false
}
}
});
return
}
- createPushMessage(resp.data)
+ resp.data.records.map(item=>{
+ createPushMessage(item.title)
+ })
+
}).catch(error => {
modal.msgError('鑾峰彇鍏憡鏁伴噺:', error)
- console.log('鑾峰彇鍏憡鏁伴噺:', error)
})
}
- const createPushMessage = (_noticesCount) => {
+ const createPushMessage = (text) => {
uni.createPushMessage({
title: '鍏憡閫氱煡',
- content: `褰撳墠鏈�${_noticesCount}鏉″叕鍛婇�氱煡锛屾敞鎰忔煡鐪媊,
+ content: text||'',
success: (resp) => {
console.log('success', resp)
- isShowNoticesCount.value = false
+ isShowNoticesList.value = false
},
fail: (resp) => {
console.log('fail', resp)
@@ -626,10 +631,9 @@
getUserLoginFacotryList()
// 鍚姩閫氱煡鐘舵�佸畾鏃跺櫒
startStatusTimer()
- // getNoticesCount()
});
onShow(()=>{
- getNoticesCount()
+ getNoticesList()
})
</script>
--
Gitblit v1.9.3