jufubao-base 1.0.28-beta21 → 1.0.28-beta22

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": "jufubao-base",
3
- "version": "1.0.28-beta21",
3
+ "version": "1.0.28-beta22",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -50,7 +50,7 @@
50
50
  "core-js": "^2.6.5",
51
51
  "flyio": "^0.6.2",
52
52
  "gxd-commands-bussiness": "^1.0.12",
53
- "gxd-uni-library-editx": "1.0.8-beta12",
53
+ "gxd-uni-library-editx": "1.0.8-beta14",
54
54
  "jweixin-module": "^1.6.0",
55
55
  "md5": "^2.3.0",
56
56
  "path-to-regexp": "^6.2.1",
@@ -14,27 +14,36 @@
14
14
  </view>
15
15
  <!-- #endif -->
16
16
  <view class="jfb-base-city__body">
17
- <view>测试插件( {{containerId}} )</view>
17
+ <xd-city
18
+ :top="top"
19
+ city-location-type="baidu"
20
+ @getWeixinAppInfo="handleGetWeixinAppInfo"
21
+ @getCityList="handleGetCityList"
22
+ @getCityName="handleGetCityName"
23
+ ></xd-city>
18
24
  </view>
19
25
  </view>
20
26
  </template>
21
27
 
22
28
  <script>
23
29
  import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
30
+ import XdCity from "@/components/XdCity/XdCity";
31
+ import cityData from "./cityData.js";
24
32
  import { jfbRootExec } from "@/utils/xd.event";
25
33
  import JfbBaseCityMixin from "./JfbBaseCityMixin";
26
34
  import { getContainerPropsValue } from "@/utils/xd.base";
27
35
  export default {
28
36
  name: "JfbBaseCity",
29
37
  components: {
30
- XdFontIcon
38
+ XdFontIcon,
39
+ XdCity
31
40
  },
32
41
  mixins: [
33
42
  JfbBaseCityMixin
34
43
  ],
35
44
  data() {
36
45
  return {
37
-
46
+ top: null,
38
47
  //todo
39
48
  }
40
49
  },
@@ -66,10 +75,78 @@
66
75
  * @param container {object} 业务组件对象自己
67
76
  */
68
77
  init(container) {
78
+ //this.height = getContainerPropsValue(container, 'content.height', 10);
79
+ },
80
+ handleGetCityName(e){
69
81
 
70
- //this.bgcolor = getContainerPropsValue(container, 'content.bgcolor', '#fff');
82
+ },
83
+ /**
84
+ * @description 微信SDK获取appInfo 完成之后可以直接使用getApp().globalData.weixinSDK调用相关接口
85
+ * @param resolve
86
+ */
87
+ handleGetWeixinAppInfo(resolve){
88
+ setTimeout(()=>{
89
+ resolve({
90
+ appId: "wxb208eaa219459f14",
91
+ nonceStr: "61558dffb381f",
92
+ signature: "c9255180cbdfb8b493a9260223f191922724251c",
93
+ timestamp: 1632996863,
94
+ }, ['chooseWXPay', 'openLocation', 'getLocation']);
95
+ }, 2000);
71
96
 
72
- //this.height = getContainerPropsValue(container, 'content.height', 10);
97
+ },
98
+ /**
99
+ * @description 获取城市列表接口
100
+ * @param location
101
+ * @param resolve
102
+ */
103
+ handleGetCityList({location}, resolve){
104
+ console.log('handleGetCityList', location, cityData.result);
105
+ resolve(this.toCityFormat(cityData.result));
106
+ console.log(getApp().globalData.weixinSDK)
107
+ },
108
+ /**
109
+ * @description 数据格式转换
110
+ */
111
+ toCityFormat(cityInfo){
112
+ let classifyList = [];
113
+ cityInfo.letters.map((item)=>{
114
+ classifyList.push({idx: item});
115
+ });
116
+
117
+ let hotData = [];
118
+ Object.keys(cityInfo.hot_city_data).map((key)=>{
119
+ hotData.push({
120
+ "city_name": cityInfo.hot_city_data[key],
121
+ "city_id": Number(key),
122
+ },)
123
+ });
124
+
125
+ let list = [];
126
+ Object.keys(cityInfo.city_data).map((key)=>{
127
+ let item = {idx: key, cities: []};
128
+ cityInfo.city_data[key].map(itm=>{
129
+ let city_id = itm[0]['value'];
130
+ let city_name = itm[1]['value'];
131
+ let province_name = itm[2]['value'];
132
+ item.cities.push({
133
+ city_id,
134
+ city_name,
135
+ province_name,
136
+ city_pinyin: '',
137
+ py: '',
138
+ letter: key,
139
+ })
140
+ });
141
+ list.push(item);
142
+ });
143
+
144
+ console.log(classifyList, hotData, list)
145
+ return {
146
+ city_nav: list,
147
+ classify_nav: classifyList,
148
+ hot_city: hotData
149
+ }
73
150
  },
74
151
  onJfbScroll(options) {
75
152
  console.log('event.onJfbScroll', options)