Browse Source

修复权限页

ming 4 years ago
parent
commit
3f8c5bc0b8

+ 14 - 3
pages.json

@@ -274,9 +274,20 @@
 
 		}, {
 			"path": "pages/authority/authority",
-			"style": {
-				"navigationBarTitleText": "授权",
-				"enablePullDownRefresh": false
+			"style": {
+				
+				"autoBackButton": false,
+				    "navigationBarTitleText": "授权",
+				    "h5": {
+				      "titleNView": {
+				        "autoBackButton": false
+				      }
+				    }
+
+				
+				
+
+				
 			}
 
 		}

+ 1 - 1
pages/authManage/authManage.vue

@@ -161,7 +161,7 @@
 
 			// ListTouch计算方向
 			ListTouchMove(e) {
-				this.listTouchDirection = e.touches[0].pageX - this.listTouchStart < -80 ? 'left' : 'right'
+				this.listTouchDirection = e.touches[0].pageX - this.listTouchStart < -60 ? 'left' : 'right'
 			},
 
 			// ListTouch计算滚动

+ 4 - 0
pages/authority/authority.vue

@@ -16,6 +16,10 @@
 				
 
 			}
+		},
+		
+		mounted(){
+			document.querySelector('.uni-page-head-hd').style.display = 'none'
 		},
 		
 		computed: {

+ 152 - 34
pages/index/index.vue

@@ -88,8 +88,8 @@
 			return {
 				componentKey: 0,
 				arr: [],
-				searchInput: '',
-				alarmCount:'',
+				searchInput: '',
+				alarmCount: '',
 				flag: false,
 				// 宫格列表数据
 				cuIconList: [{
@@ -166,13 +166,93 @@
 			}
 		},
 
-		onLoad(option) {
 
-			let ua = navigator.userAgent.toLowerCase();
-			if (ua.match(/MicroMessenger/i) == "micromessenger"){
-				//是
-				this.init();
-			}else{
+
+		created: function() {
+			// alert('created')
+
+
+
+		},
+		
+		beforeCreate: function() {
+			// alert('beforeCreate')
+			let ua = navigator.userAgent.toLowerCase();
+			if (ua.match(/MicroMessenger/i) == "micromessenger") {
+				// alert('是')
+				//是
+				// alert('init')
+				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授权失败,请重新登录");
+								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',
@@ -181,16 +261,58 @@
 				// 	uni.navigateTo({
 				// 		url: '/pages/login/login',
 				// 	});
-				// }, 2000);
-			}
+				// }, 2000);
+			}
+		
+		
+		},
+	
+		onLaunch: function() {
+			// alert('onLaunch')
+			
+		},
 
 
-			this.hackReset = false;
-			this.$nextTick(() => {
-				this.hackReset = true;
-			})
-			this.getData();
-			this.getSearchList();
+		onLoad: function(option) {
+			// alert('onload')
+			
+			let ua = navigator.userAgent.toLowerCase();
+			if (ua.match(/MicroMessenger/i) == "micromessenger") {
+				// alert('是')
+				
+				var init=this.init();
+				if(init="3001"){
+					this.getData();
+					this.getSearchList();
+				}
+				
+				//是
+				
+			} else {
+				this.getData();
+				this.getSearchList();
+				// alert('不是')
+				//不是
+				// uni.navigateTo({
+				// 	url: '/pages/login/login',
+				// });
+				// setTimeout(function() {
+				// 	uni.navigateTo({
+				// 		url: '/pages/login/login',
+				// 	});
+				// }, 2000);
+			}
+			
+			this.hackReset = false;
+			this.$nextTick(() => {
+				this.hackReset = true;
+			})
+		
+			
+			
+			
+			
+			
 		},
 		methods: {
 
@@ -225,7 +347,7 @@
 				if (code) {
 
 					params.code = code;
-			
+
 
 					//使用code请求服务器接口,换取用户用户openID
 					const res = await this.$myRequest({
@@ -233,20 +355,18 @@
 						data: params
 					})
 					if (res.data.flag == 3000) {
-						// alert("授权失败,请重新登录");
-						window.location.href ='https://qhome.usky.cn/index.html#/';
-					}
-			
-					if (res.data.flag == 3003) {
-						uni.navigateTo({
-							url: '/pages/authority/authority',
-						});
+						 // alert("3000授权失败,");
+						window.location.href = 'https://qhome.usky.cn/index.html#/';
 					}
-					if (res.data.flag == 3002) {
-						// alert("授权失败,请重新登录");
-						window.location.href ='https://qhome.usky.cn/index.html#/';
+
+					if (res.data.flag == 3003) {
+						 // alert("3003授权失败");
+						uni.navigateTo({
+							url: '/pages/authority/authority',
+						});
 					}
-					return "ok";
+				
+					return res.data.flag;
 				}
 
 				var cs = {};
@@ -291,8 +411,8 @@
 					url: 'Index/getDataStatistics',
 					showLoading: true
 				})
-				this.staticData = res.data.data[0]
-				this.alarmCount=this.staticData.alarmCount
+				this.staticData = res.data.data[0]
+				this.alarmCount = this.staticData.alarmCount
 			},
 
 
@@ -341,9 +461,7 @@
 						content: '此模块开发中~',
 						showCancel: false,
 						success: function(res) {
-							if (res.confirm) {
-							} else if (res.cancel) {
-							}
+							if (res.confirm) {} else if (res.cancel) {}
 						}
 					});
 				}

+ 7 - 8
pages/siteList/siteList.vue

@@ -174,8 +174,6 @@
 
 	}
 
-	/* *:not(input) { */
-
 	* {
 		-webkit-touch-callout: none;
 		-webkit-user-select: none;
@@ -184,12 +182,13 @@
 		-ms-user-select: none;
 		user-select: none;
 	}
-	input {
+	input {
+		-webkit-touch-callout:initial !important;
+		-webkit-user-select:initial !important;
+		-khtml-user-select:initial !important;
+		-moz-user-select:initial !important;
+		-ms-user-select:initial !important;
 		user-select: initial !important;
 	}
-
-
-	/* uni-page-head .uni-page-head-bd{
-		 user-select: none!important;
-	} */
+	
 </style>

+ 2 - 2
pages/siteManage/siteManage.vue

@@ -106,8 +106,8 @@
 			// 打开导航
 			mapLocation(item) {
 				uni.openLocation({
-					latitude: parseInt(item.latitude),
-					longitude: parseInt(item.longitude),
+					latitude: parseFloat(item.latitude),
+					longitude: parseFloat(item.longitude),
 					success: function() {
 						// console.log('success');
 					}