Browse Source

修改 优化 列表页调转不做限制, 隐藏建筑体检, 站点修改获取经纬度等

ming 4 years ago
parent
commit
b25481d2b0

+ 9 - 8
components/list-test/list-test.vue

@@ -160,14 +160,15 @@
 			
 			// 页面跳转
 			goNowUrl(item) {
-				if(item.siteAlarmCount){
-					uni.navigateTo({
-						url: this.nowUrl+'?companyCode='+item.companyCode,
-						success: res => {},
-						fail: () => {},
-						complete: () => {}
-					});
-				}
+				uni.navigateTo({
+					url: this.nowUrl+'?companyCode='+item.companyCode,
+					success: res => {},
+					fail: () => {},
+					complete: () => {}
+				});
+				// if(item.siteAlarmCount){
+					
+				// }
 				
 			},
 			

+ 19 - 16
pages/alarmingList/alarmingList.vue

@@ -80,25 +80,28 @@
 			
 			// 页面跳转
 			goProcessList() {
-				if(this.powerMonitoringCount){
-					uni.navigateTo({
-						url: '/pages/processList/processList?type=1&companyCode='+this.companyCode+'',
-						success: res => {},
-						fail: () => {},
-						complete: () => {}
-					});
-				}
+				
+				uni.navigateTo({
+					url: '/pages/processList/processList?type=1&companyCode='+this.companyCode+'',
+					success: res => {},
+					fail: () => {},
+					complete: () => {}
+				});
+				// if(this.powerMonitoringCount){
+					
+				// }
 				
 			},
 			goProcessList2() {
-				if(this.videoMonitoringCount){
-					uni.navigateTo({
-						url: '/pages/processList/processList?type=2&companyCode='+this.companyCode+'',
-						success: res => {},
-						fail: () => {},
-						complete: () => {}
-					});
-				}
+				uni.navigateTo({
+					url: '/pages/processList/processList?type=2&companyCode='+this.companyCode+'',
+					success: res => {},
+					fail: () => {},
+					complete: () => {}
+				});
+				// if(this.videoMonitoringCount){
+					
+				// }
 				
 			},
 			

+ 2 - 2
pages/analyse/analyse.vue

@@ -15,7 +15,7 @@
 					</view>
 				</view>
 			</view>
-			<view class="cu-item  shadow" >
+			<!-- <view class="cu-item  shadow" >
 				<view class="cu-avatar " style="background-image:url(../../static/build-icon.png)"></view>
 				<view class="content">
 					<view class="">建筑体检</view>
@@ -25,7 +25,7 @@
 						<text class="icon iconfont margin-right-xs margin-left-lg">&#xe629;</text>
 					</view>
 				</view>
-			</view>
+			</view> -->
 			
 		</view>
 		

+ 18 - 59
pages/index/index.vue

@@ -179,12 +179,9 @@
 		},
 		
 		beforeCreate: function() {
-			// alert('beforeCreate')
 			let ua = navigator.userAgent.toLowerCase();
 			if (ua.match(/MicroMessenger/i) == "micromessenger") {
-				// alert('是')
-				//是
-				// alert('init')
+			
 				var appId = "wx4eab2e3b5531d58b";
 				var params = {};
 		
@@ -234,7 +231,10 @@
 							}
 							if (res.data.flag == 3002) {
 								// alert("3002授权失败,请重新登录");
-								window.location.href = 'https://qhome.usky.cn/index.html#/';
+								uni.switchTab({
+									url: '/pages/index/index'
+								});
+								// window.location.href = 'https://qhome.usky.cn/index.html#/';
 							}
 						}
 					});
@@ -270,18 +270,11 @@
 		
 		},
 	
-		onLaunch: function() {
-			// alert('onLaunch')
-			
-		},
-
 
 		onLoad: function(option) {
-			// alert('onload')
 			
 			let ua = navigator.userAgent.toLowerCase();
 			if (ua.match(/MicroMessenger/i) == "micromessenger") {
-				// alert('是')
 				
 				var init=this.init();
 				if(init="3001"){
@@ -294,7 +287,7 @@
 			} else {
 				this.getData();
 				this.getSearchList();
-				// alert('不是')
+		
 				//不是
 				// uni.navigateTo({
 				// 	url: '/pages/login/login',
@@ -309,12 +302,7 @@
 			this.hackReset = false;
 			this.$nextTick(() => {
 				this.hackReset = true;
-			})
-		
-			
-			
-			
-			
+			})			
 			
 		},
 		
@@ -334,32 +322,23 @@
 				}
 				return theRequest
 			},
