Commit 6cba0d329e7e7fde2e179e27c191e95b106c22c8

Authored by fengtao
1 parent 597b630f

feat:系统通知新增阅读状态

@@ -43,11 +43,14 @@ export default { @@ -43,11 +43,14 @@ export default {
43 // 隐藏原生的tabbar 43 // 隐藏原生的tabbar
44 uni.hideTabBar(); 44 uni.hideTabBar();
45 if (e.data !== null) { 45 if (e.data !== null) {
46 - let params = JSON.parse(e.data); 46 + let params = JSON.parse(decodeURIComponent(e.data));
47 if (params) this.notifyList = params; 47 if (params) this.notifyList = params;
  48 + uni.setStorageSync('storagePre', true);
48 } 49 }
49 }, 50 },
50 - methods: {} 51 + onHide() {
  52 + uni.setStorageSync('storagePre', false);
  53 + }
51 }; 54 };
52 </script> 55 </script>
53 56
@@ -18,8 +18,9 @@ @@ -18,8 +18,9 @@
18 <text class="text-bottom">{{ item.sysNotice.createTime }}</text> 18 <text class="text-bottom">{{ item.sysNotice.createTime }}</text>
19 </view> 19 </view>
20 </view> 20 </view>
21 - <view class="item-right"> 21 + <view class="item-right u-flex" style="justify-content: space-between;margin-right: ;">
22 <text class="text">{{ formatType(item.sysNotice) }}</text> 22 <text class="text">{{ formatType(item.sysNotice) }}</text>
  23 + <u-badge v-if="item.readStatus == '0'" numberType="overflow" isDot />
23 </view> 24 </view>
24 </view> 25 </view>
25 </view> 26 </view>
@@ -67,28 +68,29 @@ export default { @@ -67,28 +68,29 @@ export default {
67 downOption: { 68 downOption: {
68 auto: false //是否在初始化后,自动执行downCallback; 默认true 69 auto: false //是否在初始化后,自动执行downCallback; 默认true
69 }, 70 },
70 - list: [] 71 + list: [],
  72 + pre: false
71 }; 73 };
72 }, 74 },
73 onLoad(e) { 75 onLoad(e) {
74 // 隐藏原生的tabbar 76 // 隐藏原生的tabbar
75 uni.hideTabBar(); 77 uni.hideTabBar();
76 - this.stop(); 78 + this.pre = false;
  79 + uni.removeStorageSync('storagePre');
  80 + },
  81 + onShow() {
  82 + this.pre = uni.getStorageSync('storagePre');
  83 + if (this.pre) {
  84 + this.loadData(1);
  85 + }
  86 + },
  87 + onHide() {
  88 + uni.removeStorageSync('storagePre');
77 }, 89 },
78 methods: { 90 methods: {
79 formatType(e) { 91 formatType(e) {
80 return e?.type == 'OTHER' ? '其他' : e?.type == 'MEETING' ? '会议' : '公告'; 92 return e?.type == 'OTHER' ? '其他' : e?.type == 'MEETING' ? '会议' : '公告';
81 }, 93 },
82 - stop() {  
83 - let interval = setInterval(function() {  
84 - uni.hideKeyboard(); //隐藏软键盘  
85 - console.log('刷新');  
86 - }, 20);  
87 - setTimeout(() => {  
88 - clearInterval(interval);  
89 - console.log('停止刷新');  
90 - }, 3000);  
91 - },  
92 openTypeClick() { 94 openTypeClick() {
93 this.showType = true; 95 this.showType = true;
94 uni.hideKeyboard(); 96 uni.hideKeyboard();
@@ -134,12 +136,15 @@ export default { @@ -134,12 +136,15 @@ export default {
134 }); 136 });
135 }, 137 },
136 clickNotifyDetail(e) { 138 clickNotifyDetail(e) {
137 - let obj = e;  
138 - setTimeout(() => {  
139 - uni.navigateTo({  
140 - url: './notifyDetail?data=' + JSON.stringify(obj) 139 + uni.$u.http
  140 + .get(`/yt/noticeUser/${e.id}`)
  141 + .then(res => {})
  142 + .catch(e => {
  143 + uni.$u.toast(e.data?.message);
141 }); 144 });
142 - }, 500); 145 + uni.navigateTo({
  146 + url: './notifyDetail?data=' + encodeURIComponent(JSON.stringify(e))
  147 + });
143 } 148 }
144 } 149 }
145 }; 150 };