Commit 0493813703a5bf13d853b4671290ad459ba0d5ae

Authored by fengwotao
2 parents 84c365f3 62a3bd84

pref: app、mp端 优化代码

@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <image src="/static/shaixuan.png" /> 6 <image src="/static/shaixuan.png" />
7 </view> 7 </view>
8 <!-- 告警分页 --> 8 <!-- 告警分页 -->
9 - <mescroll-uni height="700px" ref="mescrollRef" @init="mescrollInit" :up="upOption" :down="downOption" 9 + <mescroll-uni height="700rpx;" ref="mescrollRef" @init="mescrollInit" :up="upOption" :down="downOption"
10 @down="downCallback" @up="upCallback"> 10 @down="downCallback" @up="upCallback">
11 <alarm-item :list="list" @openAlertDetail="openAlertDetail"></alarm-item> 11 <alarm-item :list="list" @openAlertDetail="openAlertDetail"></alarm-item>
12 <mescroll-empty v-if="!list.length" /> 12 <mescroll-empty v-if="!list.length" />
@@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
17 </view> 17 </view>
18 </template> 18 </template>
19 <script> 19 <script>
20 - import FilterItem from '@/pages/device/components/query-item.vue';  
21 import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; 20 import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
22 import api from '@/api/index.js' 21 import api from '@/api/index.js'
23 import alarmItem from '@/pages/alarm/components/alarm-item.vue' 22 import alarmItem from '@/pages/alarm/components/alarm-item.vue'
@@ -29,7 +28,6 @@ @@ -29,7 +28,6 @@
29 export default { 28 export default {
30 mixins: [MescrollMixin], 29 mixins: [MescrollMixin],
31 components: { 30 components: {
32 - FilterItem,  
33 alarmItem, 31 alarmItem,
34 alarmPopup 32 alarmPopup
35 }, 33 },
@@ -69,7 +67,9 @@ @@ -69,7 +67,9 @@
69 }, 67 },
70 resetQuery() { 68 resetQuery() {
71 this.page.num = 1; 69 this.page.num = 1;
72 - this.$refs.alarmPopupRef.resetQuery() 70 + this.$nextTick(() => {
  71 + this.$refs.alarmPopupRef.resetQuery()
  72 + })
73 this.conditions = {} 73 this.conditions = {}
74 }, 74 },
75 downCallback() { 75 downCallback() {
1 <template> 1 <template>
  2 +
2 </template> 3 </template>
3 4
4 <script> 5 <script>
5 export default { 6 export default {
6 7
7 } 8 }
8 -</script>  
9 -<style>  
10 -</style>  
  9 +</script>
@@ -60,7 +60,7 @@ @@ -60,7 +60,7 @@
60 </view> 60 </view>
61 <!-- 命令下发 --> 61 <!-- 命令下发 -->
62 <!-- #ifdef APP-PLUS --> 62 <!-- #ifdef APP-PLUS -->
63 - <app-command-issuance :showModal="appShowModal"></app-command-issuance> 63 + <app-command-issuance></app-command-issuance>
64 <!-- #endif --> 64 <!-- #endif -->
65 <!-- #ifdef MP --> 65 <!-- #ifdef MP -->
66 <!-- u-modal在app端弹窗层级无法覆盖 --> 66 <!-- u-modal在app端弹窗层级无法覆盖 -->
@@ -80,13 +80,11 @@ @@ -80,13 +80,11 @@
80 import api from '@/api/index.js' 80 import api from '@/api/index.js'
81 import mpCommandIssuance from './mp-command-issuance.vue' 81 import mpCommandIssuance from './mp-command-issuance.vue'
82 import appCommandIssuance from './app-command-issuance.vue' 82 import appCommandIssuance from './app-command-issuance.vue'
83 - import nextModal from '@/components/module/next-modal_1.0.2/components/next-modal/next-modal.vue'  
84 83
85 export default { 84 export default {
86 components: { 85 components: {
87 mpCommandIssuance, 86 mpCommandIssuance,
88 appCommandIssuance, 87 appCommandIssuance,
89 - nextModal  
90 }, 88 },
91 props: { 89 props: {
92 deviceDetail: { 90 deviceDetail: {
@@ -137,7 +135,7 @@ @@ -137,7 +135,7 @@
137 latitude: this.deviceDetail.deviceInfo.latitude || 0 135 latitude: this.deviceDetail.deviceInfo.latitude || 0
138 }; 136 };
139 uni.navigateTo({ 137 uni.navigateTo({
140 - url: '/deviceSubPage/deviceDetailPage/devicePosition?data=' + JSON.stringify(data) 138 + url: '/device-subpackage/device-detail/device-position?data=' + JSON.stringify(data)
141 }); 139 });
142 }, 140 },
143 disabledScroll() { 141 disabledScroll() {
@@ -145,6 +143,7 @@ @@ -145,6 +143,7 @@
145 }, 143 },
146 handleAppShowModal() { 144 handleAppShowModal() {
147 this.appShowModal = true 145 this.appShowModal = true
  146 + this.$refs.appCommandIssuanceRef.open()
148 }, 147 },
149 handleMpShowModal() { 148 handleMpShowModal() {
150 const { 149 const {
@@ -103,7 +103,7 @@ @@ -103,7 +103,7 @@
103 103
104 <style lang="scss" scoped> 104 <style lang="scss" scoped>
105 .command-detail { 105 .command-detail {
106 - padding: 0 30rpx; 106 + padding: 5rpx 30rpx;
107 height: 100vh; 107 height: 100vh;
108 background-color: #f8f9fa; 108 background-color: #f8f9fa;
109 109
@@ -39,15 +39,17 @@ @@ -39,15 +39,17 @@
39 </view> 39 </view>
40 </mescroll-uni> 40 </mescroll-uni>
41 <!-- 命令记录弹窗筛选 --> 41 <!-- 命令记录弹窗筛选 -->
42 - <u-popup @close="close" closeable bgColor="#fff" :show="show" mode="bottom" :round="20"  
43 - @touchmove.stop.prevent="disabledScroll"> 42 + <u-popup @close="close" closeable bgColor="#fff" :show="show" mode="bottom" :round="20">
44 <view class="filter" @touchmove.stop.prevent="disabledScroll"> 43 <view class="filter" @touchmove.stop.prevent="disabledScroll">
45 <view class="filter-title"><text>筛选条件</text></view> 44 <view class="filter-title"><text>筛选条件</text></view>
46 <query-item :filterList="issueStatus" title="下发状态" 45 <query-item :filterList="issueStatus" title="下发状态"
47 @clickTag="currentIndex => handleClickTag(currentIndex, issueStatus)"></query-item> 46 @clickTag="currentIndex => handleClickTag(currentIndex, issueStatus)"></query-item>
48 - <view class="mt-3">  
49 - <uni-datetime-picker return-type="timestamp" v-model="range" type="datetimerange"  
50 - rangeSeparator="至" /> 47 + <view class="flex-column">
  48 + <view class="mt-3 command-time-text">命令下发时间</view>
  49 + <view class="mt-3">
  50 + <uni-datetime-picker return-type="timestamp" v-model="range" type="datetimerange"
  51 + rangeSeparator="至" />
  52 + </view>
51 </view> 53 </view>
52 <view class="h-30"></view> 54 <view class="h-30"></view>
53 <view class="button-group"> 55 <view class="button-group">
@@ -147,7 +149,9 @@ @@ -147,7 +149,9 @@
147 const condition = Object.values(this.formTime) 149 const condition = Object.values(this.formTime)
148 if (condition.length === 0) { 150 if (condition.length === 0) {
149 this.page.num += 1; 151 this.page.num += 1;
150 - this.loadData(this.page.num); 152 + this.loadData(this.page.num, {
  153 + ...tbDeviceId
  154 + });
151 } else if (condition.filter(Boolean).length > 0) { 155 } else if (condition.filter(Boolean).length > 0) {
152 this.page.num += 1; 156 this.page.num += 1;
153 this.loadData(this.page.num, { 157 this.loadData(this.page.num, {
@@ -156,7 +160,9 @@ @@ -156,7 +160,9 @@
156 }); 160 });
157 } else { 161 } else {
158 this.page.num += 1; 162 this.page.num += 1;
159 - this.loadData(this.page.num); 163 + this.loadData(this.page.num, {
  164 + ...tbDeviceId
  165 + });
160 } 166 }
161 }, 167 },
162 async loadData(pageNo, params = {}) { 168 async loadData(pageNo, params = {}) {
@@ -321,5 +327,11 @@ @@ -321,5 +327,11 @@
321 width: 330rpx; 327 width: 330rpx;
322 } 328 }
323 } 329 }
  330 +
  331 + .command-time-text {
  332 + color: #333;
  333 + font-size: 14px;
  334 + font-weight: 700;
  335 + }
324 } 336 }
325 </style> 337 </style>
@@ -96,7 +96,6 @@ @@ -96,7 +96,6 @@
96 alarmStatus, 96 alarmStatus,
97 lastOnlineTime, 97 lastOnlineTime,
98 }; 98 };
99 -  
100 // 设备类型不是网关子设备的添加一个命令记录的选项卡 99 // 设备类型不是网关子设备的添加一个命令记录的选项卡
101 if (this.deviceDetail.deviceType !== "SENSOR") { 100 if (this.deviceDetail.deviceType !== "SENSOR") {
102 this.list.push({ 101 this.list.push({
@@ -180,7 +179,6 @@ @@ -180,7 +179,6 @@
180 }; 179 };
181 }); 180 });
182 }); 181 });
183 -  
184 const keys = await getDeviceKeys(tbDeviceId); 182 const keys = await getDeviceKeys(tbDeviceId);
185 this.keys = [keys]; 183 this.keys = [keys];
186 // 昨天 184 // 昨天
@@ -204,7 +202,6 @@ @@ -204,7 +202,6 @@
204 }); 202 });
205 this.timeDiff = "30分钟"; 203 this.timeDiff = "30分钟";
206 if (!Object.keys(data).length) return; 204 if (!Object.keys(data).length) return;
207 -  
208 this.historyData = data[keys[0]].map((item) => { 205 this.historyData = data[keys[0]].map((item) => {
209 return { 206 return {
210 value: item.value, 207 value: item.value,
@@ -16,17 +16,23 @@ @@ -16,17 +16,23 @@
16 <u--textarea placeholder="请输入反馈信息" v-model="feedbackData.feedbackInfo.message" count> 16 <u--textarea placeholder="请输入反馈信息" v-model="feedbackData.feedbackInfo.message" count>
17 </u--textarea> 17 </u--textarea>
18 </u-form-item> 18 </u-form-item>
19 - <view class="feed-back-text" style="margin: 15px 0px 0px -16rpx;">上传图片(最多6张)</view>  
20 - <view class="info" style="margin-top: 15rpx;background: rgba(1, 1, 1, 0);"> 19 + <view class="feed-back-text upload-text">上传图片(最多6张)</view>
  20 + <view class="info">
21 <view class="info-contain"> 21 <view class="info-contain">
22 <u-form-item label="图片" prop="feedbackInfo.images" borderBottom> 22 <u-form-item label="图片" prop="feedbackInfo.images" borderBottom>
23 <u-upload :capture="capture" :fileList="fileList1" @afterRead="afterRead" 23 <u-upload :capture="capture" :fileList="fileList1" @afterRead="afterRead"
24 @delete="deletePic" name="1" multiple :maxCount="6"></u-upload> 24 @delete="deletePic" name="1" multiple :maxCount="6"></u-upload>
25 </u-form-item> 25 </u-form-item>
26 </view> 26 </view>
27 - <view style="width:427rpx;margin:0 auto;"> 27 + <view class="info-button">
  28 + <!-- #ifdef MP -->
28 <u-button class="buttonSty button-sty" shape="circle" type="primary" text="提交" 29 <u-button class="buttonSty button-sty" shape="circle" type="primary" text="提交"
29 - customStyle="margin-top: 200rpx" @click="submit"></u-button> 30 + customStyle="margin-top: 280rpx" @click="submit"></u-button>
  31 + <!-- #endif -->
  32 + <!-- #ifdef APP-PLUS -->
  33 + <u-button class="buttonSty button-sty" shape="circle" type="primary" text="提交"
  34 + customStyle="margin-top: 880rpx" @click="submit"></u-button>
  35 + <!-- #endif -->
30 </view> 36 </view>
31 </view> 37 </view>
32 </u--form> 38 </u--form>
@@ -15,6 +15,9 @@ @@ -15,6 +15,9 @@
15 padding-left: 15rpx; 15 padding-left: 15rpx;
16 padding: 0 20rpx; 16 padding: 0 20rpx;
17 height: 860rpx; 17 height: 860rpx;
  18 + .upload-text{
  19 + margin: 15px 0px 0px -16rpx;
  20 + }
18 21
19 .info { 22 .info {
20 width: 700rpx; 23 width: 700rpx;
@@ -23,6 +26,8 @@ @@ -23,6 +26,8 @@
23 margin-top: 100rpx; 26 margin-top: 100rpx;
24 height: 256rpx; 27 height: 256rpx;
25 margin-left: -20rpx; 28 margin-left: -20rpx;
  29 + margin-top: 15rpx;
  30 + background: rgba(1, 1, 1, 0);
26 31
27 .info-contain { 32 .info-contain {
28 margin: 0rpx 27rpx; 33 margin: 0rpx 27rpx;
@@ -43,6 +48,10 @@ @@ -43,6 +48,10 @@
43 border: none !important; 48 border: none !important;
44 } 49 }
45 } 50 }
  51 + .info-button{
  52 + width:427rpx;
  53 + margin:0 auto;
  54 + }
46 } 55 }
47 56
48 /deep/.u-button--primary { 57 /deep/.u-button--primary {
@@ -38,8 +38,7 @@ @@ -38,8 +38,7 @@
38 <u-form-item labelWidth="80px" label="邮箱地址" prop="email" borderBottom> 38 <u-form-item labelWidth="80px" label="邮箱地址" prop="email" borderBottom>
39 <u--input placeholder="请输入邮箱地址" v-model="myInfoModel.email" border="none"></u--input> 39 <u--input placeholder="请输入邮箱地址" v-model="myInfoModel.email" border="none"></u--input>
40 </u-form-item> 40 </u-form-item>
41 - <u-form-item @click="showDate = true;hideKeyboard();" labelWidth="80px" label="有效期"  
42 - prop="accountExpireTime"> 41 + <u-form-item @click="hideKeyboard" labelWidth="80px" label="有效期" prop="accountExpireTime">
43 <u--input v-model="myInfoModel.accountExpireTime" placeholder="请选择有效期" border="none"></u--input> 42 <u--input v-model="myInfoModel.accountExpireTime" placeholder="请选择有效期" border="none"></u--input>
44 <u-datetime-picker :formatter="formatter" :show="showDate" :value="datetime" mode="dateTime" 43 <u-datetime-picker :formatter="formatter" :show="showDate" :value="datetime" mode="dateTime"
45 closeOnClickOverlay @confirm="dateConfirm" @cancel="dateClose" @close="dateClose"> 44 closeOnClickOverlay @confirm="dateConfirm" @cancel="dateClose" @close="dateClose">
@@ -383,6 +382,7 @@ @@ -383,6 +382,7 @@
383 }, 382 },
384 //隐藏输入框 383 //隐藏输入框
385 hideKeyboard() { 384 hideKeyboard() {
  385 + this.showDate = true;
386 uni.hideKeyboard(); 386 uni.hideKeyboard();
387 } 387 }
388 } 388 }
@@ -139,7 +139,7 @@ @@ -139,7 +139,7 @@
139 useShowToast(toastText).then(async (res) => { 139 useShowToast(toastText).then(async (res) => {
140 this.saveUserInfo(); 140 this.saveUserInfo();
141 await this.getAlarmTotalData(); 141 await this.getAlarmTotalData();
142 - useReLaunch("/pages/index/index") 142 + useReLaunch("../../pages/index/index")
143 }); 143 });
144 }, 144 },
145 //微信授权登录 145 //微信授权登录
@@ -130,7 +130,9 @@ @@ -130,7 +130,9 @@
130 resetQuery() { 130 resetQuery() {
131 this.queryCondition.searchAlarmText = ''; 131 this.queryCondition.searchAlarmText = '';
132 this.page.num = 1; 132 this.page.num = 1;
133 - this.$refs.alarmPopupRef.resetQuery() 133 + this.$nextTick(() => {
  134 + this.$refs.alarmPopupRef.resetQuery()
  135 + })
134 this.conditions = {} 136 this.conditions = {}
135 }, 137 },
136 topBack() { 138 topBack() {
@@ -185,7 +187,9 @@ @@ -185,7 +187,9 @@
185 }, 187 },
186 openSearchDialog() { 188 openSearchDialog() {
187 this.show = true; 189 this.show = true;
188 - this.resetQuery(); 190 + this.$nextTick(() => {
  191 + this.resetQuery();
  192 + })
189 }, 193 },
190 openOrg() { 194 openOrg() {
191 useNavigateTo('/pages/organization/organization') 195 useNavigateTo('/pages/organization/organization')
@@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
19 rangeSeparator="至" /> 19 rangeSeparator="至" />
20 </view> 20 </view>
21 </view> 21 </view>
  22 + <view class="h-30"></view>
22 <view class="u-flex bottom-button"> 23 <view class="u-flex bottom-button">
23 <view class="button-item"> 24 <view class="button-item">
24 <u-button @click="resetQuery" type="info" shape="circle" text="重置"> 25 <u-button @click="resetQuery" type="info" shape="circle" text="重置">
@@ -110,10 +111,12 @@ @@ -110,10 +111,12 @@
110 resetQuery() { 111 resetQuery() {
111 for (let i in this.queryCondition) Reflect.set(this.queryCondition, i, '') 112 for (let i in this.queryCondition) Reflect.set(this.queryCondition, i, '')
112 this.range = [] 113 this.range = []
113 - this.$refs.queryItemAlarmStatusRef.reset()  
114 - this.$refs.queryDeviceTypeStatusRef.reset()  
115 - this.$refs.queryItemAlarmLevelRef.reset()  
116 - this.$refs.queryItemSelectTimeRef.reset() 114 + this.$nextTick(() => {
  115 + this.$refs.queryItemAlarmStatusRef.reset()
  116 + this.$refs.queryDeviceTypeStatusRef.reset()
  117 + this.$refs.queryItemAlarmLevelRef.reset()
  118 + this.$refs.queryItemSelectTimeRef.reset()
  119 + })
117 }, 120 },
118 } 121 }
119 }; 122 };
@@ -170,7 +170,9 @@ @@ -170,7 +170,9 @@
170 }, 170 },
171 openSearchDialog() { 171 openSearchDialog() {
172 this.show = true; 172 this.show = true;
173 - this.resetQuery() 173 + this.$nextTick(() => {
  174 + this.resetQuery();
  175 + })
174 }, 176 },
175 openDeviceDetail(id, alarmStatus, lastOnlineTime, tbDeviceId) { 177 openDeviceDetail(id, alarmStatus, lastOnlineTime, tbDeviceId) {
176 uni.navigateTo({ 178 uni.navigateTo({
1 <template> 1 <template>
2 <view class="container"> 2 <view class="container">
3 <view class="container-box"> 3 <view class="container-box">
4 - <image :src="mpOwnConfig.logo"></image> 4 + <image v-if="mpOwnConfig.logo" :src="mpOwnConfig.logo"></image>
  5 + <image v-else :src="staticLogo"></image>
5 <text class="splash-text-muted">连接世界 创造价值</text> 6 <text class="splash-text-muted">连接世界 创造价值</text>
6 </view> 7 </view>
7 </view> 8 </view>
@@ -12,7 +13,9 @@ @@ -12,7 +13,9 @@
12 mapState 13 mapState
13 } from 'vuex'; 14 } from 'vuex';
14 import api from '@/api/index.js' 15 import api from '@/api/index.js'
15 - import { useReLaunch } from '@/plugins/utils.js' 16 + import {
  17 + useReLaunch
  18 + } from '@/plugins/utils.js'
16 19
17 export default { 20 export default {
18 data() { 21 data() {
@@ -72,4 +75,4 @@ @@ -72,4 +75,4 @@
72 } 75 }
73 } 76 }
74 } 77 }
75 -</style> 78 +</style>
@@ -47,6 +47,10 @@ button { @@ -47,6 +47,10 @@ button {
47 white-space: nowrap; 47 white-space: nowrap;
48 } 48 }
49 ///////////////////////////////////////////////////////////////小程序、app抽取公共样式///////////////////////////////////////////////////////////////////// 49 ///////////////////////////////////////////////////////////////小程序、app抽取公共样式/////////////////////////////////////////////////////////////////////
  50 +.flex-column{
  51 + display: flex;
  52 + flex-direction: column;
  53 +}
50 .mt-3{ 54 .mt-3{
51 margin-top: 30rpx; 55 margin-top: 30rpx;
52 } 56 }