Commit 0493813703a5bf13d853b4671290ad459ba0d5ae

Authored by fengwotao
2 parents 84c365f3 62a3bd84

pref: app、mp端 优化代码

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