From eddb02d2cf71def7e56700b46d87782c441c1e76 Mon Sep 17 00:00:00 2001 From: modendeveloper Date: Sat, 14 Dec 2024 21:56:37 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E5=88=86=E4=BA=AB=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=AF=B9=E6=8E=A5&&=E6=8D=A2=E4=B8=80=E6=8D=A2?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/inn.js | 4 + pages/cloud/haveFun.vue | 28 +++++-- pages/town/components/projects.vue | 54 ++++++++++++- pages/town/index.vue | 118 ++++++++++++++++++++++++++++- 4 files changed, 193 insertions(+), 11 deletions(-) diff --git a/api/inn.js b/api/inn.js index 3ad1d82..928a72f 100644 --- a/api/inn.js +++ b/api/inn.js @@ -262,5 +262,9 @@ export function watchTownActive(data) { return request.post("/ancientTown/activity/view", data, {login: true}) } +export function shareTown(id) { + return request.get("/ancientTown/poster/" + id, {login: true}) +} + diff --git a/pages/cloud/haveFun.vue b/pages/cloud/haveFun.vue index 734b8b5..595382e 100644 --- a/pages/cloud/haveFun.vue +++ b/pages/cloud/haveFun.vue @@ -100,8 +100,12 @@ - + 推荐 + + + 换一换 + @@ -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) { diff --git a/pages/town/components/projects.vue b/pages/town/components/projects.vue index b6b37b1..cb7a4b6 100644 --- a/pages/town/components/projects.vue +++ b/pages/town/components/projects.vue @@ -32,11 +32,20 @@ > - + + + + + {{ item.cityName }} + + - {{ item.hotelName }} + {{ item.content }} @@ -120,6 +129,47 @@ export default {