gxd-uni-library-editx 1.0.8-beta22 → 1.0.8-beta24

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gxd-uni-library-editx",
3
- "version": "1.0.8-beta22",
3
+ "version": "1.0.8-beta24",
4
4
  "private": false,
5
5
  "description": "聚福宝基础插件专用库",
6
6
  "main": "index.js",
@@ -19,7 +19,7 @@
19
19
  v-model="searchValue"
20
20
  />
21
21
  </view>
22
- <view class="" @tap="backPrevPage()">返回</view>
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
- storage.set(this.saveKey, item, 24);
310
- console.log('$xdRoot.selectCity', item);
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 storage from "@/common/storage";
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
- //从storage获取定位信息
107
- if(storage.get('xd_three_map')) {
108
- if (typeof getApp()['saveLogs'] === 'function' && this.$settings['isDebug']) {
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
- if(this.location) {
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
- fail: ()=>{
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.cityInfo === null) return '';
67
- else return this.$xdUniHelper.cutStringLen(this.cityInfo.city_name, 6)
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
- this.$xdRoot.$on('selectCity', (city)=>{
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 (storage.get(this.saveKey)) {
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.cityInfo, location: this.threeLocation});
88
+ this.$emit("done", {city: this.stateCity, location: this.stateLocation});
90
89
  },
91
90
  async getCity(){
92
- let location = this.threeLocation;
93
- if(location){
94
- let cityInfo = await this.p_getCityInfoByLocation(location)
95
- storage.set(this.saveKey, cityInfo);
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
- this.cityInfo = this.$settings.defaultCity;
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.threeLocation = location;
103
+ this.setLocationInfo(location);
105
104
  this.init();
106
105
  },
107
106
  p_getCityInfoByLocation(location){
@@ -23,6 +23,7 @@
23
23
  width: '100%',
24
24
  backgroundColor: barBgColor,
25
25
  backgroundImage: getNavBackImage,
26
+ zIndex: (wiewType ? 1300: 999)
26
27
  }
27
28
  ">
28
29
  <xd-bar
@@ -44,6 +45,7 @@
44
45
  <view class="xd-Layout__top animation-top"
45
46
  v-show="contentStatus"
46
47
  :style="{
48
+ paddingTop: windowTop + 'rpx',
47
49
  height: topHeight + 'rpx',
48
50
  top: (navBarHeight + statusBarHeight) + 'rpx',
49
51
  zIndex: (wiewType ? 1490: 1001)
@@ -309,6 +311,10 @@
309
311
  return `url("${this.bgImage}")`
310
312
  }
311
313
  },
314
+
315
+ windowTop(){
316
+ return this.getRpx(uni.getSystemInfoSync().windowTop || 0)
317
+ },
312
318
 
313
319
  getBodyBackImagePosition(){
314
320
  let windowTop = uni.getSystemInfoSync().windowTop || 0;
@@ -423,6 +429,12 @@
423
429
  //重缓存中获取底部安全距离
424
430
  if(uni.getStorageSync('xd-layout')) {
425
431
  this.safeHeight = uni.getStorageSync('xd-layout')['safeHeight'];
432
+ //修复刘海初始化值为0
433
+ if(this.safeHeight === 0) {
434
+ this.handleSafeBottom();
435
+ }
436
+ console.warn(`xd-layout.storage: ${JSON.stringify(this.safeHeight)}`);
437
+ console.warn(`xd-layout.system: ${JSON.stringify(this.systemInfoSyn)}`);
426
438
  this.getSafeBottom();
427
439
  }
428
440
 
@@ -488,28 +500,18 @@
488
500
 
489
501
  this.createTime = new Date().getTime() - this.startTime;
490
502
  },
491
-
492
- /**
493
- * @description 获取底部安全距离数据
494
- */
495
- getSafeBottom(){
496
- //已缓存安全距离
497
- if(this.safeHeight !== null) {
498
- this.time = new Date().getTime() - this.startTime;
499
- this.initStatus = true;
500
- this.layoutDone();
501
- return
502
- }
503
-
503
+
504
+ handleSafeBottom(){
504
505
  //未缓存安全距离
505
- this.$nextTick(()=>{
506
+ this.$nextTick(() => {
506
507
  this.$xdUniHelper.getWindowHeight(['#xd-Layout__padding'], this)
507
- .then(res=>{
508
+ .then(res => {
509
+ console.warn(`xd-layout.getWindowHeight: ${JSON.stringify(res)}`)
508
510
  this.safeHeight = Math.max(
509
511
  this.getRpx(res['#xd-Layout__padding']['height']),
510
512
  this.systemInfoSyn.safeAreaInsets.bottom
511
513
  );
512
-
514
+
513
515
  this.time = new Date().getTime() - this.startTime;
514
516
  this.initStatus = true;
515
517
  //保存计算属性
@@ -520,6 +522,21 @@
520
522
  })
521
523
  .catch()
522
524
  })
525
+ },
526
+
527
+ /**
528
+ * @description 获取底部安全距离数据
529
+ */
530
+ getSafeBottom(){
531
+ //已缓存安全距离
532
+ if(this.safeHeight !== null) {
533
+ this.time = new Date().getTime() - this.startTime;
534
+ this.initStatus = true;
535
+ this.layoutDone();
536
+ return
537
+ }
538
+
539
+ this.handleSafeBottom();
523
540
 
524
541
  },
525
542