Commit 6cba0d329e7e7fde2e179e27c191e95b106c22c8

Authored by fengtao
1 parent 597b630f

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

... ... @@ -43,11 +43,14 @@ export default {
43 43 // 隐藏原生的tabbar
44 44 uni.hideTabBar();
45 45 if (e.data !== null) {
46   - let params = JSON.parse(e.data);
  46 + let params = JSON.parse(decodeURIComponent(e.data));
47 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 55 </script>
53 56
... ...
... ... @@ -18,8 +18,9 @@
18 18 <text class="text-bottom">{{ item.sysNotice.createTime }}</text>
19 19 </view>
20 20 </view>
21   - <view class="item-right">
  21 + <view class="item-right u-flex" style="justify-content: space-between;margin-right: ;">
22 22 <text class="text">{{ formatType(item.sysNotice) }}</text>
  23 + <u-badge v-if="item.readStatus == '0'" numberType="overflow" isDot />
23 24 </view>
24 25 </view>
25 26 </view>
... ... @@ -67,28 +68,29 @@ export default {
67 68 downOption: {
68 69 auto: false //是否在初始化后,自动执行downCallback; 默认true
69 70 },
70   - list: []
  71 + list: [],
  72 + pre: false
71 73 };
72 74 },
73 75 onLoad(e) {
74 76 // 隐藏原生的tabbar
75 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 90 methods: {
79 91 formatType(e) {
80 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 94 openTypeClick() {
93 95 this.showType = true;
94 96 uni.hideKeyboard();
... ... @@ -134,12 +136,15 @@ export default {
134 136 });
135 137 },
136 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 };
... ...