gxd-uni-library-editx 1.0.8-beta21 → 1.0.8-beta23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
v-model="searchValue"
|
|
20
20
|
/>
|
|
21
21
|
</view>
|
|
22
|
-
<view class="" @tap="backPrevPage
|
|
22
|
+
<view class="" @tap="backPrevPage">返回</view>
|
|
23
23
|
</view>
|
|
24
24
|
<view class="xd-city__header-box" :style="{height: customBar + 'rpx'}"></view>
|
|
25
25
|
<view class="xd-city__content" v-if="scrollHeight !== null">
|
|
@@ -115,6 +115,7 @@
|
|
|
115
115
|
import storage from "@/common/storage";
|
|
116
116
|
import helper from "@/utils/helper";
|
|
117
117
|
import XdCityLocation from "@/components/XdCityLocation/XdCityLocation";
|
|
118
|
+
import { mapState, mapMutations } from "vuex"
|
|
118
119
|
|
|
119
120
|
/**
|
|
120
121
|
* XdCity
|
|
@@ -148,8 +149,10 @@
|
|
|
148
149
|
getCityInfoByLocation: {
|
|
149
150
|
type: Function,
|
|
150
151
|
}
|
|
151
|
-
|
|
152
152
|
},
|
|
153
|
+
computed: mapState({
|
|
154
|
+
cityLocation: state => state.cityLocation
|
|
155
|
+
}),
|
|
153
156
|
data() {
|
|
154
157
|
return {
|
|
155
158
|
listInfo: null, //城市列表信息
|
|
@@ -197,7 +200,6 @@
|
|
|
197
200
|
cityLastMaxLen: 5, //保存最近访问记录最大数据
|
|
198
201
|
cityLastSaveKey: 'xd_user_last_access_cities',
|
|
199
202
|
cityCacheLocation: [], //最近访问列表记录
|
|
200
|
-
saveKey: 'xd_user_current_access_city', //用户选中城市存储key
|
|
201
203
|
|
|
202
204
|
}
|
|
203
205
|
},
|
|
@@ -217,6 +219,7 @@
|
|
|
217
219
|
});
|
|
218
220
|
},
|
|
219
221
|
methods: {
|
|
222
|
+
...mapMutations(['setCityInfo']),
|
|
220
223
|
handleDone(location){
|
|
221
224
|
console.log('location', location);
|
|
222
225
|
this.threeLocation = location;
|
|
@@ -306,8 +309,8 @@
|
|
|
306
309
|
setTimeout(()=>{
|
|
307
310
|
let routes = this.$xdUniHelper.getCurrentPages();
|
|
308
311
|
if (item) {
|
|
309
|
-
|
|
310
|
-
|
|
312
|
+
// console.log('$xdRoot.selectCity', item);
|
|
313
|
+
this.setCityInfo(item);
|
|
311
314
|
this.$xdRoot.$emit('selectCity', item);
|
|
312
315
|
}
|
|
313
316
|
|
|
@@ -428,6 +431,7 @@
|
|
|
428
431
|
if(item.city_id === -1) {
|
|
429
432
|
return;
|
|
430
433
|
}
|
|
434
|
+
Object.assign(item, {city_code: item.city_id})
|
|
431
435
|
|
|
432
436
|
//在最近访问记录中无数据
|
|
433
437
|
if(!this.$xdUniHelper.isKeyInLists(this.cityCacheLocation, item['city_id'], 'city_id')){
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
import {initWeixin} from "@/components/XdCityLocation/jweixin";
|
|
33
33
|
import XdBaiduMap from "@/components/XdBaiduMap/XdBaiduMap";
|
|
34
34
|
// #endif
|
|
35
|
-
import
|
|
35
|
+
import { mapState, mapMutations } from "vuex"
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
export default {
|
|
@@ -71,6 +71,9 @@
|
|
|
71
71
|
default: 1
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
|
+
computed: mapState({
|
|
75
|
+
stateLocation: state => state.cityLocation.location
|
|
76
|
+
}),
|
|
74
77
|
data(){
|
|
75
78
|
return {
|
|
76
79
|
location: {},
|
|
@@ -102,18 +105,11 @@
|
|
|
102
105
|
|
|
103
106
|
},
|
|
104
107
|
methods:{
|
|
108
|
+
...mapMutations(['setLocationInfo']),
|
|
105
109
|
init(){
|
|
106
|
-
|
|
107
|
-
if(
|
|
108
|
-
|
|
109
|
-
getApp()['saveLogs']({
|
|
110
|
-
location: storage.get('xd_three_map'),
|
|
111
|
-
status: 'ok',
|
|
112
|
-
locationType: 'cache',
|
|
113
|
-
pos: 'XdCityLocation'
|
|
114
|
-
}, 'info');
|
|
115
|
-
}
|
|
116
|
-
this.$emit('done', storage.get('xd_three_map'));
|
|
110
|
+
|
|
111
|
+
if(this.stateLocation){
|
|
112
|
+
this.$emit('done', this.stateLocation);
|
|
117
113
|
return;
|
|
118
114
|
}
|
|
119
115
|
|
|
@@ -139,9 +135,7 @@
|
|
|
139
135
|
console.log('handleDone', this.location);
|
|
140
136
|
if(this.backed) return;
|
|
141
137
|
this.backed = true;
|
|
142
|
-
|
|
143
|
-
storage.set('xd_three_map', this.location, this.expire);
|
|
144
|
-
}
|
|
138
|
+
this.setLocationInfo(this.location);
|
|
145
139
|
console.log('handleDone',this.location);
|
|
146
140
|
this.$emit('done', this.location);
|
|
147
141
|
},
|
|
@@ -299,7 +293,7 @@
|
|
|
299
293
|
};
|
|
300
294
|
this.handleDone()
|
|
301
295
|
},
|
|
302
|
-
|
|
296
|
+
error: ()=>{
|
|
303
297
|
this.location = null;
|
|
304
298
|
this.handleDone()
|
|
305
299
|
}
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
import storage from "@/common/storage";
|
|
25
25
|
import XdCityLocation from "@/components/XdCityLocation/XdCityLocation";
|
|
26
26
|
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
|
|
27
|
+
import { mapState, mapMutations } from "vuex"
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* XdCityShow
|
|
@@ -57,51 +58,49 @@
|
|
|
57
58
|
return {
|
|
58
59
|
cityInfo: null,
|
|
59
60
|
threeLocation: null,
|
|
60
|
-
saveKey: 'xd_user_current_access_city', //用户选中城市存储key
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
|
|
64
64
|
computed:{
|
|
65
|
+
...mapState({
|
|
66
|
+
stateCity: state => state.cityLocation.city,
|
|
67
|
+
stateLocation: state => state.cityLocation.location
|
|
68
|
+
}),
|
|
65
69
|
getCityName(){
|
|
66
|
-
if(this.
|
|
67
|
-
else return this.$xdUniHelper.cutStringLen(this.
|
|
70
|
+
if(!this.stateCity) return '';
|
|
71
|
+
else return this.$xdUniHelper.cutStringLen(this.stateCity.city_name, 6)
|
|
68
72
|
}
|
|
69
73
|
},
|
|
70
74
|
|
|
71
75
|
|
|
72
76
|
created(){
|
|
73
|
-
|
|
74
|
-
console.log('$xdRoot.selectCity', city);
|
|
75
|
-
this.init();
|
|
76
|
-
});
|
|
77
|
+
|
|
77
78
|
},
|
|
78
79
|
|
|
79
80
|
methods:{
|
|
81
|
+
...mapMutations(['setLocationInfo', 'setCityInfo']),
|
|
80
82
|
async init(){
|
|
81
|
-
console.log("storage.get(this.saveKey)", storage.get(this.saveKey))
|
|
82
83
|
//缓存中获取用户定位信息
|
|
83
|
-
if (
|
|
84
|
-
this.cityInfo = storage.get(this.saveKey);
|
|
85
|
-
this.threeLocation = storage.get("xd_three_map");
|
|
84
|
+
if (this.stateCity) {
|
|
86
85
|
} else {
|
|
87
86
|
await this.getCity();
|
|
88
87
|
}
|
|
89
|
-
this.$emit("done", {city: this.
|
|
88
|
+
this.$emit("done", {city: this.stateCity, location: this.stateLocation});
|
|
90
89
|
},
|
|
91
90
|
async getCity(){
|
|
92
|
-
let location = this.threeLocation;
|
|
93
|
-
if(
|
|
94
|
-
let cityInfo = await this.p_getCityInfoByLocation(
|
|
95
|
-
|
|
96
|
-
this.cityInfo = cityInfo;
|
|
91
|
+
// let location = this.threeLocation;
|
|
92
|
+
if(this.stateLocation){
|
|
93
|
+
let cityInfo = await this.p_getCityInfoByLocation(this.stateLocation) ;
|
|
94
|
+
this.setCityInfo(cityInfo);
|
|
97
95
|
}else{
|
|
98
|
-
|
|
96
|
+
let cityInfo = this.$settings.defaultCity;
|
|
97
|
+
this.setCityInfo(cityInfo);
|
|
99
98
|
}
|
|
100
99
|
},
|
|
101
100
|
|
|
102
101
|
handleDone(location) {
|
|
103
102
|
console.log('location', location);
|
|
104
|
-
this.
|
|
103
|
+
this.setLocationInfo(location);
|
|
105
104
|
this.init();
|
|
106
105
|
},
|
|
107
106
|
p_getCityInfoByLocation(location){
|
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
v-if="initStatus"
|
|
5
5
|
class="xd-Layout__animation"
|
|
6
6
|
>
|
|
7
|
-
|
|
8
7
|
<!--topBar-->
|
|
9
8
|
<view class="xd-Layout__top-height"
|
|
10
9
|
:style="{
|
|
11
10
|
height: (topHeight +navBarHeight + statusBarHeight) +'rpx',
|
|
12
|
-
backgroundColor: barBgColor,
|
|
11
|
+
backgroundColor: navigationStyle ? barBgColor: '',
|
|
13
12
|
backgroundImage: getNavBackImage,
|
|
14
13
|
backgroundPosition: 'top center',
|
|
15
14
|
backgroundSize: '100%',
|
|
@@ -287,8 +286,7 @@
|
|
|
287
286
|
observer: null,
|
|
288
287
|
|
|
289
288
|
//底部是否插槽模式
|
|
290
|
-
isFooterSolt: true
|
|
291
|
-
|
|
289
|
+
isFooterSolt: true
|
|
292
290
|
|
|
293
291
|
}
|
|
294
292
|
},
|
package/src/utils/helper.js
CHANGED
|
@@ -833,9 +833,13 @@ class Helpers {
|
|
|
833
833
|
}
|
|
834
834
|
// #endif
|
|
835
835
|
|
|
836
|
+
|
|
837
|
+
|
|
836
838
|
if (isH5) {
|
|
839
|
+
console.warn(`window.location.href: ${JSON.stringify(obj)}`);
|
|
837
840
|
window.location.href = obj['url'];
|
|
838
841
|
} else {
|
|
842
|
+
console.warn(`${type?'navigateTo.jump': 'redirectTo'}: ${JSON.stringify(obj)}`);
|
|
839
843
|
if (type) uni.navigateTo(obj);
|
|
840
844
|
else uni.redirectTo(obj);
|
|
841
845
|
}
|