58 lines
1.4 KiB
Vue
58 lines
1.4 KiB
Vue
<template>
|
|
<view class="container">
|
|
<h3 class="container-title">{{ viewData?.title }}</h3>
|
|
<view class="container-sub-title">
|
|
<span>阅读 {{ viewData?.readCount }}</span>
|
|
<span style="margin-left: 30px">{{ moment(viewData?.publishTime).format('YYYY年MM月DD日 HH:mm') }}</span>
|
|
</view>
|
|
<view v-html="viewData?.content"></view>
|
|
</view>
|
|
|
|
</template>
|
|
|
|
<script setup>
|
|
import {ref, reactive, onMounted, computed, h} from 'vue';
|
|
import {onLoad} from "@dcloudio/uni-app";
|
|
import {Toast} from "tdesign-mobile-vue";
|
|
import {useRequest} from "@/utils/request";
|
|
import moment from "moment";
|
|
|
|
const request = useRequest()
|
|
const momentId = ref(null);
|
|
const viewData = ref(null);
|
|
|
|
function getWonderfulMoment() {
|
|
request.post('/platform/activity/wonderfulMoment/getWonderfulMomentById/' + momentId.value).then(res=>{
|
|
if(res.code === 0){
|
|
res.data.content = res?.data?.content.replaceAll('/open/file/upload/download?filepath=','')
|
|
viewData.value = res.data
|
|
}else{
|
|
Toast({message: res.msg, theme: 'error'});
|
|
}
|
|
})
|
|
}
|
|
|
|
onLoad((option) => {
|
|
if (option.id) {
|
|
momentId.value = Number(option.id);
|
|
getWonderfulMoment()
|
|
}
|
|
});
|
|
onMounted(() => {
|
|
});
|
|
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
.container {
|
|
padding: 10px;
|
|
background-color: white !important;
|
|
min-height: 100%;
|
|
}
|
|
.container-sub-title {
|
|
margin-top: 20px;
|
|
color: #C9C9C9;
|
|
margin-bottom: 20px;
|
|
}
|
|
</style>
|