Commit 68cd0f1a4b9a5e59cdd3f59469221218227699b0

Authored by fengtao
1 parent 5aab4f02

feat:新增通知管理接口,通知详情接口,新增告警分页接口,新增告警详情接口,新增告警处理接口,新增告警筛选接口

... ... @@ -15,12 +15,8 @@
15 15 <block v-for="(item, index) in list" :key="index">
16 16 <!-- 自定义icon -->
17 17 <u-tabbar-item :text="item.name" :badge="item.badge" :dot="item.dot" :badgeStyle="item.badgeStyle">
18   - <view slot="active-icon">
19   - <view class="custom-icon" :class="['custom-icon-' + item.iconFill]" style="font-size: 20px;" :style="{ color: activeColor }"></view>
20   - </view>
21   - <view slot="inactive-icon">
22   - <view class="custom-icon" :class="['custom-icon-' + item.icon]" style="font-size: 20px;" :style="{ color: inactiveColor }"></view>
23   - </view>
  18 + <view slot="active-icon"><image style="width:30rpx;height: 30rpx;" :src="item.iconFill" mode=""></image></view>
  19 + <view slot="inactive-icon"><image style="width:30rpx;height: 30rpx;" :src="item.icon" mode=""></image></view>
24 20 </u-tabbar-item>
25 21 </block>
26 22 </u-tabbar>
... ... @@ -90,32 +86,47 @@ export default {
90 86 {
91 87 name: '首页',
92 88 url: 'pages/index/index',
93   - icon: 'home',
94   - iconFill: 'home-filling'
  89 + icon: '../../../static/homw-un.png',
  90 + iconFill: '../../../static/home-yes.png'
95 91 },
96 92 {
97 93 name: '设备',
98 94 url: 'pages/device/device',
99   - icon: 'shangpin',
100   - iconFill: 'shangpin-filling'
  95 + icon: '../../../static/device-un.png',
  96 + iconFill: '../../../static/device-yes.png'
101 97 },
102 98 {
103 99 name: '告警',
104 100 url: 'pages/alert/alert',
105   - icon: 'shangpin',
106   - iconFill: 'shangpin-filling',
107   - badge: 16
  101 + icon: '../../../static/alert-un.png',
  102 + iconFill: '../../../static/alert-yes.png',
  103 + badge: 0
108 104 },
109 105 {
110 106 name: '我的',
111 107 url: 'pages/personal/personal',
112   - icon: 'my',
113   - iconFill: 'my-filling'
  108 + icon: '../../../static/my-un.png',
  109 + iconFill: '../../../static/my-yes.png'
114 110 }
115 111 ]
116 112 };
117 113 },
  114 + onLoad() {},
