Commit ab624e46a042b87c3c081b2a24e1637435a26bf1
Merge branch 'dev-ft' into 'main'
refractor:移除一些无用代码,feat:增加了默认头像 See merge request huang/thingskit-app!34
Showing
12 changed files
with
109 additions
and
144 deletions
@@ -118,9 +118,10 @@ export default { | @@ -118,9 +118,10 @@ export default { | ||
118 | }; | 118 | }; |
119 | }, | 119 | }, |
120 | onLoad() { | 120 | onLoad() { |
121 | - this.loadData(); | 121 | + console.log('Onload the dofunc'); |
122 | }, | 122 | }, |
123 | created() { | 123 | created() { |
124 | + this.loadData(); | ||
124 | //获取页面路径 | 125 | //获取页面路径 |
125 | let currentPages = getCurrentPages(); | 126 | let currentPages = getCurrentPages(); |
126 | let page = currentPages[currentPages.length - 1]; | 127 | let page = currentPages[currentPages.length - 1]; |
@@ -31,7 +31,6 @@ uni.$u.http.setConfig((config) => { | @@ -31,7 +31,6 @@ uni.$u.http.setConfig((config) => { | ||
31 | // 请求拦截 | 31 | // 请求拦截 |
32 | uni.$u.http.interceptors.request.use( | 32 | uni.$u.http.interceptors.request.use( |
33 | (config) => { | 33 | (config) => { |
34 | - // 可使用async await 做异步操作 | ||
35 | // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} | 34 | // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} |
36 | config.data = config.data || {}; | 35 | config.data = config.data || {}; |
37 | // 根据custom参数中配置的是否需要token,添加对应的请求头 | 36 | // 根据custom参数中配置的是否需要token,添加对应的请求头 |
@@ -41,7 +40,6 @@ uni.$u.http.interceptors.request.use( | @@ -41,7 +40,6 @@ uni.$u.http.interceptors.request.use( | ||
41 | uni.getStorageSync("userInfo").isToken || | 40 | uni.getStorageSync("userInfo").isToken || |
42 | undefined; | 41 | undefined; |
43 | } | 42 | } |
44 | - // console.log("请求开始", config); | ||
45 | if (config?.custom?.load) { | 43 | if (config?.custom?.load) { |
46 | //打开加载动画 | 44 | //打开加载动画 |
47 | store.commit("setLoadingShow", true); | 45 | store.commit("setLoadingShow", true); |
@@ -50,7 +48,6 @@ uni.$u.http.interceptors.request.use( | @@ -50,7 +48,6 @@ uni.$u.http.interceptors.request.use( | ||
50 | return config; | 48 | return config; |
51 | }, | 49 | }, |
52 | (config) => { | 50 | (config) => { |
53 | - // 可使用async await 做异步操作 | ||
54 | return Promise.reject(config); | 51 | return Promise.reject(config); |
55 | } | 52 | } |
56 | ); | 53 | ); |
@@ -58,65 +55,41 @@ uni.$u.http.interceptors.request.use( | @@ -58,65 +55,41 @@ uni.$u.http.interceptors.request.use( | ||
58 | // 响应拦截 | 55 | // 响应拦截 |
59 | uni.$u.http.interceptors.response.use( | 56 | uni.$u.http.interceptors.response.use( |
60 | (response) => { | 57 | (response) => { |
61 | - /* 对响应成功做点什么 可使用async await 做异步操作*/ | ||
62 | // 关闭加载动画 | 58 | // 关闭加载动画 |
63 | store.commit("setLoadingShow", false); | 59 | store.commit("setLoadingShow", false); |
64 | const data = response.data; | 60 | const data = response.data; |
65 | - // 自定义参数 | ||
66 | const custom = response.config?.custom; | 61 | const custom = response.config?.custom; |
67 | // code: 200、请求成功 其他,没有更多参数 401、被迫下线重新登录、 | 62 | // code: 200、请求成功 其他,没有更多参数 401、被迫下线重新登录、 |
68 | if (response.statusCode == 200) { | 63 | if (response.statusCode == 200) { |
69 | return Promise.resolve(data); | 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 | } else if (response.statusCode == 401) { | 65 | } else if (response.statusCode == 401) { |
76 | - //被迫下线重新登录 | ||
77 | // 清空登录信息 | 66 | // 清空登录信息 |
78 | store.commit("emptyUserInfo"); | 67 | store.commit("emptyUserInfo"); |
79 | // 20秒节流,弹窗登录 | 68 | // 20秒节流,弹窗登录 |
80 | uni.$u.throttle(judgeLogin(), 20000); | 69 | uni.$u.throttle(judgeLogin(), 20000); |
81 | return new Promise(() => {}); | 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 | (response) => { | 73 | (response) => { |
74 | + console.log('Response error', response) | ||
97 | // 关闭加载动画 | 75 | // 关闭加载动画 |
98 | store.commit("setLoadingShow", false); | 76 | store.commit("setLoadingShow", false); |
99 | - // 对响应错误做点什么 (statusCode !== 200) | ||
100 | - let errorData = "请检查网络或服务器"; | 77 | + let show = true; |
78 | + let errorData = '请检查网络或服务器' | ||
101 | let message = response.data?.message || response?.errMsg; | 79 | let message = response.data?.message || response?.errMsg; |
102 | if (message == "request:fail url not in domain list") { | 80 | if (message == "request:fail url not in domain list") { |
103 | errorData = "检查请求域名是否添加了域名白名单"; | 81 | errorData = "检查请求域名是否添加了域名白名单"; |
104 | } else if (message == "request:fail timeout") { | 82 | } else if (message == "request:fail timeout") { |
105 | errorData = "请求超时:请检查网络"; | 83 | errorData = "请求超时:请检查网络"; |
106 | - } else if (message == "Token has expired") { | 84 | + } else if (response.data.status == 401) { |
107 | uni.reLaunch({ | 85 | uni.reLaunch({ |
108 | url: "/publicLoginSubPage/public/login", | 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 | } else { | 89 | } else { |
117 | errorData = message || ""; | 90 | errorData = message || ""; |
118 | } | 91 | } |
119 | - uni.$u.toast(errorData); | 92 | + if (show) uni.$u.toast(errorData); |
120 | return Promise.reject(response); | 93 | return Promise.reject(response); |
121 | } | 94 | } |
122 | ); | 95 | ); |
@@ -290,7 +290,7 @@ export default { | @@ -290,7 +290,7 @@ export default { | ||
290 | width: 700rpx; | 290 | width: 700rpx; |
291 | background-color: #ffffff; | 291 | background-color: #ffffff; |
292 | border-radius: 10px; | 292 | border-radius: 10px; |
293 | - margin-top: 80rpx; | 293 | + margin-top: 100rpx; |
294 | height: 256rpx; | 294 | height: 256rpx; |
295 | margin-left: -20rpx; | 295 | margin-left: -20rpx; |
296 | .info-contain { | 296 | .info-contain { |
@@ -176,6 +176,7 @@ | @@ -176,6 +176,7 @@ | ||
176 | </view> | 176 | </view> |
177 | </view> | 177 | </view> |
178 | </u-popup> | 178 | </u-popup> |
179 | + <!-- 告警筛选 --> | ||
179 | <u-calendar | 180 | <u-calendar |
180 | :show="showCalendar" | 181 | :show="showCalendar" |
181 | mode="range" | 182 | mode="range" |
@@ -195,7 +196,6 @@ import fTabbar from '@/components/module/f-tabbar/f-tabbar'; | @@ -195,7 +196,6 @@ import fTabbar from '@/components/module/f-tabbar/f-tabbar'; | ||
195 | import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; | 196 | import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; |
196 | import { pageNumber, pageSize } from '@/config/constant.js'; | 197 | import { pageNumber, pageSize } from '@/config/constant.js'; |
197 | import { alertStatus, deviceType, alertLevel, timeArea } from './static/data.js'; | 198 | import { alertStatus, deviceType, alertLevel, timeArea } from './static/data.js'; |
198 | -import { mapActions } from 'vuex'; | ||
199 | 199 | ||
200 | export default { | 200 | export default { |
201 | mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件) | 201 | mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件) |
@@ -245,20 +245,20 @@ export default { | @@ -245,20 +245,20 @@ export default { | ||
245 | if (this.detailStatus) { | 245 | if (this.detailStatus) { |
246 | this.loadData(1, null, null, null, null, null, null); | 246 | this.loadData(1, null, null, null, null, null, null); |
247 | } | 247 | } |
248 | - if (this.ordId == '') { | ||
249 | - } else { | 248 | + if (this.ordId) { |
250 | this.loadData(1, null, null, null, null, null, this.ordId); | 249 | this.loadData(1, null, null, null, null, null, this.ordId); |
251 | } | 250 | } |
252 | }, | 251 | }, |
253 | onHide() { | 252 | onHide() { |
254 | this.ordId = ''; | 253 | this.ordId = ''; |
255 | this.detailStatus = false; | 254 | this.detailStatus = false; |
256 | - this.loadData(1, null, null, null, null, null, null); | ||
257 | }, | 255 | }, |
258 | onLoad(e) { | 256 | onLoad(e) { |
259 | // 隐藏原生的tabbar | 257 | // 隐藏原生的tabbar |
260 | uni.hideTabBar(); | 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 | let params = JSON.parse(e.type); | 262 | let params = JSON.parse(e.type); |
263 | let type; | 263 | let type; |
264 | if (Array.isArray(params)) { | 264 | if (Array.isArray(params)) { |
@@ -267,12 +267,9 @@ export default { | @@ -267,12 +267,9 @@ export default { | ||
267 | type = params; | 267 | type = params; |
268 | } | 268 | } |
269 | this.loadData(1, type, null, null, null, null, null); | 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 | methods: { | 272 | methods: { |
275 | - ...mapActions(['updateBadgeTotal']), | ||
276 | inputChanged(e) { | 273 | inputChanged(e) { |
277 | this.loadData(1, null, null, null, null, null, null, e); | 274 | this.loadData(1, null, null, null, null, null, null, e); |
278 | }, | 275 | }, |
@@ -365,13 +362,17 @@ export default { | @@ -365,13 +362,17 @@ export default { | ||
365 | organizationId: organizationV, | 362 | organizationId: organizationV, |
366 | alarmType: alarmName | 363 | alarmType: alarmName |
367 | }; | 364 | }; |
365 | + if (statusV == '') { | ||
366 | + delete httpData.status; | ||
367 | + } | ||
368 | + if (severityV == '') { | ||
369 | + delete httpData.severity; | ||
370 | + } | ||
368 | uni.$u.http | 371 | uni.$u.http |
369 | .get('/yt/alarm', { params: httpData, custom: { load: false } }) | 372 | .get('/yt/alarm', { params: httpData, custom: { load: false } }) |
370 | .then(res => { | 373 | .then(res => { |
371 | uni.stopPullDownRefresh(); | 374 | uni.stopPullDownRefresh(); |
372 | this.mescroll.endByPage(res.items.length, res.total); | 375 | this.mescroll.endByPage(res.items.length, res.total); |
373 | - //异步实时更新告警徽标数 | ||
374 | - this.updateBadgeTotal(httpData); | ||
375 | this.alertTotal = res.total; | 376 | this.alertTotal = res.total; |
376 | if (pageNo == 1) { | 377 | if (pageNo == 1) { |
377 | this.list = res.items; | 378 | this.list = res.items; |
@@ -390,7 +391,6 @@ export default { | @@ -390,7 +391,6 @@ export default { | ||
390 | url: './org/org' | 391 | url: './org/org' |
391 | }); | 392 | }); |
392 | }, | 393 | }, |
393 | - open() {}, | ||
394 | close() { | 394 | close() { |
395 | this.show = false; | 395 | this.show = false; |
396 | }, | 396 | }, |
@@ -39,19 +39,19 @@ | @@ -39,19 +39,19 @@ | ||
39 | <text class="item-text home-text-muted">告警统计</text> | 39 | <text class="item-text home-text-muted">告警统计</text> |
40 | </view> | 40 | </view> |
41 | <view class="item-child-bottom u-flex"> | 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 | <view class="sigle-text"> | 43 | <view class="sigle-text"> |
44 | <text class="home-text-total">{{ alertData.noHandle }}</text> | 44 | <text class="home-text-total">{{ alertData.noHandle }}</text> |
45 | </view> | 45 | </view> |
46 | <view class="sigle-value"><text class="home-text-total-bottom">未处理</text></view> | 46 | <view class="sigle-value"><text class="home-text-total-bottom">未处理</text></view> |
47 | </view> | 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 | <view class="sigle-text"> | 49 | <view class="sigle-text"> |
50 | <text class="home-text-total">{{ alertData.doneHandle }}</text> | 50 | <text class="home-text-total">{{ alertData.doneHandle }}</text> |
51 | </view> | 51 | </view> |
52 | <view class="sigle-value"><text class="home-text-total-bottom">已处理</text></view> | 52 | <view class="sigle-value"><text class="home-text-total-bottom">已处理</text></view> |
53 | </view> | 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 | <view class="sigle-text"> | 55 | <view class="sigle-text"> |
56 | <text class="home-text-total">{{ alertData.errorReport }}</text> | 56 | <text class="home-text-total">{{ alertData.errorReport }}</text> |
57 | </view> | 57 | </view> |
@@ -97,6 +97,7 @@ | @@ -97,6 +97,7 @@ | ||
97 | 97 | ||
98 | <script> | 98 | <script> |
99 | import fTabbar from '@/components/module/f-tabbar/f-tabbar'; | 99 | import fTabbar from '@/components/module/f-tabbar/f-tabbar'; |
100 | +import { mapActions } from 'vuex'; | ||
100 | 101 | ||
101 | export default { | 102 | export default { |
102 | components: { | 103 | components: { |
@@ -122,22 +123,20 @@ export default { | @@ -122,22 +123,20 @@ export default { | ||
122 | this.getDeviceTotalData(); | 123 | this.getDeviceTotalData(); |
123 | }, | 124 | }, |
124 | methods: { | 125 | methods: { |
126 | + ...mapActions(['updateBadgeTotal']), | ||
125 | getDeviceTotalData() { | 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 | openCamera() { | 141 | openCamera() { |
143 | uni.navigateTo({ | 142 | uni.navigateTo({ |
@@ -149,18 +148,8 @@ export default { | @@ -149,18 +148,8 @@ export default { | ||
149 | url: 'configuration/configuration' | 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 | uni.reLaunch({ | 153 | uni.reLaunch({ |
165 | url: '../alarm/alarm?type=' + JSON.stringify(e) | 154 | url: '../alarm/alarm?type=' + JSON.stringify(e) |
166 | }); | 155 | }); |
@@ -8,25 +8,26 @@ | @@ -8,25 +8,26 @@ | ||
8 | <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> | 8 | <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> |
9 | <block v-if="userInfo.isToken"> | 9 | <block v-if="userInfo.isToken"> |
10 | <view @click="openPersonalInfo" class="u-m-r-20"> | 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 | </view> | 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 | <view class="name u-m-r-10" v-if="userInfo.realName || userInfo.nickName"> | 15 | <view class="name u-m-r-10" v-if="userInfo.realName || userInfo.nickName"> |
16 | <text style="#FFFFFF;font-size: 18px;">{{ userInfo.realName || userInfo.nickName }}</text> | 16 | <text style="#FFFFFF;font-size: 18px;">{{ userInfo.realName || userInfo.nickName }}</text> |
17 | </view> | 17 | </view> |
18 | </view> | 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 | <view v-else><text style="color:#FFFFFF;font-size: 14px;">手机号:未绑定</text></view> | 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 | </view> | 22 | </view> |
22 | </block> | 23 | </block> |
23 | <block v-else> | 24 | <block v-else> |
24 | <view class="u-m-r-20" @click="openLoginFunc"> | 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 | </view> | 27 | </view> |
27 | <view class="u-flex-1"> | 28 | <view class="u-flex-1"> |
28 | <view @click="openLoginFunc" class="u-font-lg click-login login-btn ">请点击登录</view> | 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 | </view> | 31 | </view> |
31 | </block> | 32 | </block> |
32 | <view v-if="userInfo.isToken"><u-icon name="arrow-right" color="white" size="13"></u-icon></view> | 33 | <view v-if="userInfo.isToken"><u-icon name="arrow-right" color="white" size="13"></u-icon></view> |
@@ -55,7 +56,7 @@ | @@ -55,7 +56,7 @@ | ||
55 | </view> | 56 | </view> |
56 | <view class="u-flex-1"> | 57 | <view class="u-flex-1"> |
57 | <view @click="openLoginFunc" class="u-font-lg login-btn">登录</view> | 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 | </view> | 60 | </view> |
60 | </block> | 61 | </block> |
61 | <view><u-icon name="arrow-right" color="black" size="13"></u-icon></view> | 62 | <view><u-icon name="arrow-right" color="black" size="13"></u-icon></view> |
@@ -75,8 +76,8 @@ | @@ -75,8 +76,8 @@ | ||
75 | <view class="nav-right"><image class="image" src="../../static/arrow-right.png"></image></view> | 76 | <view class="nav-right"><image class="image" src="../../static/arrow-right.png"></image></view> |
76 | </view> | 77 | </view> |
77 | </view> | 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 | </view> | 81 | </view> |
81 | </view> | 82 | </view> |
82 | <!-- 绑定账号 --> | 83 | <!-- 绑定账号 --> |
@@ -95,7 +96,6 @@ | @@ -95,7 +96,6 @@ | ||
95 | type="password" | 96 | type="password" |
96 | placeholder="登录密码" | 97 | placeholder="登录密码" |
97 | v-model="bindAccountObj.appUserSecret" | 98 | v-model="bindAccountObj.appUserSecret" |
98 | - @change="passwordChange" | ||
99 | ></u--input> | 99 | ></u--input> |
100 | </view> | 100 | </view> |
101 | <view class="u-flex item-phone"> | 101 | <view class="u-flex item-phone"> |
@@ -159,6 +159,7 @@ import base from '@/config/baseUrl'; | @@ -159,6 +159,7 @@ import base from '@/config/baseUrl'; | ||
159 | import fTabbar from '@/components/module/f-tabbar/f-tabbar'; | 159 | import fTabbar from '@/components/module/f-tabbar/f-tabbar'; |
160 | import fNavbar from '@/components/module/f-navbar/f-navbar'; | 160 | import fNavbar from '@/components/module/f-navbar/f-navbar'; |
161 | import { mapState, mapMutations } from 'vuex'; | 161 | import { mapState, mapMutations } from 'vuex'; |
162 | +import { appId } from '@/config/constant.js'; | ||
162 | 163 | ||
163 | export default { | 164 | export default { |
164 | components: { | 165 | components: { |
@@ -191,9 +192,10 @@ export default { | @@ -191,9 +192,10 @@ export default { | ||
191 | onLoad(e) { | 192 | onLoad(e) { |
192 | // 隐藏原生的tabbar | 193 | // 隐藏原生的tabbar |
193 | uni.hideTabBar(); | 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 | this.thirdObj = params; | 197 | this.thirdObj = params; |
198 | + console.log(this.thirdObj); | ||
197 | } | 199 | } |
198 | }, | 200 | }, |
199 | computed: { | 201 | computed: { |
@@ -437,6 +439,18 @@ export default { | @@ -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,7 +17,7 @@ | ||
17 | </view> | 17 | </view> |
18 | <view class="form-row u-flex"> | 18 | <view class="form-row u-flex"> |
19 | <view class="v-input"><input type="text" v-model="loginForm.password" maxlength="32" placeholder="请输入登录密码" :password="!showPassword" /></view> | 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 | <u-icon></u-icon> | 21 | <u-icon></u-icon> |
22 | </view> | 22 | </view> |
23 | <button class="submit" size="default" @click="onSubmitFunc"><text class="text">登录</text></button> | 23 | <button class="submit" size="default" @click="onSubmitFunc"><text class="text">登录</text></button> |
@@ -81,11 +81,13 @@ export default { | @@ -81,11 +81,13 @@ export default { | ||
81 | methods: { | 81 | methods: { |
82 | ...mapMutations(['setUserInfo']), | 82 | ...mapMutations(['setUserInfo']), |
83 | //微信授权登录 | 83 | //微信授权登录 |
84 | + //#ifdef MP | ||
84 | onAuthorization(e) { | 85 | onAuthorization(e) { |
85 | wx.getUserProfile({ | 86 | wx.getUserProfile({ |
86 | desc: '获取用户信息', | 87 | desc: '获取用户信息', |
87 | success: res => { | 88 | success: res => { |
88 | if (res) { | 89 | if (res) { |
90 | + //微信官方自带解密(node) | ||
89 | let pc = new WXBizDataCrypt(appId, this.session_key); | 91 | let pc = new WXBizDataCrypt(appId, this.session_key); |
90 | let data = pc.decryptData(res.encryptedData, res.iv); | 92 | let data = pc.decryptData(res.encryptedData, res.iv); |
91 | let obj = { | 93 | let obj = { |
@@ -98,6 +100,10 @@ export default { | @@ -98,6 +100,10 @@ export default { | ||
98 | .get(`/yt/third/login/${this.openid}`) | 100 | .get(`/yt/third/login/${this.openid}`) |
99 | .then(res => { | 101 | .then(res => { |
100 | if (res.token == '' || res.token == null) { | 102 | if (res.token == '' || res.token == null) { |
103 | + //需要绑定,跳转我的页面 | ||
104 | + uni.reLaunch({ | ||
105 | + url: '/pages/personal/personal' | ||
106 | + }); | ||
101 | } else { | 107 | } else { |
102 | // 储存登录信息 | 108 | // 储存登录信息 |
103 | let resObj = { | 109 | let resObj = { |
@@ -116,9 +122,6 @@ export default { | @@ -116,9 +122,6 @@ export default { | ||
116 | icon: 'none' | 122 | icon: 'none' |
117 | }); | 123 | }); |
118 | this.saveUserInfo(); | 124 | this.saveUserInfo(); |
119 | - // return uni.showToast({ | ||
120 | - // title: '不需要绑定' | ||
121 | - // }); | ||
122 | } | 125 | } |
123 | }) | 126 | }) |
124 | .catch(e => { | 127 | .catch(e => { |
@@ -127,7 +130,7 @@ export default { | @@ -127,7 +130,7 @@ export default { | ||
127 | // #ifdef APP-PLUS||MP | 130 | // #ifdef APP-PLUS||MP |
128 | setTimeout(() => { | 131 | setTimeout(() => { |
129 | uni.reLaunch({ | 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 | }, 500); | 135 | }, 500); |
133 | // #endif | 136 | // #endif |
@@ -135,6 +138,7 @@ export default { | @@ -135,6 +138,7 @@ export default { | ||
135 | } | 138 | } |
136 | }); | 139 | }); |
137 | }, | 140 | }, |
141 | + //#endif | ||
138 | saveUserInfo() { | 142 | saveUserInfo() { |
139 | //储存个人信息 | 143 | //储存个人信息 |
140 | uni.$u.http.get('/yt/user/me/info').then(res => { | 144 | uni.$u.http.get('/yt/user/me/info').then(res => { |
@@ -120,5 +120,6 @@ | @@ -120,5 +120,6 @@ | ||
120 | background: linear-gradient(241deg, #00c9a7 0%, rgba(0, 223, 252, 0.5) 100%); | 120 | background: linear-gradient(241deg, #00c9a7 0%, rgba(0, 223, 252, 0.5) 100%); |
121 | opacity: 0.1; | 121 | opacity: 0.1; |
122 | transform: rotate(180deg); | 122 | transform: rotate(180deg); |
123 | + z-index: -9999; | ||
123 | } | 124 | } |
124 | } | 125 | } |
@@ -34,29 +34,7 @@ export const actions = { | @@ -34,29 +34,7 @@ export const actions = { | ||
34 | state, | 34 | state, |
35 | commit | 35 | commit |
36 | }, data) { | 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,17 +23,11 @@ | ||
23 | </view> | 23 | </view> |
24 | </view> | 24 | </view> |
25 | </view> | 25 | </view> |
26 | - <f-tabbar></f-tabbar> | ||
27 | </view> | 26 | </view> |
28 | </template> | 27 | </template> |
29 | 28 | ||
30 | <script> | 29 | <script> |
31 | -import fTabbar from '@/components/module/f-tabbar/f-tabbar'; | ||
32 | - | ||
33 | export default { | 30 | export default { |
34 | - components: { | ||
35 | - fTabbar | ||
36 | - }, | ||
37 | data() { | 31 | data() { |
38 | return { | 32 | return { |
39 | notifyList: {} | 33 | notifyList: {} |
@@ -43,11 +37,14 @@ export default { | @@ -43,11 +37,14 @@ export default { | ||
43 | // 隐藏原生的tabbar | 37 | // 隐藏原生的tabbar |
44 | uni.hideTabBar(); | 38 | uni.hideTabBar(); |
45 | if (e.data !== null) { | 39 | if (e.data !== null) { |
46 | - let params = JSON.parse(e.data); | 40 | + let params = JSON.parse(decodeURIComponent(e.data)); |
47 | if (params) this.notifyList = params; | 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 | </script> | 49 | </script> |
53 | 50 |
@@ -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 | }; |