Commit 99a3448e58cc7a0f79c376244eb6ec3090323a78

Authored by xp.Huang
2 parents 61739d8a 220d2582

Merge branch 'dev-ft' into 'main'

fix:DEFECT-369 修改问题单号的pc端和min-pro筛选时间数据不同意问题,修改返回顶部时间为10ms,feat:新增无数据显示默认图片

See merge request huang/thingskit-app!40
1 <script> 1 <script>
2 import base from '@/config/baseUrl'; 2 import base from '@/config/baseUrl';
3 import store from '@/store'; 3 import store from '@/store';
4 -// #ifdef APP-PLUS  
5 -import APPUpdate from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';  
6 -// #endif  
7 4
8 import { mpUpData, scene } from '@/config/common'; 5 import { mpUpData, scene } from '@/config/common';
9 export default { 6 export default {
@@ -16,9 +13,6 @@ export default { @@ -16,9 +13,6 @@ export default {
16 store.commit('setCacheData'); 13 store.commit('setCacheData');
17 //获取二维码信息 14 //获取二维码信息
18 scene(e); 15 scene(e);
19 - // #ifdef APP-PLUS  
20 - APPUpdate(); //检测app更新  
21 - // #endif  
22 }, 16 },
23 onShow(e) { 17 onShow(e) {
24 // #ifdef MP 18 // #ifdef MP
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 padding: 30rpx; 2 padding: 30rpx;
3 } 3 }
4 .alarm-detail-column { 4 .alarm-detail-column {
5 - border-radius: 20px; 5 + border-radius: 10px;
6 width: 688rpx; 6 width: 688rpx;
7 height: 573rpx; 7 height: 573rpx;
8 background-color: #ffffff; 8 background-color: #ffffff;
@@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
54 } 54 }
55 .hanle-main { 55 .hanle-main {
56 margin-top: 30rpx; 56 margin-top: 30rpx;
57 - border-radius: 20px; 57 + border-radius: 10px;
58 width: 688rpx; 58 width: 688rpx;
59 height: 273rpx; 59 height: 273rpx;
60 background-color: #ffffff; 60 background-color: #ffffff;
@@ -128,30 +128,7 @@ export const judgeLogin = (callback) => { @@ -128,30 +128,7 @@ export const judgeLogin = (callback) => {
128 } 128 }
129 if (!storeUserInfo.isToken) { 129 if (!storeUserInfo.isToken) {
130 // #ifdef MP 130 // #ifdef MP
131 - return uni.$u.toast('请登录')  
132 - // uni.$showModal({  
133 - // title: "登录提示",  
134 - // confirmVal: '去登录',  
135 - // cancelVal: '再逛会',  
136 - // content: '此时此刻需要您登录喔~',  
137 - // }).then(res => {  
138 - // uni.navigateTo({  
139 - // url: "/pages/personal/login"  
140 - // });  
141 - // }).catch(res => {})  
142 - // store.commit('setLoginPopupShow', true);  
143 - // #endif  
144 - // #ifdef APP-PLUS  
145 - uni.$showModal({  
146 - title: "登录提示",  
147 - confirmVal: '去登录',  
148 - cancelVal: '再逛会',  
149 - content: '此时此刻需要您登录喔~',  
150 - }).then(res => {  
151 - uni.navigateTo({  
152 - url: "/pages/personal/login"  
153 - });  
154 - }).catch(res => {}) 131 + return
155 // #endif 132 // #endif
156 // #ifdef H5 133 // #ifdef H5
157 h5Login(); 134 h5Login();
@@ -31,6 +31,11 @@ uni.$u.http.setConfig((config) => { @@ -31,6 +31,11 @@ uni.$u.http.setConfig((config) => {
31 // 请求拦截 31 // 请求拦截
32 uni.$u.http.interceptors.request.use( 32 uni.$u.http.interceptors.request.use(
33 (config) => { 33 (config) => {
  34 + if (store.state.userInfo.isThirdLogin) {
  35 + uni.switchTab({
  36 + url: "../pages/personal/personal",
  37 + });
  38 + }
34 // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} 39 // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{}
35 config.data = config.data || {}; 40 config.data = config.data || {};
36 // 根据custom参数中配置的是否需要token,添加对应的请求头 41 // 根据custom参数中配置的是否需要token,添加对应的请求头
@@ -71,7 +76,6 @@ uni.$u.http.interceptors.response.use( @@ -71,7 +76,6 @@ uni.$u.http.interceptors.response.use(
71 } else {} 76 } else {}
72 }, 77 },
73 (response) => { 78 (response) => {
74 - console.log('Response error', response)  
75 // 关闭加载动画 79 // 关闭加载动画
76 store.commit("setLoadingShow", false); 80 store.commit("setLoadingShow", false);
77 let show = true; 81 let show = true;
@@ -82,12 +86,19 @@ uni.$u.http.interceptors.response.use( @@ -82,12 +86,19 @@ uni.$u.http.interceptors.response.use(
82 } else if (message == "request:fail timeout") { 86 } else if (message == "request:fail timeout") {
83 errorData = "请求超时:请检查网络"; 87 errorData = "请求超时:请检查网络";
84 } else if (response.data.status == 401) { 88 } else if (response.data.status == 401) {
85 - uni.reLaunch({  
86 - url: "/publicLoginSubPage/public/login",  
87 - });  
88 - // 清空登录信息  
89 - store.commit("emptyUserInfo");  
90 - show = false; 89 + if (!store.state.userInfo.isThirdLogin) {
  90 + uni.reLaunch({
  91 + url: "/publicLoginSubPage/public/login",
  92 + });
  93 + // 清空登录信息
  94 + store.commit("emptyUserInfo");
  95 + show = false;
  96 + } else {
  97 + uni.switchTab({
  98 + url: "../pages/personal/personal",
  99 + });
  100 + show = false;
  101 + }
91 } else { 102 } else {
92 errorData = message || ""; 103 errorData = message || "";
93 } 104 }
@@ -30,7 +30,12 @@ @@ -30,7 +30,12 @@
30 <!-- 吸顶组件 --> 30 <!-- 吸顶组件 -->
31 <!-- 自带分页组件 --> 31 <!-- 自带分页组件 -->
32 <mescroll-body ref="mescrollRef" :up="upOption" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback"> 32 <mescroll-body ref="mescrollRef" :up="upOption" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback">
33 - <view class="device-list"> 33 + <!-- 无数据图片 -->
  34 + <view v-if="list.length == 0" style="position: relative;top: 100rpx;flex-direction: column;" class="u-flex">
  35 + <view><image style="width: 280rpx;height: 250rpx;" src="../../static/empty.png"></image></view>
  36 + <view style="text-align: center;"><text style="font-size: 12px;color: gray;">~ 空空如也 ~</text></view>
  37 + </view>
  38 + <view v-else class="device-list">
34 <view @click="openAlertDetail(item)" class="list-item" v-for="(item, index) in list" :key="index"> 39 <view @click="openAlertDetail(item)" class="list-item" v-for="(item, index) in list" :key="index">
35 <view class="u-flex item"> 40 <view class="u-flex item">
36 <view class="item-text text-clip"> 41 <view class="item-text text-clip">
@@ -164,7 +169,7 @@ @@ -164,7 +169,7 @@
164 <view class="u-flex popup-alarm-child"> 169 <view class="u-flex popup-alarm-child">
165 <view class="home-text-muted">选择日期</view> 170 <view class="home-text-muted">选择日期</view>
166 <view style="width: 623rpx;margin-left: 5rpx;margin-right: 70rpx;margin-top: 35rpx;"> 171 <view style="width: 623rpx;margin-left: 5rpx;margin-right: 70rpx;margin-top: 35rpx;">
167 - <uni-datetime-picker v-model="range" type="daterange" /> 172 + <uni-datetime-picker v-model="range" type="datetimerange" rangeSeparator="至" />
168 </view> 173 </view>
169 </view> 174 </view>
170 </view> 175 </view>
@@ -197,7 +202,7 @@ export default { @@ -197,7 +202,7 @@ export default {
197 }, 202 },
198 data() { 203 data() {
199 return { 204 return {
200 - range: ['', ''], 205 + range: [],
201 alertStatusVal: '', 206 alertStatusVal: '',
202 deviceTypeVal: '', 207 deviceTypeVal: '',
203 alertLevelVal: '', 208 alertLevelVal: '',
@@ -378,7 +383,7 @@ export default { @@ -378,7 +383,7 @@ export default {
378 topBack() { 383 topBack() {
379 uni.pageScrollTo({ 384 uni.pageScrollTo({
380 scrollTop: 0, // 滚动到页面的目标位置 这个是滚动到顶部, 0 385 scrollTop: 0, // 滚动到页面的目标位置 这个是滚动到顶部, 0
381 - duration: 300 // 滚动动画的时长 386 + duration: 10 // 滚动动画的时长
382 }); 387 });
383 }, 388 },
384 /*下拉刷新的回调 */ 389 /*下拉刷新的回调 */
@@ -451,7 +456,6 @@ export default { @@ -451,7 +456,6 @@ export default {
451 } 456 }
452 }) 457 })
453 .catch(e => { 458 .catch(e => {
454 - uni.$u.toast(e.data?.message);  
455 //联网失败, 结束加载 459 //联网失败, 结束加载
456 that.mescroll.endErr(); 460 that.mescroll.endErr();
457 }); 461 });
@@ -41,9 +41,7 @@ export default { @@ -41,9 +41,7 @@ export default {
41 this.tree = list; 41 this.tree = list;
42 } 42 }
43 }) 43 })
44 - .catch(e => {  
45 - uni.$u.toast(e.data.message);  
46 - }); 44 + .catch(e => {});
47 }, 45 },
48 confirm(val) { 46 confirm(val) {
49 this.id = val[0].id; 47 this.id = val[0].id;
@@ -125,14 +125,17 @@ @@ -125,14 +125,17 @@
125 justify-content: space-between; 125 justify-content: space-between;
126 126
127 .item { 127 .item {
128 - margin: 30rpx;  
129 justify-content: flex-start; 128 justify-content: flex-start;
130 flex-direction: column; 129 flex-direction: column;
131 align-items: center; 130 align-items: center;
  131 + height: 211rpx;
  132 + margin-top: 8rpx;
  133 + margin-left: 37rpx;
132 134
133 .item-text { 135 .item-text {
134 width: 400rpx; 136 width: 400rpx;
135 text-align: left; 137 text-align: left;
  138 + margin-top: 13rpx;
136 139
137 .text { 140 .text {
138 color: #666666; 141 color: #666666;
@@ -152,7 +155,8 @@ @@ -152,7 +155,8 @@
152 155
153 .item-right { 156 .item-right {
154 flex-direction: row; 157 flex-direction: row;
155 - margin-top: -15rpx; 158 + margin-top: -3rpx;
  159 + margin-right: 25rpx;
156 160
157 .right-image { 161 .right-image {
158 width: 30rpx; 162 width: 30rpx;
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <view class="u-flex org-contact"><text class="text">组织关系</text></view> 7 <view class="u-flex org-contact"><text class="text">组织关系</text></view>
8 <view class="u-flex org-device"> 8 <view class="u-flex org-device">
9 <image class="device-image" src="../../../static/org.png"></image> 9 <image class="device-image" src="../../../static/org.png"></image>
10 - <text class="device-text">设备数:{{ deviceTotal }}</text> 10 + <text class="device-text">摄像头数:{{ cameraTotal }}</text>
11 </view> 11 </view>
12 </view> 12 </view>
13 <view class="org-item"><image class="image" src="../../../static/arrow-right.png"></image></view> 13 <view class="org-item"><image class="image" src="../../../static/arrow-right.png"></image></view>
@@ -54,7 +54,7 @@ export default { @@ -54,7 +54,7 @@ export default {
54 auto: false // 不自动加载 54 auto: false // 不自动加载
55 }, 55 },
56 current: 0, 56 current: 0,
57 - deviceTotal: 0, 57 + cameraTotal: 0,
58 list: [], 58 list: [],
59 ordId: '' 59 ordId: ''
60 }; 60 };
@@ -72,7 +72,7 @@ export default { @@ -72,7 +72,7 @@ export default {
72 onLoad() { 72 onLoad() {
73 // 隐藏原生的tabbar 73 // 隐藏原生的tabbar
74 uni.hideTabBar(); 74 uni.hideTabBar();
75 - this.getDeviceTotalData(); 75 + this.getcameraTotalData();
76 }, 76 },
77 methods: { 77 methods: {
78 /*下拉刷新的回调 */ 78 /*下拉刷新的回调 */
@@ -98,6 +98,7 @@ export default { @@ -98,6 +98,7 @@ export default {
98 .then(res => { 98 .then(res => {
99 uni.stopPullDownRefresh(); 99 uni.stopPullDownRefresh();
100 this.mescroll.endByPage(res.items.length, res.total); 100 this.mescroll.endByPage(res.items.length, res.total);
  101 + this.cameraTotal = res.total;
101 if (pageNo == 1) { 102 if (pageNo == 1) {
102 this.list = res.items; 103 this.list = res.items;
103 } else { 104 } else {
@@ -105,7 +106,6 @@ export default { @@ -105,7 +106,6 @@ export default {
105 } 106 }
106 }) 107 })
107 .catch(e => { 108 .catch(e => {
108 - uni.$u.toast(e.data?.message);  
109 //联网失败, 结束加载 109 //联网失败, 结束加载
110 this.mescroll.endErr(); 110 this.mescroll.endErr();
111 }); 111 });
@@ -113,22 +113,6 @@ export default { @@ -113,22 +113,6 @@ export default {
113 hideImageUrl(item, index) { 113 hideImageUrl(item, index) {
114 this.current = index; 114 this.current = index;
115 }, 115 },
116 - getDeviceTotalData() {  
117 - let httpData = {  
118 - page: 1,  
119 - pageSize: 10  
120 - };  
121 - uni.$u.http  
122 - .get('/yt/device', { params: httpData, custom: { load: false } })  
123 - .then(res => {  
124 - if (res) {  
125 - this.deviceTotal = res.total;  
126 - }  
127 - })  
128 - .catch(e => {  
129 - uni.$u.toast(e.data?.message);  
130 - });  
131 - },  
132 openCameraDetail(e) { 116 openCameraDetail(e) {
133 console.log(e); 117 console.log(e);
134 }, 118 },
@@ -41,9 +41,7 @@ export default { @@ -41,9 +41,7 @@ export default {
41 this.tree = list; 41 this.tree = list;
42 } 42 }
43 }) 43 })
44 - .catch(e => {  
45 - uni.$u.toast(e.data.message);  
46 - }); 44 + .catch(e => {});
47 }, 45 },
48 confirm(val) { 46 confirm(val) {
49 this.id = val[0].id; 47 this.id = val[0].id;
@@ -144,9 +144,9 @@ export default { @@ -144,9 +144,9 @@ export default {
144 }); 144 });
145 }, 145 },
146 openOrgStatus() { 146 openOrgStatus() {
147 - uni.navigateTo({  
148 - url: 'configuration/configuration'  
149 - }); 147 + // uni.navigateTo({
  148 + // url: 'configuration/configuration'
  149 + // });
150 }, 150 },
151 //告警状态查询 151 //告警状态查询
152 navigatorAlarmStatus(e) { 152 navigatorAlarmStatus(e) {
@@ -67,11 +67,11 @@ @@ -67,11 +67,11 @@
67 width: 330rpx; 67 width: 330rpx;
68 height: 200rpx; 68 height: 200rpx;
69 background-color: #fff; 69 background-color: #fff;
70 - border-radius: 20px; 70 + border-radius: 10px;
71 margin-left: 25rpx; 71 margin-left: 25rpx;
72 margin-right: 21rpx; 72 margin-right: 21rpx;
73 .video { 73 .video {
74 - border-radius: 20px; 74 + border-radius: 10px;
75 width: 330rpx; 75 width: 330rpx;
76 height: 200rpx; 76 height: 200rpx;
77 } 77 }
@@ -92,7 +92,7 @@ @@ -92,7 +92,7 @@
92 .image { 92 .image {
93 width: 330rpx; 93 width: 330rpx;
94 height: 200rpx; 94 height: 200rpx;
95 - border-radius: 20px; 95 + border-radius: 10px;
96 } 96 }
97 } 97 }
98 } 98 }
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 background-color: #fff; 20 background-color: #fff;
21 border: 0.01rpx solid #fff; 21 border: 0.01rpx solid #fff;
22 padding: 40rpx; 22 padding: 40rpx;
23 - border-radius: 20px; 23 + border-radius: 10px;
24 .item-center { 24 .item-center {
25 width: 290rpx; 25 width: 290rpx;
26 height: 150rpx; 26 height: 150rpx;
@@ -80,7 +80,7 @@ @@ -80,7 +80,7 @@
80 justify-content: space-between; 80 justify-content: space-between;
81 align-items: flex-start; 81 align-items: flex-start;
82 flex-direction: column; 82 flex-direction: column;
83 - border-radius: 20px; 83 + border-radius: 10px;
84 .item-child-top { 84 .item-child-top {
85 justify-content: space-between; 85 justify-content: space-between;
86 padding: 30rpx; 86 padding: 30rpx;
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> 8 <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30">
9 <block v-if="userInfo.isToken || userInfo.isThirdLogin"> 9 <block v-if="userInfo.isToken || userInfo.isThirdLogin">
10 <view @click="openPersonalInfo" class="u-m-r-20"> 10 <view @click="openPersonalInfo" class="u-m-r-20">
11 - <image class="avatar" mode="aspectFill" :src="userInfo.avatar == '' ? '/static/logo.png' : userInfo.avatar"></image> 11 + <image class="avatar" mode="aspectFill" :src="!userInfo.avatar ? '../../static/logo.png' : userInfo.avatar"></image>
12 </view> 12 </view>
13 <view class="u-flex-1"> 13 <view class="u-flex-1">
14 <view class="nickName u-flex"> 14 <view class="nickName u-flex">
1 import Vue from 'vue'; 1 import Vue from 'vue';
2 import moment from 'moment'; 2 import moment from 'moment';
3 -// #ifdef APP-PLUS  
4 -import {judgePermission} from './permission'  
5 -// #endif  
6 const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'; 3 const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
7 //金额过滤 4 //金额过滤
8 Vue.filter('money', function(val) { 5 Vue.filter('money', function(val) {
@@ -26,68 +23,68 @@ Vue.filter('money', function(val) { @@ -26,68 +23,68 @@ Vue.filter('money', function(val) {
26 }); 23 });
27 //手机号中间4位为* 24 //手机号中间4位为*
28 Vue.filter('phone', function(val) { 25 Vue.filter('phone', function(val) {
29 - var tel = val;  
30 - tel = "" + tel;  
31 - var telShort = tel.replace(tel.substring(3, 7), "****")  
32 - return telShort 26 + var tel = val;
  27 + tel = "" + tel;
  28 + var telShort = tel.replace(tel.substring(3, 7), "****")
  29 + return telShort
33 }) 30 })
34 //获取系统信息、判断ipX安全距离 31 //获取系统信息、判断ipX安全距离
35 export const getTabbarHeight = function() { 32 export const getTabbarHeight = function() {
36 - var systemInfo = uni.getSystemInfoSync()  
37 - var data = {  
38 - ...systemInfo,  
39 - tabbarH: 50,//tabbar高度--单位px  
40 - tabbarPaddingB: 0,//tabbar底部安全距离高度--单位px  
41 - device: systemInfo.system.indexOf('iOS') != -1?'iOS':'Android', //苹果或者安卓设备  
42 - }  
43 - let modelArr = ['10,3','10,6','X', 'XR', 'XS', '11', '12', '13', '14', '15', '16'];  
44 - let model = systemInfo.model;  
45 - model && modelArr.forEach(item => {  
46 - //适配iphoneX以上的底部,给tabbar一定高度的padding-bottom  
47 - if(model.indexOf(item) != -1 && (model.indexOf('iPhone') != -1 || model.indexOf('iphone') != -1)) {  
48 - data.tabbarH = 70  
49 - data.tabbarPaddingB = 20  
50 - }  
51 - })  
52 - return data; 33 + var systemInfo = uni.getSystemInfoSync()
  34 + var data = {
  35 + ...systemInfo,
  36 + tabbarH: 50, //tabbar高度--单位px
  37 + tabbarPaddingB: 0, //tabbar底部安全距离高度--单位px
  38 + device: systemInfo.system.indexOf('iOS') != -1 ? 'iOS' : 'Android', //苹果或者安卓设备
  39 + }
  40 + let modelArr = ['10,3', '10,6', 'X', 'XR', 'XS', '11', '12', '13', '14', '15', '16'];
  41 + let model = systemInfo.model;
  42 + model && modelArr.forEach(item => {
  43 + //适配iphoneX以上的底部,给tabbar一定高度的padding-bottom
  44 + if (model.indexOf(item) != -1 && (model.indexOf('iPhone') != -1 || model.indexOf('iphone') != -1)) {
  45 + data.tabbarH = 70
  46 + data.tabbarPaddingB = 20
  47 + }
  48 + })
  49 + return data;
53 } 50 }
54 51
55 //计算两点距离 52 //计算两点距离
56 -export const commonDistance = function(lat1, lng1, lat2, lng2) {  
57 - var f = ((lat1 + lat2) / 2) * Math.PI / 180.0;  
58 - var g = ((lat1 - lat2) / 2) * Math.PI / 180.0;  
59 - var l = ((lng1 - lng2) / 2) * Math.PI / 180.0;  
60 - var sg = Math.sin(g);  
61 - var sl = Math.sin(l);  
62 - var sf = Math.sin(f);   
63 - var s, c, w, r, d, h1, h2;  
64 - var a = 6378137.0; //地球的直径  
65 - var fl = 1 / 298.257;  
66 - sg = sg * sg;    
67 - sl = sl * sl;    
68 - sf = sf * sf;    
69 - s = sg * (1 - sl) + (1 - sf) * sl;    
70 - c = (1 - sg) * (1 - sl) + sf * sl;    
71 - w = Math.atan(Math.sqrt(s / c));    
72 - r = Math.sqrt(s * c) / w;    
73 - d = 2 * w * a;    
74 - h1 = (3 * r - 1) / 2 / c;    
75 - h2 = (3 * r + 1) / 2 / s;    
76 - var num = d * (1 + fl * (h1 * sf * (1 - sg) - h2 * (1 - sf) * sg))    
77 - // 换算单位  
78 - if (num == undefined) {  
79 - num = "0.0 m"  
80 - };  
81 - if (num < 1000) {  
82 - num = (Math.round(num)).toFixed(1) + "m"  
83 - } else if (num > 1000) {  
84 - num = (Math.round(num / 100) / 10).toFixed(1) + "km"  
85 - }  
86 - return num 53 +export const commonDistance = function(lat1, lng1, lat2, lng2) {
  54 + var f = ((lat1 + lat2) / 2) * Math.PI / 180.0;
  55 + var g = ((lat1 - lat2) / 2) * Math.PI / 180.0;
  56 + var l = ((lng1 - lng2) / 2) * Math.PI / 180.0;
  57 + var sg = Math.sin(g);
  58 + var sl = Math.sin(l);
  59 + var sf = Math.sin(f);
  60 + var s, c, w, r, d, h1, h2;
  61 + var a = 6378137.0; //地球的直径
  62 + var fl = 1 / 298.257;
  63 + sg = sg * sg;
  64 + sl = sl * sl;
  65 + sf = sf * sf;
  66 + s = sg * (1 - sl) + (1 - sf) * sl;
  67 + c = (1 - sg) * (1 - sl) + sf * sl;
  68 + w = Math.atan(Math.sqrt(s / c));
  69 + r = Math.sqrt(s * c) / w;
  70 + d = 2 * w * a;
  71 + h1 = (3 * r - 1) / 2 / c;
  72 + h2 = (3 * r + 1) / 2 / s;
  73 + var num = d * (1 + fl * (h1 * sf * (1 - sg) - h2 * (1 - sf) * sg))
  74 + // 换算单位
  75 + if (num == undefined) {
  76 + num = "0.0 m"
  77 + };
  78 + if (num < 1000) {
  79 + num = (Math.round(num)).toFixed(1) + "m"
  80 + } else if (num > 1000) {
  81 + num = (Math.round(num / 100) / 10).toFixed(1) + "km"
  82 + }
  83 + return num
87 } 84 }
88 // px转upx 85 // px转upx
89 -export const px2upx = function(n){  
90 - return n/(uni.upx2px(n)/n); 86 +export const px2upx = function(n) {
  87 + return n / (uni.upx2px(n) / n);
91 } 88 }
92 89
93 // 判断两时间段之间活动状态、判断活动还有多长时间开始、多长时间结束----添加定时器运行此方法可倒计时 90 // 判断两时间段之间活动状态、判断活动还有多长时间开始、多长时间结束----添加定时器运行此方法可倒计时
@@ -95,53 +92,59 @@ export const px2upx = function(n){ @@ -95,53 +92,59 @@ export const px2upx = function(n){
95 // var closeTime = new Date(item.closeTime.replace(/-/g, '/')).getTime(); //转时间戳 92 // var closeTime = new Date(item.closeTime.replace(/-/g, '/')).getTime(); //转时间戳
96 // var djs = this.djsTime(startTime, closeTime); 93 // var djs = this.djsTime(startTime, closeTime);
97 export const djsTime = function(startTime, endTime) { 94 export const djsTime = function(startTime, endTime) {
98 - var bbb = new Date().getTime(),  
99 - leftTime = startTime - bbb,  
100 - rightTime = endTime - bbb,  
101 - djsTime = '',  
102 - speed = 0,  
103 - activityStatus = 0, //活动状态 1:未开始 2:进行中 3:已结束  
104 - dd,hh,mm,ss;  
105 - if (leftTime > 0) { //还未开始  
106 - activityStatus = 1  
107 - dd = Math.floor(leftTime / 1000 / 60 / 60 / 24);  
108 - hh = Math.floor((leftTime / 1000 / 60 / 60) % 24) < 10 ? '0' + Math.floor((leftTime / 1000 / 60 / 60) % 24) : Math.floor((leftTime / 1000 / 60 / 60) % 24);  
109 - mm = Math.floor((leftTime / 1000 / 60) % 60) < 10 ? '0' + Math.floor((leftTime / 1000 / 60) % 60) : Math.floor((leftTime / 1000 / 60) % 60);  
110 - ss = Math.floor((leftTime / 1000) % 60) < 10 ? '0' + Math.floor((leftTime / 1000) % 60) : Math.floor((leftTime / 1000) % 60);  
111 - if (dd != 0) {  
112 - djsTime = dd + "天 " + hh + ":" + mm + ":" + ss;  
113 - } else {  
114 - djsTime = hh + ":" + mm + ":" + ss;  
115 - }  
116 - } else if (leftTime <= 0) {  
117 - if (rightTime > 0) { //进行中  
118 - activityStatus = 2;  
119 - speed = (1 - rightTime / (endTime - startTime)) * 100;  
120 - dd = Math.floor(rightTime / 1000 / 60 / 60 / 24);  
121 - hh = Math.floor((rightTime / 1000 / 60 / 60) % 24) < 10 ? '0' + Math.floor((rightTime / 1000 / 60 / 60) % 24) : Math.floor((rightTime / 1000 / 60 / 60) % 24);  
122 - mm = Math.floor((rightTime / 1000 / 60) % 60) < 10 ? '0' + Math.floor((rightTime / 1000 / 60) % 60) : Math.floor((rightTime / 1000 / 60) % 60);  
123 - ss = Math.floor((rightTime / 1000) % 60) < 10 ? '0' + Math.floor((rightTime / 1000) % 60) : Math.floor((rightTime / 1000) % 60);  
124 - if (dd != 0) {  
125 - djsTime = dd + "天 " + hh + ":" + mm + ":" + ss;  
126 - } else {  
127 - djsTime = hh + ":" + mm + ":" + ss;  
128 - }  
129 - } else { //已结束  
130 - speed = 100;  
131 - djsTime = '已结束';  
132 - activityStatus = 3;  
133 - }  
134 - }  
135 - var item = {  
136 - djsTime: djsTime, //距离当前时间差  
137 - activityStatus: activityStatus, //活动状态 1:未开始 2:进行中 3:已结束  
138 - speed: speed, //进度(单位%)  
139 - dd: dd, //天  
140 - hh: hh, //小时  
141 - mm: mm, //分  
142 - ss: ss, //秒  
143 - }  
144 - return item; 95 + var bbb = new Date().getTime(),
  96 + leftTime = startTime - bbb,
  97 + rightTime = endTime - bbb,
  98 + djsTime = '',
  99 + speed = 0,
  100 + activityStatus = 0, //活动状态 1:未开始 2:进行中 3:已结束
  101 + dd, hh, mm, ss;
  102 + if (leftTime > 0) { //还未开始
  103 + activityStatus = 1
  104 + dd = Math.floor(leftTime / 1000 / 60 / 60 / 24);
  105 + hh = Math.floor((leftTime / 1000 / 60 / 60) % 24) < 10 ? '0' + Math.floor((leftTime / 1000 / 60 / 60) %
  106 + 24) : Math.floor((leftTime / 1000 / 60 / 60) % 24);
  107 + mm = Math.floor((leftTime / 1000 / 60) % 60) < 10 ? '0' + Math.floor((leftTime / 1000 / 60) % 60) : Math
  108 + .floor((leftTime / 1000 / 60) % 60);
  109 + ss = Math.floor((leftTime / 1000) % 60) < 10 ? '0' + Math.floor((leftTime / 1000) % 60) : Math.floor((
  110 + leftTime / 1000) % 60);
  111 + if (dd != 0) {
  112 + djsTime = dd + "天 " + hh + ":" + mm + ":" + ss;
  113 + } else {
  114 + djsTime = hh + ":" + mm + ":" + ss;
  115 + }
  116 + } else if (leftTime <= 0) {
  117 + if (rightTime > 0) { //进行中
  118 + activityStatus = 2;
  119 + speed = (1 - rightTime / (endTime - startTime)) * 100;
  120 + dd = Math.floor(rightTime / 1000 / 60 / 60 / 24);
  121 + hh = Math.floor((rightTime / 1000 / 60 / 60) % 24) < 10 ? '0' + Math.floor((rightTime / 1000 / 60 /
  122 + 60) % 24) : Math.floor((rightTime / 1000 / 60 / 60) % 24);
  123 + mm = Math.floor((rightTime / 1000 / 60) % 60) < 10 ? '0' + Math.floor((rightTime / 1000 / 60) % 60) :
  124 + Math.floor((rightTime / 1000 / 60) % 60);
  125 + ss = Math.floor((rightTime / 1000) % 60) < 10 ? '0' + Math.floor((rightTime / 1000) % 60) : Math.floor((
  126 + rightTime / 1000) % 60);
  127 + if (dd != 0) {
  128 + djsTime = dd + "天 " + hh + ":" + mm + ":" + ss;
  129 + } else {
  130 + djsTime = hh + ":" + mm + ":" + ss;
  131 + }
  132 + } else { //已结束
  133 + speed = 100;
  134 + djsTime = '已结束';
  135 + activityStatus = 3;
  136 + }
  137 + }
  138 + var item = {
  139 + djsTime: djsTime, //距离当前时间差
  140 + activityStatus: activityStatus, //活动状态 1:未开始 2:进行中 3:已结束
  141 + speed: speed, //进度(单位%)
  142 + dd: dd, //天
  143 + hh: hh, //小时
  144 + mm: mm, //分
  145 + ss: ss, //秒
  146 + }
  147 + return item;
145 } 148 }
146 149
147 // 小程序获取定位权限判断 150 // 小程序获取定位权限判断
@@ -151,14 +154,14 @@ function getMpLocation(successCallback, errCallback, isOpenSetting) { @@ -151,14 +154,14 @@ function getMpLocation(successCallback, errCallback, isOpenSetting) {
151 success: res => { 154 success: res => {
152 if (res.authSetting['scope.userLocation'] || !isOpenSetting) { 155 if (res.authSetting['scope.userLocation'] || !isOpenSetting) {
153 uni.getLocation({ 156 uni.getLocation({
154 - // #ifndef MP-ALIPAY  
155 - type: 'gcj02',  
156 - // #endif  
157 - success(res){  
158 - console.log('successCallback') 157 + // #ifndef MP-ALIPAY
  158 + type: 'gcj02',
  159 + // #endif
  160 + success(res) {
  161 + console.log('successCallback')
159 successCallback(res); 162 successCallback(res);
160 }, 163 },
161 - fail(err){ 164 + fail(err) {
162 console.log("位置信息错误", err); 165 console.log("位置信息错误", err);
163 errCallback("位置信息获取失败"); 166 errCallback("位置信息获取失败");
164 } 167 }
@@ -200,40 +203,24 @@ export const getAppLatLon = function(successCallback, errCallback, isOpenSetting @@ -200,40 +203,24 @@ export const getAppLatLon = function(successCallback, errCallback, isOpenSetting
200 getMpLocation(successCallback, errCallback, isOpenSetting); 203 getMpLocation(successCallback, errCallback, isOpenSetting);
201 } 204 }
202 // #endif 205 // #endif
203 - // #ifdef MP-ALIPAY  
204 - getMpLocation(successCallback, errCallback, false);  
205 - // #endif  
206 - // #ifdef H5  
207 - uni.getLocation({  
208 - type: 'gcj02',  
209 - success(res){  
210 - console.log('successCallback')  
211 - successCallback(res);  
212 - },  
213 - fail(err){  
214 - console.log("位置信息错误", err);  
215 - errCallback("位置信息获取失败");  
216 - }  
217 - });  
218 - // #endif  
219 - // #ifdef APP-PLUS  
220 - judgePermission("location", function(result) {  
221 - if (result == 1) {  
222 - uni.getLocation({  
223 - type: 'gcj02',  
224 - success: res => {  
225 - successCallback(res);  
226 - },  
227 - fail: (err) => {  
228 - console.log("位置信息错误", err);  
229 - errCallback("位置信息获取失败");  
230 - }  
231 - }); 206 + // #ifdef MP-ALIPAY
  207 + getMpLocation(successCallback, errCallback, false);
  208 + // #endif
  209 + // #ifdef H5
  210 + uni.getLocation({
  211 + type: 'gcj02',
  212 + success(res) {
  213 + console.log('successCallback')
  214 + successCallback(res);
  215 + },
  216 + fail(err) {
  217 + console.log("位置信息错误", err);
  218 + errCallback("位置信息获取失败");
232 } 219 }
233 }); 220 });
234 // #endif 221 // #endif
235 } 222 }
236 223
237 export function formatToDate(date = undefined, format = DATE_TIME_FORMAT) { 224 export function formatToDate(date = undefined, format = DATE_TIME_FORMAT) {
238 - return moment(date).format(format);  
239 -}  
  225 + return moment(date).format(format);
  226 +}
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 </view> 8 </view>
9 <view class="u-m-t-20 basic-text"><text class="text">基本资料</text></view> 9 <view class="u-m-t-20 basic-text"><text class="text">基本资料</text></view>
10 <view class="basic-main"> 10 <view class="basic-main">
11 - <u--form labelPosition="left" :model="myInfoModel" :rules="rules" ref="myInfoFormRef"> 11 + <u--form labelPosition="left" :model="myInfoModel">
12 <u-form-item labelWidth="80px" label="真实姓名" prop="userInfo.realName" borderBottom ref="item1"> 12 <u-form-item labelWidth="80px" label="真实姓名" prop="userInfo.realName" borderBottom ref="item1">
13 <u--input placeholder="请输入真实姓名" v-model="myInfoModel.userInfo.realName" border="none"></u--input> 13 <u--input placeholder="请输入真实姓名" v-model="myInfoModel.userInfo.realName" border="none"></u--input>
14 </u-form-item> 14 </u-form-item>
@@ -86,54 +86,6 @@ export default { @@ -86,54 +86,6 @@ export default {
86 dateTime: Number(new Date()), 86 dateTime: Number(new Date()),
87 avatar: '', 87 avatar: '',
88 id: '', 88 id: '',
89 - rules: {  
90 - 'userInfo.realName': [  
91 - {  
92 - type: 'string',  
93 - required: true,  
94 - message: '请填写姓名',  
95 - trigger: ['blur', 'change']  
96 - },  
97 - {  
98 - validator: (rule, value, callback) => {  
99 - return uni.$u.test.chinese(value);  
100 - },  
101 - message: '姓名必须为中文',  
102 - trigger: ['change', 'blur']  
103 - }  
104 - ],  
105 - 'userInfo.phoneNumber': [  
106 - {  
107 - type: 'string',  
108 - required: true,  
109 - message: '请填写手机号码',  
110 - trigger: ['blur', 'change']  
111 - },  
112 - {  
113 - // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明  
114 - validator: (rule, value, callback) => {  
115 - return uni.$u.test.mobile(value);  
116 - },  
117 - message: '手机必须为数字',  
118 - trigger: ['change', 'blur']  
119 - }  
120 - ],  
121 - 'userInfo.email': [  
122 - {  
123 - type: 'string',  
124 - required: true,  
125 - message: '请填写邮箱',  
126 - trigger: ['blur', 'change']  
127 - },  
128 - {  
129 - validator: (rule, value, callback) => {  
130 - return uni.$u.test.email(value);  
131 - },  
132 - message: '邮箱必须带有@',  
133 - trigger: ['change', 'blur']  
134 - }  
135 - ]  
136 - },  
137 info: {}, 89 info: {},
138 openIds: '' 90 openIds: ''
139 }; 91 };
@@ -153,7 +105,6 @@ export default { @@ -153,7 +105,6 @@ export default {
153 }, 105 },
154 onShow() { 106 onShow() {
155 let getOpenId = getApp().globalData.openId; 107 let getOpenId = getApp().globalData.openId;
156 - console.log('获取全局openId', getOpenId);  
157 if (getOpenId) { 108 if (getOpenId) {
158 this.openIds = getOpenId; 109 this.openIds = getOpenId;
159 } 110 }
@@ -161,7 +112,6 @@ export default { @@ -161,7 +112,6 @@ export default {
161 methods: { 112 methods: {
162 confrimBind(e) { 113 confrimBind(e) {
163 if (e) { 114 if (e) {
164 - console.log('Bind', e.third?.thirdUserId);  
165 //解绑 115 //解绑
166 let httpData = { 116 let httpData = {
167 appUserId: e.data?.userId, 117 appUserId: e.data?.userId,
@@ -231,37 +181,30 @@ export default { @@ -231,37 +181,30 @@ export default {
231 }); 181 });
232 }, 182 },
233 onSubmitFunc() { 183 onSubmitFunc() {
234 - this.$refs.myInfoFormRef  
235 - .validate() 184 + let httpData = {
  185 + avatar: this.avatar,
  186 + email: this.myInfoModel.userInfo.email,
  187 + id: this.id,
  188 + phoneNumber: this.myInfoModel.userInfo.phoneNumber,
  189 + realName: this.myInfoModel.userInfo.realName
  190 + };
  191 + uni.$u.http
  192 + .put('/yt/user/center', httpData)
236 .then(res => { 193 .then(res => {
237 - let httpData = {  
238 - avatar: this.avatar,  
239 - email: this.myInfoModel.userInfo.email,  
240 - id: this.id,  
241 - phoneNumber: this.myInfoModel.userInfo.phoneNumber,  
242 - realName: this.myInfoModel.userInfo.realName  
243 - };  
244 - uni.$u.http  
245 - .put('/yt/user/center', httpData)  
246 - .then(res => {  
247 - if (res) {  
248 - uni.showToast({  
249 - title: '更新个人资料成功~',  
250 - icon: 'none'  
251 - });  
252 - setTimeout(() => {  
253 - uni.navigateBack({  
254 - delta: 1  
255 - });  
256 - }, 500);  
257 - }  
258 - })  
259 - .catch(e => {  
260 - uni.$u.toast(e.data.message); 194 + if (res) {
  195 + uni.showToast({
  196 + title: '更新个人资料成功~',
  197 + icon: 'none'
261 }); 198 });
  199 + setTimeout(() => {
  200 + uni.navigateBack({
  201 + delta: 1
  202 + });
  203 + }, 500);
  204 + }
262 }) 205 })
263 - .catch(errors => {  
264 - uni.$u.toast('校验失败'); 206 + .catch(e => {
  207 + uni.$u.toast(e.data.message);
265 }); 208 });
266 }, 209 },
267 dateClose() { 210 dateClose() {
@@ -118,7 +118,8 @@ export default { @@ -118,7 +118,8 @@ export default {
118 url: '../../pages/personal/personal' 118 url: '../../pages/personal/personal'
119 }); 119 });
120 let userInfo = { 120 let userInfo = {
121 - isThirdLogin: true //token用于判断是否登录 121 + isThirdLogin: true, //token用于判断是否登录
  122 + avatar: data.avatarUrl
122 }; 123 };
123 this.setUserInfo(userInfo); 124 this.setUserInfo(userInfo);
124 } else { 125 } else {
@@ -130,7 +131,8 @@ export default { @@ -130,7 +131,8 @@ export default {
130 }; 131 };
131 let userInfo = { 132 let userInfo = {
132 ...resObj, 133 ...resObj,
133 - token: true //token用于判断是否登录 134 + token: true, //token用于判断是否登录
  135 + isThirdLogin: false
134 }; 136 };
135 if (userInfo.token) { 137 if (userInfo.token) {
136 this.setUserInfo(userInfo); 138 this.setUserInfo(userInfo);
@@ -25,6 +25,7 @@ export const mutations = { @@ -25,6 +25,7 @@ export const mutations = {
25 // #endif 25 // #endif
26 // #ifndef H5 26 // #ifndef H5
27 uni.removeStorageSync("userInfo"); 27 uni.removeStorageSync("userInfo");
  28 + uni.removeStorageSync('storagePre');
28 // #endif 29 // #endif
29 }, 30 },
30 }; 31 };
@@ -35,6 +36,5 @@ export const actions = { @@ -35,6 +36,5 @@ export const actions = {
35 commit 36 commit
36 }, data) { 37 }, data) {
37 state.badgeInfo = data 38 state.badgeInfo = data
38 - console.log('Change total', data);  
39 } 39 }
40 }; 40 };
@@ -64,7 +64,7 @@ button { @@ -64,7 +64,7 @@ button {
64 .text-bold { 64 .text-bold {
65 color: #333333; 65 color: #333333;
66 font-family: PingFangSC-Medium, PingFang SC; 66 font-family: PingFangSC-Medium, PingFang SC;
67 - font-weight: 500; 67 + font-weight: bold;
68 font-size: 15px; 68 font-size: 15px;
69 } 69 }
70 //(设备、告警,适用设备详情基础信息文本(右边的值的文本))第二个文本 70 //(设备、告警,适用设备详情基础信息文本(右边的值的文本))第二个文本
@@ -132,7 +132,7 @@ button { @@ -132,7 +132,7 @@ button {
132 .home-text-total { 132 .home-text-total {
133 font-size: 17px; 133 font-size: 17px;
134 font-family: PingFangSC-Regular, PingFang SC; 134 font-family: PingFangSC-Regular, PingFang SC;
135 - font-weight: 500; 135 + font-weight: bold;
136 color: #333333; 136 color: #333333;
137 } 137 }
138 .home-text-total-bottom { 138 .home-text-total-bottom {
@@ -116,6 +116,8 @@ export default { @@ -116,6 +116,8 @@ export default {
116 this.list.length = 0; 116 this.list.length = 0;
117 this.page.num = 1; 117 this.page.num = 1;
118 this.loadData(1); 118 this.loadData(1);
  119 + this.isJudgeNextPage = '';
  120 + this.model1.userInfo.type = '';
119 }, 121 },
120 /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */ 122 /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
121 upCallback() { 123 upCallback() {