Commit a4c5a838606ff6d803e8dd99c846fa7992e34639

Authored by xp.Huang
2 parents 406ed4f6 62a3bd84

Merge branch 'main_dev' into 'main'

merge main dev to main

See merge request yunteng/thingskit-app!115
@@ -30,7 +30,24 @@ @@ -30,7 +30,24 @@
30 // }) 30 // })
31 // #endif 31 // #endif
32 }, 32 },
33 - onHide() {} 33 + onHide() {},
  34 + onUnload(){
  35 + uni.setStorageSync('getConfiguration', {
  36 + isConfiguration: false
  37 + });
  38 + },
  39 + methods:{
  40 + // 判断是否是第三方登录没有绑定账号不请求数据
  41 + getBindNot(){
  42 + // #ifndef H5
  43 + const userInfo = uni.getStorageSync('userInfo');
  44 + // #endif
  45 + // #ifdef H5
  46 + const userInfo = JSON.parse(sessionStorage.getItem('userInfo') || localStorage.getItem('userInfo'));
  47 + // #endif
  48 + return userInfo.isThirdLogin
  49 + }
  50 + }
34 }; 51 };
35 </script> 52 </script>
36 53
@@ -36,6 +36,11 @@ @@ -36,6 +36,11 @@
36 class="text-device-muted text-clip">{{ list.details == null ? '暂无数据' : formatDetailText(list.details.data) }}</text> 36 class="text-device-muted text-clip">{{ list.details == null ? '暂无数据' : formatDetailText(list.details.data) }}</text>
37 </view> 37 </view>
38 <view class="column"> 38 <view class="column">
  39 + <text class="text-org-bold">告警场景:</text>
  40 + <text
  41 + class="text-device-muted text-clip">{{ list.type == null ? '暂无数据' : list.type }}</text>
  42 + </view>
  43 + <view class="column">
39 <text class="text-org-bold">告警时间:</text> 44 <text class="text-org-bold">告警时间:</text>
40 <text class="text-device-muted">{{ list.createdTime }}</text> 45 <text class="text-device-muted">{{ list.createdTime }}</text>
41 </view> 46 </view>
@@ -169,7 +174,7 @@ @@ -169,7 +174,7 @@
169 const jsonStr = JSON.stringify(e); 174 const jsonStr = JSON.stringify(e);
170 const str = jsonStr.substring(1, jsonStr.length - 1); 175 const str = jsonStr.substring(1, jsonStr.length - 1);
171 const newStr = str.replace(/\"/g, ''); 176 const newStr = str.replace(/\"/g, '');
172 - return newStr; 177 + return newStr.slice(0,26);
173 } 178 }
174 } 179 }
175 }; 180 };
@@ -125,7 +125,9 @@ uni.$u.http.interceptors.response.use( @@ -125,7 +125,9 @@ uni.$u.http.interceptors.response.use(
125 errorData = message || ""; 125 errorData = message || "";
126 } 126 }
127 // console.log('errorData', errorData); 127 // console.log('errorData', errorData);
128 - uni.$u.toast(message); 128 + if(message != "request:ok"){
  129 + uni.$u.toast(message);
  130 + }
129 // if (show) uni.$u.toast(errorData); 131 // if (show) uni.$u.toast(errorData);
130 return Promise.reject(response); 132 return Promise.reject(response);
131 } 133 }
@@ -243,4 +243,4 @@ @@ -243,4 +243,4 @@
243 height: 100vh; 243 height: 100vh;
244 background-color: #f8f9fa; 244 background-color: #f8f9fa;
245 } 245 }
246 -</style> 246 +</style>
@@ -110,12 +110,22 @@ @@ -110,12 +110,22 @@
110 }, 110 },
111 { 111 {
112 checked: false, 112 checked: false,
113 - name: '成功', 113 + name: '响应成功',
114 type: 'SUCCESSFUL' 114 type: 'SUCCESSFUL'
115 }, 115 },
116 { 116 {
117 checked: false, 117 checked: false,
118 - name: '失败', 118 + name: '发送成功',
  119 + type: 'DELIVERED'
  120 + },
  121 + {
  122 + checked: false,
  123 + name: '已过期',
  124 + type: 'EXPIRED'
  125 + },
  126 + {
  127 + checked: false,
  128 + name: '响应失败',
119 type: 'FAILED' 129 type: 'FAILED'
120 } 130 }
121 ], 131 ],
@@ -12,8 +12,8 @@ @@ -12,8 +12,8 @@
12 {{ deviceDetail.alias? deviceDetail.alias: deviceDetail.name }} 12 {{ deviceDetail.alias? deviceDetail.alias: deviceDetail.name }}
13 </view> 13 </view>
14 <view style="margin-left: 20rpx; font-size: 14px;" 14 <view style="margin-left: 20rpx; font-size: 14px;"
15 - :style="{ color: deviceDetail.deviceState === 'INACTIVE' ? '#666' : deviceDetail.deviceState === 'ONLINE' ? '#377DFF' : '#DE4437' }">  
16 - {{ deviceDetail.deviceState === 'INACTIVE' ? '待激活' : deviceDetail.deviceState === 'ONLINE' ? '在线' : '离线' }} 15 + :style="{ color: deviceDetail.deviceState === 'INACTIVE' ? '#666' : deviceDetail.deviceState === 'ONLINE' ? '#377DFF' : '#DE4437' }">
  16 + {{ deviceStatus }}
17 </view> 17 </view>
18 </view> 18 </view>
19 <view style="margin-right: 20rpx;" 19 <view style="margin-right: 20rpx;"
@@ -126,8 +126,8 @@ @@ -126,8 +126,8 @@
126 </view> 126 </view>
127 <view style="margin-top: 28rpx;width: 100%;"> 127 <view style="margin-top: 28rpx;width: 100%;">
128 <div class="u-flex u-row-between"> 128 <div class="u-flex u-row-between">
129 - <u--textarea placeholder="请输入下发内容(json格式)" v-model="inputCommandVal" />  
130 - <u-icon @click="handleCopy(copyTextValue)" name="question-circle" color="#2979ff" size="28" 129 + <u--textarea :placeholder="`请输入下发内容${isShowTCP?'(字符串格式)':'(json格式)'}`" v-model="inputCommandVal" />
  130 + <u-icon v-if="!isShowTCP" @click="handleCopy(copyTextValue)" name="question-circle" color="#2979ff" size="28"
131 class="ml-10"> 131 class="ml-10">
132 </u-icon> 132 </u-icon>
133 </div> 133 </div>
@@ -187,10 +187,14 @@ @@ -187,10 +187,14 @@
187 showModel: false, 187 showModel: false,
188 commandType: 'OneWay', 188 commandType: 'OneWay',
189 commandValue: {}, 189 commandValue: {},
190 - inputCommandVal: '' 190 + inputCommandVal: '',
  191 + isShowTCP:false,//用于下发命令时判断是否是TCP/UDP
