gxd-uni-library-editx 1.0.37 → 1.0.38

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.37",
3
+ "version": "1.0.38",
4
4
  "private": false,
5
5
  "description": "聚福宝基础插件专用库",
6
6
  "main": "index.js",
@@ -29,7 +29,7 @@
29
29
  getParentsStyle, //获取页面风格单个键值值
30
30
  getParentsStyles //获取页面风格列表
31
31
  } from '@/utils/xd.base';
32
-
32
+
33
33
  /**
34
34
  * XdButton 按钮UI
35
35
  * @description 按钮组件
@@ -56,7 +56,7 @@
56
56
  type: String,
57
57
  default: ''
58
58
  },
59
-
59
+
60
60
  systemStyle: {
61
61
  type: Object|null,
62
62
  default: null
@@ -123,7 +123,7 @@
123
123
  default: 'to bottom',
124
124
  },
125
125
  /**仅支持线性渐变******/
126
-
126
+
127
127
  isBoxShadow:{
128
128
  type: Boolean,
129
129
  default: false,
@@ -230,12 +230,12 @@
230
230
  this.status = true;
231
231
  },
232
232
  methods:{
233
-
233
+
234
234
  handleClick(e){
235
235
  this.$emit('click',e);
236
236
  this.$emit('tap', e);
237
237
  },
238
-
238
+
239
239
  getInfo(type, dataKey, list='btnHeightList'){
240
240
  if (this[dataKey]) {
241
241
  let temp = this[dataKey];
@@ -280,7 +280,7 @@
280
280
  if (this.uiType === 'subPrimary') {
281
281
  return this.btnBtnColor.subGradient || this.getColor();
282
282
  }
283
-
283
+
284
284
  let bgc = this.getColor();
285
285
  if (this.isGradual && this.gradualColor && this.gradualType) {
286
286
  bgc =`linear-gradient(${this.gradualType}, ${this.gradualColor})`;
@@ -1,12 +1,8 @@
1
1
  <template>
2
2
  <view class="xd-city-box">
3
+ <xd-city-location ref="location" @cityAndLocation="handleCityAndLocationDone" baidu is-select></xd-city-location>
3
4
  <view class="xd-city" v-if="allCityList.length > 0">
4
- <view class="xd-city__header"
5
- :style="{
6
- height: customBar + 'rpx',
7
- top: top + 'rpx',
8
- }"
9
- >
5
+ <view class="xd-city__header" :style="{height: customBar + 'rpx',top: top + 'rpx'}">
10
6
  <view>
11
7
  <input
12
8
  class="xd-city__header-input"
@@ -109,7 +105,6 @@
109
105
  <!-- 选中之后字母 结束-->
110
106
  </view>
111
107
  </view>
112
- <xd-city-location v-if="loaded" @done="handleDone" baidu></xd-city-location>
113
108
  </view>
114
109
  </template>
115
110
 
@@ -149,44 +144,22 @@
149
144
  type: Number,
150
145
  default: 0 //px
151
146
  },
152
-
153
- getCityInfoByLocation: {
154
- type: Function,
155
- }
156
147
  },
157
- computed: mapState({
158
- cityLocation: state => state.cityLocation
159
- }),
148
+
160
149
  data() {
161
150
  return {
162
151
  listInfo: null, //城市列表信息
163
152
  allCityList: [], //城市一维数组列表
164
- threeLocation: null, //第三方定位信息
165
-
166
153
  hotCityList: [], //热门城市列表
167
154
  cityList: null, //城市列表
168
155
  cityLetter: [],//城市字母排序
169
-
170
156
  customBar: 90, //搜索区域高度
171
157
  scrollHeight: null, //内容区域高度
172
158
  callbackUrl: null, //访问回调地址
173
159
 
174
-
175
-
176
- //定位信息
177
- position: {
178
- city_name: '定位中..', city_id: -1
179
- }, //定位获取的位置
180
-
181
- //测试定位城市
182
- testLocationItem: {
183
- "city_id": "110100",
184
- "city_name": "北京市",
185
- "province_name": "北京市",
186
- "city_pinyin": "",
187
- "py": "",
188
- "letter": "B"
189
- },
160
+ //定位获取的位置
161
+ position: {city_name: '定位中..', city_id: -1},
162
+ locationInfo: null,
190
163
 
191
164
  tId: null,
192
165
  showMask: false,
@@ -203,22 +176,17 @@
203
176
  //城市信息
204
177
  cityLastMaxLen: 5, //保存最近访问记录最大数据
205
178
  cityLastSaveKey: 'xd_user_last_access_cities',
206
- locationStorageKey: "xd_three_map",
207
- rejectSave: 'xd-user-reject-location',
208
- currentLocationCity: 'jfb_current_ajax_location_city',
179
+ prevUserSelectCityKey:'xd_user_select_access_city',
180
+ prevUserLocationCityKey:'xd_user_current_access_city',
181
+ //定位成功保存数据(定位成功就保存等待有组件需要弹出时候转化xd_three_map)
182
+ locationSuccessKey: 'xd_three_map_success',
183
+ //定位成功保存数据(定位成功就保存等待有组件需要弹出时候转化 prevUserLocationCityKey)
184
+ prevUserlocationCitySuccessKey: 'xd_user_location_success_city',
209
185
  cityCacheLocation: [], //最近访问列表记录
210
-
211
- loaded: false, //页面加载完成
212
- reloading: false,
213
-
214
186
  }
215
187
  },
216
188
 
217
189
  created(){
218
-
219
- this.$nextTick(() => {
220
- this.loaded = true;
221
- })
222
190
  this.init();
223
191
  },
224
192
 
@@ -234,43 +202,31 @@
234
202
  this.cityCacheLocation = storage.get(this.cityLastSaveKey);
235
203
  }
