cyl/master-0804
wangxia 4 months ago
parent 53d1b5a69b
commit 2cb033e0d2

@ -358,6 +358,8 @@ export default {
if (cachedCity) { if (cachedCity) {
if (this.selectedCity != cachedCity) { if (this.selectedCity != cachedCity) {
this.selectedCity = cachedCity; this.selectedCity = cachedCity;
this.speed = -1;
this.loading = true;
this.getList(); this.getList();
} }
} }

@ -1,11 +1,11 @@
<template> <template>
<view class="g_pl_16 container" style="background-color: #f5f5f5"> <view class="g_pl_16 container" style="background-color: #f5f5f5">
<scroll-view class="cities-scroll" scroll-with-animation="true" style="box-sizing: border-box; height: calc(100vh - 87px)" :scroll-into-view="az" scroll-y ref="scrollViewRef"> <scroll-view class="cities-scroll" scroll-with-animation="true" style="box-sizing: border-box" :scroll-into-view="az" scroll-y ref="scrollViewRef">
<view class=""> <view class="">
<view class="headTxt">当前城市</view> <view class="headTxt">当前城市</view>
<view class="" hover-class="none" hover-stop-propagation="false"> <view class="" hover-class="none" hover-stop-propagation="false">
<view @click="selectQuanGuo" class="itemCity" :class="{ active: selectedCity === '全国' }">全国</view> <view @click="selectQuanGuo" :class="{ itemCity: true, active: selectedCity === '全国' }">全国</view>
<view class="g_flex_row_center itemCity" v-if="currentCity" @click="selectCity({ shortName: currentCity })" :class="{ active: selectedCity === currentCity }"> <view class="g_flex_row_center" v-if="currentCity" @click="selectCity({ shortName: currentCity })" :class="{ itemCity: true, active: selectedCity === currentCity }">
<i class="iconfont icon-dizhi1 g_mr_4"></i> <i class="iconfont icon-dizhi1 g_mr_4"></i>
{{ currentCity }} {{ currentCity }}
</view> </view>
@ -15,7 +15,7 @@
<block v-for="group in cities"> <block v-for="group in cities">
<view class="headTxt" :id="`letter-${group.name[0] == '热' ? 're' : group.name[0]}`">{{ group.name }}</view> <view class="headTxt" :id="`letter-${group.name[0] == '热' ? 're' : group.name[0]}`">{{ group.name }}</view>
<block v-for="city in group.list"> <block v-for="city in group.list">
<view @click="selectCity(city)" class="itemCity" :class="{ active: selectedCity === city.shortName }">{{ city.shortName }}</view> <view @click="selectCity(city)" :class="{ itemCity: true, active: selectedCity === city.shortName }">{{ city.shortName }}</view>
</block> </block>
</block> </block>
</view> </view>
@ -35,7 +35,7 @@
<g-panel-fixed> <g-panel-fixed>
<view class="g_flex_row_center"> <view class="g_flex_row_center">
<g-button btnText="重置" size="small" @clickBtn="back"></g-button> <g-button btnText="重置" size="small" @clickBtn="back"></g-button>
<g-button btnText="确定" type="primary" class="g_ml_24" size="small" @clickBtn="setCity"></g-button> <g-button btnText="确定" type="primary" class="g_ml_20" size="small" @clickBtn="setCity"></g-button>
</view> </view>
</g-panel-fixed> </g-panel-fixed>
</view> </view>
@ -69,7 +69,7 @@ export default {
methods: { methods: {
setCity() { setCity() {
uni.setStorageSync("selectedCity", this.selectedCity); uni.setStorageSync("selectedCity", this.selectedCity);
console.log(`城市 ${this.selectedCity}保存到缓存`); console.log(`城市 ${this.selectedCity} 保存到缓存`);
uni.navigateBack({ delta: 1 }); uni.navigateBack({ delta: 1 });
}, },
getCity() { getCity() {
@ -225,6 +225,8 @@ export default {
} }
.cities-scroll { .cities-scroll {
// height: calc(100vh - constant(safe-area-inset-bottom) - 72px);
padding-bottom: 87px;
// height: calc(100vh - 100px); // height: calc(100vh - 100px);
// overflow-y: auto; // overflow-y: auto;
} }

Loading…
Cancel
Save