zaijin hace 3 años
padre
commit
57f235f022
Se han modificado 3 ficheros con 22 adiciones y 9 borrados
  1. 0 1
      common/http.interceptor.js
  2. 11 6
      pages/center/index.vue
  3. 11 2
      pages/index/index.vue

+ 0 - 1
common/http.interceptor.js

@@ -16,7 +16,6 @@ const install = (Vue, vm) => {
 	// 请求拦截,配置Token等参数
 	Vue.prototype.$u.http.interceptor.request = (config) => {
 		// config.header.Token = 'xxxxxx';
-		
 		// 方式一,存放在vuex的token,假设使用了uView封装的vuex方式,见:https://uviewui.com/components/globalVariable.html
 		// config.header.token = vm.vuex_token;
 		

+ 11 - 6
pages/center/index.vue

@@ -160,13 +160,18 @@
 				});
 			},
 			loginOut() {
+				// this.$store.state.vuex_hasLogin = false
+				// this.$store.state.vuex_wxinfo = null
+				// this.$store.state.vuex_token = ''
+				// this.$store.state.vuex_user = null
+				this.$u.vuex('vuex_hasLogin', false);
+				this.$u.vuex('vuex_wxinfo', null);
+				this.$u.vuex('vuex_token', '');
+				this.$u.vuex('vuex_user', null);
+				this.userInfo = []
+				this.code = ''
+				localStorage.clear()
 				setTimeout(() => {
-					this.$store.state.vuex_hasLogin = false
-					this.$store.state.vuex_token = ''
-					this.$store.state.vuex_user = null
-					this.userInfo = []
-					this.code = ''
-					localStorage.clear()
 					this.logoutPop = false
 					uni.navigateTo({
 						url: '/pages/center/phoneLogin/phoneLogin'

+ 11 - 2
pages/index/index.vue

@@ -220,8 +220,9 @@
 			getLocation(){
 				const that = this
 				uni.getLocation({
-					type: 'wgs84',
+					type: 'gcj02',
 					geocode: true,
+					altitude: true,
 					success: (res) => {
 						that.latLongItude = {latitude: res.latitude,longitude:res.longitude};
 						that.latitude = res.latitude;
@@ -235,6 +236,8 @@
 			},
 			// 通过经纬度获取地区详细信息
 			getCityNameByLonLat({longitude,latitude} = {}){
+				alert(latitude)
+				alert(longitude)
 				let that = this;
 				uni.showLoading({
 				    title: '加载中',
@@ -280,7 +283,13 @@
 			},
 			cityChange(e){
 				console.log('cityChange',e);
-				this.city = e.city.label;
+				if (e.area) {
+					this.city = e.area.label;
+				} else if (e.city) {
+					this.city = e.city.label;
+				} else {
+					this.city = e.province.label;
+				}
 			},
 			handleGetIndexData(){
 				this.$u.api.getIndexData()