191 }; 192 };
192 }, 193 },
193 computed: { 194 computed: {
  195 + deviceStatus(){
  196 + return this.deviceDetail.deviceState === 'INACTIVE' ? '待激活' : this.deviceDetail.deviceState === 'ONLINE' ? '在线' : '离线'
  197 + },
194 deviceType() { 198 deviceType() {
195 return this.deviceDetail.deviceType === 'DIRECT_CONNECTION' ? 199 return this.deviceDetail.deviceType === 'DIRECT_CONNECTION' ?
196 '直连设备' : 200 '直连设备' :
@@ -218,18 +222,20 @@ @@ -218,18 +222,20 @@
218 methods: { 222 methods: {
219 handleCopy(value) { 223 handleCopy(value) {
220 uni.showModal({ 224 uni.showModal({
221 - content: JSON.stringify(value), //模板中提示的内容 225 + content: JSON.stringify(value),
222 confirmText: '复制内容', 226 confirmText: '复制内容',
223 - success: () => { //点击复制内容的后调函数 227 + showCancel:false,
  228 + success: () => {
224 uni.setClipboardData({ 229 uni.setClipboardData({
225 - data: JSON.stringify(value), //要被复制的内容  
226 - success: () => { //复制成功的回调函数  
227 - uni.showToast({ //提示 230 + data: JSON.stringify(value),
  231 + success: () => {
  232 + uni.showToast({
228 title: '复制成功' 233 title: '复制成功'
229 }) 234 })
230 } 235 }
231 }); 236 });
232 - } 237 + },
  238 +
233 }); 239 });
234 }, 240 },
235 radioChange: function(evt) { 241 radioChange: function(evt) {
@@ -252,11 +258,15 @@ @@ -252,11 +258,15 @@
252 }, 258 },
253 showModal(e) { 259 showModal(e) {
254 this.modalName = e.currentTarget.dataset.target 260 this.modalName = e.currentTarget.dataset.target
  261 + const {transportType} = this.deviceDetail.deviceProfile
  262 + this.isShowTCP = transportType=='TCP'?true:false
255 this.showNodal = true 263 this.showNodal = true
256 }, 264 },
257 showModalBtn() { 265 showModalBtn() {
258 this.showModel = true; 266 this.showModel = true;
259 this.inputCommandVal = ''; 267 this.inputCommandVal = '';
  268 + const {transportType} = this.deviceDetail.deviceProfile
  269 + this.isShowTCP = transportType=='TCP'?true:false
260 }, 270 },
261 disabledScroll() { 271 disabledScroll() {
262 return; 272 return;
@@ -271,13 +281,22 @@ @@ -271,13 +281,22 @@
271 }, 281 },
272 async confirmCommand() { 282 async confirmCommand() {
273 try { 283 try {
274 - const commandJsonValue = JSON.parse(this.inputCommandVal); 284 + this.commandValue.method = 'methodThingskit';
275 this.commandValue.persistent = true; 285 this.commandValue.persistent = true;
276 this.commandValue.additionalInfo = { 286 this.commandValue.additionalInfo = {
277 cmdType: 'API' 287 cmdType: 'API'
278 }; 288 };
279 - this.commandValue.method = 'methodThingskit';  
280 - this.commandValue.params = commandJsonValue 289 + if(this.isShowTCP){//TCP的格式只能是字符串
  290 + const zg = /^[0-9a-zA-Z]*$/
  291 + if(!zg.test(this.inputCommandVal)) {
  292 + uni.$u.toast('输入的内容只能是字母和数字的组合')
  293 + return
  294 + }
  295 + this.commandValue.params = this.inputCommandVal
  296 + }else{
  297 + const commandJsonValue = JSON.parse(this.inputCommandVal);
  298 + this.commandValue.params = commandJsonValue
  299 + }
281 await issueCommand(this.commandType, this.deviceDetail.tbDeviceId, this.commandValue); 300 await issueCommand(this.commandType, this.deviceDetail.tbDeviceId, this.commandValue);
282 this.hiddenModal(); 301 this.hiddenModal();
283 uni.$u.toast('下发成功~'); 302 uni.$u.toast('下发成功~');
@@ -390,4 +409,4 @@ @@ -390,4 +409,4 @@
390 width: 300rpx; 409 width: 300rpx;
391 } 410 }
392 } 411 }
393 -</style> 412 +</style>
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 "path": "pages/index/index", 16 "path": "pages/index/index",
17 "style": { 17 "style": {
18 "navigationBarTitleText": "首页", 18 "navigationBarTitleText": "首页",
19 - "disableScroll": true 19 + "enablePullDownRefresh": true
20 } 20 }
21 }, 21 },
22 { 22 {
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 <view class="search"> 8 <view class="search">
9 <view> 9 <view>
10 <view class="search-left"> 10 <view class="search-left">
11 - <u--input prefixIcon="search" placeholder="请输入告警名字" shape="circle" @change="inputChanged"> 11 + <u--input prefixIcon="search" placeholder="请输入告警设备" shape="circle" @change="inputChanged">
12 </u--input> 12 </u--input>
13 </view> 13 </view>
14 </view> 14 </view>
@@ -241,6 +241,9 @@ @@ -241,6 +241,9 @@
241 }, 241 },
242 onShow() { 242 onShow() {
243 this.page.num = 1; 243 this.page.num = 1;
  244 + if(getApp().getBindNot()){
  245 + return
  246 + }
244 if (this.detailStatus) { 247 if (this.detailStatus) {
245 this.loadData(1, null, null, null, null, null, null); 248 this.loadData(1, null, null, null, null, null, null);
246 } 249 }
@@ -256,6 +259,9 @@ @@ -256,6 +259,9 @@
256 onLoad(e) { 259 onLoad(e) {
257 // 隐藏原生的tabbar 260 // 隐藏原生的tabbar
258 uni.hideTabBar(); 261 uni.hideTabBar();
  262 + if(getApp().getBindNot()){
  263 + return
  264 + }
259 if (e.type == undefined) { 265 if (e.type == undefined) {
260 this.loadData(1, null, null, null, null, null, null); 266 this.loadData(1, null, null, null, null, null, null);
261 } else { 267 } else {
@@ -303,8 +309,9 @@ @@ -303,8 +309,9 @@
303 const formatS = curTime.getTime(); 309 const formatS = curTime.getTime();
304 let addMinute = new Date(curTime.setMinutes(curTime.getMinutes() - this.selectTimeVal)); 310 let addMinute = new Date(curTime.setMinutes(curTime.getMinutes() - this.selectTimeVal));
305 const formatE = addMinute.getTime(); 311 const formatE = addMinute.getTime();
306 - this.timeData.getTimeGapS = formatS;  
307 - this.timeData.getTimeGapE = formatE; 312 + this.timeData.getTimeGapS = i>0?formatS:'';
  313 + this.timeData.getTimeGapE = i>0?formatE:'';
  314 + console.log(this.timeData.getTimeGapS,'this.timeData.getTimeGapS',this.timeData.getTimeGapE)
308 }, 315 },
309 queryData() { 316 queryData() {
310 this.topBack(); 317 this.topBack();
@@ -345,8 +352,8 @@ @@ -345,8 +352,8 @@
345 this.current4 = 0; 352 this.current4 = 0;
346 this.selectTimeVal = ''; 353 this.selectTimeVal = '';
347 this.timeData.selectTime = []; 354 this.timeData.selectTime = [];
348 - this.timeDatagetTimeGapS = '';  
349 - this.timeDatagetTimeGapE = ''; 355 + this.timeData.getTimeGapS = '';
  356 + this.timeData.getTimeGapE = '';
350 this.range = []; 357 this.range = [];
351 this.searchAlarmText = ''; 358 this.searchAlarmText = '';
352 this.startTimeVa = ''; 359 this.startTimeVa = '';
@@ -434,7 +441,7 @@ @@ -434,7 +441,7 @@
434 severity: severityV, 441 severity: severityV,
435 deviceType: deviceTypeV, 442 deviceType: deviceTypeV,
436 organizationId: organizationV, 443 organizationId: organizationV,
437 - alarmType: alarmName 444 + deviceName: alarmName
438 }; 445 };
439 if (statusV == '') { 446 if (statusV == '') {
440 delete httpData.status; 447 delete httpData.status;
@@ -480,7 +487,8 @@ @@ -480,7 +487,8 @@
480 organizationName: e.organizationName, 487 organizationName: e.organizationName,
481 details: e.details, 488 details: e.details,
482 createdTime: e.createdTime, 489 createdTime: e.createdTime,
483 - status: e.status 490 + status: e.status,
  491 + type: e.type
484 }; 492 };
485 uni.navigateTo({ 493 uni.navigateTo({
486 url: '/alarmSubPage/alarmDetailPage/alarmDetail?data=' + JSON.stringify(obj) 494 url: '/alarmSubPage/alarmDetailPage/alarmDetail?data=' + JSON.stringify(obj)
@@ -211,6 +211,9 @@ @@ -211,6 +211,9 @@
211 async onLoad(options) { 211 async onLoad(options) {
212 // 隐藏原生的tabbar 212 // 隐藏原生的tabbar
213 uni.hideTabBar(); 213 uni.hideTabBar();
  214 + if(getApp().getBindNot()){
  215 + return
  216 + }
214 this.page.num = 1; 217 this.page.num = 1;
215 const { 218 const {
216 deviceState 219 deviceState
@@ -231,6 +234,9 @@ @@ -231,6 +234,9 @@
231 } 234 }
232 }, 235 },
233 onShow() { 236 onShow() {
  237 + if(getApp().getBindNot()){
  238 + return
  239 + }
234 if (this.orgId) { 240 if (this.orgId) {
235 this.loadData(1, { 241 this.loadData(1, {
236 organizationId: this.orgId 242 organizationId: this.orgId
@@ -21,13 +21,13 @@ @@ -21,13 +21,13 @@
21 </view> 21 </view>
22 <view @click="navigatorDeviceStatus('OFFLINE')" class="u-flex sigle-child"> 22 <view @click="navigatorDeviceStatus('OFFLINE')" class="u-flex sigle-child">
23 <view class="sigle-text"> 23 <view class="sigle-text">
24 - <text class="home-text-total">{{ deviceData.unLine }}</text> 24 + <text class="home-text-total">{{ deviceData.offLine }}</text>
25 </view> 25 </view>
26 <view class="sigle-value"><text class="home-text-total-bottom">离线</text></view> 26 <view class="sigle-value"><text class="home-text-total-bottom">离线</text></view>
27 </view> 27 </view>
28 <view @click="navigatorDeviceStatus('INACTIVE')" class="u-flex sigle-child"> 28 <view @click="navigatorDeviceStatus('INACTIVE')" class="u-flex sigle-child">
29 <view class="sigle-text"> 29 <view class="sigle-text">
30 - <text class="home-text-total">{{ deviceData.noActive }}</text> 30 + <text class="home-text-total">{{ deviceData.inActive }}</text>
31 </view> 31 </view>
32 <view class="sigle-value"><text class="home-text-total-bottom">待激活</text></view> 32 <view class="sigle-value"><text class="home-text-total-bottom">待激活</text></view>
33 </view> 33 </view>
@@ -39,22 +39,22 @@ @@ -39,22 +39,22 @@
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="navigatorAlarmStatus(['ACTIVE_UNACK', 'ACTIVE_ACK'])" 42 + <view @click="navigatorAlarmStatus(['ACTIVE_UNACK'])"
43 class="u-flex sigle-child"> 43 class="u-flex sigle-child">
44 <view class="sigle-text"> 44 <view class="sigle-text">
45 - <text class="home-text-total">{{ alertData.noHandle }}</text> 45 + <text class="home-text-total">{{ alertData.activedAlarm }}</text>
46 </view> 46 </view>
47 <view class="sigle-value"><text class="home-text-total-bottom">未处理</text></view> 47 <view class="sigle-value"><text class="home-text-total-bottom">未处理</text></view>
48 </view> 48 </view>
49 <view @click="navigatorAlarmStatus('CLEARED_ACK')" class="u-flex sigle-child"> 49 <view @click="navigatorAlarmStatus('CLEARED_ACK')" class="u-flex sigle-child">
50 <view class="sigle-text"> 50 <view class="sigle-text">
51 - <text class="home-text-total">{{ alertData.doneHandle }}</text> 51 + <text class="home-text-total">{{ alertData.clearedAck }}</text>
52 </view> 52 </view>
53 <view class="sigle-value"><text class="home-text-total-bottom">已处理</text></view> 53 <view class="sigle-value"><text class="home-text-total-bottom">已处理</text></view>
54 </view> 54 </view>
55 <view @click="navigatorAlarmStatus('CLEARED_UNACK')" class="u-flex sigle-child"> 55 <view @click="navigatorAlarmStatus('CLEARED_UNACK')" class="u-flex sigle-child">
56 <view class="sigle-text"> 56 <view class="sigle-text">
57 - <text class="home-text-total">{{ alertData.errorReport }}</text> 57 + <text class="home-text-total">{{ alertData.clearedUnack }}</text>
58 </view> 58 </view>
59 <view class="sigle-value"><text class="home-text-total-bottom">误报</text></view> 59 <view class="sigle-value"><text class="home-text-total-bottom">误报</text></view>
60 </view> 60 </view>
@@ -105,7 +105,8 @@ @@ -105,7 +105,8 @@
105 import { 105 import {
106 mapActions 106 mapActions
107 } from 'vuex'; 107 } from 'vuex';
108 - import api from '@/api/index.js' 108 + import api from '@/api/index.js'
  109 + import { useNavigateTo } from '@/plugins/utils.js'
109 110
110 export default { 111 export default {
111 components: { 112 components: {
@@ -115,36 +116,42 @@ @@ -115,36 +116,42 @@
115 return { 116 return {
116 deviceData: { 117 deviceData: {
117 onLine: 0, 118 onLine: 0,
118 - unLine: 0,  
119 - noActive: 0 119 + offLine: 0,
  120 + inActive: 0
120 }, 121 },
121 alertData: { 122 alertData: {
122 - noHandle: 0,  
123 - doneHandle: 0,  
124 - errorReport: 0 123 + activedAlarm: 0,
  124 + clearedAck: 0,
  125 + clearedUnack: 0
125 } 126 }
126 }; 127 };
127 }, 128 },
128 onLoad() { 129 onLoad() {
129 // 隐藏原生的tabbar 130 // 隐藏原生的tabbar
130 uni.hideTabBar(); 131 uni.hideTabBar();
  132 + if(getApp().getBindNot()){
  133 + return
  134 + }
131 this.getDeviceTotalData(); 135 this.getDeviceTotalData();
132 uni.setStorageSync('getConfiguration', { 136 uni.setStorageSync('getConfiguration', {
133 isConfiguration: false 137 isConfiguration: false
134 }); 138 });
135 uni.removeStorageSync('getConfiguration'); 139 uni.removeStorageSync('getConfiguration');
  140 + },
  141 + onPullDownRefresh() {
  142 + this.getDeviceTotalData();
  143 + setTimeout(function () {
  144 + uni.stopPullDownRefresh();
  145 + uni.$u.toast('下拉刷新成功...');
  146 + }, 1000);
136 }, 147 },
137 methods: { 148 methods: {
138 ...mapActions(['updateBadgeTotal']), 149 ...mapActions(['updateBadgeTotal']),
139 async getDeviceTotalData() { 150 async getDeviceTotalData() {
140 const res = await api.homeApi.getHomeStatisticsApi() 151 const res = await api.homeApi.getHomeStatisticsApi()
141 - if (res) {  
142 - this.deviceData.onLine = res.totalDevice?.onLine;  
143 - this.deviceData.unLine = res.totalDevice?.offLine;  
144 - this.deviceData.noActive = res.totalDevice?.inActive;  
145 - this.alertData.noHandle = res.totalAlarm?.activedAlarm;  
146 - this.alertData.doneHandle = res.totalAlarm?.clearedAck;  
147 - this.alertData.errorReport = res.totalAlarm?.clearedUnack; 152 + if (res) {
  153 + for(let i in this.deviceData) Reflect.set(this.deviceData,i,res.totalDevice[i])
  154 + for(let i in this.alertData) Reflect.set(this.alertData,i,res.totalAlarm[i])
148 //异步实时更新告警徽标数 155 //异步实时更新告警徽标数
149 this.updateBadgeTotal(res.totalAlarm?.activedAlarm); 156 this.updateBadgeTotal(res.totalAlarm?.activedAlarm);
150 } 157 }
@@ -152,15 +159,11 @@ @@ -152,15 +159,11 @@
152 showToastWip() { 159 showToastWip() {
153 uni.$u.toast('拼命开发中 ...'); 160 uni.$u.toast('拼命开发中 ...');
154 }, 161 },
155 - openCamera() {  
156 - uni.navigateTo({  
157 - url: 'camera/camera'  
158 - }); 162 + openCamera() {
  163 + useNavigateTo('camera/camera')
159 }, 164 },
160 - openOrgStatus() {  
161 - uni.navigateTo({  
162 - url: 'configuration/configuration'  
163 - }); 165 + openOrgStatus() {
  166 + useNavigateTo('configuration/configuration')
164 }, 167 },
165 //告警状态查询 168 //告警状态查询
166 navigatorAlarmStatus(e) { 169 navigatorAlarmStatus(e) {
@@ -21,6 +21,9 @@ @@ -21,6 +21,9 @@
21 }; 21 };
22 }, 22 },
23 onLoad() { 23 onLoad() {
  24 + uni.setStorageSync('getConfiguration', {
  25 + isConfiguration: false
  26 + });
24 this.getPlateForm(); 27 this.getPlateForm();
25 }, 28 },
26 created() { 29 created() {
@@ -135,6 +135,7 @@ @@ -135,6 +135,7 @@
135 mapState, 135 mapState,
136 mapMutations 136 mapMutations
137 } from 'vuex'; 137 } from 'vuex';
  138 + import { loginPasswordReg } from '@/plugins/utils.js'
138 139
139 export default { 140 export default {
140 components: { 141 components: {
@@ -244,14 +245,13 @@ @@ -244,14 +245,13 @@
244 if (this.bindAccountObj.appUserKey == '' || this.bindAccountObj.appUserKey == undefined) { 245 if (this.bindAccountObj.appUserKey == '' || this.bindAccountObj.appUserKey == undefined) {
245 return uni.$u.toast('请输入登录账号~'); 246 return uni.$u.toast('请输入登录账号~');
246 } 247 }
247 - const passReg = /^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/;  
248 if (this.bindAccountObj.appUserSecret == '') { 248 if (this.bindAccountObj.appUserSecret == '') {
249 uni.showToast({ 249 uni.showToast({
250 title: '请输入登录密码~', 250 title: '请输入登录密码~',
251 icon: 'none' 251 icon: 'none'
252 }); 252 });
253 return; 253 return;
254 - } else if (!passReg.test(this.bindAccountObj.appUserSecret)) { 254 + } else if (!loginPasswordReg.test(this.bindAccountObj.appUserSecret)) {
255 uni.showModal({ 255 uni.showModal({
256 title: '提示', 256 title: '提示',
257 content: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~', 257 content: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~',
1 -import Vue from "vue";  
2 -import moment from "moment";  
3 -const DATE_TIME_FORMAT = "YYYY-MM-DD HH:mm:ss";  
4 -//手机号中间4位为*  
5 -Vue.filter("phone", function (val) {  
6 - var tel = val;  
7 - tel = "" + tel;  
8 - var telShort = tel.replace(tel.substring(3, 7), "****");  
9 - return telShort;  
10 -});  
11 -//获取系统信息、判断ipX安全距离  
12 -export const getTabbarHeight = function () {  
13 - var systemInfo = uni.getSystemInfoSync();  
14 - var data = {  
15 - ...systemInfo,  
16 - tabbarH: 50, //tabbar高度--单位px  
17 - tabbarPaddingB: 0, //tabbar底部安全距离高度--单位px  
18 - device: systemInfo.system.indexOf("iOS") != -1 ? "iOS" : "Android", //苹果或者安卓设备  
19 - };  
20 - let modelArr = [  
21 - "10,3",  
22 - "10,6",  
23 - "X",  
24 - "XR",  
25 - "XS",  
26 - "11",  
27 - "12",  
28 - "13",  
29 - "14",  
30 - "15",  
31 - "16",  
32 - ];  
33 - let model = systemInfo.model;  
34 - model &&  
35 - modelArr.forEach((item) => {  
36 - //适配iphoneX以上的底部,给tabbar一定高度的padding-bottom  
37 - if (  
38 - model.indexOf(item) != -1 &&  
39 - (model.indexOf("iPhone") != -1 || model.indexOf("iphone") != -1)  
40 - ) {  
41 - data.tabbarH = 70;  
42 - data.tabbarPaddingB = 20;  
43 - }  
44 - });  
45 - return data;  
46 -};  
47 -  
48 -// px转upx  
49 -export const px2upx = function (n) {  
50 - return n / (uni.upx2px(n) / n);  
51 -};  
52 -  
53 -// 小程序获取定位权限判断  
54 -// isOpenSetting 默认false:不检验授权,true:检验授权后获取地址  
55 -function getMpLocation(successCallback, errCallback, isOpenSetting) {  
56 - uni.getSetting({  
57 - success: (res) => {  
58 - if (res.authSetting["scope.userLocation"] || !isOpenSetting) {  
59 - uni.getLocation({  
60 - // #ifndef MP-ALIPAY  
61 - type: "gcj02",  
62 - // #endif  
63 - success(res) {  
64 - console.log("successCallback");  
65 - successCallback(res);  
66 - },  
67 - fail(err) {  
68 - console.log("位置信息错误", err);  
69 - errCallback("位置信息获取失败");  
70 - },  
71 - });  
72 - } else {  
73 - errCallback("“位置信息”未授权");  
74 - isOpenSetting &&  
75 - uni.showModal({  
76 - title: "提示",  
77 - content: "请先在设置页面打开“位置信息”使用权限",  
78 - confirmText: "去设置",  
79 - cancelText: "再逛会",  
80 - success: (res) => {  
81 - if (res.confirm) {  
82 - uni.openSetting();  
83 - }  
84 - },  
85 - });  
86 - }  
87 - },  
88 - });  
89 -}  
90 -// 获取地址信息  
91 -let locationAuthorize = true;  
92 -export const getAppLatLon = function (  
93 - successCallback,  
94 - errCallback,  
95 - isOpenSetting  
96 -) {  
97 - const _this = this;  
98 - // #ifdef MP-WEIXIN  
99 - if (locationAuthorize && isOpenSetting) {  
100 - uni.authorize({  
101 - scope: "scope.userLocation",  
102 - success: () => {  
103 - getMpLocation(successCallback, errCallback, isOpenSetting);  
104 - locationAuthorize = false;  
105 - },  
106 - fail: () => {  
107 - locationAuthorize = false;  
108 - },  
109 - });  
110 - } else {  
111 - getMpLocation(successCallback, errCallback, isOpenSetting);  
112 - }  
113 - // #endif  
114 - // #ifdef MP-ALIPAY  
115 - getMpLocation(successCallback, errCallback, false);  
116 - // #endif  
117 - // #ifdef H5  
118 - uni.getLocation({  
119 - type: "gcj02",  
120 - success(res) {  
121 - console.log("successCallback");  
122 - successCallback(res);  
123 - },  
124 - fail(err) {  
125 - console.log("位置信息错误", err);  
126 - errCallback("位置信息获取失败");  
127 - },  
128 - });  
129 - // #endif  
130 -};  
131 -  
132 -export function formatToDate(date = undefined, format = DATE_TIME_FORMAT) {  
133 - return moment(date).format(format);  
134 -} 1 +import Vue from "vue";
  2 +import moment from "moment";
  3 +const DATE_TIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
  4 +
  5 +/**
  6 + 登录密码正则验证
  7 + 最短8位,最长16位
  8 + 必须包含1个数字
  9 + 必须包含1个小写字母
  10 + 必须包含1个大写字母
  11 + 必须包含1个特殊字符
  12 + */
  13 +export const loginPasswordReg =/^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z]{1,})(?=.*[a-z]{1,})(?=.*[_!@#$%^&*?\(\)]).*$/;
  14 +
  15 +//手机号中间4位为*
  16 +Vue.filter("phone", function (val) {
  17 + var tel = val;
  18 + tel = "" + tel;
  19 + var telShort = tel.replace(tel.substring(3, 7), "****");
  20 + return telShort;
  21 +});
  22 +//获取系统信息、判断ipX安全距离
  23 +export const getTabbarHeight = function () {
  24 + var systemInfo = uni.getSystemInfoSync();
  25 + var data = {
  26 + ...systemInfo,
  27 + tabbarH: 50, //tabbar高度--单位px
  28 + tabbarPaddingB: 0, //tabbar底部安全距离高度--单位px
  29 + device: systemInfo.system.indexOf("iOS") != -1 ? "iOS" : "Android", //苹果或者安卓设备
  30 + };
  31 + let modelArr = [
  32 + "10,3",
  33 + "10,6",
  34 + "X",
  35 + "XR",
  36 + "XS",
  37 + "11",
  38 + "12",
  39 + "13",
  40 + "14",
  41 + "15",
  42 + "16",
  43 + ];
  44 + let model = systemInfo.model;
  45 + model &&
  46 + modelArr.forEach((item) => {
  47 + //适配iphoneX以上的底部,给tabbar一定高度的padding-bottom
  48 + if (
  49 + model.indexOf(item) != -1 &&
  50 + (model.indexOf("iPhone") != -1 || model.indexOf("iphone") != -1)
  51 + ) {
  52 + data.tabbarH = 70;
  53 + data.tabbarPaddingB = 20;
  54 + }
  55 + });
  56 + return data;
  57 +};
  58 +
  59 +// px转upx
  60 +export const px2upx = function (n) {
  61 + return n / (uni.upx2px(n) / n);
  62 +};
  63 +
  64 +// 小程序获取定位权限判断
  65 +// isOpenSetting 默认false:不检验授权,true:检验授权后获取地址
  66 +function getMpLocation(successCallback, errCallback, isOpenSetting) {
  67 + uni.getSetting({
  68 + success: (res) => {
  69 + if (res.authSetting["scope.userLocation"] || !isOpenSetting) {
  70 + uni.getLocation({
  71 + // #ifndef MP-ALIPAY
  72 + type: "gcj02",
  73 + // #endif
  74 + success(res) {
  75 + console.log("successCallback");
  76 + successCallback(res);
  77 + },
  78 + fail(err) {
  79 + console.log("位置信息错误", err);
  80 + errCallback("位置信息获取失败");
  81 + },
  82 + });
  83 + } else {
  84 + errCallback("“位置信息”未授权");
  85 + isOpenSetting &&
  86 + uni.showModal({
  87 + title: "提示",
  88 + content: "请先在设置页面打开“位置信息”使用权限",
  89 + confirmText: "去设置",
  90 + cancelText: "再逛会",
  91 + success: (res) => {
  92 + if (res.confirm) {
  93 + uni.openSetting();
  94 + }
  95 + },
  96 + });
  97 + }
  98 + },
  99 + });
  100 +}
  101 +// 获取地址信息
  102 +let locationAuthorize = true;
  103 +export const getAppLatLon = function (
  104 + successCallback,
  105 + errCallback,
  106 + isOpenSetting
  107 +) {
  108 + const _this = this;
  109 + // #ifdef MP-WEIXIN
  110 + if (locationAuthorize && isOpenSetting) {
  111 + uni.authorize({
  112 + scope: "scope.userLocation",
  113 + success: () => {
  114 + getMpLocation(successCallback, errCallback, isOpenSetting);
  115 + locationAuthorize = false;
  116 + },
  117 + fail: () => {
  118 + locationAuthorize = false;
  119 + },
  120 + });
  121 + } else {
  122 + getMpLocation(successCallback, errCallback, isOpenSetting);
  123 + }
  124 + // #endif
  125 + // #ifdef MP-ALIPAY
  126 + getMpLocation(successCallback, errCallback, false);
  127 + // #endif
  128 + // #ifdef H5
  129 + uni.getLocation({
  130 + type: "gcj02",
  131 + success(res) {
  132 + console.log("successCallback");
  133 + successCallback(res);
  134 + },
  135 + fail(err) {
  136 + console.log("位置信息错误", err);
  137 + errCallback("位置信息获取失败");
  138 + },
  139 + });
  140 + // #endif
  141 +};
  142 +
  143 +export function formatToDate(date = undefined, format = DATE_TIME_FORMAT) {
  144 + return moment(date).format(format);
  145 +}
  146 +
  147 +//封装uniapp跳转 navigateTo
  148 +export const useNavigateTo=(path,param)=>{
  149 + if (!path) return
  150 + if(param){
  151 + uni.navigateTo({
  152 + url: path + encodeURIComponent(JSON.stringify(param))
  153 + });
  154 + }else{
  155 + uni.navigateTo({
  156 + url:path
  157 + });
  158 + }
  159 +}
@@ -52,6 +52,7 @@ @@ -52,6 +52,7 @@
52 52
53 <script> 53 <script>
54 import api from '@/api/index.js' 54 import api from '@/api/index.js'
  55 + import { loginPasswordReg } from '@/plugins/utils.js'
55 56
56 var clear; 57 var clear;
57 export default { 58 export default {
@@ -156,14 +157,13 @@ @@ -156,14 +157,13 @@
156 this.nextStatus = false; 157 this.nextStatus = false;
157 }, 158 },
158 onSubmit() { 159 onSubmit() {
159 - const passReg = /^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/;  
160 if (this.password == '' && this.rePassword == '') { 160 if (this.password == '' && this.rePassword == '') {
161 uni.showToast({ 161 uni.showToast({
162 title: '请输入密码~', 162 title: '请输入密码~',
163 icon: 'none' 163 icon: 'none'
164 }); 164 });
165 return; 165 return;
166 - } else if (!passReg.test(this.password) && !passReg.test(this.rePassword)) { 166 + } else if (!loginPasswordReg.test(this.password) && !loginPasswordReg.test(this.rePassword)) {
167 //uni.showToast,字数过长,会造成手机上显示不完全,官方bug,采用uni.showModal 167 //uni.showToast,字数过长,会造成手机上显示不完全,官方bug,采用uni.showModal
168 uni.showModal({ 168 uni.showModal({
169 title: '提示', 169 title: '提示',
@@ -69,6 +69,7 @@ @@ -69,6 +69,7 @@
69 mapState 69 mapState
70 } from "vuex"; 70 } from "vuex";
71 import api from '@/api' 71 import api from '@/api'
  72 + import { loginPasswordReg } from '@/plugins/utils.js'
72 73
73 export default { 74 export default {
74 data() { 75 data() {
@@ -97,14 +98,17 @@ @@ -97,14 +98,17 @@
97 }, 98 },
98 }); 99 });
99 //#endif 100 //#endif
  101 + uni.setStorageSync('getConfiguration', {
  102 + isConfiguration: false
  103 + });
100 }, 104 },
101 computed: { 105 computed: {
102 ...mapState(["plateInfo"]), 106 ...mapState(["plateInfo"]),
103 }, 107 },
104 - mounted() {  
105 - this.getPlateForm();  
106 - },  
107 onShow() { 108 onShow() {
  109 + uni.setStorageSync('getConfiguration', {
  110 + isConfiguration: false
  111 + });
108 this.getPlateForm(); 112 this.getPlateForm();
109 }, 113 },
110 methods: { 114 methods: {
@@ -237,18 +241,15 @@ @@ -237,18 +241,15 @@
237 if (this.loginForm.username == "") { 241 if (this.loginForm.username == "") {
238 return uni.$u.toast("请输入登录账号~"); 242 return uni.$u.toast("请输入登录账号~");
239 } 243 }
240 - const passReg =  
241 - /^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/;  
242 -  
243 if (this.loginForm.password == "") { 244 if (this.loginForm.password == "") {
244 uni.showToast({ 245 uni.showToast({
245 title: "请输入登录密码~", 246 title: "请输入登录密码~",
246 icon: "none", 247 icon: "none",
247 }); 248 });
248 return; 249 return;
249 - } else if (!passReg.test(this.loginForm.password)) { 250 + } else if (!loginPasswordReg.test(this.loginForm.password)) {
250 uni.showModal({ 251 uni.showModal({
251 - title: "提示", 252 + title: "提示",
252 content: "密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~", 253 content: "密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~",
253 showCancel: false, 254 showCancel: false,
254 }); 255 });
1 -<template>  
2 - <view class="notify-detail-page">  
3 - <!-- 公共组件-每个页面必须引入 -->  
4 - <public-module></public-module>  
5 - <view class="notify-column">  
6 - <view class="column-list">  
7 - <view style="margin-left: 36rpx;position: relative;top: 21rpx;">  
8 - <view class="text-clip" style="width:500rpx">  
9 - <text class="notify-detail-text ">{{ notifyList.title }}</text>  
10 - </view>  
11 - </view>  
12 - <view style="height: 25rpx;"></view>  
13 - <u-list height="140rpx">  
14 - <u-list-item>  
15 - <u-cell :value="`${notifyList.senderDate}`" :title="`${notifyList.senderName}`">  
16 - <u-avatar slot="icon" shape="circle" size="35" :src="notifyList.avatar"></u-avatar>  
17 - </u-cell>  
18 - </u-list-item>  
19 - </u-list>  
20 - <view class="bottom-text">  
21 - <view class="u-flex column"></view>  
22 - <view style="margin-top: 21rpx;">  
23 - <!-- 富文本解析 -->  
24 - <u-parse :content="notifyList.content"></u-parse>  
25 - <!-- 富文本解析 -->  
26 - </view>  
27 - </view>  
28 - </view>  
29 - </view>  
30 - </view>  
31 -</template>  
32 -  
33 -<script>  
34 -export default {  
35 - data() {  
36 - return {  
37 - notifyList: {}  
38 - };  
39 - },  
40 - onLoad(e) {  
41 - // 隐藏原生的tabbar  
42 - uni.hideTabBar();  
43 - if (e.data !== null) {  
44 - let params = JSON.parse(decodeURIComponent(e.data));  
45 - if (params) this.notifyList = params;  
46 - uni.setStorageSync('storagePre', true);  
47 - }  
48 - },  
49 - onHide() {  
50 - uni.setStorageSync('storagePre', false);  
51 - }  
52 -};  
53 -</script>  
54 -  
55 -<style lang="scss" scoped>  
56 -@import './static/notifyDetail.scss';  
57 -/deep/ .u-line {  
58 - position: relative !important;  
59 - width: 640rpx !important;  
60 - left: 31rpx !important;  
61 -}  
62 -</style> 1 +<template>
  2 + <view class="notify-detail-page">
  3 + <!-- 公共组件-每个页面必须引入 -->
  4 + <public-module></public-module>
  5 + <view class="notify-column">
  6 + <view class="column-list">
  7 + <view class="column-title">
  8 + <view class="text-clip" style="width:500rpx">
  9 + <text class="notify-detail-text ">{{ notifyList.title }}</text>
  10 + </view>
  11 + </view>
  12 + <view style="height: 25rpx;"></view>
  13 + <u-list height="140rpx">
  14 + <u-list-item>
  15 + <u-cell :value="`${notifyList.senderDate}`" :title="`${notifyList.senderName}`">
  16 + <u-avatar slot="icon" shape="circle" size="35" :src="notifyList.avatar"></u-avatar>
  17 + </u-cell>
  18 + </u-list-item>
  19 + </u-list>
  20 + <view class="bottom-text">
  21 + <view class="u-flex column"></view>
  22 + <view style="margin-top: 21rpx;">
  23 + <!-- 富文本解析 -->
  24 + <u-parse :content="notifyList.content"></u-parse>
  25 + <!-- 富文本解析 -->
  26 + </view>
  27 + </view>
  28 + </view>
  29 + </view>
  30 + </view>
  31 +</template>
  32 +
  33 +<script>
  34 +export default {
  35 + data() {
  36 + return {
  37 + notifyList: {}
  38 + };
  39 + },
  40 + onLoad(e) {
  41 + // 隐藏原生的tabbar
  42 + uni.hideTabBar();
  43 + if (e.data !== null) {
  44 + let params = JSON.parse(decodeURIComponent(e.data));
  45 + if (params) this.notifyList = params;
  46 + }
  47 + }
  48 +};
  49 +</script>
  50 +
  51 +<style lang="scss" scoped>
  52 +@import './static/notifyDetail.scss';
  53 +/deep/ .u-line {
  54 + position: relative !important;
  55 + width: 640rpx !important;
  56 + left: 31rpx !important;
  57 +}
  58 +</style>
1 -.notify-detail-page {  
2 - min-height: 100vh;  
3 - background-color: #f8f9fa;  
4 - padding-top: 10rpx;  
5 - padding-left: 27rpx;  
6 -}  
7 -.notify-column {  
8 - .column-list {  
9 - border-radius: 10px;  
10 - margin-top: 20rpx;  
11 - width: 696rpx;  
12 - height: 1000rpx;  
13 - background-color: #ffffff;  
14 - .bottom-text {  
15 - margin-left: 33rpx;  
16 - .text {  
17 - color: #2e384d;  
18 - font-size: 15px;  
19 - }  
20 - .column {  
21 - margin-top: 20rpx;  
22 - .text {  
23 - font-size: 16px;  
24 - font-family: PingFangSC-Medium, PingFang SC;  
25 - font-weight: 500;  
26 - color: #2e384d;  
27 - }  
28 - }  
29 - }  
30 - }  
31 -} 1 +.notify-detail-page {
  2 + min-height: 100vh;
  3 + background-color: #f8f9fa;
  4 + padding-top: 10rpx;
  5 + padding-left: 27rpx;
  6 +}
  7 +.notify-column {
  8 + .column-list {
  9 + border-radius: 10px;
  10 + margin-top: 20rpx;
  11 + width: 696rpx;
  12 + height: 1000rpx;
  13 + background-color: #ffffff;
  14 + .column-title{
  15 + margin-left: 36rpx;
  16 + position: relative;
  17 + top: 21rpx;
  18 + }
  19 + .bottom-text {
  20 + margin-left: 33rpx;
  21 + .text {
  22 + color: #2e384d;
  23 + font-size: 15px;
  24 + }
  25 + .column {
  26 + margin-top: 20rpx;
  27 + .text {
  28 + font-size: 16px;
  29 + font-family: PingFangSC-Medium, PingFang SC;
  30 + font-weight: 500;
  31 + color: #2e384d;
  32 + }
  33 + }
  34 + }
  35 + }
  36 +}
1 -.notify-page {  
2 - min-height: 100vh;  
3 - background-color: #f8f9fa;  
4 - padding-top: 10rpx;  
5 - padding-left: 27rpx;  
6 -}  
7 -/deep/.u-list-item {  
8 - background: #ffffff;  
9 - width: 695rpx;  
10 - border-radius: 10px;  
11 - margin-top: 20rpx;  
12 -}  
13 -.notify-main {  
14 - .main {  
15 - flex-direction: column;  
16 - margin-left: -22rpx;  
17 - .main-item {  
18 - justify-content: space-between;  
19 - flex-direction: row;  
20 - margin: 15rpx;  
21 - width: 700rpx;  
22 - height: 136rpx;  
23 - background: #ffffff;  
24 - border-radius: 10px;  
25 - .item {  
26 - justify-content: space-between;  
27 - flex-direction: row;  
28 - .item-avatar {  
29 - margin-left: 30rpx;  
30 - .avatar {  
31 - margin-left: 30rpx;  
32 - }  
33 - }  
34 - .item-content {  
35 - margin-left: 30rpx;  
36 - text-align: left;  
37 - justify-content: space-between;  
38 - flex-direction: column;  
39 - .text-top {  
40 - width: 400rpx;  
41 - color: #2e384d;  
42 - font-size: 15px;  
43 - }  
44 - .text-bottom {  
45 - width: 400rpx;  
46 - color: #999999;  
47 - font-size: 13px;  
48 - }  
49 - }  
50 - }  
51 - .item-right {  
52 - .text {  
53 - margin-right: 30rpx;  
54 - color: #999999;  
55 - font-size: 13px;  
56 - }  
57 - }  
58 - }  
59 - }  
60 -} 1 +.notify-page {
  2 + min-height: 100vh;
  3 + background-color: #f8f9fa;
  4 + padding-top: 10rpx;
  5 + padding-left: 27rpx;
  6 + .notify-page-top-select{
  7 + width: 750rpx;
  8 + height:53rpx;
  9 + background-color: #f8f9fa;
  10 + position:fixed;
  11 + top:0;
  12 + z-index: 99999;
  13 + }
  14 + .top-select{
  15 + background-color: #f8f9fa;
  16 + width: 700rpx;
  17 + position: relative;
  18 + top: 35rpx;
  19 + }
  20 +}
  21 +/deep/.u-list-item {
  22 + background: #ffffff;
  23 + width: 695rpx;
  24 + border-radius: 10px;
  25 + margin-top: 20rpx;
  26 +}
  27 +.notify-main {
  28 + .main {
  29 + flex-direction: column;
  30 + margin-left: -22rpx;
  31 + .main-item {
  32 + justify-content: space-between;
  33 + flex-direction: row;
  34 + margin: 15rpx;
  35 + width: 700rpx;
  36 + height: 136rpx;
  37 + background: #ffffff;
  38 + border-radius: 10px;
  39 + .item {
  40 + justify-content: space-between;
  41 + flex-direction: row;
  42 + .item-avatar {
  43 + margin-left: 30rpx;
  44 + .avatar {
  45 + margin-left: 30rpx;
  46 + }
  47 + }
  48 + .item-content {
  49 + margin-left: 30rpx;
  50 + text-align: left;
  51 + justify-content: space-between;
  52 + flex-direction: column;
  53 + .text-top {
  54 + width: 400rpx;
  55 + color: #2e384d;
  56 + font-size: 15px;
  57 + }
  58 + .text-bottom {
  59 + width: 400rpx;
  60 + color: #999999;
  61 + font-size: 13px;
  62 + }
  63 + }
  64 + }
  65 + .item-right {
  66 + .text {
  67 + margin-right: 30rpx;
  68 + color: #999999;
  69 + font-size: 13px;
  70 + }
  71 + }
  72 + }
  73 + }
  74 +}
1 -<template>  
2 - <view class="notify-page">  
3 - <!-- 公共组件-每个页面必须引入 -->  
4 - <public-module></public-module>  
5 - <view style="width: 750rpx;height:53rpx;background-color: #f8f9fa;position:fixed;top:0;z-index: 99999;">  
6 - <view @click="openTypeClick" style="background-color: #f8f9fa;width: 700rpx;position: relative;top: 35rpx;">  
7 - <u--input suffixIcon="arrow-down" shape="circle" disabled v-model="model1.userInfo.type"  
8 - placeholder="请选择类型" border="surround"></u--input>  
9 - <u-action-sheet :show="showType" :actions="actions" title="请选择类型" @close="showType = false"  
10 - @select="typeSelect"></u-action-sheet>  
11 - </view>  
12 - </view>  
13 - <view style="height: 110rpx;"></view>  
14 - <view class="notify-main">  
15 - <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback"  
16 - @up="upCallback">  
17 - <view class="u-flex main">  
18 - <view @click="clickNotifyDetail(item, index)" class="u-flex main-item" v-for="(item, index) in list"  
19 - :key="index">  
20 - <view class="u-flex item">  
21 - <view class="item-avatar">  
22 - <u-avatar class="avatar" shape="circle" size="40" :src="item.sysNotice.avatar">  
23 - </u-avatar>  
24 - </view>  
25 - <view class="u-flex item-content">  
26 - <text class="text-top text-clip">{{ item.sysNotice.title }}</text>  
27 - <text class="text-bottom text-clip">{{ item.sysNotice.createTime }}</text>  
28 - </view>  
29 - </view>  
30 - <view class="item-right u-flex" style="justify-content: space-between;">  
31 - <text class="text">{{ formatType(item.sysNotice) }}</text>  
32 - <u-badge style="margin-right: 10rpx;" v-if="item.readStatus == '0'" numberType="overflow"  
33 - isDot />  
34 - </view>  
35 - </view>  
36 - </view>  
37 - </mescroll-body>  
38 - </view>  
39 - </view>  
40 -</template>  
41 -  
42 -<script>  
43 - import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';  
44 - import api from '@/api/index.js'  
45 -  
46 - export default {  
47 - mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)  
48 - data() {  
49 - return {  
50 - model1: {  
51 - userInfo: {  
52 - type: ''  
53 - }  
54 - },  
55 - showType: false,  
56 - actions: [{  
57 - name: '全部',  
58 - value: ''  
59 - },  
60 - {  
61 - name: '会议',  
62 - value: 'MEETING'  
63 - },  
64 - {  
65 - name: '公告',  
66 - value: 'NOTICE'  
67 - },  
68 - {  
69 - name: '其他',  
70 - value: 'OTHER'  
71 - }  
72 - ],  
73 - page: {  
74 - num: 0,  
75 - size: 10  
76 - },  
77 - downOption: {  
78 - auto: false //是否在初始化后,自动执行downCallback; 默认true  
79 - },  
80 - list: [],  
81 - pre: false,  
82 - isJudgeNextPage: '',  
83 - distance: 0,  
84 - scrollDistance: 0  
85 - };  
86 - },  
87 - onLoad(e) {  
88 - // 隐藏原生的tabbar  
89 - uni.hideTabBar();  
90 - this.pre = false;  
91 - uni.removeStorageSync('storagePre');  
92 - },  
93 - onShow() {  
94 - this.pre = uni.getStorageSync('storagePre');  
95 - if (this.pre) {}  
96 - },  
97 - onHide() {  
98 - uni.removeStorageSync('storagePre');  
99 - },  
100 - methods: {  
101 - formatType(e) {  
102 - return e?.type == 'OTHER' ? '其他' : e?.type == 'MEETING' ? '会议' : '公告';  
103 - },  
104 - openTypeClick() {  
105 - this.showType = true;  
106 - uni.hideKeyboard();  
107 - },  
108 - typeSelect(e) {  
109 - this.isJudgeNextPage = e.value;  
110 - this.page.num = 1;  
111 - this.model1.userInfo.type = e.name;  
112 - this.loadData(1, this.isJudgeNextPage == '' ? null : this.isJudgeNextPage);  
113 - uni.pageScrollTo({  
114 - scrollTop: this.scrollDistance + 20,  
115 - duration: 50  
116 - });  
117 - uni.pageScrollTo({  
118 - scrollTop: this.scrollDistance - 20,  
119 - duration: 50  
120 - });  
121 - },  
122 - onPageScroll(e) {  
123 - this.scrollDistance = e.scrollTop;  
124 - },  
125 - /*下拉刷新的回调 */  
126 - downCallback() {  
127 - //联网加载数据  
128 - this.list.length = 0;  
129 - this.page.num = 1;  
130 - this.loadData(1);  
131 - this.isJudgeNextPage = '';  
132 - this.model1.userInfo.type = '';  
133 - },  
134 - /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */  
135 - upCallback() {  
136 - if (this.isJudgeNextPage != '') {  
137 - //联网加载数据  
138 - this.page.num += 1;  
139 - this.loadData(this.page.num, this.isJudgeNextPage);  
140 - } else {  
141 - //联网加载数据  
142 - this.page.num += 1;  
143 - this.loadData(this.page.num);  
144 - }  
145 - },  
146 -  
147 - async loadData(pageNo, t) {  
148 - let httpData = {  
149 - page: pageNo,  
150 - pageSize: 10,  
151 - type: t  
152 - };  
153 - const res = await api.notifyApi.getNotifyApi({  
154 - params: httpData,  
155 - custom: {  
156 - load: false  
157 - }  
158 - })  
159 - uni.stopPullDownRefresh();  
160 - this.mescroll.endByPage(res.items.length, res.total);  
161 - if (pageNo == 1) {  
162 - this.list = res.items;  
163 - } else {  
164 - this.list = this.list.concat(res.items);  
165 - }  
166 - },  
167 - async clickNotifyDetail(e, i) {  
168 - this.list[i].readStatus = 1;  
169 - await api.notifyApi.byNotifyIdGetDetailApi(e.sysNotice.id)  
170 - uni.navigateTo({  
171 - url: './notifyDetail?data=' + encodeURIComponent(JSON.stringify(e.sysNotice))  
172 - });  
173 - }  
174 - }  
175 - };  
176 -</script>  
177 -  
178 -<style lang="scss" scoped>  
179 - @import './static/systemNotify.scss';  
180 -  
181 - /deep/ .u-badge--error {  
182 - position: relative;  
183 - right: 11rpx;  
184 - }  
185 -</style> 1 +<template>
  2 + <view class="notify-page">
  3 + <!-- 公共组件-每个页面必须引入 -->
  4 + <public-module></public-module>
  5 + <view class="notify-page-top-select">
  6 + <view @click="handleTypeClick" class="top-select">
  7 + <u--input suffixIcon="arrow-down" shape="circle" disabled v-model="notifyType"
  8 + placeholder="请选择类型" border="surround"></u--input>
  9 + <u-action-sheet safe-area-inset-bottom :show="showType" :actions="actions" title="请选择类型" @close="showType = false"
  10 + @select="handleTypeSelect"></u-action-sheet>
  11 + </view>
  12 + </view>
  13 + <view style="height: 110rpx;"></view>
  14 + <view class="notify-main">
  15 + <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback"
  16 + @up="upCallback">
  17 + <view class="u-flex main">
  18 + <view @click="handleNotifyDetail(item, index)" class="u-flex main-item" v-for="(item, index) in list"
  19 + :key="index">
  20 + <view class="u-flex item">
  21 + <view class="item-avatar">
  22 + <u-avatar class="avatar" shape="circle" size="40" :src="item.sysNotice.avatar">
  23 + </u-avatar>
  24 + </view>
  25 + <view class="u-flex item-content">
  26 + <text class="text-top text-clip">{{ item.sysNotice.title }}</text>
  27 + <text class="text-bottom text-clip">{{ item.sysNotice.senderDate }}</text>
  28 + </view>
  29 + </view>
  30 + <view class="item-right u-flex" style="justify-content: space-between;">
  31 + <text class="text">{{ formatType(item.sysNotice.type) }}</text>
  32 + <!-- readStatus===0则阅读状态表示未阅读 -->
  33 + <u-badge style="margin-right: 10rpx;" v-if="item.readStatus == '0'" numberType="overflow"
  34 + isDot />
  35 + </view>
  36 + </view>
  37 + </view>
  38 + </mescroll-body>
  39 + </view>
  40 + </view>
  41 +</template>
  42 +
  43 +<script>
  44 + import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
  45 + import api from '@/api/index.js'
  46 + import { useNavigateTo } from '@/plugins/utils.js'
  47 +
  48 + export default {
  49 + mixins: [MescrollMixin],
  50 + data() {
  51 + return {
  52 + notifyType:'',
  53 + showType: false,
  54 + actions: [{
  55 + name: '全部',
  56 + value: ''
  57 + },
  58 + {
  59 + name: '会议',
  60 + value: 'MEETING'
  61 + },
  62 + {
  63 + name: '公告',
  64 + value: 'NOTICE'
  65 + },
  66 + {
  67 + name: '其他',
  68 + value: 'OTHER'
  69 + }
  70 + ],
  71 + page: {
  72 + page: 0,
  73 + pageSize: 10
  74 + },
  75 + downOption: {
  76 + auto: false //是否在初始化后,自动执行downCallback; 默认true
  77 + },
  78 + list: [],
  79 + selectType: '',
  80 + distance: 0,
  81 + };
  82 + },
  83 + onLoad(e) {
  84 + // 隐藏原生的tabbar
  85 + uni.hideTabBar();
  86 + },
  87 + methods: {
  88 + formatType(e) {
  89 + return this.actions.find((item)=>item.value===e && item.value!=='').name
  90 + },
  91 + handleTypeClick() {
  92 + this.showType = true;
  93 + uni.hideKeyboard();
  94 + },
  95 + handleTypeSelect(e) {
  96 + this.selectType = e.value;
  97 + this.page.page = 1;
  98 + this.notifyType = e.name;
  99 + this.loadData(1, !this.selectType ? null : this.selectType);
  100 + },
  101 + downCallback() {
  102 + this.list.length = 0;
  103 + this.page.page = 1;
  104 + this.loadData(1);
  105 + this.selectType = '';
  106 + this.notifyType = '';
  107 + },
  108 + upCallback() {
  109 + if (this.selectType) {
  110 + this.page.page += 1;
  111 + this.loadData(this.page.page, this.selectType);
  112 + } else {
  113 + this.page.page += 1;
  114 + this.loadData(this.page.page);
  115 + }
  116 + },
  117 + async loadData(page, type) {
  118 + let params = {
  119 + page,
  120 + pageSize: 10,
  121 + type
  122 + };
  123 + const res = await api.notifyApi.getNotifyApi({
  124 + params,
  125 + custom: {
  126 + load: false
  127 + }
  128 + })
  129 + uni.stopPullDownRefresh();
  130 + this.mescroll.endByPage(res.items.length, res.total);
  131 + if (page == 1) {
  132 + this.list = res.items;
  133 + } else {
  134 + this.list = this.list.concat(res.items);
  135 + }
  136 + },
  137 + async handleNotifyDetail(item, index) {
  138 + this.list[index].readStatus = 1;//点击了则说明阅读了
  139 + await api.notifyApi.byNotifyIdGetDetailApi(item.sysNotice.id)
  140 + useNavigateTo('./notifyDetail?data=', item.sysNotice)
  141 + }
  142 + }
  143 + };
  144 +</script>
  145 +
  146 +<style lang="scss" scoped>
  147 + @import './static/systemNotify.scss';
  148 +
  149 + /deep/ .u-badge--error {
  150 + position: relative;
  151 + right: 11rpx;
  152 + }
  153 +</style>