-			async getUrlPrams(key) {
-				var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)", "i");
-				var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
-				var context = "";
-				if (r != null) {
-					context = r[2];
-				}
-				return context;
-			},
+			
 			async init() {
 				var appId = "wx4eab2e3b5531d58b";
-				// var appId = "wx8bba7ec467b61efa"; //ming测试公众号
+				// var appId = "wx8bba7ec467b61efa"; //ming测试公众号
+				
+				var CODE = this.getUrlCode();
+				var code = CODE['code'];
+				
+				
 				var params = {};
-				var CODE = this.getUrlCode();
-				var code = CODE['code'];
 				if (code) {
-
 					params.code = code;
-
-
-					//使用code请求服务器接口,换取用户用户openID
+					//使用code请求服务器接口,换取用户用户openID 
 					const res = await this.$myRequest({
 						url: 'Com/getPageAuthorization',
 						data: params
 					})
-					
 					
 					if (res.data.flag == 3000) {
 
@@ -380,7 +359,8 @@
 				var cs = {};
 				var curl = window.location.href;
 				cs.curl = curl;
-
+
+				//
 				const res1 = await this.$myRequest({
 					url: 'Com/getAuthorizationUrl',
 					data: cs
@@ -393,28 +373,7 @@
 			},
 			// end
 
-			//首页初始化授权
-			// async getPageAuthorization(ming = {}) {
-			// 	const res = await this.$myRequest({
-			// 		url: 'Com/getPageAuthorization',
-			// 		data: ming
-			// 	})
-			// 	alert('res.data.flag')
-			// 	alert(res.data.flag)
-
-			// 	if (res.data.flag == 3000) {
-			// 		uni.navigateTo({
-			// 			url: '/pages/login/login',
-			// 		});
-			// 	}
-			// 	if (res.data.flag == 3002) {
-			// 		uni.navigateTo({
-			// 			url: 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx4eab2e3b5531d58b&redirect_uri=' + res.data
-			// 				.tourl + '&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect',
-			// 		});
-			// 	}
-
-			// },
+		
 
 			async getData() {
 				const res = await this.$myRequest({

+ 14 - 2
pages/login/login.vue

@@ -218,7 +218,13 @@
 				const res = await this.$myRequest({
 					url: 'Login/setSignUp',
 					data: params
-				})
+				})
+				alert('res.data.flag');
+				alert(res.data.flag);
+				
+				alert('res.data.msg')
+				alert(res.data.msg)
+				
 				if (res.data.flag == true) {
 					uni.switchTab({
 						url: '/pages/index/index'
@@ -233,7 +239,13 @@
 			async getLoginAuthorize() {
 				const res = await this.$myRequest({
 					url: 'Login/getLoginAuthorize',
-				})
+				})
+				if(res.data.flag == true){
+					uni.switchTab({
+						url: '/pages/index/index'
+					});
+					
+				}
 
 			},
 

+ 18 - 8
pages/siteAdd/siteAdd.vue

@@ -66,13 +66,13 @@
 				<view class="title">纬度:</view>
 				<input name="input" v-model="siteMessage.latitude"></input>
 			</view>
-			<!-- <view class="form-item">
+			<view class="form-item">
 				<view class="title"></view>
 				<button class=" cu-btn " style="padding:10rpx 20rpx"  @click="getLocation2()">
 					<image src="../../static/nav-icon.png" style="width:25rpx;height:25rpx;margin-right:26rpx"></image>
 					获取当前经纬度
 				</button>
-			</view> -->
+			</view>
 			<view class="form-item">
 				<view class="title">联系人:</view>
 				<input name="input" v-model="siteMessage.userName"></input>
@@ -126,7 +126,7 @@
 		},
 
 		methods: {
-			
+			//新增
 			getLocation(){
 				// 将this赋值给that
 				let that = this
@@ -135,17 +135,27 @@
 					wx.getLocation({
 					  type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
 					  success: function (res) {
-					    // var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
-					    // var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
-					    // var speed = res.speed; // 速度,以米/每秒计
-					    // var accuracy = res.accuracy; // 位置精度
-						
 						that.longitude=res.longitude
 						that.latitude=res.latitude
 					  }
 					});
 				});
 			},
+			//修改
+			getLocation2(){
+				// 将this赋值给that
+				let that = this
+				// 微信公众号获取位置
+				jwx.configWeiXin(jweixin => {
+					wx.getLocation({
+					  type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
+					  success: function (res) {
+						that.siteMessage.longitude=res.longitude
+						that.siteMessage.latitude=res.latitude
+					  }
+					});
+				});
+			},
 			
 			
 

+ 11 - 7
util/api.js

@@ -24,14 +24,18 @@ export const myRequest = (options) => {
 			header: {
 				'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
 			},
-			success: (res) => {
-				if (res.data.flag == false) {
-					return uni.showToast({
-						title: res.data.msg?res.data.msg:"获取数据失败",
-						icon: "none"
-					})
+			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)
 				}
-				resolve(res)
+				
 			},
 			fail: (err) => {