Browse Source

根据陆文佳提供的测试文档进行bug修复

Ming 3 years ago
parent
commit
f43bcd2002

+ 12 - 2
pages/analyse/analyse.vue

@@ -4,7 +4,7 @@
 			
 		</view>
 		<view class="cu-list menu-avatar padding-lr">
-			<view class="cu-item shadow">
+			<view class="cu-item shadow" @tap=goMonthReport()>
 				<view class="cu-avatar " style="background-image:url(../../static/yb-icon.png)"></view>
 				<view class="content">
 					<view class="">月报</view>
@@ -38,7 +38,17 @@
 			return {
 			}
 		},
-		methods: {
+		methods: {
+			goMonthReport() {
+				uni.showModal({
+					title: 'Tips',
+					content: '此模块开发中~',
+					showCancel: false,
+					success: function(res) {
+						if (res.confirm) {} else if (res.cancel) {}
+					}
+				});
+			}
 			
 
 		}

+ 3 - 1
pages/deviceAdd/deviceAdd.vue

@@ -25,7 +25,7 @@
 					<option value="2" >楼层2</option>
 				</select> -->
 				<select name="" id="" v-model="formMess.floor" filterable clearable>
-					<!-- <option value="" >请选择</option> -->
+					<option value="" >请选择</option>
 					<option value="-10">楼层B10</option>
 					<option value="-9">楼层B9</option>
 					<option value="-8">楼层B8</option>
@@ -42,6 +42,7 @@
 			<view class="form-item">
 				<view class="title"><text class="necessary">*</text>设备类型:</view>
 				<select name="" id="" v-model="formMess.deviceType" filterable clearable>
+					<option value="">请选择</option>
 					<option value="1">智慧用电</option>
 					<option value="2">视频监测</option>
 				</select>
@@ -49,6 +50,7 @@
 			<view class="form-item">
 				<view class="title"><text class="necessary">*</text>站点:</view>
 				<select name="" id="" v-model="formMess.siteId" filterable clearable>
+					<option value="">请选择</option>
 					<option :value=item.id v-for="item in siteList">{{ item.siteName}}</option>
 				</select>
 			</view>

+ 3 - 2
pages/index/components/chart/chart.vue

@@ -35,7 +35,8 @@
 					tooltip: {
 						trigger: 'item',
 						// formatter: "{b}: {c} ({d}%)",
-						formatter: "{b}: {c} "
+						formatter: "{b}: {c} ",
+						position: ['50%', '50%']
 					},
 					title: [{ //aa标题
 						text: '{val|' + this.bindData.integratedAlarmCount + '}\n{name|' + title + '}',
@@ -196,7 +197,7 @@
 
 	.echarts {
 		width: 100%;
-		height: 500rpx;
+		height: 520rpx;
 		margin-top: 70rpx;
 	}
 </style>

+ 2 - 1
pages/index/components/chart2/chart2.vue

@@ -44,7 +44,8 @@
 					tooltip: {
 						trigger: 'item',
 						// formatter: "{a} <br/>{b}: {c} ({d}%)"
-						formatter: "{b}: {c} "
+						formatter: "{b}: {c} ",
+						position: ['50%', '50%']
 					},
 
 					title: [{ //aa标题

+ 178 - 165
pages/index/index.vue

@@ -3,13 +3,14 @@
 		<view class="searchSelect shadow" v-if="flag">
 			<view class="cu-bar search bg-white">
 				<view class="search-form round">
-					<input @focus="InputFocus" @blur="InputBlur" @input="handleInput()" v-model="searchInput" :adjust-position="false"
-					 type="text" placeholder="" confirm-type="search"></input>
+					<input @focus="InputFocus" @blur="InputBlur" @input="handleInput()" v-model="searchInput"
+						:adjust-position="false" type="text" placeholder="" confirm-type="search"></input>
 					<text class="cuIcon-search "></text>
 				</view>
 			</view>
 			<view class="select-items">
-				<view class="select-item" v-for="(item,index) in searchList" @click="clickSelectItem(item,index)" :key="index">{{item}}</view>
+				<view class="select-item" v-for="(item,index) in searchList" @click="clickSelectItem(item,index)"
+					:key="index">{{item}}</view>
 			</view>
 		</view>
 		<view class="section1 section bg-white padding-xs">
@@ -21,10 +22,10 @@
 			</view>
 			<view class="time text-center">统计时段:{{staticData.statisticalPeriod}}
 			</view>
-			<view style="height:570rpx" >
-				<view v-if="Inv == 0" >
+			<view style="height:570rpx">
+				<view v-if="Inv == 0">
 					<chart :bindData="staticData" v-if="hackReset"></chart>
-					
+
 				</view>
 				<view v-if="Inv == 1">
 
@@ -58,7 +59,8 @@
 		<!-- <square :cuIconList="cuIconList"></square> -->
 		<view class="section2 section  bg-white margin-top-sm margin-bottom-sm">
 			<view class="cu-list grid col-3 no-border">
-				<view class="cu-item justify-center align-center" @tap=navItemClick(index) v-for="(item,index) in cuIconList" :key="index">
+				<view class="cu-item justify-center align-center" @tap=navItemClick(index)
+					v-for="(item,index) in cuIconList" :key="index">
 					<image :src="item.imgUrl" style="width:100rpx;height:100rpx"></image>
 					<view class="cu-tag badge" v-if="item.badge!=0">
 						<block v-if="item.badge!=0">{{item.badge>99?'99+':item.badge}}</block>
@@ -75,8 +77,8 @@
 	import chart2 from './components/chart2/chart2.vue';
 	import chart3 from './components/chart3/chart3.vue';
 	import chart4 from './components/chart4/chart4.vue';
-	import json from '../../data/json.js';
-	
+	import json from '../../data/json.js';
+
 
 	export default {
 		components: {
@@ -92,8 +94,8 @@
 				arr: [],
 				searchInput: '',
 				alarmCount: '',
-				flag: false,
-			
+				flag: false,
+
 				// 宫格列表数据
 				cuIconList: [{
 					imgUrl: '../../static/square1.png',
@@ -176,140 +178,141 @@
 
 
 
-		},
-		
-		mounted(){
-			document.querySelector('.uni-page-head-hd').style.display = 'none'
-		},
-		
-		beforeCreate: function() {
-			let ua = navigator.userAgent.toLowerCase();
-			if (ua.match(/MicroMessenger/i) == "micromessenger") {
-			
-				var appId = "wx4eab2e3b5531d58b";
-				var params = {};
-		
-				var url = location.search
-				this.winUrl = url
-				var theRequest = new Object()
-				if (url.indexOf("?") != -1) {
-					var str = url.substr(1)
-					var strs = str.split("&")
-					for (var i = 0; i < strs.length; i++) {
-						theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1])
-					}
-				}
-		
-		
-				var CODE = theRequest;
-				var code = CODE['code'];
-				// alert(code)
-				if (code) {
-		
-					params.code = code;
-		
-					// alert('code')
-					//使用code请求服务器接口,换取用户用户openID
-		
-					uni.request({
-						url: 'https://qhome.usky.cn/USKYOF/USKYOF.php/Home/Com/getPageAuthorization', //仅为示例,并非真实接口地址。
-						// data: {
-						//     text: 'uni.request'
-						// },
-						method: 'POST',
-						header: {
-							'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
-						},
-						success: (res) => {
-							// alert(res.data.flag)
-							if (res.data.flag == 3000) {
-								// alert("3000授权失败,请重新登录");
-								window.location.href = 'https://qhome.usky.cn/index.html#/';
-							}
-		
-							if (res.data.flag == 3003) {
-								// alert("3003");
-								uni.navigateTo({
-									url: '/pages/authority/authority',
-								});
-							}
-							if (res.data.flag == 3002) {
-								// alert("3002授权失败,请重新登录");
-								uni.switchTab({
-									url: '/pages/index/index'
-								});
-								// window.location.href = 'https://qhome.usky.cn/index.html#/';
-							}
-						}
-					});
-		
-				}
-		
-				var cs = {};
-				var curl = window.location.href;
-				cs.curl = curl;
-		
-				const res1 = this.$myRequest({
-					url: 'Com/getAuthorizationUrl',
-					data: cs
-				})
-		
-				var turl = res1.data.turl;
-				window.location.href =
-					'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx4eab2e3b5531d58b&redirect_uri=' + turl +
-					'&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect';
-			} else {
-				// alert('不是')
-				//不是
-				// uni.navigateTo({
-				// 	url: '/pages/login/login',
-				// });
-				// setTimeout(function() {
-				// 	uni.navigateTo({
-				// 		url: '/pages/login/login',
-				// 	});
-				// }, 2000);
-			}
-		
-		
 		},
-	
 
-		onLoad: function(option) {
-			
-			let ua = navigator.userAgent.toLowerCase();
-			if (ua.match(/MicroMessenger/i) == "micromessenger") {
-				
-				var init=this.init();
-				if(init="3001"){
-					this.getData();
-				
-				}
-				
-				//是
-				
-			} else {
-				this.getData();
-				
-		
-				//不是
-				// uni.navigateTo({
-				// 	url: '/pages/login/login',
-				// });
-				// setTimeout(function() {
-				// 	uni.navigateTo({
-				// 		url: '/pages/login/login',
-				// 	});
-				// }, 2000);
-			}
-			
-			this.hackReset = false;
-			this.$nextTick(() => {
-				this.hackReset = true;
-			})			
-			
-		},
-		
+		mounted() {
+			document.querySelector('.uni-page-head-hd').style.display = 'none'
+		},
+
+		beforeCreate: function() {
+			let ua = navigator.userAgent.toLowerCase();
+			if (ua.match(/MicroMessenger/i) == "micromessenger") {
+
+				var appId = "wx4eab2e3b5531d58b";
+				var params = {};
+
+				var url = location.search
+				this.winUrl = url
+				var theRequest = new Object()
+				if (url.indexOf("?") != -1) {
+					var str = url.substr(1)
+					var strs = str.split("&")
+					for (var i = 0; i < strs.length; i++) {
+						theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1])
+					}
+				}
+
+
+				var CODE = theRequest;
+				var code = CODE['code'];
+				// alert(code)
+				if (code) {
+
+					params.code = code;
+
+					// alert('code')
+					//使用code请求服务器接口,换取用户用户openID
+
+					uni.request({
+						url: 'https://qhome.usky.cn/USKYOF/USKYOF.php/Home/Com/getPageAuthorization', //仅为示例,并非真实接口地址。
+						// data: {
+						//     text: 'uni.request'
+						// },
+						method: 'POST',
+						header: {
+							'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
+						},
+						success: (res) => {
+							// alert(res.data.flag)
+							if (res.data.flag == 3000) {
+								// alert("3000授权失败,请重新登录");
+								window.location.href = 'https://qhome.usky.cn/index.html#/';
+							}
+
+							if (res.data.flag == 3003) {
+								// alert("3003");
+								uni.navigateTo({
+									url: '/pages/authority/authority',
+								});
+							}
+							if (res.data.flag == 3002) {
+								// alert("3002授权失败,请重新登录");
+								uni.switchTab({
+									url: '/pages/index/index'
+								});
+								// window.location.href = 'https://qhome.usky.cn/index.html#/';
+							}
+						}
+					});
+
+				}
+
+				var cs = {};
+				var curl = window.location.href;
+				cs.curl = curl;
+
+				const res1 = this.$myRequest({
+					url: 'Com/getAuthorizationUrl',
+					data: cs
+				})
+
+				var turl = res1.data.turl;
+				window.location.href =
+					'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx4eab2e3b5531d58b&redirect_uri=' +
+					turl +
+					'&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect';
+			} else {
+				// alert('不是')
+				//不是
+				// uni.navigateTo({
+				// 	url: '/pages/login/login',
+				// });
+				// setTimeout(function() {
+				// 	uni.navigateTo({
+				// 		url: '/pages/login/login',
+				// 	});
+				// }, 2000);
+			}
+
+
+		},
+
+
+		onLoad: function(option) {
+
+			let ua = navigator.userAgent.toLowerCase();
+			if (ua.match(/MicroMessenger/i) == "micromessenger") {
+
+				var init = this.init();
+				if (init = "3001") {
+					this.getData();
+
+				}
+
+				//是
+
+			} else {
+				this.getData();
+
+
+				//不是
+				// uni.navigateTo({
+				// 	url: '/pages/login/login',
+				// });
+				// setTimeout(function() {
+				// 	uni.navigateTo({
+				// 		url: '/pages/login/login',
+				// 	});
+				// }, 2000);
+			}
+
+			this.hackReset = false;
+			this.$nextTick(() => {
+				this.hackReset = true;
+			})
+
+		},
+
 		methods: {
 
 			// start
@@ -326,15 +329,15 @@
 				}
 				return theRequest
 			},
-			
+
 			async init() {
-				var appId = "wx4eab2e3b5531d58b";
-				// var appId = "wx8bba7ec467b61efa"; //ming测试公众号
-				
-				var CODE = this.getUrlCode();
-				var code = CODE['code'];
-				
-				
+				var appId = "wx4eab2e3b5531d58b";
+				// var appId = "wx8bba7ec467b61efa"; //ming测试公众号
+
+				var CODE = this.getUrlCode();
+				var code = CODE['code'];
+
+
 				var params = {};
 				if (code) {
 					params.code = code;
@@ -342,28 +345,28 @@
 					const res = await this.$myRequest({
 						url: 'Com/getPageAuthorization',
 						data: params
-					})
-					
-					if (res.data.flag == 3000) {
+					})
 
-						 // alert("3000授权失败,");
+					if (res.data.flag == 3000) {
+
+						// alert("3000授权失败,");
 						window.location.href = 'https://qhome.usky.cn/index.html#/';
 					}
 
-					if (res.data.flag == 3003) {
-						 // alert("3003授权失败");
+					if (res.data.flag == 3003) {
+						// alert("3003授权失败");
 						uni.navigateTo({
 							url: '/pages/authority/authority',
 						});
 					}
-				
+
 					return res.data.flag;
 				}
 
 				var cs = {};
 				var curl = window.location.href;
 				cs.curl = curl;
-
+
 				//
 				const res1 = await this.$myRequest({
 					url: 'Com/getAuthorizationUrl',
@@ -372,25 +375,26 @@
 
 				var turl = res1.data.turl;
 				window.location.href =
-					'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx4eab2e3b5531d58b&redirect_uri=' + turl +
+					'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx4eab2e3b5531d58b&redirect_uri=' +
+					turl +
 					'&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect';
 			},
 			// end
 
-		
+
 
 			async getData() {
 				const res = await this.$myRequest({
 					url: 'Index/getDataStatistics',
 					showLoading: true
 				})
-				this.staticData = res.data.data[0]  
-				this.alarmCount = this.staticData.alarmCount
-				this.cuIconList[0].badge=this.staticData.unprocessedCount
+				this.staticData = res.data.data[0]
+				this.alarmCount = this.staticData.alarmCount
+				this.cuIconList[0].badge = this.staticData.unprocessedCount
 			},
 
 
-			
+
 
 			handleInput() {
 				var newlist = this.searchList2.filter(item => item.indexOf(this.searchInput) > -1)
@@ -443,6 +447,15 @@
 
 		}
 	}
+
+
+	//解决IOS返回页面不刷新的问题
+	history.pushState(null, null, document.URL); //禁止网页返回上一页
+	window.addEventListener('popstate', function() {
+		// alert('点击返回按钮了!')
+	});
+	
+	
 </script>
 
 <style lang="scss">

+ 7 - 3
pages/login/login.vue

@@ -10,7 +10,7 @@
 				<view class="phone-box">
 					<input type="text" placeholder="请输入手机号码" onfocus="this.placeholder=''" v-model="phone">
 					<span class="icon iconfont left-icon">&#xe64f;</span>
-					<span class="icon iconfont right-icon">&#xe610;</span>
+					<span class="icon iconfont right-icon" @tap="clearPhone">&#xe610;</span>
 				</view>
 				<view class="password-box">
 					<input type="text" placeholder="请输入验证码" v-model="verify" maxlength="5" >
@@ -64,6 +64,9 @@
 
 		},
 		methods: {
+			clearPhone(){
+				this.phone=''
+			},
 
 			// setNavigationBarTitle
 			getUrlCode() {
@@ -151,7 +154,8 @@
 					return
 
 				}
-				if (!/^1[345678]\d{9}$/.test(this.phone)) {
+				// /^1[3|4|5|7|8|9][0-9]{9}$/
+				if (!/^1[3456789]\d{9}$/.test(this.phone)) {
 					uni.showToast({
 						title: "请输入正确的手机号码...",
 						icon: "none"
@@ -201,7 +205,7 @@
 					return
 
 				}
-				if (!/^1[345678]\d{9}$/.test(this.phone)) {
+				if (!/^1[3456789]\d{9}$/.test(this.phone)) {
 					uni.showToast({
 						title: "请输入正确的手机号码...",
 						icon: "none"

+ 2 - 2
pages/siteAdd/siteAdd.vue

@@ -203,7 +203,7 @@
 					});
 					return
 				}
-				if (!/^1[345678]\d{9}$/.test(this.phone)){
+				if (!/^1[3456789]\d{9}$/.test(this.phone)){
 					uni.showToast({
 						title: "请输入正确的手机号码...",
 						icon:"none"
@@ -264,7 +264,7 @@
 					});
 					return
 				}
-				if (!/^1[345678]\d{9}$/.test(this.siteMessage.phone)){
+				if (!/^1[3456789]\d{9}$/.test(this.siteMessage.phone)){
 					uni.showToast({
 						title: "请输入正确的手机号码...",
 						icon:"none"

+ 2 - 1
pages/siteManage/siteManage.vue

@@ -1,6 +1,7 @@
 <template>
 	<view class="site-wrapper">
 		<!-- 筛选框start -->
+		<view style="height:100rpx"></view>
 		<view class="ding">
 			<view class="cu-bar search bg-gray filter-section">
 				<view class="search-form round bg-white">
@@ -15,7 +16,7 @@
 		<!-- 筛选框end -->
 
 		<!-- 站点列表start -->
-		<view class="site-items">
+		<view class="site-items" style="margin-top:0;height: calc(100vh - 300rpx);">
 			<view class="cu-list menu-avatar">
 				<view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in siteList" :key="index"
 				 @touchstart="ListTouchStart" @touchmove="ListTouchMove" @touchend="ListTouchEnd" :data-target="'move-box-' + index">

+ 46 - 31
util/api.js

@@ -1,7 +1,7 @@
-const BASE_URL = 'https://iot.usky.cn/USKYOF/USKYOF.php/Home/'   //(测试域名)
-// const BASE_URL='https://qhome.usky.cn/USKYOF/USKYOF.php/Home/'
+const BASE_URL = 'https://iot.usky.cn/USKYOF/USKYOF.php/Home/' //(测试域名)
+// const BASE_URL='https://qhome.usky.cn/USKYOF/USKYOF.php/Home/'
 // 同时发送异步代码的次数,防止一次点击中有多次请求,用于处理
-let ajaxTimes = 0;
+let ajaxTimes = 0;
 
 export const myRequest = (options) => {
 
@@ -24,29 +24,47 @@ export const myRequest = (options) => {
 			header: {
 				'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
 			},
-			success: (res) => {
-				let notShowToastUrl = ['Login/getLoginAuthorize'];
-				if(  !notShowToastUrl.includes(options.url)){
-					if (res.data.flag == false) {
-						return uni.showToast({
-							title: res.data.msg?res.data.msg:"获取数据失败",
-							icon: "none"
-						})
-					}
-					resolve(res)
+			success: (res) => {
+				let notShowToastUrl = ['Login/getLoginAuthorize'];
+				if (!notShowToastUrl.includes(options.url)) {
+					if (res.data.flag == false) {
+						return uni.showToast({
+							title: res.data.msg ? res.data.msg : "获取数据失败",
+							icon: "none"
+						})
+					}
+					resolve(res)
 				}
-				
+
 			},
 			fail: (err) => {
 
-				uni.showModal({
-					showCancel: false,
-					content: '请求接口失败'
-				});
-				// uni.showToast({
-				// 	title: '请求接口失败',
-				// 	icon:"none"
-				// })
+				// 修复首页请求接口失败bug start
+				let notIndexFail = ['Index/getDataStatistics','Com/getAuthorizationUrl'];
+				if (notIndexFail.includes(options.url)) {
+					// alert(3)
+					window.location.href = 'https://qhome.usky.cn/index.html#/pages/index/index';
+					// uni.switchTab({
+					// 	url: '/pages/index/index'
+					// });
+				}else{
+					uni.showModal({
+						showCancel: false,
+						content: '请求接口失败'
+					});
+				}
+				// end
+				
+				// uni.showModal({
+				// 	showCancel: false,
+				// 	content: '请求接口失败'
+				// });
+				
+				
+				
+
+			
+
 				reject(err)
 
 			},
@@ -64,13 +82,10 @@ export const myRequest = (options) => {
 		})
 	})
 
+}
+
+
+export default {
+	BASE_URL
+
 }
-
-
-export default {
-	    BASE_URL
-						
-}
-
-
-