Feat:分享接口对接&&换一换接口对接

This commit is contained in:
modendeveloper
2024-12-14 21:56:37 +08:00
parent b535e21e2f
commit eddb02d2cf
4 changed files with 193 additions and 11 deletions
+22 -6
View File
@@ -100,8 +100,12 @@
</view>
</view>
<view class="body" v-else>
<view>
<view class="v12-justify-between v12-align-center">
<text class="v12-font-bold" v-if="currType.carousel">推荐</text>
<view class="v12-dark1-text v12-font-28 v12-align-center" @click="handleRefresh">
<u-icon name="reload"></u-icon>
换一换
</view>
</view>
<view v-if="isLoad">
<view v-if="hotelList.length > 0">
@@ -159,7 +163,7 @@ export default {
name: '',
page: 1,
typeList: [],
typeIndex: -1,
typeIndex: 0,
// 当前选中的类型
currType: {},
cityName: '',
@@ -168,7 +172,8 @@ export default {
pageKeyId: Object.freeze('findFunIndex'),
isNext: false,
townConfig: {},
townList: []
townList: [],
randomSeed: null
}
},
computed: {
@@ -220,6 +225,10 @@ export default {
}
},
methods: {
handleRefresh() {
uni.showLoading()
this.fetchList(1, this.randomSeed)
},
toTown(town) {
uni.navigateTo({
url: `/pages/town/index?id=${town.id}`
@@ -266,7 +275,7 @@ export default {
this.hotelList = []
this.fetchList()
},
fetchList() {
fetchList(random = 0, randomSeed) {
if(this.typeIndex === -1) {
const params = {
cityName: this.name,
@@ -281,15 +290,21 @@ export default {
const param = {
page: this.page,
type: this.typeList[this.typeIndex].id,
cityName: this.cityName
cityName: this.cityName,
random: random,
randomSeed: randomSeed
}
const name = this.name.trim()
if (name.length > 0) {
param.name = name
}
getHotelList(param).then(res => {
const { success, data } = res
const { success, data, msg } = res
if (success) {
if(random === 1) {
this.randomSeed = msg
this.hotelList = []
}
for (let i = 0; i < data.length; i++) {
const cover = data[i].cover
data[i].hide = true
@@ -310,6 +325,7 @@ export default {
}
}).finally(() => {
this.isLoad = true
uni.hideLoading()
})
},
typeBannerItemClick(item) {