Feat: 寻趣味接口对接(缺分享接口,店住名称字段)

This commit is contained in:
linxi
2024-12-13 16:04:25 +08:00
parent 50cbe66332
commit b535e21e2f
8 changed files with 124 additions and 42 deletions
+5
View File
@@ -258,4 +258,9 @@ export function getAncientTownActive(params) {
return request.get("/ancientTown/activity", params) return request.get("/ancientTown/activity", params)
} }
export function watchTownActive(data) {
return request.post("/ancientTown/activity/view", data, {login: true})
}
+1
View File
@@ -109,6 +109,7 @@
{ {
"path": "pages/town/index", "path": "pages/town/index",
"style": { "style": {
"navigationBarTextStyle": "white",
"navigationStyle": "custom", "navigationStyle": "custom",
"navigationBarTitleText": "探索生活好去处" "navigationBarTitleText": "探索生活好去处"
} }
+1 -1
View File
@@ -92,7 +92,7 @@
</view> </view>
<view class="body" v-if="typeIndex === -1"> <view class="body" v-if="typeIndex === -1">
<view class="town-card" v-for="(town, i) in townList" :key="i" @click="toTown(town)"> <view class="town-card" v-for="(town, i) in townList" :key="i" @click="toTown(town)">
<view class="town-title">{{ town.name }}</view> <!-- <view class="town-title">{{ town.name }}</view> -->
<image :src="town.frontImage" mode="scaleToFill"/> <image :src="town.frontImage" mode="scaleToFill"/>
<view class="v12-primary enter-btn">点击进入 <view class="v12-primary enter-btn">点击进入
<view class="icon-box"><u-icon name="arrow-rightward" color="#fff" size="8"></u-icon></view> <view class="icon-box"><u-icon name="arrow-rightward" color="#fff" size="8"></u-icon></view>
+3 -3
View File
@@ -1,6 +1,6 @@
<template> <template>
<view> <view class="v12-pa-2">
<view class="culture v12-d-grid-columns-2"> <view class="culture v12-d-grid-columns-2" v-if="list.length > 0">
<view class="img-item " v-for="(item, index) in list" :key="index" @click="viewImg(item)"> <view class="img-item " v-for="(item, index) in list" :key="index" @click="viewImg(item)">
<image class="img-item" :src="item" mode="widthFix|heightFix" lazy-load="false"></image> <image class="img-item" :src="item" mode="widthFix|heightFix" lazy-load="false"></image>
</view> </view>
@@ -48,7 +48,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.culture{ .culture{
grid-gap: 20rpx 20rpx; grid-gap: 20rpx 20rpx;
padding: 20rpx; padding: 20rpx 10rpx;
background: #fff; background: #fff;
border-radius: 30rpx; border-radius: 30rpx;
margin-top: 20rpx; margin-top: 20rpx;
+12 -22
View File
@@ -1,8 +1,8 @@
<template> <template>
<view> <view>
<view v-if="infoArray.length > 0" class="info-wrapper"> <view v-if="actives.length > 0" class="info-wrapper">
<view class="info-list"> <view class="info-list">
<view v-for="(item, index) in infoArray" :key="index" class="info-item"> <view v-for="(item, index) in actives" :key="index" class="info-item">
<view <view
:class="item.isTop === 1 ? 'info-item-top' : ''" :class="item.isTop === 1 ? 'info-item-top' : ''"
:style="{ :style="{
@@ -56,7 +56,7 @@
/> />
</view> </view>
<image <image
v-if="infoArray.length === 0" v-if="actives.length === 0"
:src="webUrl + '/orderIcon/wu.png'" :src="webUrl + '/orderIcon/wu.png'"
class="img-nodata" class="img-nodata"
mode="scaleToFill" mode="scaleToFill"
@@ -65,11 +65,7 @@
</template> </template>
<script> <script>
import { import { watchTownActive } from "@/api/inn.js"
getNews,
hadLike,
hadView
} from "@/api/product"
import imgBox from '@/components/imageTypeSet/imagebox.vue' import imgBox from '@/components/imageTypeSet/imagebox.vue'
export default { export default {
props: { props: {
@@ -84,25 +80,19 @@ export default {
data() { data() {
return { return {
webUrl: this.$VUE_APP_RESOURCES_URL, webUrl: this.$VUE_APP_RESOURCES_URL,
actives: this.infoArray
}
},
watch: {
infoArray(val) {
this.actives = val
} }
}, },
methods: { methods: {
likeInfoItemHandle(item, index, value, voValue) {
hadLike({ landmarkNewsId: item.id }).then(res => {
const { success } = res
if (success) {
this.$dialog.toast({
mes: '操作成功!'
})
this.$set(this.infoArray[index], 'zan', value)
this.$set(this.infoArray[index], 'hasZan', voValue)
}
})
},
infoItemViewClick(item) { infoItemViewClick(item) {
uni.$u.debounce(() => { uni.$u.debounce(() => {
hadView({ landmarkNewsId: item.id }).finally(() => { watchTownActive({ id: item.id }).finally(() => {
this.infoArray.map(info => { this.actives.forEach(info => {
if (info.id === item.id) { if (info.id === item.id) {
info.pv += 1 info.pv += 1
} }
+44 -8
View File
@@ -23,30 +23,43 @@
</view> </view>
</view> </view>
<view <view
v-if="tabs.length > 0"
class="content v12-justify-center" class="content v12-justify-center"
:class="{ :class="{
'first-one': actived === 1, 'first-one': actived === 1,
'last-one': actived === 3 'last-one': actived === 3
}" }"
> >
<view class="v12-d-grid-columns-2 v12-gap-10"> <view v-if="items.length > 0" class="v12-d-grid-columns-2 v12-gap-10">
<view v-for="(item, index) in items" :key="index" class="store-card"> <view v-for="(item, index) in items" :key="index" class="store-card" @click="toStore(item.hotelId)">
<view> <view>
<image class="town-cover" :src="item.cover" mode="aspectFit|aspectFill|widthFix"></image> <image class="town-cover" :src="item.cover" mode="aspectFit|aspectFill|widthFix"></image>
</view> </view>
<view class="v12-pa-2"> <view class="v12-pa-2 card-bottom">
<view class="v12-dark-text v12-font-bold v12-font-30 v12-py-1 more-t">昆明小吃</view> <view class="v12-dark-text v12-font-bold v12-font-30 v12-py-1 more-t">{{ item.hotelName }}</view>
<view class="v12-align-center"> <view class="v12-align-center">
<view class="avtor"> <view class="avtor">
<image class="avtor"></image> <image class="avtor" :src="item.logo" mode="scaleToFill"></image>
</view> </view>
<view class="v12-secondary-dark-text v12-font-28 v12-ml-3 one-t">刘欢小吃</view> <view class="v12-secondary-dark-text v12-font-28 v12-ml-3 one-t">{{ item.hotelName }}</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<image
v-if="items.length === 0"
:src="webUrl + '/orderIcon/wu.png'"
class="img-nodata"
style="left: 25%;"
mode="scaleToFill"
/>
</view> </view>
<image
v-if="tabs.length === 0"
:src="webUrl + '/orderIcon/wu.png'"
class="img-nodata"
mode="scaleToFill"
/>
</view> </view>
</template> </template>
@@ -93,12 +106,35 @@ export default {
methods: { methods: {
handleTab(value) { handleTab(value) {
this.actived = value this.actived = value
} },
toStore(id) {
if (!id) {
return
}
uni.navigateTo({
url: '/pagesInn/inn/innHome?id=' + id
})
},
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.img-nodata {
position: relative;
top: 0;
left: 50%;
transform: translate(-50%, 0);
width: 352rpx;
height: 338rpx;
margin-bottom: 60rpx;
}
.card-bottom{
display: flex;
flex-direction: column;
justify-content: space-between;
height: calc(100% - 356rpx);
}
.avtor{ .avtor{
width: 52rpx; width: 52rpx;
height: 52rpx; height: 52rpx;
+6 -2
View File
@@ -13,7 +13,10 @@
<view> <view>
<view class="v12-font-28 v12-mb-1 v12-dark1-text">{{ info.openTime || '' }}</view> <view class="v12-font-28 v12-mb-1 v12-dark1-text">{{ info.openTime || '' }}</view>
<view class="v12-font-28 v12-mb-1 v12-dark1-text">{{ info.address || '' }}</view> <view class="v12-font-28 v12-mb-1 v12-dark1-text">{{ info.address || '' }}</view>
<view class="v12-font-28 v12-mb-1 v12-dark1-text">{{ info.announcement || '' }}</view> <view class="v12-font-28 v12-mb-1 v12-dark1-text v12-d-flex">
<u-icon size="16" :name="webUrl + '/orderIcon/laba.png'"></u-icon>
{{ info.announcement || '' }}
</view>
</view> </view>
<view class="action-wrap"> <view class="action-wrap">
<view @click="showLocation"> <view @click="showLocation">
@@ -36,7 +39,7 @@
简介 简介
</view> </view>
<view class="intro-text"> <view class="intro-text">
{{ info.desc || '' }} <rich-text class="" :nodes="info.desc"></rich-text>
</view> </view>
</view> </view>
</view> </view>
@@ -84,6 +87,7 @@ export default {
background: #fff; background: #fff;
margin-top: 20rpx; margin-top: 20rpx;
border-radius: 30rpx; border-radius: 30rpx;
padding: 20rpx;
} }
.intro-text{ .intro-text{
color: #999; color: #999;
+52 -6
View File
@@ -1,7 +1,18 @@
<template> <template>
<view class="town"> <view class="town">
<hx-navbar :back="true" :fixed="true" color="#fff" :statusBar="true" transparent="hidden" barPlaceholder="hidden" />
<view class="top-img"> <view class="top-img">
<image :src="townInfo.cover" mode="scaleToFill" class="img"></image> <image v-if="townInfo.coverType === 1" :src="townInfo.cover" mode="scaleToFill" class="img"></image>
<video
v-if="townInfo.coverType === 2"
class="img"
:src="townInfo.cover"
autoplay
:play-btn-position="center"
:show-fullscreen-btn="false"
:show-play-btn="false"
:show-center-play-btn="flase"
> </video>
</view> </view>
<view class="top-intro"> <view class="top-intro">
<view class="intro-title v12-pa-3"> <view class="intro-title v12-pa-3">
@@ -10,9 +21,12 @@
4A 4A
</text> </text>
</view> </view>
<view class="shareBtn"><u-icon name="share-square" color="#C52733"></u-icon>分享给好友</view>
<u-line dashed></u-line> <u-line dashed></u-line>
<view class="v12-pa-3 intro-content"> <view v-if="townInfo.intro" class="v12-pa-3 intro-content">
{{ townInfo.intro }} <u-read-more :toggle="true" showHeight="200">
{{ townInfo.intro }}
</u-read-more>
</view> </view>
</view> </view>
<view class="tabs-wrap"> <view class="tabs-wrap">
@@ -93,6 +107,21 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.shareBtn{
width: fit-content;
padding: 5rpx 15rpx;
background: #edbfc2;
box-shadow: 0rpx 4rpx 4rpx rgba(0,0,0,0.16);
border-radius: 24rpx 0rpx 0rpx 24rpx;
color: #C52733;
font-weight: bold;
font-size: 28rpx;
position: absolute;
right: 0;
top: 0;
display: flex;
align-items: center;
}
.town{ .town{
min-height: 100vh; min-height: 100vh;
background: #f0f0f0; background: #f0f0f0;
@@ -113,7 +142,7 @@ export default {
font-size: 36rpx; font-size: 36rpx;
} }
.intro-content{ .intro-content{
letter-spacing: 100px; letter-spacing: 2.5px;
line-height: 40rpx; line-height: 40rpx;
font-size: 28rpx; font-size: 28rpx;
color: #666; color: #666;
@@ -134,15 +163,32 @@ export default {
border-radius: 30rpx; border-radius: 30rpx;
margin-top: -30rpx; margin-top: -30rpx;
position: relative; position: relative;
z-index: 2; z-index: 11;
} }
.top-img{ .top-img{
width: 100%; width: 100%;
background: #fff;
height: 560rpx; height: 560rpx;
background: rgba(180,18,18,0.39); position: relative;
.img{ .img{
height: inherit; height: inherit;
width: 100%; width: 100%;
} }
.img1{
z-index: 10;
position: absolute;
top: 0;
left: 0;
border-radius: 30rpx;
}
.bg{
height: 100%;
width: 50%;
background: #fff;
position: absolute;
top: -30rpx;
right: 0;
z-index: 9;
}
} }
</style> </style>