118 115 created() {
  116 + let httpData = {
  117 + page: 1,
  118 + pageSize: 10,
  119 + entityType: 'DEVICE',
  120 + entityId: ''
  121 + };
  122 + uni.$u.http
  123 + .get('/yt/alarm', { params: httpData })
  124 + .then(res => {
  125 + this.list[2].badge = res.total;
  126 + })
  127 + .catch(e => {
  128 + uni.$u.toast(e.data.message);
  129 + });
119 130 //获取页面路径
120 131 let currentPages = getCurrentPages();
121 132 let page = currentPages[currentPages.length - 1];
... ...
... ... @@ -6,14 +6,26 @@ import {
6 6
7 7 // 初始化请求配置
8 8 uni.$u.http.setConfig((config) => {
9   - let token = store.state.userInfo.isToken || (uni.getStorageSync('userInfo').isToken || undefined)
  9 + let token
  10 + token = store.state.userInfo.isToken || (uni.getStorageSync('userInfo').isToken || undefined)
10 11 //#ifdef MP
11   - let token = store.state.userInfo.isToken || (wx.getStorageSync('userInfo').isToken || undefined)
  12 + token = store.state.userInfo.isToken || (wx.getStorageSync('userInfo').isToken || undefined)
12 13 //#endif
13 14 // #ifdef H5
14 15 window.sessionStorage.getItem('userInfo');
15 16 // #endif
16   - console.log('获取token', token);
  17 + console.log('Get Token',token);
  18 + if (!token) {
  19 + uni.showToast({
  20 + title: '请先登录',
  21 + icon: 'none'
  22 + });
  23 + setTimeout(() => {
  24 + uni.reLaunch({
  25 + url: '/pages/personal/personal'
  26 + })
  27 + }, 500)
  28 + }
17 29 /* config 为默认全局配置*/
18 30 config.baseURL = base.baseUrl; /* 根域名 */
19 31 config.header = {
... ... @@ -84,16 +96,17 @@ uni.$u.http.interceptors.response.use((response) => {
84 96 }
85 97 }
86 98 }, (response) => {
87   - console.log('Error', response);
88 99 // 关闭加载动画
89 100 store.commit("setLoadingShow", false);
90 101 // 对响应错误做点什么 (statusCode !== 200)
91 102 let errorData = '请检查网络或服务器'
92   - let message = response.errMsg || response.errMsg
  103 + let message = response.data.message || response.errMsg
93 104 if (message == "request:fail url not in domain list") {
94 105 errorData = '检查请求域名是否添加了域名白名单'
95 106 } else if (message == 'request:fail timeout') {
96 107 errorData = '请求超时:请检查网络'
  108 + } else if (message == 'Token has expired') {
  109 + errorData = 'Token失效,请重新登录'
97 110 } else {
98 111 errorData = message || '请检查网络或服务器'
99 112 }
... ...
... ... @@ -27,16 +27,26 @@
27 27 </view>
28 28 <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback">
29 29 <view class="device-list">
30   - <view @click="openAlertDetail(item.id)" class="list-item" v-for="(item, index) in list" :key="index">
  30 + <view @click="openAlertDetail(item)" class="list-item" v-for="(item, index) in list" :key="index">
31 31 <view class="u-flex item" style="justify-content: flex-start;flex-direction: column;align-items: center;">
32 32 <view style="width: 400rpx;text-align: left;">
33   - <text style="color:#333333;font-size: 15px;">{{ item.deviceName }}</text>
  33 + <text style="color:#333333;font-size: 15px;">{{ item.deviceName == null ? '暂无数据' : item.deviceName }}</text>
34 34 </view>
35 35 <view style="width: 400rpx;text-align: left;">
36   - <text style="color:#666666;font-size: 15px;">{{ item.name2 }}</text>
  36 + <text style="color:#666666;font-size: 15px;">{{ item.details == null ? '暂无数据' : item.details.data }}</text>
37 37 </view>
38 38 <view style="width: 400rpx;text-align: left;">
39   - <text style="color:#666666;font-size: 15px;">{{ item.status }}</text>
  39 + <text style="color:#666666;font-size: 15px;">
  40 + {{
  41 + item.status == 'CLEARED_UNACK'
  42 + ? '清除未确认'
  43 + : item.status == 'ACTIVE_UNACK'
  44 + ? '激活未确认'
  45 + : item.status == 'CLEARED_ACK'
  46 + ? '清除已确认'
  47 + : '激活已确认'
  48 + }}
  49 + </text>
40 50 </view>
41 51 <view style="width: 400rpx;text-align: left;">
42 52 <text style="color:#999999;font-size: 15px;">{{ item.createdTime }}</text>
... ... @@ -44,9 +54,34 @@
44 54 </view>
45 55 <view class="item">
46 56 <view class="u-flex" style="flex-direction: row;margin-top: -6rpx;">
47   - <image style="width: 30rpx;height: 30rpx;margin-top: 5rpx;margin-right: 5rpx;" :src="item.name4" mode=""></image>
  57 + <image style="width: 30rpx;height: 30rpx;margin-top: 5rpx;margin-right: 5rpx;" :src="bindImageUrl(item.severity)" mode=""></image>
48 58 <view class="">
49   - <text style="color: #333333;font-size: 13px;margin-left: 5rpx;margin-top: 20rpx;">{{ item.severity }}</text>
  59 + <text
  60 + :style="[
  61 + item.severity == 'CRITICAL'
  62 + ? { color: '#DE4437' }
  63 + : item.severity == 'MAJOR'
  64 + ? { color: '#DE7337' }
  65 + : item.severity == 'MINOR'
  66 + ? { color: '#FFC107' }
  67 + : item.severity == 'WARNING'
  68 + ? { color: '#DE4437' }
  69 + : { color: '#00C9A7' }
  70 + ]"
  71 + style="color: #333333;font-size: 13px;margin-left: 5rpx;margin-top: 20rpx;"
  72 + >
  73 + {{
  74 + item.severity == 'CRITICAL'
  75 + ? '危险'
  76 + : item.severity == 'MAJOR'
  77 + ? '重要'
  78 + : item.severity == 'MINOR'
  79 + ? '次要'
  80 + : item.severity == 'WARNING'
  81 + ? '警告'
  82 + : '不确定'
  83 + }}
  84 + </text>
50 85 </view>
51 86 </view>
52 87 </view>
... ... @@ -66,6 +101,8 @@
66 101 flex-wrap: wrap;justify-content: space-between; align-content: space-between;"
67 102 >
68 103 <view
  104 + @click="getAlertStatus(item, index)"
  105 + :style="[index == current1 ? { background: '#377DFF' } : { background: '#F6F6F6' }]"
69 106 v-for="(item, index) in alertStatus"
70 107 :key="index"
71 108 style="margin: 10rpx;line-height: 50rpx;text-align: center;
... ... @@ -84,6 +121,8 @@
84 121 flex-wrap: wrap;justify-content: space-between; align-content: space-between;"
85 122 >
86 123 <view
  124 + @click="getTypeStatus(item, index)"
  125 + :style="[index == current2 ? { background: '#377DFF' } : { background: '#F6F6F6' }]"
87 126 v-for="(item, index) in deviceType"
88 127 :key="index"
89 128 style="margin: 10rpx;line-height: 50rpx;text-align: center;
... ... @@ -102,6 +141,8 @@
102 141 flex-wrap: wrap;justify-content: space-between; align-content: space-between;"
103 142 >
104 143 <view
  144 + @click="getLevelStatus(item, index)"
  145 + :style="[index == current3 ? { background: '#377DFF' } : { background: '#F6F6F6' }]"
105 146 v-for="(item, index) in alertLevel"
106 147 :key="index"
107 148 style="margin: 10rpx;line-height: 50rpx;text-align: center;
... ... @@ -120,6 +161,8 @@
120 161 flex-wrap: wrap;justify-content: space-between; align-content: space-between;"
121 162 >
122 163 <view
  164 + @click="getTimeStatus(item, index)"
  165 + :style="[index == current4 ? { background: '#377DFF' } : { background: '#F6F6F6' }]"
123 166 v-for="(item, index) in timeArea"
124 167 :key="index"
125 168 style="margin: 10rpx;line-height: 50rpx;text-align: center;
... ... @@ -150,8 +193,8 @@
150 193 </view>
151 194 </view>
152 195 <view class="u-flex" style="flex-direction: row;margin-top: 128rpx;margin-left: 55rpx;">
153   - <view style="width: 300rpx"><u-button type="info" shape="circle" text="重置"></u-button></view>
154   - <view style="width: 300rpx;margin-left:46rpx ;"><u-button type="primary" shape="circle" text="确认"></u-button></view>
  196 + <view style="width: 300rpx"><u-button @click="resetData" type="info" shape="circle" text="重置"></u-button></view>
  197 + <view style="width: 300rpx;margin-left:46rpx ;"><u-button @click="queryData" type="primary" shape="circle" text="确认"></u-button></view>
155 198 </view>
156 199 <view style="height: 30rpx;"></view>
157 200 </view>
... ... @@ -183,8 +226,18 @@ export default {
183 226 },
184 227 data() {
185 228 return {
  229 + alertStatusVal: '',
  230 + deviceTypeVal: '',
  231 + alertLevelVal: '',
  232 + selectTimeVal: '',
  233 + startTime: '',
  234 + endTime: '',
  235 + current1: 0,
  236 + current2: 0,
  237 + current3: 0,
  238 + current4: 0,
186 239 page: {
187   - num: 1,
  240 + num: 0,
188 241 size: 10
189 242 },
190 243 downOption: {
... ... @@ -192,45 +245,45 @@ export default {
192 245 },
193 246 timeData: {
194 247 selectTime: '',
195   - getTimeGap: ''
  248 + getTimeGap: '',
  249 + getDateVal: ''
196 250 },
197 251 showCalendar: false,
198 252 show: false,
199 253 list: [],
200 254 alertStatus: [
201 255 {
202   - index: 1,
  256 + index: 0,
203 257 name: '全部',
  258 + value: '',
204 259 bgColor: '#377DFF',
205 260 textColor: '#377DFF'
206 261 },
207 262 {
208   - index: 2,
  263 + index: 1,
209 264 name: '激活未确认',
  265 + value: 'ACTIVE_UNACK',
210 266 bgColor: '#F6F6F6',
211 267 textColor: '#F6F6F6'
212 268 },
213 269 {
214   - index: 3,
  270 + index: 2,
215 271 name: '激活已确认',
  272 + value: 'ACTIVE_ACK',
216 273 bgColor: '#F6F6F6',
217 274 textColor: '#F6F6F6'
218 275 },
219 276 {
220   - index: 4,
  277 + index: 3,
221 278 name: '清除未确认',
  279 + value: 'CLEARED_UNACK',
222 280 bgColor: '#F6F6F6',
223 281 textColor: '#F6F6F6'
224 282 },
225 283 {
226   - index: 5,
227   - name: '清除已确认',
228   - bgColor: '#F6F6F6',
229   - textColor: '#F6F6F6'
230   - },
231   - {
232   - index: 6,
  284 + index: 4,
233 285 name: '清除已确认',
  286 + value: 'CLEARED_ACK',
234 287 bgColor: '#F6F6F6',
235 288 textColor: '#F6F6F6'
236 289 }
... ... @@ -239,24 +292,28 @@ export default {
239 292 {
240 293 index: 1,
241 294 name: '全部',
  295 + value: '',
242 296 bgColor: '#377DFF',
243 297 textColor: '#377DFF'
244 298 },
245 299 {
246 300 index: 2,
247 301 name: '网关设备',
  302 + value: 'GATEWAY',
248 303 bgColor: '#F6F6F6',
249 304 textColor: '#F6F6F6'
250 305 },
251 306 {
252 307 index: 3,
253 308 name: '网关子设备',
  309 + value: 'SENSOR',
254 310 bgColor: '#F6F6F6',
255 311 textColor: '#F6F6F6'
256 312 },
257 313 {
258 314 index: 4,
259 315 name: '直连设备',
  316 + value: 'DIRECT_CONNECTION',
260 317 bgColor: '#F6F6F6',
261 318 textColor: '#F6F6F6'
262 319 }
... ... @@ -265,36 +322,42 @@ export default {
265 322 {
266 323 index: 1,
267 324 name: '全部',
  325 + value: '',
268 326 bgColor: '#377DFF',
269 327 textColor: '#377DFF'
270 328 },
271 329 {
272 330 index: 2,
273 331 name: '危险',
  332 + value: 'CRITICAL',
274 333 bgColor: '#F6F6F6',
275 334 textColor: '#F6F6F6'
276 335 },
277 336 {
278 337 index: 3,
279 338 name: '重要',
  339 + value: 'MAJOR',
280 340 bgColor: '#F6F6F6',
281 341 textColor: '#F6F6F6'
282 342 },
283 343 {
284 344 index: 4,
285 345 name: '次要',
  346 + value: 'MINOR',
286 347 bgColor: '#F6F6F6',
287 348 textColor: '#F6F6F6'
288 349 },
289 350 {
290   - index: 4,
  351 + index: 5,
291 352 name: '警告',
  353 + value: 'WARNING',
292 354 bgColor: '#F6F6F6',
293 355 textColor: '#F6F6F6'
294 356 },
295 357 {
296   - index: 4,
  358 + index: 6,
297 359 name: '不确定',
  360 + value: 'INDETERMINATE',
298 361 bgColor: '#F6F6F6',
299 362 textColor: '#F6F6F6'
300 363 }
... ... @@ -334,40 +397,103 @@ export default {
334 397 value: '24',
335 398 bgColor: '#F6F6F6',
336 399 textColor: '#F6F6F6'
337   - },
338   - {
339   - index: 6,
340   - name: '',
341   - value: '',
342   - bgColor: '#F6F6F6',
343   - textColor: '#F6F6F6'
344 400 }
345 401 ]
346 402 };
347 403 },
  404 + onShow() {
  405 + console.log('Show');
  406 + this.loadData(1);
  407 + },
348 408 onLoad(e) {
349 409 // 隐藏原生的tabbar
350 410 uni.hideTabBar();
351 411 },
352 412 methods: {
  413 + getAlertStatus(e, i) {
  414 + this.current1 = i;
  415 + this.alertStatusVal = e.value;
  416 + },
  417 + getTypeStatus(e, i) {
  418 + this.current2 = i;
  419 + this.deviceTypeVal = e.value;
  420 + },
  421 + getLevelStatus(e, i) {
  422 + this.current3 = i;
  423 + this.alertLevelVal = e.value;
  424 + },
  425 + getTimeStatus(e, i) {
  426 + this.current4 = i;
  427 + this.selectTimeVal = e.value;
  428 + },
  429 + queryData() {
  430 + let date1 = new Date(this.timeData.getDateVal[0]);
  431 + let date2 = new Date(this.timeData.getDateVal[this.timeData.getDateVal.length - 1]);
  432 + let startTimeVa, endTimeVa;
  433 + if (this.timeData.getDateVal.length == 0) {
  434 + startTimeVa = '';
  435 + endTimeVa = '';
  436 + } else {
  437 + startTimeVa = date1.getTime();
  438 + endTimeVa = date2.getTime();
  439 + }
  440 + this.loadData(1, this.alertStatusVal, startTimeVa, endTimeVa, this.alertLevelVal, this.deviceTypeVal);
  441 + this.show = false;
  442 + },
  443 + resetData() {
  444 + this.current1 = 0;
  445 + this.alertStatusVal = '';
  446 + this.current2 = 0;
  447 + this.deviceTypeVal = '';
  448 + this.current3 = 0;
  449 + this.alertLevelVal = '';
  450 + this.current4 = 0;
  451 + this.selectTimeVal = '';
  452 + },
  453 + bindImageUrl(e) {
  454 + switch (e) {
  455 + case 'CRITICAL':
  456 + return '../../static/danger.png';
  457 + break;
  458 + case 'MAJOR':
  459 + return '../../static/major.png';
  460 + break;
  461 + case 'MINOR':
  462 + return '../../static/secondary.png';
  463 + break;
  464 + case 'WARNING':
  465 + return '../../static/danger.png';
  466 + break;
  467 + case 'INDETERMINATE':
  468 + return '../../static/noshue.png';
  469 + break;
  470 + default:
  471 + return '';
  472 + break;
  473 + }
  474 + },
353 475 /*下拉刷新的回调 */
354 476 downCallback() {
355 477 //联网加载数据
  478 + this.list.length = 0;
  479 + this.page.num = 1;
356 480 this.loadData(1);
357 481 },
358 482 /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
359 483 upCallback() {
360 484 //联网加载数据
361   - // this.page.num+=10
  485 + this.page.num += 1;
362 486 this.loadData(this.page.num);
363 487 },
364   - // 特价商品
365   - loadData(pageNo) {
  488 + loadData(pageNo, statusV, startTimeV, endTimeV, severityV, deviceTypeV) {
366 489 let httpData = {
367 490 page: pageNo,
368 491 pageSize: 10,
369   - entityType: 'DEVICE',
370   - entityId: ''
  492 + status: statusV,
  493 + startTime: startTimeV,
  494 + endTime: endTimeV,
  495 + severity: severityV,
  496 + deviceType: deviceTypeV
371 497 };
372 498 uni.$u.http
373 499 .get('/yt/alarm', { params: httpData, custom: { load: false } })
... ... @@ -376,14 +502,12 @@ export default {
376 502 this.mescroll.endByPage(res.items.length, res.total);
377 503 if (pageNo == 1) {
378 504 this.list = res.items;
379   - console.log(this.list);
380 505 } else {
381 506 this.list = this.list.concat(res.items);
382   - console.log(this.list);
383 507 }
384 508 })
385 509 .catch(e => {
386   - console.log(e);
  510 + uni.$u.toast(e.data.message);
387 511 //联网失败, 结束加载
388 512 this.mescroll.endErr();
389 513 });
... ... @@ -399,6 +523,7 @@ export default {
399 523 },
400 524 openSearchDialog() {
401 525 this.show = true;
  526 + this.resetData();
402 527 },
403 528 hideKeyboard() {
404 529 uni.hideKeyboard();
... ... @@ -406,13 +531,23 @@ export default {
406 531 calendarConfirm(e) {
407 532 this.showCalendar = false;
408 533 this.timeData.selectTime = `${e[0]} / ${e[e.length - 1]}`;
  534 + this.timeData.getDateVal = e;
409 535 },
410 536 calendarClose() {
411 537 this.showCalendar = false;
412 538 },
413   - openAlertDetail() {
  539 + openAlertDetail(e) {
  540 + let obj = {
  541 + id: e.id,
  542 + deviceName: e.deviceName,
  543 + severity: e.severity,
  544 + originatorType: e.originatorType,
  545 + details: e.details,
  546 + createdTime: e.createdTime,
  547 + status: e.status
  548 + };
414 549 uni.navigateTo({
415   - url: './alertDetail'
  550 + url: './alertDetail?data=' + JSON.stringify(obj)
416 551 });
417 552 }
418 553 }
... ...
... ... @@ -3,14 +3,63 @@
3 3 <!-- 公共组件-每个页面必须引入 -->
4 4 <public-module></public-module>
5 5 <view style="border-radius: 20px;width: 688rpx;height: 573rpx;background-color: #FFFFFF;">
6   - <u-list @scrolltolower="scrolltolower">
7   - <u-list-item v-for="(item, index) in list" :key="index"><u-cell :title="item.name" :value="item.val"></u-cell></u-list-item>
8   - </u-list>
  6 + <view class="u-flex" style="height: 573rpx;justify-content:space-between;flex-direction: column;align-items: center;">
  7 + <view
  8 + class="u-flex"
  9 + style="flex-direction: row;justify-content: space-between;margin-top: 10rpx;line-height:68rpx;width: 614rpx;height:90rpx;text-align: left;border-bottom: 0.1rpx solid #F0F0F0;"
  10 + >
  11 + {{list}}
  12 + <text style="color:#333333;font-size: 15px;">{{ list.deviceName == null ? '暂无数据' : list.deviceName }}</text>
  13 + <image style="width: 30rpx;height: 30rpx;" src="../../static/alert-detail.png" mode=""></image>
  14 + </view>
  15 + <view style="margin-top: 10rpx;line-height:68rpx;width: 614rpx;height:90rpx;text-align: left;border-bottom: 0.1rpx solid #F0F0F0;">
  16 + <text style="color:#333333;font-size: 14px;">告警级别:</text>
  17 + <text style="color:#DE4437">
  18 + {{
  19 + item.severity == 'CRITICAL'
  20 + ? '危险'
  21 + : item.severity == 'MAJOR'
  22 + ? '重要'
  23 + : item.severity == 'MINOR'
  24 + ? '次要'
  25 + : item.severity == 'WARNING'
  26 + ? '警告'
  27 + : '不确定'
  28 + }}
  29 + </text>
  30 + </view>
  31 + <view style="margin-top: 10rpx;line-height:68rpx;width: 614rpx;height:90rpx;text-align: left;border-bottom: 0.1rpx solid #F0F0F0;">
  32 + <text style="color:#333333;font-size: 15px;">所属组织:</text>
  33 + <text style="color:#666666;font-size: 14px;">{{ list.originatorType }}</text>
  34 + </view>
  35 + <view style="margin-top: 10rpx;line-height:68rpx;width: 614rpx;height:90rpx;text-align: left;border-bottom: 0.1rpx solid #F0F0F0;">
  36 + <text style="color:#333333;font-size: 15px;">告警值:</text>
  37 + <text style="color:#666666;font-size: 14px;">{{ list.details == null ? '暂无数据' : list.details.data }}</text>
  38 + </view>
  39 + <view style="margin-top: 10rpx;line-height:68rpx;width: 614rpx;height:90rpx;text-align: left;border-bottom: 0.1rpx solid #F0F0F0;">
  40 + <text style="color:#333333;font-size: 15px;">告警时间:</text>
  41 + <text style="color:#666666;font-size: 14px;">{{ list.createdTime }}</text>
  42 + </view>
  43 + <view style="margin-top: 10rpx;line-height:68rpx;width: 614rpx;height:90rpx;text-align: left;border-bottom: 0.1rpx solid #F0F0F0;">
  44 + <text style="color:#333333;font-size: 15px;">告警状态:</text>
  45 + <text style="color:#DE4437;font-size: 14px;">
  46 + {{
  47 + item.status == 'CLEARED_UNACK'
  48 + ? '清除未确认'
  49 + : item.status == 'ACTIVE_UNACK'
  50 + ? '激活未确认'
  51 + : item.status == 'CLEARED_ACK'
  52 + ? '清除已确认'
  53 + : '激活已确认'
  54 + }}
  55 + </text>
  56 + </view>
  57 + </view>
9 58 </view>
10 59 <view style="color:#333333,font-size:15px;margin-top: 20rpx;">处理结果</view>
11 60 <view style="margin-top: 20rpx;;border-radius: 20px;width: 688rpx;height: 273rpx;background-color: #FFFFFF;">
12 61 <u--form labelPosition="left" :model="formModel" ref="form1">
13   - <u-form-item label="." prop="result" ref="item3">
  62 + <u-form-item label="." prop="result" ref="item3">
14 63 <u--textarea border="none" height="96" placeholder="请输入处理结果" v-model="formModel.result" count></u--textarea>
15 64 </u-form-item>
16 65 </u--form>
... ... @@ -31,40 +80,35 @@ export default {
31 80 formModel: {
32 81 result: ''
33 82 },
34   - list: [
35   - {
36   - name: '新疆1-59-25栏位网关子设备',
37   - val: '22'
38   - },
39   - {
40   - name: '告警级别',
41   - val: '危险'
42   - },
43   - {
44   - name: '所属组织',
45   - val: '1-59-25栏位'
46   - },
47   - {
48   - name: '告警值',
49   - val: '856'
50   - },
51   - {
52   - name: '告警时间',
53   - val: '2022-01-25 12:53:22'
54   - },
55   - {
56   - name: '告警状态',
57   - val: '激活未确认'
58   - }
59   - ]
  83 + list: {}
60 84 };
61 85 },
62 86 onLoad(e) {
  87 + if (e.data !== null) {
  88 + let params = JSON.parse(e.data);
  89 + this.list = params;
  90 + }
63 91 // 隐藏原生的tabbar
64 92 uni.hideTabBar();
65 93 },
66 94 methods: {
67   - handleSubmit() {}
  95 + handleSubmit() {
  96 + // console.log(this.formModel);
  97 + uni.$u.http
  98 + .post(`/alarm/${this.list.id}/ack`)
  99 + .then(res => {
  100 + uni.$u.toast('处理成功');
  101 + setTimeout(() => {
  102 + uni.navigateBack({
  103 + delta: 1
  104 + });
  105 + }, 500);
  106 + })
  107 + .catch(e => {
  108 + console.log(e);
  109 + uni.$u.toast(e);
  110 + });
  111 + }
68 112 }
69 113 };
70 114 </script>
... ...
  1 +<template>
  2 + <view class="u-page">
  3 + <u-navbar
  4 + title="表单"
  5 + @leftClick="navigateBack"
  6 + safeAreaInsetTop
  7 + fixed
  8 + placeholder
  9 + ></u-navbar>
  10 + <view class="u-demo-block">
  11 + <text class="u-demo-block__title">基础使用</text>
  12 + <view class="u-demo-block__content">
  13 + <!-- 注意,如果需要兼容微信小程序,最好通过setRules方法设置rules规则 -->
  14 + <u--form
  15 + labelPosition="left"
  16 + :model="model1"
  17 + ref="form1"
  18 + >
  19 + <u-form-item
  20 + label="姓名"
  21 + prop="userInfo.name"
  22 + borderBottom
  23 + ref="item1"
  24 + >
  25 + <u--input
  26 + v-model="model1.userInfo.name"
  27 + border="none"
  28 + placeholder="姓名,只能为中文"
  29 + ></u--input>
  30 + </u-form-item>
  31 + <u-form-item
  32 + label="性别"
  33 + prop="userInfo.sex"
  34 + borderBottom
  35 + @click="showSex = true; hideKeyboard()"
  36 + ref="item1"
  37 + >
  38 + <u--input
  39 + v-model="model1.userInfo.sex"
  40 + disabled
  41 + disabledColor="#ffffff"
  42 + placeholder="请选择性别"
  43 + border="none"
  44 + ></u--input>
  45 + <u-icon
  46 + slot="right"
  47 + name="arrow-right"
  48 + ></u-icon>
  49 + </u-form-item>
  50 + <u-form-item
  51 + label="水果"
  52 + prop="radiovalue1"
  53 + borderBottom
  54 + ref="item2"
  55 + >
  56 + <u-radio-group v-model="model1.radiovalue1">
  57 + <u-radio
  58 + :customStyle="{marginRight: '16px'}"
  59 + v-for="(item, index) in radiolist1"
  60 + :key="index"
  61 + :label="item.name"
  62 + :name="item.name"
  63 + >
  64 + </u-radio>
  65 + </u-radio-group>
  66 + </u-form-item>
  67 + <u-form-item
  68 + label="兴趣爱好"
  69 + prop="checkboxValue1"
  70 + borderBottom
  71 + labelWidth="80"
  72 + ref="item3"
  73 + >
  74 + <u-checkbox-group
  75 + v-model="model1.checkboxValue1"
  76 + shape="square"
  77 + @change="change"
  78 + >
  79 + <u-checkbox
  80 + :customStyle="{marginRight: '16px'}"
  81 + v-for="(item, index) in checkboxList1"
  82 + :key="index"
  83 + :label="item.name"
  84 + :name="item.name"
  85 + >
  86 + </u-checkbox>
  87 + </u-checkbox-group>
  88 + </u-form-item>
  89 + <u-form-item
  90 + label="简介"
  91 + prop="intro"
  92 + borderBottom
  93 + ref="item3"
  94 + >
  95 + <u--textarea
  96 + placeholder="不低于3个字"
  97 + v-model="model1.intro"
  98 + count
  99 + ></u--textarea>
  100 + </u-form-item>
  101 + <u-form-item
  102 + label="住店时间"
  103 + prop="hotel"
  104 + labelWidth="80"
  105 + borderBottom
  106 + @click="showCalendar = true; hideKeyboard()"
  107 + >
  108 + <u--input
  109 + v-model="model1.hotel"
  110 + disabled
  111 + disabledColor="#ffffff"
  112 + placeholder="请选择住店和离店时间"
  113 + border="none"
  114 + ></u--input>
  115 + <u-icon
  116 + slot="right"
  117 + name="arrow-right"
  118 + ></u-icon>
  119 + </u-form-item>
  120 + <u-form-item
  121 + label="验证码"
  122 + prop="code"
  123 + labelWidth="80"
  124 + borderBottom
  125 + >
  126 + <u--input
  127 + v-model="model1.code"
  128 + border="none"
  129 + placeholder="请填写验证码"
  130 + ></u--input>
  131 + <u-button
  132 + slot="right"
  133 + @tap="getCode"
  134 + :text="tips"
  135 + type="success"
  136 + size="mini"
  137 + :disabled="disabled1"
  138 + ></u-button>
  139 + </u-form-item>
  140 + <u-form-item
  141 + label="生日"
  142 + prop="userInfo.birthday"
  143 + borderBottom
  144 + @click="showBirthday = true; hideKeyboard()"
  145 + ref="item1"
  146 + >
  147 + <u--input
  148 + v-model="model1.userInfo.birthday"
  149 + disabled
  150 + disabledColor="#ffffff"
  151 + placeholder="请选择生日"
  152 + border="none"
  153 + ></u--input>
  154 + <u-icon
  155 + slot="right"
  156 + name="arrow-right"
  157 + ></u-icon>
  158 + </u-form-item>
  159 + </u--form>
  160 + <u-button
  161 + type="primary"
  162 + text="提交"
  163 + customStyle="margin-top: 50px"
  164 + @click="submit"
  165 + ></u-button>
  166 + <u-button
  167 + type="error"
  168 + text="重置"
  169 + customStyle="margin-top: 10px"
  170 + @click="reset"
  171 + ></u-button>
  172 + <u-action-sheet
  173 + :show="showSex"
  174 + :actions="actions"
  175 + title="请选择性别"
  176 + description="如果选择保密会报错"
  177 + @close="showSex = false"
  178 + @select="sexSelect"
  179 + >
  180 + </u-action-sheet>
  181 + <u-calendar
  182 + :show="showCalendar"
  183 + mode="range"
  184 + @confirm="calendarConfirm"
  185 + @close="calendarClose"
  186 + startText="住店"
  187 + endText="离店"
  188 + confirmDisabledText="请选择离店日期"
  189 + :formatter="formatter"
  190 + ></u-calendar>
  191 + <u-code
  192 + ref="uCode"
  193 + @change="codeChange"
  194 + seconds="20"
  195 + @start="disabled1 = true"
  196 + @end="disabled1 = false"
  197 + ></u-code>
  198 + <u-datetime-picker
  199 + :show="showBirthday"
  200 + :value="birthday"
  201 + mode="date"
  202 + closeOnClickOverlay
  203 + @confirm="birthdayConfirm"
  204 + @cancel="birthdayClose"
  205 + @close="birthdayClose"
  206 + ></u-datetime-picker>
  207 + </view>
  208 + </view>
  209 + </view>
  210 +</template>
  211 +
  212 +<script>
  213 + export default {
  214 + data() {
  215 + return {
  216 + fileList1: [],
  217 + disabled1: false,
  218 + tips: '',
  219 + value: '',
  220 + showCalendar: false,
  221 + showBirthday: false,
  222 + model1: {
  223 + userInfo: {
  224 + name: '楼兰',
  225 + sex: '',
  226 + birthday: ''
  227 + },
  228 + radiovalue1: '苹果',
  229 + checkboxValue1: [],
  230 + intro: '',
  231 + code: ''
  232 + },
  233 + showSex: false,
  234 + birthday: Number(new Date()),
  235 + actions: [{
  236 + name: '男',
  237 + },
  238 + {
  239 + name: '女',
  240 + },
  241 + {
  242 + name: '保密',
  243 + },
  244 + ],
  245 + rules: {
  246 + 'userInfo.name': [{
  247 + type: 'string',
  248 + required: true,
  249 + message: '请填写姓名',
  250 + trigger: ['blur', 'change']
  251 + }, {
  252 + // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
  253 + validator: (rule, value, callback) => {
  254 + // 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
  255 + return uni.$u.test.chinese(value);
  256 + },
  257 + message: "姓名必须为中文",
  258 + // 触发器可以同时用blur和change,二者之间用英文逗号隔开
  259 + trigger: ["change", "blur"],
  260 + }],
  261 + code: {
  262 + type: 'string',
  263 + required: true,
  264 + len: 4,
  265 + message: '请填写4位验证码',
  266 + trigger: ['blur']
  267 + },
  268 + 'userInfo.sex': {
  269 + type: 'string',
  270 + max: 1,
  271 + required: true,
  272 + message: '请选择男或女',
  273 + trigger: ['blur', 'change']
  274 + },
  275 + radiovalue1: {
  276 + type: 'string',
  277 + min: 1,
  278 + max: 2,
  279 + message: '橙子有毒',
  280 + trigger: ['change']
  281 + },
  282 + checkboxValue1: {
  283 + type: 'array',
  284 + min: 2,
  285 + required: true,
  286 + message: '不能太宅,至少选两项',
  287 + trigger: ['change']
  288 + },
  289 + intro: {
  290 + type: 'string',
  291 + min: 3,
  292 + required: true,
  293 + message: '不低于3个字',
  294 + trigger: ['change']
  295 + },
  296 + hotel: {
  297 + type: 'string',
  298 + min: 2,
  299 + required: true,
  300 + message: '请选择住店时间',
  301 + trigger: ['change']
  302 + },
  303 + 'userInfo.birthday': {
  304 + type: 'string',
  305 + required: true,
  306 + message: '请选择生日',
  307 + trigger: ['change']
  308 + },
  309 + },
  310 + radiolist1: [{
  311 + name: '苹果',
  312 + disabled: false
  313 + },
  314 + {
  315 + name: '香蕉',
  316 + disabled: false
  317 + },
  318 + {
  319 + name: '毒橙子',
  320 + disabled: false
  321 + }
  322 + ],
  323 + checkboxList1: [{
  324 + name: '羽毛球',
  325 + disabled: false
  326 + },
  327 + {
  328 + name: '跑步',
  329 + disabled: false
  330 + },
  331 + {
  332 + name: '爬山',
  333 + disabled: false
  334 + }
  335 + ]
  336 + }
  337 + },
  338 + onReady() {
  339 + // 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
  340 + this.$refs.form1.setRules(this.rules)
  341 + },
  342 + methods: {
  343 + afterRead(event) {
  344 + this.fileList1.push({
  345 + url: event.file,
  346 + status: 'uploading',
  347 + message: '上传中'
  348 + })
  349 + },
  350 + groupChange(n) {
  351 + // console.log('groupChange', n);
  352 + },
  353 + radioChange(n) {
  354 + // console.log('radioChange', n);
  355 + },
  356 + navigateBack() {
  357 + uni.navigateBack()
  358 + },
  359 + sexSelect(e) {
  360 + this.model1.userInfo.sex = e.name
  361 + this.$refs.form1.validateField('userInfo.sex')
  362 + },
  363 + change(e) {
  364 + // console.log(e);
  365 + },
  366 + formatter(day) {
  367 + const d = new Date()
  368 + let month = d.getMonth() + 1
  369 + const date = d.getDate()
  370 + if (day.month == month && day.day == date + 3) {
  371 + day.bottomInfo = '有优惠'
  372 + day.dot = true
  373 + }
  374 + return day
  375 + },
  376 + calendarConfirm(e) {
  377 + this.showCalendar = false
  378 + this.model1.hotel = `${e[0]} / ${e[e.length - 1]}`
  379 + this.$refs.form1.validateField('hotel')
  380 + },
  381 + codeChange(text) {
  382 + this.tips = text;
  383 + },
  384 + getCode() {
  385 + if (this.$refs.uCode.canGetCode) {
  386 + // 模拟向后端请求验证码
  387 + uni.showLoading({
  388 + title: '正在获取验证码'
  389 + })
  390 + setTimeout(() => {
  391 + uni.hideLoading();
  392 + // 这里此提示会被this.start()方法中的提示覆盖
  393 + uni.$u.toast('验证码已发送');
  394 + // 通知验证码组件内部开始倒计时
  395 + this.$refs.uCode.start();
  396 + }, 2000);
  397 + } else {
  398 + uni.$u.toast('倒计时结束后再发送');
  399 + }
  400 + },
  401 + calendarClose() {
  402 + this.showCalendar = false
  403 + this.$refs.form1.validateField('hotel')
  404 + },
  405 + birthdayClose() {
  406 + this.showBirthday = false
  407 + this.$refs.form1.validateField('userInfo.birthday')
  408 + },
  409 + birthdayConfirm(e) {
  410 + this.showBirthday = false
  411 + this.model1.userInfo.birthday = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
  412 + this.$refs.form1.validateField('userInfo.birthday')
  413 + },
  414 + submit() {
  415 + // 如果有错误,会在catch中返回报错信息数组,校验通过则在then中返回true
  416 + this.$refs.form1.validate().then(res => {
  417 + uni.$u.toast('校验通过')
  418 + }).catch(errors => {
  419 + uni.$u.toast('校验失败')
  420 + })
  421 + },
  422 + reset() {
  423 + const validateList = ['userInfo.name', 'userInfo.sex', 'radiovalue1', 'checkboxValue1', 'intro',
  424 + 'hotel', 'code', 'userInfo.birthday']
  425 + this.$refs.form1.resetFields()
  426 + this.$refs.form1.clearValidate()
  427 + setTimeout(()=>{
  428 + this.$refs.form1.clearValidate(validateList)
  429 + // 或者使用 this.$refs.form1.clearValidate()
  430 + },10)
  431 + },
  432 + hideKeyboard() {
  433 + uni.hideKeyboard()
  434 + }
  435 + },
  436 + }
  437 +</script>
  438 +
  439 +<style lang="scss">
  440 +
  441 +</style>
... ...
... ... @@ -105,11 +105,14 @@
105 105 ...resObj,
106 106 token: true //token用于判断是否登录
107 107 };
108   - this.setUserInfo(userInfo);
  108 + if (userInfo.token) {
  109 + this.setUserInfo(userInfo);
  110 + }
109 111 uni.showToast({
110 112 title: '登录成功~',
111 113 icon: 'none'
112 114 });
  115 + this.saveUserInfo();
113 116 setTimeout(() => {
114 117 uni.navigateBack({
115 118 delta:2
... ... @@ -118,6 +121,14 @@
118 121 }
119 122 });
120 123 },
  124 + saveUserInfo() {
  125 + //储存个人信息
  126 + uni.$u.http.get('/yt/user/me/info').then(res => {
  127 + if (res) {
  128 + this.setUserInfo(res);
  129 + }
  130 + });
  131 + },
121 132 openAccountFunc(){
122 133 uni.navigateTo({
123 134 url:"./login"
... ...
... ... @@ -67,25 +67,43 @@ export default {
67 67 if (this.loginForm.username == '' || this.loginForm.password == '') {
68 68 return uni.$u.toast('请输入用户名或密码');
69 69 }
70   - uni.$u.http.post('/auth/login', this.loginForm).then(res => {
  70 + uni.$u.http
  71 + .post('/auth/login', this.loginForm)
  72 + .then(res => {
  73 + if (res) {
  74 + // 储存登录信息
  75 + let resObj = {
  76 + refreshToken: res.refreshToken,
  77 + isToken: res.token
  78 + };
  79 + let userInfo = {
  80 + ...resObj,
  81 + token: true //token用于判断是否登录
  82 + };
  83 + if (userInfo.token) {
  84 + this.setUserInfo(userInfo);
  85 + }
  86 + uni.showToast({
  87 + title: '登录成功~',
  88 + icon: 'none'
  89 + });
  90 + this.saveUserInfo();
  91 + setTimeout(() => {
  92 + uni.navigateBack({
  93 + delta: 1
  94 + });
  95 + }, 1000);
  96 + }
  97 + })
  98 + .catch(e => {
  99 + uni.$u.toast(e.data.message);
  100 + });
  101 + },
  102 + saveUserInfo() {
  103 + //储存个人信息
  104 + uni.$u.http.get('/yt/user/me/info').then(res => {
71 105 if (res) {
72   - // 储存登录信息
73   - let resObj = {
74   - refreshToken: res.refreshToken,
75   - isToken: res.token
76   - };
77   - let userInfo = {
78   - ...resObj,
79   - token: true //token用于判断是否登录
80   - };
81   - this.setUserInfo(userInfo);
82   - uni.showToast({
83   - title: '登录成功~',
84   - icon: 'none'
85   - });
86   - setTimeout(() => {
87   - uni.navigateBack();
88   - }, 500);
  106 + this.setUserInfo(res);
89 107 }
90 108 });
91 109 },
... ...
... ... @@ -7,10 +7,10 @@
7 7 <!-- 登录 -->
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.token">
10   - <view class="u-m-r-20"><image class="avatar" mode="aspectFill" :src="userInfo.headLogo || '/static/logo.png'"></image></view>
  10 + <view class="u-m-r-20"><image class="avatar" mode="aspectFill" :src="userInfo.avatar || '/static/logo.png'"></image></view>
11 11 <view class="u-flex-1" @click="onJump('/pages/personal/set')">
12 12 <view class="nickName u-flex">
13   - <view class="name u-m-r-10" v-if="userInfo.nickName">{{ userInfo.nickName }}</view>
  13 + <view class="name u-m-r-10" v-if="userInfo.realName">{{ userInfo.realName }}</view>
14 14 </view>
15 15 <view class="detail" v-if="userInfo.phoneNum">手机号:{{ userInfo.phoneNum | phone }}</view>
16 16 <view class="detail" v-else>手机号:未绑定</view>
... ... @@ -37,10 +37,10 @@
37 37 <!-- #ifndef MP -->
38 38 <!-- 登录 -->
39 39 <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30">
40   - <block v-if="userInfo.token">
41   - <view class="u-m-r-20"><image class="avatar" mode="aspectFill" :src="userInfo.headLogo"></image></view>
  40 + <block v-if="userInfo.isToken">
  41 + <view class="u-m-r-20"><image class="avatar" mode="aspectFill" :src="userInfo.avatar"></image></view>
42 42 <view class="u-flex-1" @click="onJump('/pages/user/set')">
43   - <view class="nickName">{{ userInfo.userName }}</view>
  43 + <view class="nickName">{{ userInfo.realName }}</view>
44 44 <view class="detail" v-if="userInfo.phoneNum">手机号:{{ userInfo.phoneNum | phone }}</view>
45 45 <view class="detail" v-else>手机号:未绑定</view>
46 46 </view>
... ... @@ -60,7 +60,7 @@
60 60 </view>
61 61 <view
62 62 class="u-flex"
63   - style="position: relative;top:-25rpx;z-index:54;background: #FFFFFF;;border-radius: 17px 17px 0px 0px;;height: 750rpx;width: 750rpx;flex-direction: column;justify-content: space-between;"
  63 + style="overflow-x: hidden;position: relative;top:-25rpx;z-index:54;background: #FFFFFF;;border-radius: 17px 17px 0px 0px;;height: 835rpx;width: 750rpx;flex-direction: column;justify-content: space-between;"
64 64 >
65 65 <view style="margin-top: 100rpx;">
66 66 <view @click="openSysNotify" class="u-flex" style="flex-direction: row;justify-content: space-between;align-content: space-between;">
... ... @@ -85,13 +85,12 @@
85 85 <view>
86 86 <u-modal :showConfirmButton="false" :show="show" :title="title">
87 87 <view v-if="!bindPhone" class="loginPhone">
88   - <view class="form-row" style="background:#F7F9FF;border-radius: 48px;width: 532rpx;height: 80rpx;border: 0.01rpx solid #F7F9FF;">
89   - <u--input border="surround" shape="circle" class="input" prefixIcon="account-fill" type="text" placeholder="登录账号" v-model="account"></u--input>
  88 + <view class="form-row" style="background:#F7F9FF;border-radius: 48px;width: 532rpx;height: 80rpx;">
  89 + <u--input shape="circle" class="input" prefixIcon="account-fill" type="text" placeholder="登录账号" v-model="account"></u--input>
90 90 </view>
91   - <view class="form-row" style="margin-top: 20rpx;background: #F7F9FF;border-radius: 48px;width: 532rpx;height: 80rpx;border: 0.01rpx solid #F7F9FF;">
  91 + <view class="form-row" style="margin-top: 20rpx;background: #F7F9FF;border-radius: 48px;width: 532rpx;height: 80rpx;">
92 92 <u--input
93 93 class="input"
94   - border="surround"
95 94 shape="circle"
96 95 prefixIcon="lock-fill"
97 96 :suffixIcon="showPasswordIcon"
... ... @@ -108,9 +107,8 @@
108 107 </view>
109 108 </view>
110 109 <view v-else class="loginPhone">
111   - <view class="form-row" style="background:#F7F9FF;border-radius: 48px;width: 532rpx;height: 80rpx;border: 0.01rpx solid #F7F9FF;">
  110 + <view class="form-row" style="background:#F7F9FF;border-radius: 48px;width: 532rpx;height: 80rpx;">
112 111 <u--input
113   - border="surround"
114 112 shape="circle"
115 113 class="input"
116 114 type="text"
... ... @@ -119,9 +117,8 @@
119 117 placeholder-style="font-weight:normal;color:#bbbbbb;"
120 118 ></u--input>
121 119 </view>
122   - <view class="form-row" style="margin-top: 20rpx;background:#F7F9FF;border-radius: 48px;width: 532rpx;height: 80rpx;border: 0.01rpx solid #F7F9FF;">
  120 + <view class="form-row" style="margin-top: 20rpx;background:#F7F9FF;border-radius: 48px;width: 532rpx;height: 80rpx;">
123 121 <u--input
124   - border="surround"
125 122 shape="circle"
126 123 class="input"
127 124 type="text"
... ... @@ -162,6 +159,7 @@
162 159 </template>
163 160
164 161 <script>
  162 +var clear;
165 163 import base from '@/config/baseUrl';
166 164 import fTabbar from '@/components/module/f-tabbar/f-tabbar';
167 165 import fNavbar from '@/components/module/f-navbar/f-navbar';
... ... @@ -230,8 +228,11 @@ export default {
230 228 });
231 229 },
232 230 openPersonalInfo() {
  231 + let obj = {
  232 + data: this.userInfo
  233 + };
233 234 uni.navigateTo({
234   - url: './set'
  235 + url: './set?data=' + JSON.stringify(obj)
235 236 });
236 237 },
237 238 clickAccountFunc() {
... ... @@ -305,11 +306,11 @@ export default {
305 306 success(res) {
306 307 if (res.confirm) {
307 308 that.emptyUserInfo();
308   - that.showLogout=false
  309 + that.showLogout = false;
309 310 setTimeout(() => {
310 311 uni.navigateTo({
311   - url:'./login'
312   - })
  312 + url: './login'
  313 + });
313 314 }, 500);
314 315 } else if (res.cancel) {
315 316 }
... ... @@ -413,8 +414,8 @@ export default {
413 414 }
414 415
415 416 .loginPhone {
416   - width: 750rpx;
417   - padding: 0rpx 10rpx;
  417 + // width: 750rpx;
  418 + // padding: 0rpx 10rpx;
418 419
419 420 .form-row {
420 421 position: relative;
... ...
... ... @@ -6,20 +6,20 @@
6 6 class="u-flex"
7 7 style="border-radius: 20px;margin-top: 37rpx;padding-left: 15rpx;;justify-content: space-between;width: 690rpx;height: 200rpx;background-color: #FFFFFF;"
8 8 >
9   - <view style=""><image style="width: 130rpx;height: 130rpx;" src="../../static/avatar-test.png" mode=""></image></view>
  9 + <view style=""><image style="border-radius: 50px;width: 130rpx;height: 130rpx;" :src="avatar" mode=""></image></view>
10 10 <view style="margin-right: 40rpx;"><image style="width: 13rpx;height: 17rpx;" src="../../static/arrow-right.png" mode=""></image></view>
11 11 </view>
12 12 <view class="u-m-t-20"><text style="color:#8f9ca2;font-size: 14px;">基本资料</text></view>
13 13 <view style="background-color: #FFFFFF;border-radius: 20px;margin-top: 20rpx;padding-left: 15rpx;">
14 14 <u--form labelPosition="left" :model="myInfoModel" :rules="rules" ref="myInfoFormRef">
15   - <u-form-item labelWidth="80px" label="真实姓名" prop="userInfo.name" borderBottom ref="item1">
16   - <u--input placeholder="请输入真实姓名" v-model="myInfoModel.userInfo.name" border="none"></u--input>
  15 + <u-form-item labelWidth="80px" label="真实姓名" prop="userInfo.realName" borderBottom ref="item1">
  16 + <u--input placeholder="请输入真实姓名" v-model="myInfoModel.userInfo.realName" border="none"></u--input>
17 17 </u-form-item>
18   - <u-form-item labelWidth="80px" label="手机号码" prop="userInfo.phone" borderBottom ref="item1">
19   - <u--input placeholder="请输入手机号码" v-model="myInfoModel.userInfo.phone" border="none"></u--input>
  18 + <u-form-item labelWidth="80px" label="手机号码" prop="userInfo.phoneNumber" borderBottom ref="item1">
  19 + <u--input placeholder="请输入手机号码" v-model="myInfoModel.userInfo.phoneNumber" border="none"></u--input>
20 20 </u-form-item>
21   - <u-form-item labelWidth="80px" label="用户账号 " prop="userInfo.account" borderBottom ref="item1">
22   - <u--input placeholder="请输入用户账号 " v-model="myInfoModel.userInfo.account" border="none"></u--input>
  21 + <u-form-item labelWidth="80px" label="用户账号 " prop="userInfo.username" borderBottom ref="item1">
  22 + <u--input placeholder="请输入用户账号 " v-model="myInfoModel.userInfo.username" border="none"></u--input>
23 23 </u-form-item>
24 24 <u-form-item labelWidth="80px" label="邮箱地址" prop="userInfo.email" borderBottom ref="item1">
25 25 <u--input placeholder="请输入邮箱地址" v-model="myInfoModel.userInfo.email" border="none"></u--input>
... ... @@ -31,11 +31,11 @@
31 31 "
32 32 labelWidth="80px"
33 33 label="有效期"
34   - prop="userInfo.dateVal"
  34 + prop="userInfo.accountExpireTime"
35 35 borderBottom
36 36 ref="item1"
37 37 >
38   - <u--input v-model="myInfoModel.userInfo.dateVal" placeholder="请选择有效期" border="none"></u--input>
  38 + <u--input v-model="myInfoModel.userInfo.accountExpireTime" placeholder="请选择有效期" border="none"></u--input>
39 39 <u-datetime-picker
40 40 :formatter="formatter"
41 41 :show="showDate"
... ... @@ -63,28 +63,121 @@ export default {
63 63 PrimaryColor: '#0079fe', //主题色
64 64 myInfoModel: {
65 65 userInfo: {
66   - name: '',
67   - phone: '',
68   - account: 'test9527',
  66 + realName: '',
  67 + phoneNumber: '',
  68 + username: '',
69 69 email: '',
70   - dateVal: ''
  70 + accountExpireTime: ''
71 71 }
72 72 },
73 73 showDate: false,
74   - dateTime: Number(new Date())
  74 + dateTime: Number(new Date()),
  75 + avatar: '',
  76 + id: '',
  77 + rules: {
  78 + 'userInfo.realName': [
  79 + {
  80 + type: 'string',
  81 + required: true,
  82 + message: '请填写姓名',
  83 + trigger: ['blur', 'change']
  84 + },
  85 + {
  86 + validator: (rule, value, callback) => {
  87 + return uni.$u.test.chinese(value);
  88 + },
  89 + message: '姓名必须为中文',
  90 + trigger: ['change', 'blur']
  91 + }
  92 + ],
  93 + 'userInfo.phoneNumber': [
  94 + {
  95 + type: 'string',
  96 + required: true,
  97 + message: '请填写手机号码',
  98 + trigger: ['blur', 'change']
  99 + },
  100 + {
  101 + // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
  102 + validator: (rule, value, callback) => {
  103 + return uni.$u.test.mobile(value);
  104 + },
  105 + message: '手机必须为数字',
  106 + trigger: ['change', 'blur']
  107 + }
  108 + ],
  109 + 'userInfo.email': [
  110 + {
  111 + type: 'string',
  112 + required: true,
  113 + message: '请填写邮箱',
  114 + trigger: ['blur', 'change']
  115 + },
  116 + {
  117 + // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
  118 + validator: (rule, value, callback) => {
  119 + return uni.$u.test.email(value);
  120 + },
  121 + message: '邮箱必须带有@',
  122 + trigger: ['change', 'blur']
  123 + }
  124 + ]
  125 + }
75 126 };
76 127 },
  128 + onLoad(e) {
  129 + if (e.data !== null) {
  130 + let params = JSON.parse(e.data);
  131 + this.myInfoModel.userInfo.realName = params.data.realName;
  132 + this.myInfoModel.userInfo.phoneNumber = params.data.phoneNumber;
  133 + this.myInfoModel.userInfo.username = params.data.username;
  134 + this.myInfoModel.userInfo.email = params.data.email;
  135 + this.myInfoModel.userInfo.accountExpireTime = params.data.accountExpireTime;
  136 + this.avatar = params.data.avatar == undefined ? '../../static/avatar-test.png' : params.data.avatar;
  137 + this.id = params.data.userId;
  138 + }
  139 + },
77 140 methods: {
78 141 onSubmitFunc() {
79   - console.log('确认');
80   - console.log(this.myInfoModel.userInfo);
  142 + this.$refs.myInfoFormRef
  143 + .validate()
  144 + .then(res => {
  145 + let httpData = {
  146 + avatar: this.avatar,
  147 + email: this.myInfoModel.userInfo.email,
  148 + id: this.id,
  149 + phoneNumber: this.myInfoModel.userInfo.phoneNumber,
  150 + realName: this.myInfoModel.userInfo.realName
  151 + };
  152 + uni.$u.http
  153 + .put('/yt/user/center', httpData)
  154 + .then(res => {
  155 + if (res) {
  156 + uni.showToast({
  157 + title: '更新个人资料成功~',
  158 + icon: 'none'
  159 + });
  160 + setTimeout(() => {
  161 + uni.navigateBack({
  162 + delta: 1
  163 + });
  164 + }, 500);
  165 + }
  166 + })
  167 + .catch(e => {
  168 + uni.$u.toast(e.data.message);
  169 + });
  170 + })
  171 + .catch(errors => {
  172 + uni.$u.toast('校验失败');
  173 + });
81 174 },
82 175 dateClose() {
83 176 this.showDate = false;
84 177 },
85 178 dateConfirm(e) {
86 179 this.showDate = false;
87   - this.myInfoModel.userInfo.dateVal = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM:ss');
  180 + this.myInfoModel.userInfo.accountExpireTime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM:ss');
88 181 },
89 182 //格式化日期
90 183 formatter(type, value) {
... ...
... ... @@ -3,16 +3,20 @@
3 3 <!-- 公共组件-每个页面必须引入 -->
4 4 <public-module></public-module>
5 5 <view>
6   - <view class="u-flex" style="margin-top: 10rpx;justify-content: center;"><text>今天晚上开会</text></view>
  6 + <view class="u-flex" style="margin-top: 10rpx;justify-content: center;">
  7 + <text style="color: #2E384D;font-size: 18px;">{{ notifyList.receiverName }}</text>
  8 + </view>
7 9 <view style="border-radius: 20px;;margin-top: 20rpx;width: 696rpx;height: 1000rpx;background-color: #FFFFFF;">
8 10 <u-list height="140rpx">
9   - <u-list-item v-for="(item, index) in notifyList" :key="index">
10   - <u-cell @click="clickNotifyDetail(item.id)" :value="`${item.time}`" :title="`${item.name}`">
11   - <u-avatar slot="icon" shape="circle" size="35" :src="item.imageUrl"></u-avatar>
  11 + <u-list-item>
  12 + <u-cell :value="`${notifyList.createTime}`" :title="`${notifyList.receiverName}`">
  13 + <u-avatar slot="icon" shape="circle" size="35" :src="1111"></u-avatar>
12 14 </u-cell>
13 15 </u-list-item>
14 16 </u-list>
15   - <view class=""><text>内容</text></view>
  17 + <view class="">
  18 + <text style="color: #2E384D;font-size: 15px;">{{ notifyList.receiverName }}</text>
  19 + </view>
16 20 </view>
17 21 </view>
18 22 <f-tabbar></f-tabbar>
... ... @@ -28,21 +32,30 @@ export default {
28 32 },
29 33 data() {
30 34 return {
31   - notifyList: [
32   - {
33   - id: '1',
34   - name: '系统管理员',
35   - imageUrl: 'https://cdn.uviewui.com/uview/album/1.jpg',
36   - time: '2022-04-12'
37   - }
38   - ]
  35 + notifyList: {}
39 36 };
40 37 },
41 38 onLoad(e) {
42 39 // 隐藏原生的tabbar
43 40 uni.hideTabBar();
44   - const item = e.item;
45   - console.log(item);
  41 + if (e.data !== null) {
  42 + let params = e.data;
  43 + this.loadData(params);
  44 + }
  45 + },
  46 + methods: {
  47 + loadData(e) {
  48 + uni.$u.http
  49 + .get(`/yt/noticeUser/${e}`)
  50 + .then(res => {
  51 + if (res) {
  52 + this.notifyList = res;
  53 + }
  54 + })
  55 + .catch(e => {
  56 + uni.$u.toast(e.data.message);
  57 + });
  58 + }
46 59 }
47 60 };
48 61 </script>
... ...
... ... @@ -2,14 +2,47 @@
2 2 <view class="notify-page">
3 3 <!-- 公共组件-每个页面必须引入 -->
4 4 <public-module></public-module>
  5 + <view style="">
  6 + <u--form labelPosition="left" :model="model1" :rules="rules" ref="form1">
  7 + <u-form-item
  8 + label="类型"
  9 + prop="userInfo.sex"
  10 + borderBottom
  11 + @click="
  12 + showType = true;
  13 + hideKeyboard();
  14 + "
  15 + ref="item1"
  16 + >
  17 + <u--input v-model="model1.userInfo.type" placeholder="请选择类型" border="none"></u--input>
  18 + <u-icon slot="right" name="arrow-right"></u-icon>
  19 + </u-form-item>
  20 + </u--form>
  21 + <u-action-sheet :show="showType" :actions="actions" title="请选择类型" @close="showType = false" @select="typeSelect"></u-action-sheet>
  22 + </view>
5 23 <view>
6   - <u-list @scrolltolower="scrolltolower">
7   - <u-list-item style="margin-top: 20rpx;background: #FFFFFF;width: 695rpx;border-radius: 20px;" v-for="(item, index) in notifyList" :key="index">
8   - <u-cell :border="false" @click="clickNotifyDetail(item.id)" isLink :value="`${item.time}`" :title="`${item.name}`">
9   - <u-avatar slot="icon" shape="circle" size="35" :src="item.imageUrl"></u-avatar>
10   - </u-cell>
11   - </u-list-item>
12   - </u-list>
  24 + <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback">
  25 + <view class="u-flex" style="flex-direction: column;margin-left: -22rpx;">
  26 + <view
  27 + @click="clickNotifyDetail(item.id)"
  28 + class="u-flex"
  29 + v-for="(item, index) in list"
  30 + :key="index"
  31 + style="justify-content: space-between;flex-direction: row;margin: 15rpx;width: 700rpx;height:136rpx;background: #FFFFFF;border-radius: 20px;"
  32 + >
  33 + <view class="u-flex" style="justify-content: space-between;flex-direction: row;">
  34 + <view style="margin-left: 30rpx;"><u-avatar style="margin-left: 30rpx;" shape="circle" size="40" :src="item.avatar"></u-avatar></view>
  35 + <view class="u-flex" style="margin-left: 30rpx;text-align: left;justify-content: space-between;flex-direction: column;">
  36 + <text style="width:400rpx;color:#2E384D;font-size: 15px;">{{ item.title }}</text>
  37 + <text style="width:400rpx;color:#999999;font-size: 13px;">{{ item.createTime }}</text>
  38 + </view>
  39 + </view>
  40 + <view class="">
  41 + <text style="margin-right: 30rpx;color:#999999;font-size: 13px;">{{ item.type == 'OTHER' ? '其他' : item.type == 'MEETING' ? '会议' : '公告' }}</text>
  42 + </view>
  43 + </view>
  44 + </view>
  45 + </mescroll-body>
13 46 </view>
14 47 <f-tabbar></f-tabbar>
15 48 </view>
... ... @@ -17,79 +50,105 @@
17 50
18 51 <script>
19 52 import fTabbar from '@/components/module/f-tabbar/f-tabbar';
  53 +import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
20 54
21 55 export default {
  56 + mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
22 57 components: {
23 58 fTabbar
24 59 },
25 60 data() {
26 61 return {
27   - notifyList: [
28   - {
29   - id: '1',
30   - name: '今天晚上会议室开会',
31   - imageUrl: 'https://cdn.uviewui.com/uview/album/1.jpg',
32   - time: '2022-04-12'
33   - },
34   - {
35   - id: '2',
36   - name: '今天晚上会议室开会',
37   - imageUrl: 'https://cdn.uviewui.com/uview/album/1.jpg',
38   - time: '2022-04-12'
39   - },
40   - {
41   - id: '3',
42   - name: '今天晚上会议室开会',
43   - imageUrl: 'https://cdn.uviewui.com/uview/album/1.jpg',
44   - time: '2022-04-12'
45   - },
46   - {
47   - id: 'eww',
48   - name: '今天晚上会议室开会',
49   - imageUrl: 'https://cdn.uviewui.com/uview/album/1.jpg',
50   - time: '2022-04-12'
51   - },
52   - {
53   - id: '4',
54   - name: '今天晚上会议室开会',
55   - imageUrl: 'https://cdn.uviewui.com/uview/album/1.jpg',
56   - time: '2022-04-12'
57   - },
  62 + model1: {
  63 + userInfo: {
  64 + type: ''
  65 + }
  66 + },
  67 + showType: false,
  68 + actions: [
58 69 {
59   - id: '1',
60   - name: '今天晚上会议室开会',
61   - imageUrl: 'https://cdn.uviewui.com/uview/album/1.jpg',
62   - time: '2022-04-12'
  70 + name: '会议',
  71 + value: 'MEETING'
63 72 },
64 73 {
65   - id: '5',
66   - name: '今天晚上会议室开会',
67   - imageUrl: 'https://cdn.uviewui.com/uview/album/1.jpg',
68   - time: '2022-04-12'
  74 + name: '公告',
  75 + value: 'NOTICE'
69 76 },
70 77 {
71   - id: '6',
72   - name: '今天晚上会议室开会',
73   - imageUrl: 'https://cdn.uviewui.com/uview/album/1.jpg',
74   - time: '2022-04-12'
  78 + name: '其他',
  79 + value: 'OTHER'
75 80 }
76   - ]
  81 + ],
  82 + page: {
  83 + num: 0,
  84 + size: 10
  85 + },
  86 + downOption: {
  87 + auto: false //是否在初始化后,自动执行downCallback; 默认true
  88 + },
  89 + list: []
77 90 };
78 91 },
79   - onLoad() {
  92 + onLoad(e) {
80 93 // 隐藏原生的tabbar
81 94 uni.hideTabBar();
82   - this.loadmore();
  95 + loadData(1);
83 96 },
84 97 methods: {
85   - scrolltolower() {
86   - this.loadmore();
  98 + typeSelect(e) {
  99 + this.model1.userInfo.type = e.name;
  100 + this.loadData(1, e.value);
  101 + },
  102 + hideKeyboard() {
  103 + uni.hideKeyboard();
  104 + },
  105 + /*下拉刷新的回调 */
  106 + downCallback() {
  107 + //联网加载数据
  108 + this.list.length = 0;
  109 + this.page.num = 1;
  110 + this.loadData(1);
  111 + },
  112 + /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  113 + upCallback() {
  114 + //联网加载数据
  115 + this.page.num += 1;
  116 + this.loadData(this.page.num);
  117 + },
  118 +
  119 + loadData(pageNo, t) {
  120 + let httpData = {
  121 + page: pageNo,
  122 + pageSize: 10,
  123 + type: t
  124 + };
  125 + uni.$u.http
  126 + .get('/yt/noticeUser/page', { params: httpData, custom: { load: false } })
  127 + .then(res => {
  128 + uni.stopPullDownRefresh();
  129 + this.mescroll.endByPage(res.items.length, res.total);
  130 + if (pageNo == 1) {
  131 + this.list = res.items.map(m => {
  132 + return {
  133 + title: m?.sysNotice?.title,
  134 + avatar: m?.sysNotice?.avatar,
  135 + id: m?.sysNotice?.id,
  136 + createTime: m?.createTime
  137 + };
  138 + });
  139 + } else {
  140 + this.list = this.list.concat(res.items);
  141 + }
  142 + })
  143 + .catch(e => {
  144 + uni.$u.toast(e.data.message);
  145 + this.mescroll.endErr();
  146 + });
87 147 },
88   - loadmore() {},
89 148 clickNotifyDetail(e) {
90   - console.log(e);
  149 + let obj = e;
91 150 uni.navigateTo({
92   - url: './notifyDetail?item' + e
  151 + url: './notifyDetail?data=' + obj
93 152 });
94 153 }
95 154 }
... ...
... ... @@ -10,12 +10,9 @@ export const mutations = {
10 10 // #ifdef H5
11 11 window.sessionStorage.setItem('userInfo', JSON.stringify(state.userInfo));
12 12 // #endif
13   - // #ifndef MP
  13 + // #ifndef H5
14 14 uni.setStorageSync('userInfo', state.userInfo);
15 15 // #endif
16   - //#ifdef MP
17   - wx.setStorageSync('userInfo', state.userInfo);
18   - //#endif
19 16 }
20 17 },
21 18 // 退出APP
... ... @@ -24,12 +21,9 @@ export const mutations = {
24 21 // #ifdef H5
25 22 window.sessionStorage.removeItem("userInfo");
26 23 // #endif
27   - // #ifndef MP
  24 + // #ifndef H5
28 25 uni.removeStorageSync("userInfo");
29 26 // #endif
30   - // #ifdef MP
31   - wx.removeStorageSync("userInfo");
32   - // #endif
33 27 },
34 28 };
35 29 export const actions = {
... ...