Commit e91427fb7041ad9edba882f1330f0490fe6b6642

Authored by fengwotao
1 parent 15e18f7f

perf: 优化app

... ... @@ -192,7 +192,7 @@
192 192 const findAttribute = dataItem.attribute.find(findItem => findItem
193 193 .identifier === e[curr].key)
194 194 acc.push(
195   - `${findAttribute.name}:${e[curr].realValue}${findAttribute.detail?.dataType?.specs?.unit?.key}`
  195 + `${findAttribute.name}:${e[curr].realValue}${!findAttribute.detail?.dataType?.specs?.unit?.key?'':findAttribute.detail?.dataType?.specs?.unit?.key}`
196 196 )
197 197 }
198 198 }))
... ...
... ... @@ -63,7 +63,7 @@
63 63 <!-- 命令下发 -->
64 64 <!-- #ifdef APP-PLUS -->
65 65 <!-- 原生弹窗 封装成子组件无效 -->
66   - <view class="cu-modal" :class="modalName == 'Modal' ? 'show' : ''">
  66 + <view v-show="showNativeModal" class="cu-modal" :class="modalName == 'Modal' ? 'show' : ''">
67 67 <view class="cu-dialog">
68 68 <view class="app-command-content">
69 69 <view class="app-command-text">
... ... @@ -138,6 +138,7 @@
138 138 },
139 139 data() {
140 140 return {
  141 + showNativeModal: false,
141 142 current: 0,
142 143 commandTypeList,
143 144 commandTypeStr: 'OneWay',
... ... @@ -182,6 +183,7 @@
182 183 onLoad() {
183 184 // 隐藏原生的tabbar
184 185 uni.hideTabBar();
  186 + this.modalName = null
185 187 },
186 188 methods: {
187 189 handleCopy(value) {
... ... @@ -222,6 +224,7 @@
222 224 },
223 225 handleAppShowModal(e) {
224 226 this.modalName = e.currentTarget.dataset.target;
  227 + this.showNativeModal = true
225 228 },
226 229 handleMpShowModal() {
227 230 const {
... ... @@ -235,6 +238,7 @@
235 238 },
236 239 hideAppModal() {
237 240 this.modalName = null;
  241 + this.showNativeModal = false
238 242 },
239 243 confirmCommand(commandType, inputCommandVal) {
240 244 this.handleCommand(commandType, inputCommandVal)
... ... @@ -252,6 +256,7 @@
252 256 this.handleCommand(this.commandTypeStr, this.inputCommandContent)
253 257 },
254 258 async handleCommand(commandType, inputCommandVal) {
  259 + if (!inputCommandVal) return uni.$u.toast('请输入下发内容~');
255 260 if (this.isShowTCP) {
256 261 //TCP的格式只能是字符串
257 262 const zg = /^[0-9a-zA-Z]*$/;
... ... @@ -263,7 +268,6 @@
263 268 } else {
264 269 this.commandValue.params = JSON.parse(inputCommandVal);
265 270 }
266   - if (!inputCommandVal) return uni.$u.toast('请输入下发内容~');
267 271 this.commandValue.persistent = true;
268 272 this.commandValue.additionalInfo = {
269 273 cmdType: 'API'
... ...
... ... @@ -101,6 +101,8 @@
101 101 this.list.push({
102 102 name: "命令记录",
103 103 });
  104 + const res = new Map()
  105 + this.list = this.list.filter((item) => !res.has(item.name) && res.set(item.name, 1))
104 106 }
105 107 this.isScrollable = this.list.length > 4;
106 108 if (res.deviceProfileId) {
... ...
... ... @@ -8,10 +8,10 @@
8 8 <text class="text">手机验证码登录</text>
9 9 <view class="circleStyle"></view>
10 10 </view>
11   - <view class="form-row"><u-input v-model="loginForm.phone" type="number" placeholder="请输入手机号码"
  11 + <view class="form-row"><u-input v-model="loginForm.phoneNumber" type="number" placeholder="请输入手机号码"
12 12 border="bottom"></u-input></view>
13 13 <view class="form-row">
14   - <u-input type="number" v-model="loginForm.verifyCode" placeholder="请输入验证码" border="bottom">
  14 + <u-input type="number" v-model="loginForm.code" placeholder="请输入验证码" border="bottom">
15 15 <template slot="suffix">
16 16 <view @click="getVerifyCode" class="verify-code">{{ codeText }}</view>
17 17 </template>
... ... @@ -36,7 +36,8 @@
36 36 } from 'vuex';
37 37 import {
38 38 useShowToast,
39   - useNavigateTo
  39 + useNavigateTo,
  40 + useReLaunch
40 41 } from '@/plugins/utils.js'
41 42 import api from '@/api'
42 43
... ... @@ -44,8 +45,8 @@
44 45 data() {
45 46 return {
46 47 loginForm: {
47   - phone: '',
48   - verifyCode: ''
  48 + phoneNumber: '',
  49 + code: ''
49 50 },
50 51 readonly: false,
51 52 codeText: '发送验证码',
... ... @@ -76,14 +77,14 @@
76 77 if (this.readonly) {
77 78 useShowToast('验证码已发送~')
78 79 }
79   - if (!this.loginForm.phone) {
  80 + if (!this.loginForm.phoneNumber) {
80 81 return useShowToast('请输入手机号~')
81 82 }
82   - if (!phoneRegular.test(this.loginForm.phone)) {
  83 + if (!phoneRegular.test(this.loginForm.phoneNumber)) {
83 84 return useShowToast('手机号格式不正确~')
84 85 }
85 86 // 获取验证码接口
86   - await api.loginApi.postPhoneCodeApi(this.loginForm.phone)
  87 + await api.loginApi.postPhoneCodeApi(this.loginForm.phoneNumber)
87 88 this.codeCountdownText(); //开始倒计时
88 89 },
89 90 async onSubmit() {
... ...
... ... @@ -72,7 +72,7 @@ const alertLevel = [{
72 72 },
73 73 {
74 74 index: 2,
75   - name: '危险',
  75 + name: '紧急',
76 76 value: 'CRITICAL',
77 77 bgColor: '#F6F6F6',
78 78 textColor: '#F6F6F6'
... ... @@ -145,7 +145,7 @@ const timeArea = [{
145 145 ]
146 146
147 147 const alarmSeverity = [{
148   - label: '危险',
  148 + label: '紧急',
149 149 value: 'CRITICAL',
150 150 color: '#DE4437',
151 151 icon: '/static/danger.png',
... ...