236
204
  });
205
+
237
206
  },
238
207
  methods: {
239
- ...mapMutations(['setCityInfo', "clearLocation"]),
240
-
208
+ ...mapMutations(['setLocationCity']),
209
+
241
210
  handleReloadPosition(){
242
211
  this.$xdShowLoading({});
243
- this.reloading = true;
244
- this.loaded = false;
245
- this.position = {city_name: '定位中', city_id: -1};
246
- this.clearLocation();
247
- storage.remove(this.rejectSave);
248
- storage.remove(this.currentLocationCity);
249
- setTimeout(()=>{
250
- this.loaded = true;
251
- }, 10)
252
- },
253
-
254
- handleDone(location){
255
- if(this.reloading) {
212
+ this.position = {city_name: '定位中..', city_id: -1};
213
+ this.$refs['location'].reloadLocation((city, location)=>{
214
+ this.locationInfo = location;
215
+ this.getLocationCityName(city);
256
216
  this.$xdHideLoading();
257
- this.reloading = false;
258
- }
259
- this.threeLocation = location;
260
- this.getLocationCityName();
217
+ })
218
+ },
219
+
220
+ handleCityAndLocationDone({location, city}){
221
+ this.locationInfo = location;
222
+ this.getLocationCityName(city);
261
223
  },
262
224
 
263
225
  init(){
264
- this.$emit('getCityList',{location: this.threeLocation},
265
- /**
266
- * @description 城市列表
267
- * @param cityList
268
- */
269
- (cityList)=>{
270
- this.listInfo = this.$xdUniHelper.cloneDeep(cityList)
271
- this.toList();
272
- }
273
- )
226
+ this.$emit('getCityList',{location: null},(cityList)=>{
227
+ this.listInfo = this.$xdUniHelper.cloneDeep(cityList)
228
+ this.toList();
229
+ })
274
230
  },
275
231
 
276
232
  toList(){
@@ -287,28 +243,15 @@
287
243
  this.setAppLettersList();
288
244
  },
289
245
 
290
- p_getCityInfoByLocation(location){
291
- let callThis = this;
292
- // #ifdef MP
293
- callThis = this.$parent;
294
- // #endif
295
- return new Promise((r, j) => {
296
- callThis.getCityInfoByLocation(location, (res) => {
297
- storage.set(this.currentLocationCity, res.data, .5);
298
- r(res.data);
299
- })
300
- })
301
- },
302
-
303
246
  /***
304
247
  * @description 获取第三方定位信息
305
248
  */
306
- async getLocationCityName(){
307
- try{
308
- let cityInfo = await this.p_getCityInfoByLocation(this.threeLocation);
309
- this.position = Object.assign({}, cityInfo, {city_id: cityInfo.city_code});
310
- }catch(err){
311
- this.position = {city_name: '定位失败', city_id: -2};
249
+ getLocationCityName(city){
250
+ if(city.is_default === 'Y' ||city.is_default === 'N') {
251
+ this.position = city;
252
+ }
253
+ else {
254
+ this.position = {city_name: '定位失败', city_id: -1}
312
255
  }
313
256
  },
314
257
 
@@ -319,8 +262,13 @@
319
262
  this.doneInput();
320
263
  setTimeout(()=>{
321
264
  if (item) {
322
- storage.remove('xd_user_current_access_city');
323
- this.setCityInfo(item);
265
+ storage.set(this.prevUserSelectCityKey,item)
266
+ storage.remove(this.locationSuccessKey)
267
+ storage.remove(this.prevUserlocationCitySuccessKey)
268
+ this.setLocationCity({
269
+ city:item,
270
+ location: this.locationInfo,
271
+ })
324
272
  this.$xdRoot.$emit('selectCity', item);
325
273
  }
326
274
  if (this.callbackUrl) {
@@ -358,7 +306,6 @@
358
306
  };
359
307
  handle();
360
308
  },
361
-
362
309
  touchStart(e) {
363
310
  this.touchmove = true
364
311
  let pageY = e.touches[0].pageY
@@ -381,7 +328,6 @@
381
328
  this.touchmove = false
382
329
  this.touchmoveIndex = -1
383
330
  },
384
-
385
331
  doneInput(){
386
332
  uni.hideKeyboard()
387
333
  },
@@ -437,10 +383,15 @@
437
383
  * @param item
438
384
  */
439
385
  handleSelected(item) {
386
+ //定位中与定位失败不能处理
440
387
  if(item.city_id === -1) {
441
388
  return;
442
389
  }
443
- Object.assign(item, {city_code: item.city_id});
390
+
391
+ //code不存在使用item.city_id进行赋值
392
+ if(!item.city_code) {
393
+ Object.assign(item, {city_code: item.city_id, is_default: 'S'});
394
+ }
444
395
 
445
396
  //在最近访问记录中无数据
446
397
  if(!this.$xdUniHelper.isKeyInLists(this.cityCacheLocation, item['city_id'], 'city_id')){
@@ -497,8 +448,8 @@
497
448
  }
498
449
  }
499
450
  }
500
-
501
-
451
+
452
+
502
453
  .fsmall {font-size: @xd-font-size-base;}
503
454
  .fmiddle {font-size: @xd-font-size-base + 2rpx;}
504
455
  .blue {color: #007AFF;}
@@ -578,7 +529,7 @@
578
529
  justify-content: flex-start!important;
579
530
  align-items: center;
580
531
  padding-bottom: unit(20, rpx);
581
-
532
+
582
533
  & > view:first-child {
583
534
  margin-bottom: 0;
584
535
  }
@@ -1,11 +1,18 @@
1
1
  <template>
2
- <!--#ifdef H5-->
3
- <xd-baidu-map
4
- v-if="baidu && initBaidu"
5
- :ak="uiBaiduAk"
6
- @onLocationSuccess="handleBaiduInit"
7
- ></xd-baidu-map>
8
- <!--#endif-->
2
+ <view>
3
+ <!--#ifdef H5-->
4
+ <baidu-map
5
+ class="xd-baidu__content"
6
+ v-if="baiduAKConfig && initBaidu"
7
+ :ak="baiduAKConfig"
8
+ @ready="handleBaiduReady"
9
+ >
10
+ </baidu-map>
11
+ <!--#endif-->
12
+ </view>
13
+
14
+
15
+
9
16
  </template>
10
17
 
11
18
  <script>
@@ -13,6 +20,7 @@
13
20
  /**
14
21
  * XdCityLocation
15
22
  * * 参考网站如下:
23
+ * https://dafrok.github.io/vue-baidu-map/#/zh/start/usage
16
24
  * https://lbsyun.baidu.com/cms/jsapi/reference/jsapi_webgl_1_0.html#a3b0
17
25
  * https://lbsyun.baidu.com/index.php?title=jspopularGL/guide/addOverlay
18
26
  * https://lbs.baidu.com/jsdemo.htm#fEditOverlay
@@ -27,22 +35,24 @@
27
35
 
28
36
  * @event {Function} getWeixinAppInfo 使用微信定位使用需要获取
29
37
  */
30
-
38
+ import newLocaltionMixins from "@/mixins/newLocaltionMixins";
31
39
  // #ifdef H5
32
40
  import XdBaiduMap from "@/components/XdBaiduMap/XdBaiduMap";
33
- import {isWechat, isPlatform, baseEnvTypeReg} from "@/utils/xd.base";
41
+ import BaiduMap from 'vue-baidu-map/components/map/Map.vue';
42
+ import BmGeolocation from 'vue-baidu-map/components/controls/Geolocation';
34
43
  // #endif
35
- import { mapState, mapMutations, mapActions } from "vuex"
36
- import storage from "@/common/storage";
37
44
 
38
45
 
39
46
  export default {
40
47
  name: "XdCityLocation",
41
48
  components: {
42
49
  // #ifdef H5
43
- XdBaiduMap
50
+ XdBaiduMap,
51
+ BaiduMap,
52
+ BmGeolocation
44
53
  // #endif
45
54
  },
55
+ mixins:[newLocaltionMixins],
46
56
  props:{
47
57
  /**
48
58
  * @description 使用百度定位支持H5 需要在/public/index.html 添加下面的地址
@@ -70,261 +80,28 @@
70
80
  expire: {
71
81
  type: Number,
72
82
  default: 1
73
- }
74
- },
75
- data(){
76
- return {
77
- //微信参数
78
- isWx: false,
79
- time: 0,
80
-
81
- location: {},
82
- baiduCount: 0, //baidu API 加载次数
83
- backed: false,
84
- initBaidu: false,
85
- uiBaiduAk: '',
86
-
87
- failStatus: false,
88
- timeStatus: null,
89
- permanentSave: 'xd-user-permanent-location-config',
90
- rejectSave: 'xd-user-reject-location',
91
- locationStorageKey: "xd_three_map"
92
- }
93
- },
94
- created() {
95
- //#ifdef H5
96
- //微信环境定位
97
- if(isWechat()) {
98
- this.isWx = true;
99
- this.init();
100
- return
101
- }
102
-
103
- //百度定位
104
- this.uiBaiduAk = this.baiduAk || this.$settings.baiduAk;
105
- if(this.baidu){
106
- if(!this.uiBaiduAk) {
107
- console.error('请传入百度AK值')
108
- throw new Error('请传入百度AK值');
109
- }else {
110
- this.initBaidu = true;
111
- this.init();
112
- }
113
- }
114
-
115
- //默认
116
- else{
117
- this.init();
118
- }
119
- // #endif
120
-
121
- // #ifdef MP-WEIXIN
122
- this.init();
123
- // #endif
124
-
125
- },
126
- methods:{
127
- ...mapMutations(['setLocationInfo']),
128
- ...mapActions(['getH5WxAuthorize']),
129
-
130
- getLocationData(){
131
- return storage.get(this.locationStorageKey);
132
- },
133
-
134
- /**
135
- * @description 火星转百度坐标
136
- * @param lng
137
- * @param lat
138
- * @returns {{latitude: *, longitude: *}}
139
- */
140
- gcj02tobd09(lng, lat) {
141
- let x_PI = 3.14159265358979324 * 3000.0 / 180.0;
142
- let PI = 3.1415926535897932384626;
143
- let a = 6378245.0;
144
- let ee = 0.00669342162296594323;
145
-
146
- lat = +lat;
147
- lng = +lng;
148
- let z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * x_PI);
149
- let theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * x_PI);
150
- let bd_lng = z * Math.cos(theta) + 0.0065;
151
- let bd_lat = z * Math.sin(theta) + 0.006;
152
- return {longitude: bd_lng, latitude:bd_lat}
153
- },
154
-
155
- wxLocation(){
156
- //被拒绝之后不在启动授权功能
157
- if(storage.get(this.rejectSave) === true) {
158
- let location = {
159
- lng: null,
160
- lat: null
161
- };
162
- this.$xdLog.setProject('Location.wx.jwxSDK.reject', location);
163
- this.handleBaiduInit(null);
164
- return
165
- }
166
-
167
- //启动微信授权功能
168
- this.getH5WxAuthorize({jsApiList: ['openLocation', 'getLocation']})
169
- .then(({jwxSDK}) => {
170
- this.$xdLog.setProject('Location.jwxSDK.init', 'Location.jwxSDK.init');
171
-
172
- //pc端端微信环境直接返回
173
- if(isPlatform().isPc ||
174
- (jwxSDK && typeof jwxSDK.getLocation !== 'function')
175
- ) {
176
- this.$xdLog.setProject('Location.wx.jwxSDK.not.support', {
177
- lng: null,
178
- lat: null
179
- });
180
- this.handleBaiduInit(null);
181
- return
182
- }
183
-
184
- let time = null;
185
- let isReturn = false;
186
-
187
- //手机端微信环境
188
- jwxSDK.getLocation({
189
- type: 'gcj02',
190
- success: (res) => {
191
- let location = this.gcj02tobd09(res.longitude, res.latitude);
192
- this.location = {
193
- latitude: location['latitude'],
194
- longitude: location['longitude'],
195
- address: {}
196
- };
197
- let temp = JSON.parse(JSON.stringify(this.location))
198
- this.$xdLog.setProject('Location.wx.api.done', {
199
- lng: location.longitude,
200
- lat: location.latitude
201
- });
202
- setTimeout(()=>{
203
- this.handleBaiduInit(temp);
204
- if(time){
205
- clearTimeout(time);
206
- time=null
207
- }
208
- }, 10)
209
- },
210
- fail: (e) => {
211
- //已超时返回
212
- if(isReturn) {
213
- time = null;
214
- return;
215
- }
216
-
217
- //比超时返回快
218
- if(time) {
219
- clearTimeout(time);
220
- time=null;
221
- }
222
-
223
- this.$xdLog.setProject('Location.wx.api.fail', {
224
- lng: null,
225
- lat: null,
226
- error:e
227
- });
228
- this.handleBaiduInit(null)
229
- },
230
- cancel: (e) => {
231
- if(time){
232
- clearTimeout(time);
233
- time=null
234
- }
235
- this.$xdLog.setProject('Location.wx.api.cancel', {
236
- lng: null,
237
- lat: null
238
- });
239
- storage.set(this.rejectSave, true);
240
- this.handleBaiduInit(null)
241
- }
242
- });
243
-
244
- //超时处理
245
- time = setTimeout(()=>{
246
- this.$xdLog.setProject('Location.wx.api.fail.timeout', {
247
- lng: null,
248
- lat: null,
249
- error:'fail.timeout'
250
- });
251
- this.handleBaiduInit(null);
252
- isReturn = true;
253
- }, 4000)
254
- })
255
- .catch(res => {
256
- this.$xdLog.setProject('Location.wx.jwxSDK.fail', {
257
- lng: null,
258
- lat: null
259
- });
260
- this.handleBaiduInit(null)
261
- });
262
- },
263
-
264
- /**
265
- * @description 主要针对百度定位超时进行返回操作
266
- */
267
- setTimeoutLocation(){
268
- if (this.getLocationData() === null) {
269
- this.timeStatus = setTimeout(() => {
270
- this.$emit('done', null);
271
- this.failStatus = true;
272
- this.$xdLog.setProject('Location.timeout.baidu', 'Location.timeout.10s');
273
- }, 4000)
274
- }
275
83
  },
276
84
 
277
- init(){
278
- if(this.getLocationData() !== null){
279
- this.$xdLog.setProject('Location.cache', this.getLocationData());
280
- this.$emit('done', this.getLocationData());
281
- if(!this.showSwitchCity) return;
282
- }
283
-
284
- //#ifdef H5
285
- //微信公众号定位
286
- if(this.isWx) {
287
- if(this.getLocationData() === null){
288
- this.wxLocation()
289
- }
290
- return;
291
- }
292
-
293
- //百度定位
294
- if(this.isWx === false) {
295
- // 没有定位信息并且超时5秒
296
- this.setTimeoutLocation();
297
- }
298
- // #endif
299
- },
300
-
301
- handleDone(){
302
- this.setLocationInfo(this.location);
303
-
304
- //超过5秒就不走这里的逻辑
305
- if(this.failStatus === false) {
306
- this.$xdLog.setProject('Location.done', this.location);
307
- this.$emit('done', this.location);
308
- clearTimeout(this.timeStatus);
309
- }
85
+ isPop:{
86
+ type: Boolean,
87
+ default: false
310
88
  },
311
89
 
312
- handleBaiduInit(location){
313
- if(location === null) this.location = null;
314
- else{
315
- this.location = {
316
- latitude: location['latitude'],
317
- longitude: location['longitude'],
318
- address: location['address']
319
- };
320
- storage.set(this.permanentSave, this.location);
321
- }
322
- this.handleDone();
90
+ isSelect:{
91
+ type: Boolean,
92
+ default: false
323
93
  },
324
- }
94
+ },
325
95
  }
326
96
  </script>
327
97
 
328
98
  <style scoped>
329
-
99
+ .xd-baidu__content {
100
+ position: fixed;
101
+ top:-99999px;
102
+ left: -99999px;
103
+ overflow: hidden;
104
+ width: 100vw;
105
+ height: 100vh;
106
+ }
330
107
  </style>
@@ -11,18 +11,16 @@
11
11
  </slot>
12
12
  </view>
13
13
  <view>
14
- <xd-city-location @done="handleDone"></xd-city-location>
14
+ <xd-city-location @cityAndLocation="handleDone" is-pop></xd-city-location>
15
15
  </view>
16
16
  </view>
17
17
 
18
18
  </template>
19
19
 
20
20
  <script>
21
- import storage from "@/common/storage";
22
21
  import XdCityLocation from "@/components/XdCityLocation/XdCityLocation";
23
22
  import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
24
23
  import { mapState, mapMutations } from "vuex"
25
- import {baseEnvTypeReg} from '@/utils/xd.base';
26
24
 
27
25
  /**
28
26
  * XdCityShow
@@ -60,11 +58,7 @@
60
58
 
61
59
  data(){
62
60
  return {
63
- cityInfo: {},
64
- currentLocationCity: 'jfb_current_ajax_location_city',
65
- useSelectCity: 'xd_user_current_access_city',
66
- userUsePopStatus: 'jfb_show_switch_city',
67
- userUsePopStatusTime: 1,
61
+ cityInfo: null,
68
62
  }
69
63
  },
70
64
 
@@ -74,76 +68,17 @@
74
68
  }),
75
69
  getCityName(){
76
70
  if (this.$configProject.isPreview) return this.$xdUniHelper.cutStringLen(this.$settings.defaultCity.city_name, 6);
77
- if(!this.stateCity.city_name) return '定位失败';
78
- return this.$xdUniHelper.cutStringLen(this.stateCity.city_name, 6)
79
- }
80
- },
81
-
82
-
83
- created(){
84
- if ((this.$configProject && this.$configProject.isPreview)
85
- || (this.$configProject.platform === 'h5' && baseEnvTypeReg.test(window.location.host))
86
- ) {
87
- this.userUsePopStatusTime = 0.01;
71
+ if(this.stateCity) {
72
+ return this.$xdUniHelper.cutStringLen(this.stateCity.city_name, 6)
73
+ }
74
+ else return '定位中...'
88
75
  }
89
- this.cityInfo = storage.get(this.useSelectCity) || {};
90
76
  },
91
77
 
92
78
  methods:{
93
- ...mapMutations(['setCityInfo']),
94
-
95
- handleDone(location) {
96
- let currentCode = null;
97
- let current = {};
98
- let useCode = null;
99
- let switchStatus = storage.get(this.userUsePopStatus);
100
-
101
- //接口有返回值
102
- if (storage.get(this.currentLocationCity)){
103
- current = storage.get(this.currentLocationCity);
104
- currentCode = current.city_code;
105
- }
106
-
107
- //当前选中的城市为默认城市直接替换
108
- if(storage.get(this.useSelectCity) && storage.get(this.useSelectCity).isDefault) {
109
-
110
- //设置的是默认值
111
- if(this.$xdUniHelper.isEmpty(current)) {
112
- this.$emit("done", {city: storage.get(this.useSelectCity), location: this.location});
113
- return;
114
- }
115
- storage.remove(this.useSelectCity);
116
- this.setCityInfo(current);
117
- this.$emit("done", {city: current, location: this.location});
118
- return;
119
- }
120
-
121
- if (storage.get(this.useSelectCity)) useCode = storage.get(this.useSelectCity).city_code;
122
-
123
- //需要进行切换逻辑
124
- if(!switchStatus && (currentCode && useCode) && currentCode !== useCode) {
125
- uni.showModal({
126
- title: '提示',
127
- content: `定位显示您在:${current['province_name']}-${current['city_name']}`,
128
- confirmText: '切换到',
129
- success: (res) => {
130
- if (res.confirm) {
131
- this.cityInfo = current;
132
- storage.remove(this.useSelectCity);
133
- this.setCityInfo(this.cityInfo);
134
- this.$emit("done", {city: this.cityInfo, location});
135
- } else if (res.cancel) {
136
- storage.set(this.userUsePopStatus, 1, this.userUsePopStatusTime);
137
- this.cityInfo = storage.get(this.useSelectCity);
138
- this.$emit("done", {city: this.cityInfo, location});
139
- }
140
- }
141
- });
142
- return
143
- }
144
-
145
- //直接返回
146
- this.$emit("done", {city: current, location: this.location});
79
+ handleDone({location , city}) {
80
+ this.cityInfo = city;
81
+ this.$emit("done", {city, location});
147
82
  },
148
83
 
149
84
  /**
@@ -81,8 +81,19 @@
81
81
  },
82
82
  computed: {
83
83
  ...mapState([
84
- 'xdInputConfirm'
85
- ])
84
+ 'xdInputConfirm',
85
+ 'styleCommon',
86
+ ]),
87
+ ...mapState({
88
+ currentStyle:(state)=>{
89
+ let style = {};
90
+ Object.keys(state.currentStyle).map(key=>{
91
+ style[`$${key}`] = state.currentStyle[key];
92
+ });
93
+ return style
94
+ }
95
+ })
96
+
86
97
  },
87
98
  data() {
88
99
  return {
@@ -159,7 +170,10 @@
159
170
  this.show = false;
160
171
  this.confirm = {}
161
172
  } else {
162
- this.$currentStyle = (value.$vm && value.$vm.styles) || {};
173
+ this.$currentStyle = value.styles
174
+ || (this.styleCommon && this.styleCommon.styles)
175
+ || this.currentStyle ||
176
+ (value.$vm && value.$vm.styles) || {};
163
177
  this.confirm = Object.assign({},
164
178
  this.$xdUniHelper.cloneDeep(this.defaultConfirm),
165
179
  value,
@@ -122,10 +122,7 @@
122
122
  <xd-tips v-if="getLayoutInfo" :get-layout-info="getLayoutInfo"></xd-tips>
123
123
  <view class="xd-Layout__padding" id="xd-Layout__padding"></view>
124
124
  <view class="xd-Layout__padding-placeholder" :style="{backgroundColor: background}"></view>
125
- <xd-city-location
126
- v-if="open"
127
- @done="handleLocationDone"
128
- ></xd-city-location>
125
+ <xd-city-location v-if="open"></xd-city-location>
129
126
  </view>
130
127
  </template>
131
128
 
@@ -137,9 +134,9 @@
137
134
  import XdLoading from "@/components/XdLoading/XdLoading";
138
135
  import XdTips from "@/components/XdTips/XdTips";
139
136
  import XdCityLocation from "@/components/XdCityLocation/XdCityLocation";
140
- import locationMixins from "@/mixins/locationMixins";
141
137
  import XdAppClass from "@/XdAppClass";
142
138
  import {mapState} from 'vuex';
139
+ import supportLocation from "@/common/supportLocation";
143
140
 
144
141
 
145
142
  /**
@@ -177,7 +174,7 @@
177
174
  XdBar,
178
175
  XdCityLocation
179
176
  },
180
- mixins: [locationMixins],
177
+ mixins: [],
181
178
  props: {
182
179
  scrollDetail:{
183
180
  type: Number,
@@ -264,7 +261,13 @@
264
261
  default: false, //false=自定义 true=系统导航
265
262
  },
266
263
 
267
-
264
+ //当前页面支持的组件
265
+ componentAttr:{
266
+ type: Object,
267
+ default(){
268
+ return {}
269
+ },
270
+ }
268
271
  },
269
272
  data() {
270
273
  return {
@@ -504,11 +507,6 @@
504
507
  }
505
508
  this.doneLayoutAndLocation()
506
509
  },
507
-
508
- //定位完成
509
- locationStatus(value){
510
- this.doneLayoutAndLocation()
511
- }
512
510
  },
513
511
 
514
512
  created() {
@@ -535,17 +533,29 @@
535
533
  })
536
534
  // #endif
537
535
 
538
-
539
536
  //定位设置
540
537
  if (this.$configProject.isPreview === false
541
538
  && this.$configProject.extras
542
539
  && this.$configProject.extras.is_open_location === 'Y'
543
540
  && !this.checkPathIsLoginAndOrCard()
544
541
  ) {
545
- this.open = true;
546
- this.locationStatus = false;
542
+ let com = Object.keys(this.componentAttr).filter(key=>{
543
+ const name = key.split('-')[0];
544
+ return supportLocation.includes(name)
545
+ });
546
+
547
+ //页面内部组有支持定位组件时候(组件内部进行定位)
548
+ if(com.length > 0){
549
+ this.open = false;
550
+ console.warn(`has.support.location.component:${JSON.stringify(com)}`)
551
+ }
552
+
553
+ //页面内部无支持定位组件时候(在框架组进行定位)
554
+ else {
555
+ console.warn(`no.support.location.component:${JSON.stringify(com)}`)
556
+ this.open = true;
557
+ }
547
558
  }
548
- else this.locationStatus = true;
549
559
 
550
560
  //切换页面之后数据清空
551
561
  this.uiErrorLogs = this.errorLogs;
@@ -621,7 +631,8 @@
621
631
  },
622
632
 
623
633
  doneLayoutAndLocation(){
624
- if (this.locationStatus && this.layoutLoading) {
634
+ if (this.layoutLoading) {
635
+ console.log(this.$settings.defaultCity);
625
636
  this.$emit('onDone', this.getLayoutInfo);
626
637
  this.$emit('done', this.getLayoutInfo);
627
638
  this.$xdLog.setProject('Layout.done', {...this.getLayoutInfo, time: new Date().getTime() - this.startTime})