111 lines
2.9 KiB
Vue
111 lines
2.9 KiB
Vue
<template>
|
|
<ai-detail class="AppDynamicDetail">
|
|
<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.girdName"></ai-info-item>
|
|
<ai-info-item label="文章类型" isLine :value="info.contentType === '0' ? '文章' : '视频'"></ai-info-item>
|
|
<ai-info-item label="分类" v-if="info.categoryName" 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 label="附件" isLine>
|
|
<div class="files">
|
|
<div class="file-item" v-for="(item, index) in info.files" :key="index">
|
|
<video controls :src="item.url" v-if="['.mp4', '.mov'].includes(item.postfix)"></video>
|
|
<img :src="item.url" v-else v-viewer="{movable: true}">
|
|
</div>
|
|
</div>
|
|
</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
|
|
this.info = {
|
|
...res.data,
|
|
pictureUrl: res.data.pictureUrl ? [{
|
|
url: res.data.pictureUrl
|
|
}] : [],
|
|
files: res.data.files.map(v => {
|
|
return {
|
|
...v,
|
|
postfix: v.postfix.toLowerCase()
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
cancel (isRefresh) {
|
|
this.$emit('change', {
|
|
type: 'List',
|
|
isRefresh: !!isRefresh
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.AppDynamicDetail {
|
|
.files {
|
|
display: flex;
|
|
align-items: center;
|
|
flex-wrap: wrap;
|
|
.file-item {
|
|
width: 240px;
|
|
height: 240px;
|
|
margin: 0 20px 20px 0;
|
|
|
|
img, video {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|