gxd-uni-library-editx 1.0.0
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/.editorconfig +14 -0
- package/README.md +447 -0
- package/index.js +3 -0
- package/package.json +104 -0
- package/postcss.config.js +22 -0
- package/settings.js.tpl +68 -0
- package/src/XdAppClass.1.0.js +257 -0
- package/src/XdAppClass.js +150 -0
- package/src/components/XdAddress/XdAddress.vue +579 -0
- package/src/components/XdAddressSelect/XdAddressSelect.vue +243 -0
- package/src/components/XdBaiduMap/XdBaiduMap.vue +204 -0
- package/src/components/XdBaiduOverlay/XdBaiduOverlay.vue +345 -0
- package/src/components/XdBaiduSearch/XdBaiduSearch.vue +354 -0
- package/src/components/XdBar/XdBar.vue +339 -0
- package/src/components/XdButton/XdButton.vue +288 -0
- package/src/components/XdCartList/XdCartList.vue +791 -0
- package/src/components/XdCartNoStoreList/XdCartNoStoreList.vue +747 -0
- package/src/components/XdCity/XdCity.vue +620 -0
- package/src/components/XdCity/city.js +93 -0
- package/src/components/XdCity/testData.js +124 -0
- package/src/components/XdCityLocation/XdCityLocation.vue +314 -0
- package/src/components/XdCityLocation/jweixin.js +72 -0
- package/src/components/XdCityShow/XdCityShow.vue +354 -0
- package/src/components/XdClipImage/XdClipImage.vue +879 -0
- package/src/components/XdCoins/XdCoins.vue +66 -0
- package/src/components/XdConfirm/XdConfirm.vue +240 -0
- package/src/components/XdContentXss/XdContentXss.vue +71 -0
- package/src/components/XdDailog/XdDailog.vue +258 -0
- package/src/components/XdDate/XdDataItemOne.vue +236 -0
- package/src/components/XdDate/XdDate.vue +1081 -0
- package/src/components/XdDate/XdDateItem.vue +316 -0
- package/src/components/XdDate/XdDateTime.vue +929 -0
- package/src/components/XdDate/i18n/en.json +19 -0
- package/src/components/XdDate/i18n/index.js +8 -0
- package/src/components/XdDate/i18n/zh-Hans.json +19 -0
- package/src/components/XdDate/i18n/zh-Hant.json +19 -0
- package/src/components/XdDate/keypress.js +45 -0
- package/src/components/XdDate/util.js +418 -0
- package/src/components/XdDownDrawer/XdDownDrawer.vue +176 -0
- package/src/components/XdEditPwd/XdEditPwd.vue +305 -0
- package/src/components/XdEnterOrderList/XdEnterOrderList.vue +413 -0
- package/src/components/XdExpressTimeLine/XdExpressTimeLine.vue +280 -0
- package/src/components/XdFilter/XdFilter.vue +541 -0
- package/src/components/XdFontIcon/XdFontIcon.vue +165 -0
- package/src/components/XdFontIcon/css/icon.less +498 -0
- package/src/components/XdFooterBar/XdFooterBar.vue +291 -0
- package/src/components/XdFooterTabbar/XdFooterTabbar.vue +284 -0
- package/src/components/XdForm/XdForm.vue +481 -0
- package/src/components/XdForm/validate.js +486 -0
- package/src/components/XdFormCheckbox/XdFormCheckbox.vue +858 -0
- package/src/components/XdFormDate.vue +187 -0
- package/src/components/XdFormInput/XdFormInput.vue +535 -0
- package/src/components/XdFormInput/common.js +56 -0
- package/src/components/XdFormItem/XdFormItem.vue +583 -0
- package/src/components/XdFormSelect/XdFormSelect.vue +119 -0
- package/src/components/XdImage/XdImage.vue +113 -0
- package/src/components/XdItemCardUser/XdItemCardUser.vue +232 -0
- package/src/components/XdItemFilmImage/XdItemFilmImage.vue +146 -0
- package/src/components/XdItemFilmText/XdItemFilmText.vue +83 -0
- package/src/components/XdItemPhysical/XdItemPhysical.vue +410 -0
- package/src/components/XdItemPhysicalPack/XdItemPhysicalPack.vue +240 -0
- package/src/components/XdItemStore/XdItemStore.vue +236 -0
- package/src/components/XdItemUserInfo/XdItemUserInfo.vue +175 -0
- package/src/components/XdJson/XdJson.vue +398 -0
- package/src/components/XdKeyValue/XdKeyValue.vue +150 -0
- package/src/components/XdLabelNew/XdLabelNew.vue +193 -0
- package/src/components/XdLayout/XdLayout.vue +634 -0
- package/src/components/XdLoading/XdLoading.vue +165 -0
- package/src/components/XdMore/XdMore.vue +66 -0
- package/src/components/XdMpHtml/XdMpHtml.vue +458 -0
- package/src/components/XdMpHtml/node/node.vue +536 -0
- package/src/components/XdMpHtml/parser.js +1260 -0
- package/src/components/XdMpHtml/static/js/handler.js +1 -0
- package/src/components/XdMpHtml/static/js/uni.webview.min.js +1 -0
- package/src/components/XdMpHtml/static/local.html +1 -0
- package/src/components/XdMy/XdMy.vue +294 -0
- package/src/components/XdMySuccess/XdMySuccess.vue +603 -0
- package/src/components/XdNavTab/XdNavTab.vue +147 -0
- package/src/components/XdNoData/XdNoData.vue +87 -0
- package/src/components/XdNoticeBar/XdNoticeBar.vue +501 -0
- package/src/components/XdNumber/XdNumber.vue +210 -0
- package/src/components/XdNumberUni/XdNumberUni.vue +270 -0
- package/src/components/XdNumberUni/readme.md +42 -0
- package/src/components/XdOnlineConfirm/XdOnlineConfirm.vue +385 -0
- package/src/components/XdOnlineDetail/XdOnlineDetail.vue +332 -0
- package/src/components/XdOnlinePay/XdOnlinePay.vue +349 -0
- package/src/components/XdOnlineSchedule/XdOnlineSchedule.vue +453 -0
- package/src/components/XdOnlineSeat/XdOnlineSeat.vue +796 -0
- package/src/components/XdOnlineSeatMove/XdOnlineSeatMove.vue +1012 -0
- package/src/components/XdPayCombo/XdPayCombo.vue +118 -0
- package/src/components/XdPreviewImage/XdPreviewImage.vue +372 -0
- package/src/components/XdPwPay/XdPwPay.vue +214 -0
- package/src/components/XdRadio/XdRadio.vue +151 -0
- package/src/components/XdRangeSlider/XdRangeSlider.vue +355 -0
- package/src/components/XdRedName/XdRedName.vue +35 -0
- package/src/components/XdSearchBar/XdSearchBar.vue +286 -0
- package/src/components/XdSelect/XdSelect.vue +382 -0
- package/src/components/XdSelectCity/XdSelectCity.vue +270 -0
- package/src/components/XdSelectTime/XdSelectTime.vue +342 -0
- package/src/components/XdStar/XdStar.vue +261 -0
- package/src/components/XdStoreCashier/XdStoreCashier.vue +526 -0
- package/src/components/XdStoreItem/XdStoreItem.vue +400 -0
- package/src/components/XdStoreOrderDetail/XdStoreOrderDetail.vue +1571 -0
- package/src/components/XdStoreOrderList/XdStoreOrderList.vue +450 -0
- package/src/components/XdStoreProductInfo/XdStoreProductInfo.vue +940 -0
- package/src/components/XdStoreProductType/XdStoreProductType.vue +307 -0
- package/src/components/XdSuccess/XdSuccess.vue +527 -0
- package/src/components/XdSwipeSelect/XdSwipeSelect.vue +99 -0
- package/src/components/XdSwiper/XdSwiper.vue +124 -0
- package/src/components/XdSwitch/XdSwitch.vue +204 -0
- package/src/components/XdTab/XdTab.vue +220 -0
- package/src/components/XdTabScroll/XdTabScroll.vue +212 -0
- package/src/components/XdTag/XdTag.vue +423 -0
- package/src/components/XdTimeLine/XdTimeLine.vue +121 -0
- package/src/components/XdTips/XdTips.vue +212 -0
- package/src/components/XdTipsBlock/XdTipsBlock.vue +141 -0
- package/src/components/XdTitleSection/XdTitleSection.vue +152 -0
- package/src/components/XdTitleTab/XdTitleTab.vue +227 -0
- package/src/components/XdUnit/XdUnit.vue +206 -0
- package/src/components/XdUpload/XdUpload.vue +197 -0
- package/src/components/XdUploadImage/XdUploadImage.vue +145 -0
- package/src/components/Xdlogs/XdLogs.vue +144 -0
- package/src/components/autoload.js +211 -0
- package/src/components/swipeAction/UniSwipeAction.vue +43 -0
- package/src/components/swipeActionItem/UniSwipeActionItem.vue +386 -0
- package/src/components/swipeActionItem/bindingx.js +298 -0
- package/src/components/swipeActionItem/index.wxs +321 -0
- package/src/components/swipeActionItem/isPC.js +18 -0
- package/src/components/swipeActionItem/mpalipay.js +210 -0
- package/src/components/swipeActionItem/mpother.js +252 -0
- package/src/components/swipeActionItem/mpwxs.js +140 -0
- package/src/dome/dome/address.vue +415 -0
- package/src/dome/dome/auth/login.vue +166 -0
- package/src/dome/dome/baidu_show.vue +20 -0
- package/src/dome/dome/cake.vue +186 -0
- package/src/dome/dome/cart.vue +205 -0
- package/src/dome/dome/cart_store.vue +149 -0
- package/src/dome/dome/cashier/cashier.vue +73 -0
- package/src/dome/dome/cashier/check_cashier.vue +469 -0
- package/src/dome/dome/cashier/success.vue +127 -0
- package/src/dome/dome/city.vue +148 -0
- package/src/dome/dome/cityData.js +9 -0
- package/src/dome/dome/clip.vue +82 -0
- package/src/dome/dome/date/date.vue +273 -0
- package/src/dome/dome/date/selected.js +315 -0
- package/src/dome/dome/dcom/app1.vue +13 -0
- package/src/dome/dome/dcom/app2.vue +13 -0
- package/src/dome/dome/dcom/app3.vue +13 -0
- package/src/dome/dome/dcom/app4.vue +13 -0
- package/src/dome/dome/dcom/app5.vue +13 -0
- package/src/dome/dome/dcom/index.vue +1 -0
- package/src/dome/dome/debug/debug.vue +95 -0
- package/src/dome/dome/docache/docache.vue +88 -0
- package/src/dome/dome/express.vue +269 -0
- package/src/dome/dome/form.vue +312 -0
- package/src/dome/dome/icon.js +125 -0
- package/src/dome/dome/icon.vue +93 -0
- package/src/dome/dome/index.vue +725 -0
- package/src/dome/dome/item.vue +236 -0
- package/src/dome/dome/json/json.vue +88 -0
- package/src/dome/dome/layout.vue +105 -0
- package/src/dome/dome/line.vue +113 -0
- package/src/dome/dome/map/search.vue +70 -0
- package/src/dome/dome/my.vue +171 -0
- package/src/dome/dome/notice.vue +93 -0
- package/src/dome/dome/online/confirm.vue +92 -0
- package/src/dome/dome/online/detail.vue +80 -0
- package/src/dome/dome/online/pay.vue +78 -0
- package/src/dome/dome/online/schedule.vue +73 -0
- package/src/dome/dome/online/seat.vue +98 -0
- package/src/dome/dome/order/detail.vue +166 -0
- package/src/dome/dome/order/enter_order.vue +294 -0
- package/src/dome/dome/order/list.vue +219 -0
- package/src/dome/dome/order/order.js +18 -0
- package/src/dome/dome/order/success.vue +68 -0
- package/src/dome/dome/product.vue +179 -0
- package/src/dome/dome/store_cashier.vue +67 -0
- package/src/dome/dome/swiper.vue +32 -0
- package/src/dome/dome/webview.vue +61 -0
- package/src/install.js +183 -0
- package/src/main/address/address.vue +251 -0
- package/src/main/cart/cart.vue +149 -0
- package/src/main/cashier/cashier.vue +72 -0
- package/src/main/cashier/check_cashier.vue +483 -0
- package/src/main/city/city.vue +149 -0
- package/src/main/date/date.vue +260 -0
- package/src/main/order/order.js +19 -0
- package/src/main/order/order.vue +222 -0
- package/src/main/product/detail.vue +121 -0
- package/src/main/product/type.vue +108 -0
- package/src/main/search/search.vue +501 -0
- package/src/pages.json +337 -0
- package/src/plugins/CreatedComponentsPlugin.js +19 -0
- package/src/plugins/JsonRename.js +72 -0
- package/src/plugins/SetAppParams.js +171 -0
- package/src/project.js +18 -0
- package/src/utils/Cookie.js +68 -0
- package/src/utils/Runtime.js +105 -0
- package/src/utils/Storage.js +104 -0
- package/src/utils/XdNetwork.js +133 -0
- package/src/utils/helper.js +1321 -0
- package/src/utils/nourl.js +95 -0
- package/src/utils/project.js +17 -0
- package/src/utils/xd.auth.js +61 -0
- package/src/utils/xd.base.js +474 -0
- package/src/utils/xd.common.js +240 -0
- package/src/utils/xd.event.js +99 -0
- package/src/utils/xd.frame.js +96 -0
- package/src/utils/xd.path.js +96 -0
- package/src/utils/xdAppLog.js +170 -0
- package/src/utils/xdWxLog.js +302 -0
- package/src/utils/xdh5log.js +307 -0
- package/src/websetting.js +64 -0
- package/tsconfig.json +9 -0
- package/xd.less +180 -0
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="xd-city-box">
|
|
3
|
+
<view class="xd-city" v-if="allCityList.length > 0">
|
|
4
|
+
<view class="xd-city__header"
|
|
5
|
+
:style="{
|
|
6
|
+
height: customBar + 'rpx',
|
|
7
|
+
top: top + 'px',
|
|
8
|
+
}"
|
|
9
|
+
>
|
|
10
|
+
<view>
|
|
11
|
+
<input
|
|
12
|
+
class="xd-city__header-input"
|
|
13
|
+
@confirm="doneInput"
|
|
14
|
+
type="text"
|
|
15
|
+
confirm-type="search"
|
|
16
|
+
:adjust-position="false"
|
|
17
|
+
@input="onInput"
|
|
18
|
+
placeholder="搜索城市"
|
|
19
|
+
v-model="searchValue"
|
|
20
|
+
/>
|
|
21
|
+
</view>
|
|
22
|
+
<view class="" @tap="backPrevPage()">返回</view>
|
|
23
|
+
</view>
|
|
24
|
+
<view class="xd-city__header-box" :style="{height: customBar + 'rpx'}"></view>
|
|
25
|
+
<view class="xd-city__content" v-if="scrollHeight !== null">
|
|
26
|
+
<!--滚动区域-->
|
|
27
|
+
<scroll-view
|
|
28
|
+
scroll-y="true"
|
|
29
|
+
:scroll-into-view="scrollIntoId"
|
|
30
|
+
:style="scrollHeight"
|
|
31
|
+
@touchmove.stop.prevent
|
|
32
|
+
>
|
|
33
|
+
<!--top-->
|
|
34
|
+
<view v-if="!searchValue" id="hot">
|
|
35
|
+
<view class="app-position">
|
|
36
|
+
<view class="app-position-title grey flexa fsmall">当前定位</view>
|
|
37
|
+
<view class="app-position_city">
|
|
38
|
+
<view
|
|
39
|
+
v-if="position"
|
|
40
|
+
class="app-position_city_one"
|
|
41
|
+
@tap="handleSelected(position)"
|
|
42
|
+
>{{position.city_name}}
|
|
43
|
+
</view>
|
|
44
|
+
</view>
|
|
45
|
+
</view>
|
|
46
|
+
<view class="app-position" v-if="cityCacheLocation.length > 0">
|
|
47
|
+
<view class="app-position-title grey flexa fsmall">最近访问</view>
|
|
48
|
+
<view class="app-position_city app-position_city_left">
|
|
49
|
+
<view
|
|
50
|
+
class="app-position_city_one"
|
|
51
|
+
v-for="(item,index) in cityCacheLocation"
|
|
52
|
+
:key="index"
|
|
53
|
+
@tap="handleSelected(item)">{{item.city_name}}
|
|
54
|
+
</view>
|
|
55
|
+
</view>
|
|
56
|
+
</view>
|
|
57
|
+
<view class="app-position" v-if="hotCityList.length > 0">
|
|
58
|
+
<view class="app-position-title grey flexa fsmall">热门城市</view>
|
|
59
|
+
<view class="app-position_city app-position_city_left">
|
|
60
|
+
<view
|
|
61
|
+
class="app-position_city_one"
|
|
62
|
+
v-for="(item,index) in hotCityList"
|
|
63
|
+
:key="index"
|
|
64
|
+
@tap="handleSelected(item)"
|
|
65
|
+
>{{item.city_name}}
|
|
66
|
+
</view>
|
|
67
|
+
</view>
|
|
68
|
+
</view>
|
|
69
|
+
</view>
|
|
70
|
+
<!--top-->
|
|
71
|
+
<!-- 城市列表 -->
|
|
72
|
+
<view
|
|
73
|
+
class="app-city"
|
|
74
|
+
v-if="searchValue === ''"
|
|
75
|
+
v-for="(item) in cityList"
|
|
76
|
+
:id="item.idx" :key="item.idx"
|
|
77
|
+
>
|
|
78
|
+
<view class="app-city-header bold">{{ item.idx }}</view>
|
|
79
|
+
<view class="app-city-item" v-for="(city, i) in item['cities']" :key="i" @tap="handleSelected(city)">
|
|
80
|
+
<text class="city">{{ city.city_name }}</text>
|
|
81
|
+
</view>
|
|
82
|
+
</view>
|
|
83
|
+
<!-- 搜索结果 -->
|
|
84
|
+
<view class="app-city-item" v-for="(item, index) in citySearchList" :key="index" @tap="handleSelected(item)">
|
|
85
|
+
<text class="city">{{ item.city_name }}</text>
|
|
86
|
+
</view>
|
|
87
|
+
<!-- 搜索结果 结束-->
|
|
88
|
+
<view class="placeholder footer"></view>
|
|
89
|
+
</scroll-view>
|
|
90
|
+
<!--滚动区域 结束-->
|
|
91
|
+
<!-- 右侧字母 -->
|
|
92
|
+
<view
|
|
93
|
+
class="letters"
|
|
94
|
+
id="app-letters-list"
|
|
95
|
+
v-if="searchValue == ''"
|
|
96
|
+
@touchstart="touchStart"
|
|
97
|
+
@touchmove.stop.prevent="touchMove"
|
|
98
|
+
@touchend="touchEnd"
|
|
99
|
+
>
|
|
100
|
+
<view class="fmin" v-for="item in cityLetter" :key="item.idx">{{ item.idx }}</view>
|
|
101
|
+
</view>
|
|
102
|
+
<!-- 右侧字母 结束 -->
|
|
103
|
+
<!-- 选中之后字母 -->
|
|
104
|
+
<view class="mask" v-if="touchmove">
|
|
105
|
+
<view class="mask-r bold">{{scrollIntoId}}</view>
|
|
106
|
+
</view>
|
|
107
|
+
<!-- 选中之后字母 结束-->
|
|
108
|
+
</view>
|
|
109
|
+
</view>
|
|
110
|
+
<!-- #ifdef H5 -->
|
|
111
|
+
<xd-city-location v-if="cityLocationType=== 'baidu'" @done="handleDone" baidu></xd-city-location>
|
|
112
|
+
<xd-city-location v-if="cityLocationType=== 'weixinSDK'" @done="handleDone" weixin @getWeixinAppInfo="handleGetWeixinAppInfo"></xd-city-location>
|
|
113
|
+
<!-- #endif -->
|
|
114
|
+
<!-- #ifdef MP-WEIXIN -->
|
|
115
|
+
<xd-city-location @done="handleDone"></xd-city-location>
|
|
116
|
+
<!-- #endif -->
|
|
117
|
+
</view>
|
|
118
|
+
</template>
|
|
119
|
+
|
|
120
|
+
<script>
|
|
121
|
+
import testData from "@/components/XdCity/testData";
|
|
122
|
+
import storage from "@/common/storage";
|
|
123
|
+
import helper from "@/utils/helper";
|
|
124
|
+
import XdCityLocation from "@/components/XdCityLocation/XdCityLocation";
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* XdCity
|
|
128
|
+
* @description 用户选中城市页面插件
|
|
129
|
+
* @property {Boolean} cityLocationType 使用定位类型 H5(baidu, weixinSDK),微信小程序不需要此参数
|
|
130
|
+
|
|
131
|
+
* @event {Function} getWeixinAppInfo 使用微信定位使用需要获取
|
|
132
|
+
* @event {Function} done 定位成功事件
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
export default {
|
|
136
|
+
name: 'XdCity',
|
|
137
|
+
components:{
|
|
138
|
+
XdCityLocation,
|
|
139
|
+
},
|
|
140
|
+
props:{
|
|
141
|
+
cityLocationType: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: 'baidu', //baidu, weixinSDK
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
callbackUrlKey: {
|
|
147
|
+
type: String,
|
|
148
|
+
default: 'xdCityRedirect',
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
top: {
|
|
152
|
+
type: Number,
|
|
153
|
+
default: 0 //px
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
},
|
|
157
|
+
data() {
|
|
158
|
+
return {
|
|
159
|
+
listInfo: null, //城市列表信息
|
|
160
|
+
allCityList: [], //城市一维数组列表
|
|
161
|
+
threeLocation: null, //第三方定位信息
|
|
162
|
+
|
|
163
|
+
hotCityList: [], //热门城市列表
|
|
164
|
+
cityList: null, //城市列表
|
|
165
|
+
cityLetter: [],//城市字母排序
|
|
166
|
+
|
|
167
|
+
customBar: 90, //搜索区域高度
|
|
168
|
+
scrollHeight: null, //内容区域高度
|
|
169
|
+
callbackUrl: null, //访问回调地址
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
//定位信息
|
|
174
|
+
position: {
|
|
175
|
+
city_name: '定位中..', city_id: -1
|
|
176
|
+
}, //定位获取的位置
|
|
177
|
+
|
|
178
|
+
//测试定位城市
|
|
179
|
+
testLocationItem: {
|
|
180
|
+
"city_id": "110100",
|
|
181
|
+
"city_name": "北京市",
|
|
182
|
+
"province_name": "北京市",
|
|
183
|
+
"city_pinyin": "",
|
|
184
|
+
"py": "",
|
|
185
|
+
"letter": "B"
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
tId: null,
|
|
189
|
+
showMask: false,
|
|
190
|
+
winHeight: 0,
|
|
191
|
+
itemHeight: 0,
|
|
192
|
+
winOffsetY: 0,
|
|
193
|
+
touchmove: false,
|
|
194
|
+
|
|
195
|
+
//搜索
|
|
196
|
+
searchValue: '', //搜索关键词
|
|
197
|
+
citySearchList: [], //搜索接口列表显示
|
|
198
|
+
scrollIntoId: '', //字母滚动当前关键字母
|
|
199
|
+
|
|
200
|
+
//城市信息
|
|
201
|
+
cityLastMaxLen: 5, //保存最近访问记录最大数据
|
|
202
|
+
cityLastSaveKey: 'xd_user_last_access_cities',
|
|
203
|
+
cityCacheLocation: [], //最近访问列表记录
|
|
204
|
+
saveKey: 'xd_user_current_access_city', //用户选中城市存储key
|
|
205
|
+
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
mounted(){
|
|
210
|
+
this.$nextTick(()=>{
|
|
211
|
+
this.scrollHeight = `height:calc(100vh - ${this.customBar * this.$rpxNum}px);`
|
|
212
|
+
console.log('scrollHeight', this.scrollHeight)
|
|
213
|
+
if (helper.getParmater(this.callbackUrlKey)) {
|
|
214
|
+
this.callbackUrl = decodeURIComponent(helper.getParmater(this.callbackUrlKey));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
//获取历史记录
|
|
218
|
+
if (storage.get(this.cityLastSaveKey)) {
|
|
219
|
+
this.cityCacheLocation = storage.get(this.cityLastSaveKey);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
methods: {
|
|
224
|
+
handleDone(location){
|
|
225
|
+
console.log('location', location);
|
|
226
|
+
this.threeLocation = location;
|
|
227
|
+
this.init();
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
init(){
|
|
231
|
+
this.$emit('getCityList',{location: this.threeLocation},
|
|
232
|
+
/**
|
|
233
|
+
* @description 城市列表
|
|
234
|
+
* @param cityList
|
|
235
|
+
*/
|
|
236
|
+
(cityList)=>{
|
|
237
|
+
if(cityList === null) {
|
|
238
|
+
this.listInfo = this.$xdUniHelper.cloneDeep(testData.data)
|
|
239
|
+
}else{
|
|
240
|
+
this.listInfo = this.$xdUniHelper.cloneDeep(cityList)
|
|
241
|
+
}
|
|
242
|
+
this.toList();
|
|
243
|
+
}
|
|
244
|
+
)
|
|
245
|
+
},
|
|
246
|
+
|
|
247
|
+
toList(){
|
|
248
|
+
let allLlist = [];
|
|
249
|
+
this.listInfo.city_nav.map((item)=>{
|
|
250
|
+
item.cities.map((itm)=>{
|
|
251
|
+
allLlist.push(itm);
|
|
252
|
+
})
|
|
253
|
+
});
|
|
254
|
+
this.hotCityList = this.listInfo.hot_city;
|
|
255
|
+
this.allCityList = allLlist;
|
|
256
|
+
this.cityList = this.listInfo.city_nav;
|
|
257
|
+
this.cityLetter = this.listInfo.classify_nav;
|
|
258
|
+
|
|
259
|
+
console.log('toList', this.allCityList, this.hotCityList);
|
|
260
|
+
this.getLocationCityName();
|
|
261
|
+
this.setAppLettersList();
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* @description 检查当前定位城市信息是否在数据列表中
|
|
267
|
+
* @param cityName
|
|
268
|
+
* @param provinceName
|
|
269
|
+
* @returns {*}
|
|
270
|
+
*/
|
|
271
|
+
checkCity(provinceName , cityName) {
|
|
272
|
+
let temp = null;
|
|
273
|
+
this.allCityList.map((item)=>{
|
|
274
|
+
if (provinceName === item['province_name'] || provinceName.indexOf(item['province_name']) === 0) {
|
|
275
|
+
if (item['city_name'].indexOf(cityName) === 0
|
|
276
|
+
|| cityName.indexOf(item['city_name']) === 0
|
|
277
|
+
) {
|
|
278
|
+
temp = item;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
return temp;
|
|
283
|
+
},
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* @description 获取AppInfo信息
|
|
287
|
+
*/
|
|
288
|
+
handleGetWeixinAppInfo(resolve) {
|
|
289
|
+
this.$emit('getWeixinAppInfo',
|
|
290
|
+
(appInfo, jsApiList) => {
|
|
291
|
+
resolve(appInfo, jsApiList)
|
|
292
|
+
});
|
|
293
|
+
},
|
|
294
|
+
|
|
295
|
+
/***
|
|
296
|
+
* @description 获取第三方定位信息
|
|
297
|
+
*/
|
|
298
|
+
getLocationCityName(){
|
|
299
|
+
// #ifdef MP-WEIXIN
|
|
300
|
+
this.$emit('getCityName', {location: this.threeLocation}, (city) => {
|
|
301
|
+
|
|
302
|
+
});
|
|
303
|
+
// #endif
|
|
304
|
+
// #ifdef H5
|
|
305
|
+
let city = {city_name: '定位失败', city_id: -2};
|
|
306
|
+
if (this.threeLocation && this.threeLocation.address) {
|
|
307
|
+
if(this.threeLocation.address['province'] && this.threeLocation.address['city']) {
|
|
308
|
+
city = this.checkCity(this.threeLocation.address['province'], this.threeLocation.address['city']);
|
|
309
|
+
if (!city) city = {city_name: '定位失败', city_id: -2}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
this.position = city;
|
|
313
|
+
// #endif
|
|
314
|
+
},
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @description 返回上一页面操作
|
|
318
|
+
*/
|
|
319
|
+
backPrevPage(item){
|
|
320
|
+
this.doneInput();
|
|
321
|
+
setTimeout(()=>{
|
|
322
|
+
let routes = this.$xdUniHelper.getCurrentPages();
|
|
323
|
+
if (item) {
|
|
324
|
+
storage.set(this.saveKey, item, 24);
|
|
325
|
+
console.log('$xdRoot.selectCity', item);
|
|
326
|
+
this.$xdRoot.$emit('selectCity', item);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if (this.callbackUrl && routes['path'] !== this.callbackUrl) {
|
|
330
|
+
this.$xdUniHelper.redirectTo({
|
|
331
|
+
url: `${this.callbackUrl}`
|
|
332
|
+
})
|
|
333
|
+
} else {
|
|
334
|
+
this.$xdUniHelper.navigateBack();
|
|
335
|
+
}
|
|
336
|
+
}, 400)
|
|
337
|
+
|
|
338
|
+
},
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* @description 初始化字母样式显示
|
|
342
|
+
*/
|
|
343
|
+
setAppLettersList() {
|
|
344
|
+
this.$xdUniHelper.getEleInfo('#app-letters-list',this, (res)=>{
|
|
345
|
+
console.log('app-letters-list', res);
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
let handle = ()=>{
|
|
349
|
+
uni.createSelectorQuery()
|
|
350
|
+
.in(this)
|
|
351
|
+
.select('#app-letters-list')
|
|
352
|
+
.boundingClientRect()
|
|
353
|
+
.exec(ret => {
|
|
354
|
+
if(ret[0] === null) setTimeout(handle, 30);
|
|
355
|
+
else {
|
|
356
|
+
this.winOffsetY = ret[0].top;
|
|
357
|
+
this.winHeight = ret[0].height;
|
|
358
|
+
this.itemHeight = this.winHeight / this.cityList.length
|
|
359
|
+
}
|
|
360
|
+
})
|
|
361
|
+
};
|
|
362
|
+
handle();
|
|
363
|
+
},
|
|
364
|
+
|
|
365
|
+
touchStart(e) {
|
|
366
|
+
this.touchmove = true
|
|
367
|
+
let pageY = e.touches[0].pageY
|
|
368
|
+
let index = Math.floor((pageY - this.winOffsetY) / this.itemHeight)
|
|
369
|
+
if (this.cityList[index]) {
|
|
370
|
+
this.scrollIntoId = this.cityList[index].idx
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
touchMove(e) {
|
|
374
|
+
let pageY = e.touches[0].pageY
|
|
375
|
+
let index = Math.floor((pageY - this.winOffsetY) / this.itemHeight)
|
|
376
|
+
if (this.cityList[index] && this.cityList[index].idx === this.scrollIntoId) {
|
|
377
|
+
return false
|
|
378
|
+
}
|
|
379
|
+
if (this.cityList[index]) {
|
|
380
|
+
this.scrollIntoId = this.cityList[index].idx
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
touchEnd() {
|
|
384
|
+
this.touchmove = false
|
|
385
|
+
this.touchmoveIndex = -1
|
|
386
|
+
},
|
|
387
|
+
|
|
388
|
+
doneInput(){
|
|
389
|
+
uni.hideKeyboard()
|
|
390
|
+
},
|
|
391
|
+
|
|
392
|
+
/***
|
|
393
|
+
* @description 搜索城市
|
|
394
|
+
* @param keyword
|
|
395
|
+
* @returns {[]}
|
|
396
|
+
*/
|
|
397
|
+
searchQuery(keyword) {
|
|
398
|
+
let res = [];
|
|
399
|
+
keyword = keyword.toUpperCase();
|
|
400
|
+
|
|
401
|
+
this.allCityList.map((item)=>{
|
|
402
|
+
//匹配首字母
|
|
403
|
+
if(item.city_pinyin && item.city_pinyin.toUpperCase().indexOf(keyword) !== -1){
|
|
404
|
+
res.push(item);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
//匹配首字母
|
|
408
|
+
else if (item.py && item.py.toUpperCase().indexOf(keyword) !== -1) {
|
|
409
|
+
res.push(item);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
//匹配单字母
|
|
413
|
+
else if(item.letter.toUpperCase() === keyword) {
|
|
414
|
+
res.push(item);
|
|
415
|
+
|
|
416
|
+
//匹配城市
|
|
417
|
+
}else if(item['city_name'].indexOf(keyword) !== -1) {
|
|
418
|
+
res.push(item);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
});
|
|
423
|
+
return res
|
|
424
|
+
},
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* @description 输入事件
|
|
428
|
+
*/
|
|
429
|
+
onInput(e) {
|
|
430
|
+
this.searchValue = e.target.value.trim();
|
|
431
|
+
if (this.searchValue !== '' && !this.$xdUniHelper.isEmpty(this.allCityList)) {
|
|
432
|
+
this.citySearchList = this.searchQuery(String(this.searchValue));
|
|
433
|
+
} else {
|
|
434
|
+
this.citySearchList = [];
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
|
|
438
|
+
/***
|
|
439
|
+
* @description 选择城市操作
|
|
440
|
+
* @param item
|
|
441
|
+
*/
|
|
442
|
+
handleSelected(item) {
|
|
443
|
+
if(item.city_id === -1) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
//在最近访问记录中无数据
|
|
448
|
+
if(!this.$xdUniHelper.isKeyInLists(this.cityCacheLocation, item['city_id'], 'city_id')){
|
|
449
|
+
this.cityCacheLocation.unshift(item)
|
|
450
|
+
this.searchValue = "";
|
|
451
|
+
this.cityCacheLocation = this.cityCacheLocation.slice(0, this.cityLastMaxLen);
|
|
452
|
+
storage.set(this.cityLastSaveKey, this.cityCacheLocation);
|
|
453
|
+
}
|
|
454
|
+
this.backPrevPage(item);
|
|
455
|
+
},
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
</script>
|
|
459
|
+
|
|
460
|
+
<style scoped lang="less">
|
|
461
|
+
.xd-city {
|
|
462
|
+
&__header {
|
|
463
|
+
position: fixed;
|
|
464
|
+
background: #eee;
|
|
465
|
+
left: 0;
|
|
466
|
+
top: 0;
|
|
467
|
+
right: 0;
|
|
468
|
+
z-index: 50;
|
|
469
|
+
display: flex;
|
|
470
|
+
justify-content: space-between;
|
|
471
|
+
align-items: center;
|
|
472
|
+
padding: 0 unit(20,rpx);
|
|
473
|
+
|
|
474
|
+
& > view:last-child {
|
|
475
|
+
font-size: @xd-font-size-base;
|
|
476
|
+
flex-shrink: 0;
|
|
477
|
+
margin-left: unit(20,rpx);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
& > view:first-child {
|
|
481
|
+
flex: 1;
|
|
482
|
+
width: 0;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
&-input {
|
|
486
|
+
width: 100%;
|
|
487
|
+
font-size: @xd-font-size-base;
|
|
488
|
+
height: unit(70, rpx);
|
|
489
|
+
max-height: unit(60, rpx);
|
|
490
|
+
border-radius: unit(30, rpx);
|
|
491
|
+
background-color: @xd-bg-color;
|
|
492
|
+
padding-left: unit(20, rpx);
|
|
493
|
+
padding-right: unit(20, rpx);
|
|
494
|
+
box-sizing: border-box;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
&-box {
|
|
498
|
+
width: 100%;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
.fsmall {font-size: @xd-font-size-base;}
|
|
503
|
+
.fmiddle {font-size: @xd-font-size-base + 2rpx;}
|
|
504
|
+
.blue {color: #007AFF;}
|
|
505
|
+
.bold{font-weight: 600;}
|
|
506
|
+
.flex{display: flex;justify-content: center;align-items: center;}
|
|
507
|
+
.mask {position: fixed;z-index: 3;top: 40%;left: 40%;}
|
|
508
|
+
.mask-r {height: unit(120,rpx);width: unit(120, rpx);border-radius: unit(60, rpx);display: flex;background: rgba(0, 0, 0, 0.5);backdrop-filter: blur(5px);justify-content: center;align-items: center;font-size: unit(40, rpx);color: #FFFFFF}
|
|
509
|
+
.content {height: 100%;width: 100%;background-color: @xd-bg-white;}
|
|
510
|
+
.title {font-size: unit(30,rpx);color: white;}
|
|
511
|
+
.grey {margin-bottom: unit(25, rpx);}
|
|
512
|
+
|
|
513
|
+
.app-header {
|
|
514
|
+
width: 100%;
|
|
515
|
+
position: relative;
|
|
516
|
+
z-index: 8;
|
|
517
|
+
background-color: @xd-bg-white;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.app-cannel {
|
|
521
|
+
width: unit(100, rpx);
|
|
522
|
+
height: 100%;
|
|
523
|
+
display: flex;
|
|
524
|
+
justify-content: center;
|
|
525
|
+
align-items: center;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.app-input {
|
|
529
|
+
font-size: unit(26,rpx);
|
|
530
|
+
width: unit(610, rpx);
|
|
531
|
+
height: unit(60, rpx);
|
|
532
|
+
max-height: unit(60, rpx);
|
|
533
|
+
border-radius: unit(30, rpx);
|
|
534
|
+
background-color: @xd-bg-color;
|
|
535
|
+
padding-left: unit(20, rpx);
|
|
536
|
+
padding-right: unit(20, rpx);
|
|
537
|
+
box-sizing: border-box;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**top**/
|
|
541
|
+
.app-position {
|
|
542
|
+
padding: unit(20, rpx) unit(20, rpx) 0;
|
|
543
|
+
box-sizing: border-box;
|
|
544
|
+
|
|
545
|
+
&-title {
|
|
546
|
+
border-bottom: 1px solid #e0e0e0;
|
|
547
|
+
padding-bottom: unit(20, rpx);
|
|
548
|
+
font-weight: bold;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
&_city {
|
|
552
|
+
width: 100%;
|
|
553
|
+
box-sizing: border-box;
|
|
554
|
+
display: flex;
|
|
555
|
+
justify-content: space-between;
|
|
556
|
+
|
|
557
|
+
&_one {
|
|
558
|
+
height: unit(60,rpx);
|
|
559
|
+
color: #333;
|
|
560
|
+
background-color: #eee;
|
|
561
|
+
border-radius: unit(30, rpx);
|
|
562
|
+
font-size: unit(30, rpx);
|
|
563
|
+
padding: 0 unit(25, rpx);
|
|
564
|
+
display: flex;
|
|
565
|
+
justify-content: center;
|
|
566
|
+
align-items: center;
|
|
567
|
+
margin: 0 unit(20, rpx) unit(20, rpx) 0;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
&_left {
|
|
571
|
+
display: flex;
|
|
572
|
+
justify-content: flex-start;
|
|
573
|
+
flex-wrap: wrap;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/**城市列表**/
|
|
579
|
+
.app-city {
|
|
580
|
+
|
|
581
|
+
&-header {
|
|
582
|
+
font-size: @xd-font-size-lg;
|
|
583
|
+
padding-left: unit(30, rpx);
|
|
584
|
+
padding-top: unit(20, rpx);
|
|
585
|
+
box-sizing: border-box;
|
|
586
|
+
display: flex;
|
|
587
|
+
align-items: center;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
&-item {
|
|
591
|
+
width: unit(670, rpx);
|
|
592
|
+
margin:0 auto 0 unit(20, rpx);
|
|
593
|
+
padding: unit(20, rpx) 0;
|
|
594
|
+
border-bottom-width: unit(1, rpx);
|
|
595
|
+
border-bottom-color: #e0e0e0;
|
|
596
|
+
border-bottom-style: solid;
|
|
597
|
+
display: flex;
|
|
598
|
+
align-items: center;
|
|
599
|
+
|
|
600
|
+
.city {
|
|
601
|
+
font-size: unit(30,rpx);
|
|
602
|
+
color:#333;
|
|
603
|
+
padding-left: unit(10, rpx);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
.letters {
|
|
609
|
+
position: absolute;
|
|
610
|
+
right: 0;
|
|
611
|
+
width: unit(80, rpx);
|
|
612
|
+
color: @xd-text-color;
|
|
613
|
+
top: 15%;
|
|
614
|
+
text-align: center;
|
|
615
|
+
font-size: @xd-font-size-base;
|
|
616
|
+
font-weight: bold;
|
|
617
|
+
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
</style>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import storage from "@/common/storage";
|
|
4
|
+
import helper from "@/utils/helper";
|
|
5
|
+
const settings = require('./../../../settings');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @description 检查当前定位城市信息是否在后台返回列表中
|
|
9
|
+
* @param cityList
|
|
10
|
+
* @param cityName
|
|
11
|
+
* @param provinceName
|
|
12
|
+
* @returns {*}
|
|
13
|
+
*/
|
|
14
|
+
export function checkCity(cityList, cityName, provinceName) {
|
|
15
|
+
console.log('checkCity',cityName, provinceName, cityList)
|
|
16
|
+
let temp = null;
|
|
17
|
+
Object.keys(cityList).map((key)=>{
|
|
18
|
+
let item = cityList[key];
|
|
19
|
+
//省份相同或者第一个字开始匹配
|
|
20
|
+
if(provinceName === item['province_name'] || provinceName.indexOf(item['province_name']) === 0) {
|
|
21
|
+
console.log(item['province_name'])
|
|
22
|
+
if(item['city_name'].indexOf(cityName) === 0
|
|
23
|
+
|| cityName.indexOf(item['city_name']) === 0
|
|
24
|
+
){
|
|
25
|
+
temp = item;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return temp;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @description 获取用户定位信息
|
|
34
|
+
* @param cityList {Object} 数据格式:{"142":{"city_id":"142","city_name":"石家庄市","province_name":"河北","city_pinyin":"","py":"","letter":"S"}}
|
|
35
|
+
* @param locationInfo
|
|
36
|
+
* @param appCity
|
|
37
|
+
* @returns {string|*|string}
|
|
38
|
+
*/
|
|
39
|
+
export function getCurrentCity(cityList, locationInfo, appCity = null) {
|
|
40
|
+
//用户自己选择城市
|
|
41
|
+
let locationData = storage.get(settings.userCityCurrentSaveKey);
|
|
42
|
+
if (locationData) return locationData;
|
|
43
|
+
|
|
44
|
+
//定位城市
|
|
45
|
+
if (locationInfo && locationInfo['address']) {
|
|
46
|
+
let cityName = locationInfo['address']['city'];
|
|
47
|
+
let provinceName = locationInfo['address']['province'];
|
|
48
|
+
locationData = checkCity(cityList, cityName, provinceName);
|
|
49
|
+
return locationData;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//定位失败,App有城市信息,使用app所在城市信息
|
|
53
|
+
if (appCity !== null) {
|
|
54
|
+
return appCity;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//定位失败并且APP无城市信息(默认使用北京)
|
|
58
|
+
return settings.defaultCity;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @description 获取城市信息,无定位城市信息跳指定页面或者首页
|
|
64
|
+
* @param $vm
|
|
65
|
+
* @param path 需要跳转的路径
|
|
66
|
+
* @returns {Promise<unknown>}
|
|
67
|
+
*/
|
|
68
|
+
export function getLocationCityInfo($vm, path = null) {
|
|
69
|
+
return new Promise((resolve)=>{
|
|
70
|
+
let cityData = storage.get(settings.userCityCurrentSaveKey);
|
|
71
|
+
let location = storage.get('App_Geolocation_Current_City');
|
|
72
|
+
|
|
73
|
+
//无当前用户选择信息或者无城市定位信息,直接跳指定页面或者首页
|
|
74
|
+
if(!cityData || !location) {
|
|
75
|
+
helper.navigateTo({
|
|
76
|
+
url: `${path ===null?$vm.$xdUniOptions['home']: path}?locationBack=true`,
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
resolve({cityData, location});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @description 获取用户选中的城市
|
|
87
|
+
* @returns {string}
|
|
88
|
+
*/
|
|
89
|
+
export function getCacheCurrentCity() {
|
|
90
|
+
return storage.get(settings.userCityCurrentSaveKey);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|