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.
51 lines
1.1 KiB
51 lines
1.1 KiB
8 months ago
|
|
||
|
<template>
|
||
|
<s-layout :title="state.type" :bgStyle="{ color: '#fff' }">
|
||
|
<view class="detail" v-html="state.detailContent"></view>
|
||
|
</s-layout>
|
||
|
</template>
|
||
|
|
||
|
<script setup>
|
||
|
import sheep from '@/sheep';
|
||
|
import { onLoad } from '@dcloudio/uni-app';
|
||
|
import { reactive } from 'vue';
|
||
|
|
||
|
const state = reactive({
|
||
|
detailContent: '',
|
||
|
type: '公告详情'
|
||
|
});
|
||
|
// 获取公告列表
|
||
|
async function getNoticeDetail(id) {
|
||
|
let { code, data: { content }, msg } = await sheep.$api.announcement.detail(id);
|
||
|
if (code === 1) {
|
||
|
state.detailContent = content;
|
||
|
} else {
|
||
|
state.detailContent = '';
|
||
|
}
|
||
|
}
|
||
|
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;
|
||
|
}
|
||
|
</style>
|