Showing
12 changed files
with
109 additions
and
144 deletions
... | ... | @@ -118,9 +118,10 @@ export default { |
118 | 118 | }; |
119 | 119 | }, |
120 | 120 | onLoad() { |
121 | - this.loadData(); | |
121 | + console.log('Onload the dofunc'); | |
122 | 122 | }, |
123 | 123 | created() { |
124 | + this.loadData(); | |
124 | 125 | //获取页面路径 |
125 | 126 | let currentPages = getCurrentPages(); |
126 | 127 | let page = currentPages[currentPages.length - 1]; | ... | ... |
... | ... | @@ -31,7 +31,6 @@ uni.$u.http.setConfig((config) => { |
31 | 31 | // 请求拦截 |
32 | 32 | uni.$u.http.interceptors.request.use( |
33 | 33 | (config) => { |
34 | - // 可使用async await 做异步操作 | |
35 | 34 | // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} |
36 | 35 | config.data = config.data || {}; |
37 | 36 | // 根据custom参数中配置的是否需要token,添加对应的请求头 |
... | ... | @@ -41,7 +40,6 @@ uni.$u.http.interceptors.request.use( |
41 | 40 | uni.getStorageSync("userInfo").isToken || |
42 | 41 | undefined; |
43 | 42 | } |
44 | - // console.log("请求开始", config); | |
45 | 43 | if (config?.custom?.load) { |
46 | 44 | //打开加载动画 |
47 | 45 | store.commit("setLoadingShow", true); |
... | ... | @@ -50,7 +48,6 @@ uni.$u.http.interceptors.request.use( |
50 | 48 | return config; |
51 | 49 | }, |
52 | 50 | (config) => { |
53 | - // 可使用async await 做异步操作 | |
54 | 51 | return Promise.reject(config); |
55 | 52 | } |
56 | 53 | ); |
... | ... | @@ -58,65 +55,41 @@ uni.$u.http.interceptors.request.use( |
58 | 55 | // 响应拦截 |
59 | 56 | uni.$u.http.interceptors.response.use( |
60 | 57 | (response) => { |
61 | - /* 对响应成功做点什么 可使用async await 做异步操作*/ | |
62 | 58 | // 关闭加载动画 |
63 | 59 | store.commit("setLoadingShow", false); |
64 | 60 | const data = response.data; |
65 | - // 自定义参数 | |
66 | 61 | const custom = response.config?.custom; |
67 | 62 | // code: 200、请求成功 其他,没有更多参数 401、被迫下线重新登录、 |
68 | 63 | if (response.statusCode == 200) { |
69 | 64 | return Promise.resolve(data); |
70 | - // if (!custom.isFactory) { | |
71 | - // return Promise.reject(response.data) | |
72 | - // } else { | |
73 | - // return data.data === undefined ? {} : Promise.reject(response.data) | |
74 | - // } | |
75 | 65 | } else if (response.statusCode == 401) { |
76 | - //被迫下线重新登录 | |
77 | 66 | // 清空登录信息 |
78 | 67 | store.commit("emptyUserInfo"); |
79 | 68 | // 20秒节流,弹窗登录 |
80 | 69 | uni.$u.throttle(judgeLogin(), 20000); |
81 | 70 | return new Promise(() => {}); |
82 | - } else { | |
83 | - // 如果没有显式定义custom的toast参数为false的话,默认对报错进行toast弹出提示 | |
84 | - if (custom.toast !== false) { | |
85 | - // uni.$u.toast(data.message || data.msg); | |
86 | - } | |
87 | - // 如果需要catch返回,则进行reject | |
88 | - if (custom?.catch) { | |
89 | - return Promise.reject(data); | |
90 | - } else { | |
91 | - // 否则返回一个pending中的promise,请求不会进入catch中 | |
92 | - return new Promise(() => {}); | |
93 | - } | |
94 | - } | |
71 | + } else {} | |
95 | 72 | }, |
96 | 73 | (response) => { |
74 | + console.log('Response error', response) | |
97 | 75 | // 关闭加载动画 |
98 | 76 | store.commit("setLoadingShow", false); |
99 | - // 对响应错误做点什么 (statusCode !== 200) | |
100 | - let errorData = "请检查网络或服务器"; | |
77 | + let show = true; | |
78 | + let errorData = '请检查网络或服务器' | |
101 | 79 | let message = response.data?.message || response?.errMsg; |
102 | 80 | if (message == "request:fail url not in domain list") { |
103 | 81 | errorData = "检查请求域名是否添加了域名白名单"; |
104 | 82 | } else if (message == "request:fail timeout") { |
105 | 83 | errorData = "请求超时:请检查网络"; |
106 | - } else if (message == "Token has expired") { | |
84 | + } else if (response.data.status == 401) { | |
107 | 85 | uni.reLaunch({ |
108 | 86 | url: "/publicLoginSubPage/public/login", |
109 | 87 | }); |
110 | - store.commit("emptyUserInfo"); | |
111 | - } else if (message == "Invalid username or password") { | |
112 | - uni.reLaunch({ | |
113 | - url: "/publicLoginSubPage/public/login", | |
114 | - }); | |
115 | - store.commit("emptyUserInfo"); | |
88 | + show = false; | |
116 | 89 | } else { |
117 | 90 | errorData = message || ""; |
118 | 91 | } |
119 | - uni.$u.toast(errorData); | |
92 | + if (show) uni.$u.toast(errorData); | |
120 | 93 | return Promise.reject(response); |
121 | 94 | } |
122 | 95 | ); | ... | ... |
... | ... | @@ -176,6 +176,7 @@ |
176 | 176 | </view> |
177 | 177 | </view> |
178 | 178 | </u-popup> |
179 | + <!-- 告警筛选 --> | |
179 | 180 | <u-calendar |
180 | 181 | :show="showCalendar" |
181 | 182 | mode="range" |
... | ... | @@ -195,7 +196,6 @@ import fTabbar from '@/components/module/f-tabbar/f-tabbar'; |
195 | 196 | import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; |
196 | 197 | import { pageNumber, pageSize } from '@/config/constant.js'; |
197 | 198 | import { alertStatus, deviceType, alertLevel, timeArea } from './static/data.js'; |
198 | -import { mapActions } from 'vuex'; | |
199 | 199 | |
200 | 200 | export default { |
201 | 201 | mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件) |
... | ... | @@ -245,20 +245,20 @@ export default { |
245 | 245 | if (this.detailStatus) { |
246 | 246 | this.loadData(1, null, null, null, null, null, null); |
247 | 247 | } |
248 | - if (this.ordId == '') { | |
249 | - } else { | |
248 | + if (this.ordId) { | |
250 | 249 | this.loadData(1, null, null, null, null, null, this.ordId); |
251 | 250 | } |
252 | 251 | }, |
253 | 252 | onHide() { |
254 | 253 | this.ordId = ''; |
255 | 254 | this.detailStatus = false; |
256 | - this.loadData(1, null, null, null, null, null, null); | |
257 | 255 | }, |
258 | 256 | onLoad(e) { |
259 | 257 | // 隐藏原生的tabbar |
260 | 258 | uni.hideTabBar(); |
261 | - if (e.type !== undefined) { | |
259 | + if (e.type == undefined) { | |
260 | + this.loadData(1, null, null, null, null, null, null); | |
261 | + } else { | |
262 | 262 | let params = JSON.parse(e.type); |
263 | 263 | let type; |
264 | 264 | if (Array.isArray(params)) { |
... | ... | @@ -267,12 +267,9 @@ export default { |
267 | 267 | type = params; |
268 | 268 | } |
269 | 269 | this.loadData(1, type, null, null, null, null, null); |
270 | - } else { | |
271 | - this.loadData(1, null, null, null, null, null, null); | |
272 | 270 | } |
273 | 271 | }, |
274 | 272 | methods: { |
275 | - ...mapActions(['updateBadgeTotal']), | |
276 | 273 | inputChanged(e) { |
277 | 274 | this.loadData(1, null, null, null, null, null, null, e); |
278 | 275 | }, |
... | ... | @@ -365,13 +362,17 @@ export default { |
365 | 362 | organizationId: organizationV, |
366 | 363 | alarmType: alarmName |
367 | 364 | }; |
365 | + if (statusV == '') { | |
366 | + delete httpData.status; | |
367 | + } | |
368 | + if (severityV == '') { | |
369 | + delete httpData.severity; | |
370 | + } | |
368 | 371 | uni.$u.http |
369 | 372 | .get('/yt/alarm', { params: httpData, custom: { load: false } }) |
370 | 373 | .then(res => { |
371 | 374 | uni.stopPullDownRefresh(); |
372 | 375 | this.mescroll.endByPage(res.items.length, res.total); |
373 | - //异步实时更新告警徽标数 | |
374 | - this.updateBadgeTotal(httpData); | |
375 | 376 | this.alertTotal = res.total; |
376 | 377 | if (pageNo == 1) { |
377 | 378 | this.list = res.items; |
... | ... | @@ -390,7 +391,6 @@ export default { |
390 | 391 | url: './org/org' |
391 | 392 | }); |
392 | 393 | }, |
393 | - open() {}, | |
394 | 394 | close() { |
395 | 395 | this.show = false; |
396 | 396 | }, | ... | ... |
... | ... | @@ -39,19 +39,19 @@ |
39 | 39 | <text class="item-text home-text-muted">告警统计</text> |
40 | 40 | </view> |
41 | 41 | <view class="item-child-bottom u-flex"> |
42 | - <view @click="navatorAlertUnhandle()" class="u-flex sigle-child"> | |
42 | + <view @click="navigatorAlarmStatus(['ACTIVE_UNACK', 'ACTIVE_ACK'])" class="u-flex sigle-child"> | |
43 | 43 | <view class="sigle-text"> |
44 | 44 | <text class="home-text-total">{{ alertData.noHandle }}</text> |
45 | 45 | </view> |
46 | 46 | <view class="sigle-value"><text class="home-text-total-bottom">未处理</text></view> |
47 | 47 | </view> |
48 | - <view @click="navatorAlertHandle('CLEARED_ACK')" class="u-flex sigle-child"> | |
48 | + <view @click="navigatorAlarmStatus('CLEARED_ACK')" class="u-flex sigle-child"> | |
49 | 49 | <view class="sigle-text"> |
50 | 50 | <text class="home-text-total">{{ alertData.doneHandle }}</text> |
51 | 51 | </view> |
52 | 52 | <view class="sigle-value"><text class="home-text-total-bottom">已处理</text></view> |
53 | 53 | </view> |
54 | - <view @click="navatorAlertFalseAlarm('CLEARED_UNACK')" class="u-flex sigle-child"> | |
54 | + <view @click="navigatorAlarmStatus('CLEARED_UNACK')" class="u-flex sigle-child"> | |
55 | 55 | <view class="sigle-text"> |
56 | 56 | <text class="home-text-total">{{ alertData.errorReport }}</text> |
57 | 57 | </view> |
... | ... | @@ -97,6 +97,7 @@ |
97 | 97 | |
98 | 98 | <script> |
99 | 99 | import fTabbar from '@/components/module/f-tabbar/f-tabbar'; |
100 | +import { mapActions } from 'vuex'; | |
100 | 101 | |
101 | 102 | export default { |
102 | 103 | components: { |
... | ... | @@ -122,22 +123,20 @@ export default { |
122 | 123 | this.getDeviceTotalData(); |
123 | 124 | }, |
124 | 125 | methods: { |
126 | + ...mapActions(['updateBadgeTotal']), | |
125 | 127 | getDeviceTotalData() { |
126 | - uni.$u.http | |
127 | - .get('/yt/homepage/app') | |
128 | - .then(res => { | |
129 | - if (res) { | |
130 | - this.deviceData.onLine = res.totalDevice.onLine; | |
131 | - this.deviceData.unLine = res.totalDevice.offLine; | |
132 | - this.deviceData.noActive = res.totalDevice.inActive; | |
133 | - this.alertData.noHandle = res.totalAlarm.activedAlarm; | |
134 | - this.alertData.doneHandle = res.totalAlarm.clearedAck; | |
135 | - this.alertData.errorReport = res.totalAlarm.clearedUnack; | |
136 | - } | |
137 | - }) | |
138 | - .catch(e => { | |
139 | - // uni.$u.toast(e.data?.message); | |
140 | - }); | |
128 | + uni.$u.http.get('/yt/homepage/app').then(res => { | |
129 | + if (res) { | |
130 | + this.deviceData.onLine = res.totalDevice.onLine; | |
131 | + this.deviceData.unLine = res.totalDevice.offLine; | |
132 | + this.deviceData.noActive = res.totalDevice.inActive; | |
133 | + this.alertData.noHandle = res.totalAlarm.activedAlarm; | |
134 | + this.alertData.doneHandle = res.totalAlarm.clearedAck; | |
135 | + this.alertData.errorReport = res.totalAlarm.clearedUnack; | |
136 | + //异步实时更新告警徽标数 | |
137 | + this.updateBadgeTotal(res.totalAlarm.activedAlarm); | |
138 | + } | |
139 | + }); | |
141 | 140 | }, |
142 | 141 | openCamera() { |
143 | 142 | uni.navigateTo({ |
... | ... | @@ -149,18 +148,8 @@ export default { |
149 | 148 | url: 'configuration/configuration' |
150 | 149 | }); |
151 | 150 | }, |
152 | - navatorAlertUnhandle() { | |
153 | - let obj = ['ACTIVE_UNACK', 'ACTIVE_ACK']; | |
154 | - uni.reLaunch({ | |
155 | - url: '../alarm/alarm?type=' + JSON.stringify(obj) | |
156 | - }); | |
157 | - }, | |
158 | - navatorAlertHandle(e) { | |
159 | - uni.reLaunch({ | |
160 | - url: '../alarm/alarm?type=' + JSON.stringify(e) | |
161 | - }); | |
162 | - }, | |
163 | - navatorAlertFalseAlarm(e) { | |
151 | + //告警状态查询 | |
152 | + navigatorAlarmStatus(e) { | |
164 | 153 | uni.reLaunch({ |
165 | 154 | url: '../alarm/alarm?type=' + JSON.stringify(e) |
166 | 155 | }); | ... | ... |
... | ... | @@ -8,25 +8,26 @@ |
8 | 8 | <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> |
9 | 9 | <block v-if="userInfo.isToken"> |
10 | 10 | <view @click="openPersonalInfo" class="u-m-r-20"> |
11 | - <image class="avatar" mode="aspectFill" :src="userInfo.avatar || userInfo.avatarUrl || '/static/default.png'"></image> | |
11 | + <image class="avatar" mode="aspectFill" :src="userInfo.avatar == '' ? '/static/default.png' : userInfo.avatar"></image> | |
12 | 12 | </view> |
13 | - <view @click="openPersonalInfo" class="u-flex-1"> | |
14 | - <view class="nickName u-flex"> | |
13 | + <view class="u-flex-1"> | |
14 | + <view @click="openPersonalInfo" class="nickName u-flex"> | |
15 | 15 | <view class="name u-m-r-10" v-if="userInfo.realName || userInfo.nickName"> |
16 | 16 | <text style="#FFFFFF;font-size: 18px;">{{ userInfo.realName || userInfo.nickName }}</text> |
17 | 17 | </view> |
18 | 18 | </view> |
19 | - <view style="color:#FFFFFF;font-size: 14px;" v-if="userInfo.phoneNumber">{{ userInfo.phoneNumber | phone }}</view> | |
19 | + <view @click="openPersonalInfo" style="color:#FFFFFF;font-size: 14px;" v-if="userInfo.phoneNumber">{{ userInfo.phoneNumber | phone }}</view> | |
20 | 20 | <view v-else><text style="color:#FFFFFF;font-size: 14px;">手机号:未绑定</text></view> |
21 | + <view v-if="userInfo.isToken" @click="clearAccountFunc(userInfo)" class="detail"><text class="text">解绑</text></view> | |
21 | 22 | </view> |
22 | 23 | </block> |
23 | 24 | <block v-else> |
24 | 25 | <view class="u-m-r-20" @click="openLoginFunc"> |
25 | - <view class="avatar u-flex"><u-icon name="account-fill" color="black" size="30"></u-icon></view> | |
26 | + <view class="avatar u-flex"><image class="avatar" mode="aspectFill" src="../../static/default.png"></image></view> | |
26 | 27 | </view> |
27 | 28 | <view class="u-flex-1"> |
28 | 29 | <view @click="openLoginFunc" class="u-font-lg click-login login-btn ">请点击登录</view> |
29 | - <view @click="clickAccountFunc" class="detail"><text class="text">绑定账号</text></view> | |
30 | + <view v-if="!userInfo.isToken" @click="clickAccountFunc" class="detail"><text class="text">绑定账号</text></view> | |
30 | 31 | </view> |
31 | 32 | </block> |
32 | 33 | <view v-if="userInfo.isToken"><u-icon name="arrow-right" color="white" size="13"></u-icon></view> |
... | ... | @@ -55,7 +56,7 @@ |
55 | 56 | </view> |
56 | 57 | <view class="u-flex-1"> |
57 | 58 | <view @click="openLoginFunc" class="u-font-lg login-btn">登录</view> |
58 | - <view @click="clickAccountFunc" style="color: black" class="detail">绑定账号</view> | |
59 | + <view v-if="userInfo.isToken == '' || userInfo.isToken == null" @click="clickAccountFunc" style="color: black" class="detail">绑定账号</view> | |
59 | 60 | </view> |
60 | 61 | </block> |
61 | 62 | <view><u-icon name="arrow-right" color="black" size="13"></u-icon></view> |
... | ... | @@ -75,8 +76,8 @@ |
75 | 76 | <view class="nav-right"><image class="image" src="../../static/arrow-right.png"></image></view> |
76 | 77 | </view> |
77 | 78 | </view> |
78 | - <view v-if="userInfo.isToken" class="u-flex" style="justify-content: center; width: 600rpx"> | |
79 | - <button class="submit" size="default" @click.top="onLoginoutFunc"><text class="text">退出账号</text></button> | |
79 | + <view @click="onLoginoutFunc" v-if="userInfo.isToken" class="u-flex" style="justify-content: center; width: 600rpx"> | |
80 | + <button class="submit" size="default" @click="onLoginoutFunc"><text class="text">退出账号</text></button> | |
80 | 81 | </view> |
81 | 82 | </view> |
82 | 83 | <!-- 绑定账号 --> |
... | ... | @@ -95,7 +96,6 @@ |
95 | 96 | type="password" |
96 | 97 | placeholder="登录密码" |
97 | 98 | v-model="bindAccountObj.appUserSecret" |
98 | - @change="passwordChange" | |
99 | 99 | ></u--input> |
100 | 100 | </view> |
101 | 101 | <view class="u-flex item-phone"> |
... | ... | @@ -159,6 +159,7 @@ import base from '@/config/baseUrl'; |
159 | 159 | import fTabbar from '@/components/module/f-tabbar/f-tabbar'; |
160 | 160 | import fNavbar from '@/components/module/f-navbar/f-navbar'; |
161 | 161 | import { mapState, mapMutations } from 'vuex'; |
162 | +import { appId } from '@/config/constant.js'; | |
162 | 163 | |
163 | 164 | export default { |
164 | 165 | components: { |
... | ... | @@ -191,9 +192,10 @@ export default { |
191 | 192 | onLoad(e) { |
192 | 193 | // 隐藏原生的tabbar |
193 | 194 | uni.hideTabBar(); |
194 | - if (e.obj !== null) { | |
195 | - const params = JSON.parse(e.obj); | |
195 | + if (e.obj != null) { | |
196 | + const params = JSON.parse(decodeURIComponent(e.obj)); | |
196 | 197 | this.thirdObj = params; |
198 | + console.log(this.thirdObj); | |
197 | 199 | } |
198 | 200 | }, |
199 | 201 | computed: { |
... | ... | @@ -437,6 +439,18 @@ export default { |
437 | 439 | } |
438 | 440 | } |
439 | 441 | }); |
442 | + }, | |
443 | + clearAccountFunc(e) { | |
444 | + //解绑 | |
445 | + let httpData = { | |
446 | + appUserId: e.userId, | |
447 | + thirdUserId: this.thirdObj.thirdUserId | |
448 | + }; | |
449 | + uni.$u.http.delete('/yt/third', httpData).then(res => { | |
450 | + if (res) { | |
451 | + this.getCodeState(); //开始倒计时 | |
452 | + } | |
453 | + }); | |
440 | 454 | } |
441 | 455 | } |
442 | 456 | }; | ... | ... |
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | </view> |
18 | 18 | <view class="form-row u-flex"> |
19 | 19 | <view class="v-input"><input type="text" v-model="loginForm.password" maxlength="32" placeholder="请输入登录密码" :password="!showPassword" /></view> |
20 | - <view class="v-password" @click="showPasswordMode"><u-icon size="25" :name="showPassword ? 'eye-fill' : 'eye-off'"></u-icon></view> | |
20 | + <view class="v-password" @click="showPasswordMode"><u-icon color="#9a9a9a" size="25" :name="showPassword ? 'eye-fill' : 'eye-off'"></u-icon></view> | |
21 | 21 | <u-icon></u-icon> |
22 | 22 | </view> |
23 | 23 | <button class="submit" size="default" @click="onSubmitFunc"><text class="text">登录</text></button> |
... | ... | @@ -81,11 +81,13 @@ export default { |
81 | 81 | methods: { |
82 | 82 | ...mapMutations(['setUserInfo']), |
83 | 83 | //微信授权登录 |
84 | + //#ifdef MP | |
84 | 85 | onAuthorization(e) { |
85 | 86 | wx.getUserProfile({ |
86 | 87 | desc: '获取用户信息', |
87 | 88 | success: res => { |
88 | 89 | if (res) { |
90 | + //微信官方自带解密(node) | |
89 | 91 | let pc = new WXBizDataCrypt(appId, this.session_key); |
90 | 92 | let data = pc.decryptData(res.encryptedData, res.iv); |
91 | 93 | let obj = { |
... | ... | @@ -98,6 +100,10 @@ export default { |
98 | 100 | .get(`/yt/third/login/${this.openid}`) |
99 | 101 | .then(res => { |
100 | 102 | if (res.token == '' || res.token == null) { |
103 | + //需要绑定,跳转我的页面 | |
104 | + uni.reLaunch({ | |
105 | + url: '/pages/personal/personal' | |
106 | + }); | |
101 | 107 | } else { |
102 | 108 | // 储存登录信息 |
103 | 109 | let resObj = { |
... | ... | @@ -116,9 +122,6 @@ export default { |
116 | 122 | icon: 'none' |
117 | 123 | }); |
118 | 124 | this.saveUserInfo(); |
119 | - // return uni.showToast({ | |
120 | - // title: '不需要绑定' | |
121 | - // }); | |
122 | 125 | } |
123 | 126 | }) |
124 | 127 | .catch(e => { |
... | ... | @@ -127,7 +130,7 @@ export default { |
127 | 130 | // #ifdef APP-PLUS||MP |
128 | 131 | setTimeout(() => { |
129 | 132 | uni.reLaunch({ |
130 | - url: '/pages/personal/personal?obj=' + JSON.stringify(obj) | |
133 | + url: '/pages/personal/personal?obj=' + encodeURIComponent(JSON.stringify(obj)) | |
131 | 134 | }); |
132 | 135 | }, 500); |
133 | 136 | // #endif |
... | ... | @@ -135,6 +138,7 @@ export default { |
135 | 138 | } |
136 | 139 | }); |
137 | 140 | }, |
141 | + //#endif | |
138 | 142 | saveUserInfo() { |
139 | 143 | //储存个人信息 |
140 | 144 | uni.$u.http.get('/yt/user/me/info').then(res => { | ... | ... |
... | ... | @@ -34,29 +34,7 @@ export const actions = { |
34 | 34 | state, |
35 | 35 | commit |
36 | 36 | }, data) { |
37 | - let httpData = { | |
38 | - page: 1, | |
39 | - pageSize: 10, | |
40 | - status: data.status == 'CLEARED_ACK' ? null : data.status, | |
41 | - startTime: data.startTime, | |
42 | - endTime: data.endTime, | |
43 | - severity: data.severity, | |
44 | - deviceType: data.deviceType, | |
45 | - organizationId: data.organizationId, | |
46 | - alarmType: data.alarmType | |
47 | - }; | |
48 | - uni.$u.http | |
49 | - .get('/yt/alarm', { | |
50 | - params: httpData, | |
51 | - custom: { | |
52 | - load: false | |
53 | - } | |
54 | - }) | |
55 | - .then(res => { | |
56 | - state.badgeInfo = res.total | |
57 | - }) | |
58 | - .catch(e => { | |
59 | - uni.$u.toast(e.data?.message); | |
60 | - }); | |
37 | + state.badgeInfo = data | |
38 | + console.log('Change total', data); | |
61 | 39 | } |
62 | 40 | }; | ... | ... |
... | ... | @@ -23,17 +23,11 @@ |
23 | 23 | </view> |
24 | 24 | </view> |
25 | 25 | </view> |
26 | - <f-tabbar></f-tabbar> | |
27 | 26 | </view> |
28 | 27 | </template> |
29 | 28 | |
30 | 29 | <script> |
31 | -import fTabbar from '@/components/module/f-tabbar/f-tabbar'; | |
32 | - | |
33 | 30 | export default { |
34 | - components: { | |
35 | - fTabbar | |
36 | - }, | |
37 | 31 | data() { |
38 | 32 | return { |
39 | 33 | notifyList: {} |
... | ... | @@ -43,11 +37,14 @@ export default { |
43 | 37 | // 隐藏原生的tabbar |
44 | 38 | uni.hideTabBar(); |
45 | 39 | if (e.data !== null) { |
46 | - let params = JSON.parse(e.data); | |
40 | + let params = JSON.parse(decodeURIComponent(e.data)); | |
47 | 41 | if (params) this.notifyList = params; |
42 | + uni.setStorageSync('storagePre', true); | |
48 | 43 | } |
49 | 44 | }, |
50 | - methods: {} | |
45 | + onHide() { | |
46 | + uni.setStorageSync('storagePre', false); | |
47 | + } | |
51 | 48 | }; |
52 | 49 | </script> |
53 | 50 | ... | ... |
... | ... | @@ -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 | }; | ... | ... |