lyuis 7 mesi fa
parent
commit
017399bfe4
1 ha cambiato i file con 17 aggiunte e 10 eliminazioni
  1. 17 10
      pages/index/index.vue

+ 17 - 10
pages/index/index.vue

@@ -83,7 +83,7 @@
 
 								<view class="topbg-sx-box-r flex align-center">
 									<!-- 城市 -->
-									<view class="topbg-sx-box-r-i flex align-center" style="" @click="getLocalJobs">
+									<view class="topbg-sx-box-r-i flex align-center" style="" @click="getLocalJobs('go')">
 										<text style="margin-right: 10rpx;">{{ county ? county : city ? city : '选择城市'
 										}}</text>
 										<u-icon name="arrow-down" color="#016bf6" size="16"></u-icon>
@@ -327,7 +327,7 @@
 
 								<view class="qySx-sx-box-r flex align-center">
 									<!-- 城市 -->
-									<view @click="getLocalJobs" class="qySx-sx-box-r-i flex align-center">
+									<view @click="getLocalJobs('go')" class="qySx-sx-box-r-i flex align-center">
 										<text style="margin-right: 10rpx;">{{ city ? city : '选择城市' }}</text>
 										<u-icon name="arrow-down" color="#00B78F" size="16"></u-icon>
 									</view>
@@ -498,10 +498,6 @@ export default {
 			{
 				id: 2,
 				name: '最新',
-			},
-			{
-				id: 3,
-				name: '附近',
 			}
 			],
 			currentjob: 0,
@@ -691,7 +687,12 @@ export default {
 		})
 
 		//#ifdef H5
-		/* this.getLocalJobs(); */
+		this.getLocalJobs('');
+		//#endif
+		//#ifdef APP-PLUS
+			const appAuthorizeSetting = uni.getAppAuthorizeSetting()
+			if(appAuthorizeSetting.locationAuthorized=='authorized')
+				this.getLocalJobs('');
 		//#endif
 		this.getDomWidth()
 		this.$Request.getT('/app/common/type/255').then(res => {
@@ -930,7 +931,7 @@ export default {
 			})
 		},
 		// 
-		async getLocalJobs() {
+		async getLocalJobs(go='go') {
 			let that = this;
 			// #ifdef APP
 			const hasLocation = await this.$queue.checkPermission(
@@ -940,10 +941,10 @@ export default {
 			);
 			if (!hasLocation) return that.goNav('/package/screen/city?city=' + that.city + '&county=' + that.county);
 			// #endif
-			that.getCity()
+			that.getCity(go)
 		},
 
-		getCity() {
+		getCity(go='') {
 			var that = this
 			// 权限通过,调用定位API
 			uni.getLocation({
@@ -952,6 +953,10 @@ export default {
 					console.log(res, '地理位置');
 					that.latitude = res.latitude;
 					that.longitude = res.longitude;
+					that.sxTypeList.push({
+						id: 3,
+						name: '附近'
+					})
 					if (that.userType == 1) {
 						// that.getUserList();
 						that.getPostType()
@@ -973,6 +978,7 @@ export default {
 						that.getSelectCity(that.longitude, that.latitude);
 						// #endif
 					}
+					if(go=='go')
 					that.goNav('/package/screen/city?city=' + that.city + '&county=' + that.county + '&type=' + 'search')
 				},
 				fail: function () {
@@ -985,6 +991,7 @@ export default {
 					} else {
 						that.getCompanyClassify()
 					}
+					if(go=='go')
 					that.goNav('/package/screen/city?city=' + that.city + '&county=' + that.county + '&type=' + 'search')
 				}
 			})