Quellcode durchsuchen

Merge branch 'deploy' of http://git.chelingzhu.com/chelingzhu-web/qhsxKx-mini-html into deploy

lilei vor 4 Jahren
Ursprung
Commit
58d3b86506
1 geänderte Dateien mit 29 neuen und 38 gelöschten Zeilen
  1. 29 38
      pages/index/index.vue

+ 29 - 38
pages/index/index.vue

@@ -54,7 +54,6 @@
 		},
 		data() {
 			return {
-				hasLogin: false, // 用户是否登录
 				mapCtx: null, // 地图对象
 				markers: [], // 标注点
 				centerX: '',
@@ -108,22 +107,11 @@
 			this.mapCtx = uni.createMapContext('map')
 		},
 		onShow() {
-			this.checkLogin()
 		},
 		onLoad() {
 			this.getUserLocation()
 		},
 		methods: {
-			// 检验登录token是否过期
-			checkLogin () {
-				checkLogin().then(res =>{
-					if (res.status == '200'){
-						this.hasLogin = true
-					} else {
-						this.hasLogin = false
-					}
-				})
-			},
 			// 用户位置信息授权
 			getUserLocation() {
 				let _this = this
@@ -194,16 +182,18 @@
 			},
 			// 进入个人中心
 			toUserCenter () {
-				if (this.hasLogin) {
-					uni.navigateTo({
-					    url: '/pages/userCenter/index'
-					})
-				} else {
-					uni.navigateTo({
-					  url: `/pages/login/login?lanuch=false&path=` + encodeURIComponent(`/pages/userCenter/index`)
-					});
-				}
-				
+				// 检验是否登录或登录是否过期
+				checkLogin().then(res =>{
+					if (res.status == '200'){
+						uni.navigateTo({
+						    url: '/pages/userCenter/index'
+						})
+					} else {
+						uni.navigateTo({
+						  url: `/pages/login/login?lanuch=false&path=` + encodeURIComponent(`/pages/userCenter/index`)
+						});
+					}
+				})
 			},
 			// 打开网点列表
 			intoList() {
@@ -239,22 +229,23 @@
 			},
 			// 扫码洗车
 			scanCode () {
-				if (this.hasLogin) {
-					uni.navigateTo({
-						url: '/pages/getOrder/getOrder'
-					})
-					// uni.scanCode({
-					//     success: function (res) {
-					//         console.log('条码类型:' + res.scanType);
-					//         console.log('条码内容:' + res.result);
-					//     }
-					// });
-				} else {
-					uni.navigateTo({
-						url: '/pages/login/login'
-					})
-				}
-				
+				checkLogin().then(res =>{
+					if (res.status == '200'){
+						uni.navigateTo({
+							url: '/pages/getOrder/getOrder'
+						})
+						// uni.scanCode({
+						//     success: function (res) {
+						//         console.log('条码类型:' + res.scanType);
+						//         console.log('条码内容:' + res.result);
+						//     }
+						// });
+					} else {
+						uni.navigateTo({
+							url: '/pages/login/login'
+						})
+					}
+				})
 			},
 			// 创建标记点
 			createMarker(point) {