文件
xionggeshop/xgsc.gynhc.com_wx/pages/public/notice-detail.vue
2026-09-14 17:24:53 +08:00

83 行
1.6 KiB
Vue

<template>
<view class="notice-detail">
<view class="notice-detail__head" v-if="detail.title">
<text class="notice-detail__title">{{ detail.title }}</text>
<text class="notice-detail__meta" v-if="detail.create_time">{{ detail.create_time }}</text>
</view>
<view class="notice-detail__body">
<u-parse v-if="detail.content" :html="detail.content"></u-parse>
<shopro-empty v-else tipText="暂无公告内容"></shopro-empty>
</view>
</view>
</template>
<script>
import { BASE_URL } from '@/env';
export default {
data() {
return {
detail: {}
};
},
onLoad() {
this.$Route.query.id && this.getDetail();
},
methods: {
getDetail() {
uni.showLoading({ title: '加载中...', mask: true });
uni.request({
url: `${BASE_URL}/api/notice/detail`,
method: 'GET',
data: { id: this.$Route.query.id },
complete: () => {
uni.hideLoading();
},
success: res => {
const body = res.data || {};
if (body.code === 1 && body.data && body.data.detail) {
this.detail = body.data.detail;
uni.setNavigationBarTitle({
title: '公告详情'
});
}
}
});
}
}
};
</script>
<style lang="scss">
.notice-detail {
min-height: 100vh;
background: $brand-page-bg;
}
.notice-detail__head {
padding: 32rpx $brand-page-gutter 24rpx;
background: #ffffff;
}
.notice-detail__title {
display: block;
font-size: 34rpx;
font-weight: 700;
color: $brand-text;
line-height: 1.45;
}
.notice-detail__meta {
display: block;
margin-top: 12rpx;
font-size: 24rpx;
color: $brand-text-muted;
}
.notice-detail__body {
margin-top: 16rpx;
padding: 32rpx $brand-page-gutter;
background: #ffffff;
}
</style>