Commit e91427fb7041ad9edba882f1330f0490fe6b6642

Authored by fengwotao
1 parent 15e18f7f

perf: 优化app

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