You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
1.9 KiB

<template>
<s-layout :title="state.type" :bgStyle="{ color: '#fff' }">
8 months ago
<view class="detail">
<view v-if="state.type === '公告详情'" class="detail-header">
<view class="detail-header-title">{{ state.title }}</view>
8 months ago
<view class="detail-header-time">{{ dayjs(state.time).format('YYYY/MM/DD') }}</view>
8 months ago
</view>
<view class="detail-content" v-html="state.detailContent"></view>
</view>
</s-layout>
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { reactive } from 'vue';
8 months ago
import dayjs from 'dayjs';
const state = reactive({
detailContent: '',
8 months ago
type: '公告详情',
title: '',
time: '',
});
// 获取公告列表
async function getNoticeDetail(id) {
8 months ago
let { code, data: { content, title, createtime }, msg } = await sheep.$api.announcement.detail(id);
if (code === 1) {
state.detailContent = content;
8 months ago
state.title = title;
state.time = createtime;
} else {
state.detailContent = '';
8 months ago
state.title = '';
state.time = '';
}
}
async function getArticleDetail(id) {
let { code, data: { content }, msg } = await sheep.$api.businessSchool.articleDetail(id);
if (code === 1) {
state.detailContent = content;
} else {
state.detailContent = '';
}
}
onLoad((options) => {
const { type, id } = options;
state.type = type;
if ('公告详情' === type || !type) {
getNoticeDetail(id);
} else {
getArticleDetail(id);
}
});
</script>
<style lang="scss" scoped>
.detail {
padding: 20rpx;
8 months ago
&-header {
text-align: center;
&-title {
color: #000;
font-size: 30rpx;
font-weight: bold;
margin-bottom: 10rpx;
}
&-time {
color: #898989;
font-size: 24rpx;
font-weight: 400;
margin-bottom: 10rpx;
}
}
&-content {}
}
</style>