Files
2024-03-19 17:56:50 +08:00

127 lines
2.7 KiB
Vue

<template>
<view class="pages-inn-info-detail">
<view class="top-box">
<view class="title more-t">{{ info.name }}</view>
<view class="sub flex jc-between ai-center">
<text class="datetime">{{ info.createdTime }}</text>
<view class="flex ai-center">
<view class="flex ai-center" style="margin-right: 28rpx">
<image :src="webUrl+'/20230803152147141807.png'"/>
<view class="num">{{ info.pv }}</view>
</view>
<view class="flex ai-center" @click="likeInfo">
<image :src="webUrl+'/20230803151308999742.png'" v-if="info.zanVo != null"/>
<image :src="webUrl+'/20230803151302213857.png'" v-else/>
<view class="num">{{ info.zan }}</view>
</view>
</view>
</view>
</view>
<view class="video-box" v-if="info.type==='NT_VIDEO'">
<video style="width: 100%;height: 320rpx;" :src="info.video" controls play-btn-position="center"/>
</view>
<view class="content-box">
<rich-text :nodes="info.content"/>
</view>
</view>
</template>
<script>
import {getHotelNewsDetail, getHotelNewsZan} from "@/api/inn";
export default {
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
id: null,
info: null
}
},
onLoad(options) {
this.id = options.id;
this.init();
},
methods: {
init() {
getHotelNewsDetail(this.id).then(({data}) => this.info = data);
},
likeInfo() {
let that = this;
uni.showLoading();
getHotelNewsZan(this.id).then((res) => {
uni.hideLoading();
uni.showToast({
title: res.msg,
mask: false,
duration: 1500,
success() {
if (res.status === 200) that.info = res.data;
}
})
}).catch((err) => {
uni.hideLoading()
uni.showToast({
title: err.msg + '',
icon: 'none',
mask: false,
duration: 1500
});
})
},
}
}
</script>
<style lang="less">
.pages-inn-info-detail {
.top-box {
padding: 40rpx 32rpx 20rpx;
box-shadow: 0 6rpx 12rpx rgba(0, 0, 0, 0.16);
.title {
margin-bottom: 20rpx;
font-size: 40rpx;
font-weight: bold;
line-height: 64rpx;
color: #333333;
}
.sub {
font-size: 32rpx;
line-height: 1;
color: #333333;
image {
width: 40rpx;
height: 40rpx;
margin-right: 4rpx;
vertical-align: middle;
}
.datetime {
color: #999999;
}
.num {
line-height: 40rpx;
}
}
}
.video-box {
box-sizing: border-box;
padding: 40rpx 32rpx 0;
}
.content-box {
padding: 40rpx 32rpx;
box-sizing: border-box;
}
}
</style>