Files
dvcp_v2_webapp/packages/3.0.0/AppContentInfo/components/Detail.vue
yanran200730 af65ba44ab 内容发布
2022-03-18 13:47:44 +08:00

94 lines
2.7 KiB
Vue

<template>
<ai-detail>
<template slot="title">
<ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<ai-wrapper
label-width="120px">
<ai-info-item label="标题" isLine :value="info.title"></ai-info-item>
<ai-info-item label="发布地区" isLine :value="info.areaName"></ai-info-item>
<ai-info-item label="文章类型" isLine :value="info.contentType === '0' ? '文章' : '视频'"></ai-info-item>
<ai-info-item label="分类" isLine :value="info.categoryName"></ai-info-item>
<ai-info-item label="正文" v-if="info.contentType === '0'" isLine>
<AiArticle :value="info.content"></AiArticle>
</ai-info-item>
<ai-info-item v-if="info.contentType === '0'" isLine label="封面图片">
<ai-uploader
:instance="instance"
disabled
v-model="info.files"
:limit="9">
</ai-uploader>
</ai-info-item>
<ai-info-item v-if="info.contentType === '1'" isLine label="封面图片">
<video style="width:100%; height:100%; object-fit: fill;" :src="info.files[0].url" controls></video>
</ai-info-item>
<ai-info-item v-if="info.contentType === '1'" isLine label="视频封面">
<ai-uploader
:instance="instance"
disabled
v-model="info.pictureUrl"
:limit="1">
</ai-uploader>
</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object,
moduleId: String
},
data () {
return {
info: {},
id: ''
}
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appcontentinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.info = res.data
this.info.pictureUrl = res.data.pictureUrl ? [{
url: res.data.pictureUrl
}] : []
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>