This commit is contained in:
yanran200730
2023-02-20 09:30:10 +08:00
parent 0222a26313
commit a1c7972f9d
9 changed files with 9 additions and 1191 deletions

View File

@@ -81,7 +81,15 @@
getInfo (id) {
this.instance.post(`/app/appexaminationinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.info = res.data
this.info = {
...res.data,
questions: res.data.questions.map(v => {
return {
...v,
answer: v.items.filter(v => v.checked === '1').map(v => v.content).join(',')
}
})
}
this.assessmentsName = res.data.assessments.map(v => {
return `${this.dict.getLabel('qjEAType', v.assessmentType)} ${this.dict.getLabel('qjEACondition', v.upCondition)} ${v.upScore} `

View File

@@ -1,134 +0,0 @@
<template>
<div class="appPressCenter">
<ai-list v-show="showList">
<template slot="title">
<ai-title
title="新闻中心"
:isShowBottomBorder="false"
@change="changeAreaId"
:isShowArea="true"
:instance="instance"
v-model="areaId"
:hideLevel="hideLevel"/>
</template>
<template slot="tabs">
<el-tabs v-model="currIndex">
<el-tab-pane
v-for="(tab, i) in tabs"
:key="i"
:label="tab.label"
:name="String(i)"
>
<component
:is="tab.comp"
v-if="currIndex === String(i)"
:ref="currIndex"
:instance="instance"
:dict="dict"
:permissions="permissions"
:areaId="areaId"
@goPage="goPage"
/>
</el-tab-pane>
</el-tabs>
</template>
</ai-list>
<component
v-if="!showList"
:is="currentPage"
:detail="detail"
:instance="instance"
:dict="dict"
:permissions="permissions"
:areaId="areaId"
@goBack="goBack"
@goPage="goPage"
/>
</div>
</template>
<script>
import {mapState} from 'vuex'
import {addArticle, addVideo, commentList, newsDetail, newsList, videoDetail} from './components'
export default {
name: 'AppPressCenter',
label: '新闻中心',
props: {
instance: Function,
dict: Object,
permissions: Function
},
components: {
newsList,
commentList,
addVideo,
addArticle,
newsDetail,
videoDetail
},
data() {
return {
areaId: '',
currIndex: '0',
detail: {}
}
},
computed: {
...mapState(['user']),
tabs() {
return [
{
label: '内容管理',
name: 'newsList',
comp: newsList,
addVideo: addVideo,
addArticle: addArticle,
newsDetail: newsDetail,
videoDetail: videoDetail
},
{label: '评论管理', name: 'commentList', comp: commentList}
]
},
showList() {
return !this.$route.hash
},
hideLevel() {
return this.user.info.areaList?.length - 1
},
currentPage() {
return this.$route.hash?.substring(1)
}
},
methods: {
changeAreaId() {
this.$nextTick(() => {
this.$refs[this.currIndex][0].getList()
})
},
goBack() {
this.$router.push({})
},
goPage(obj) {
let hash = "#" + obj.key
if (obj.row) {
let {id} = obj.row
this.$router.push({query: {id}, hash})
} else {
this.$router.push({hash})
}
}
},
created() {
this.areaId = this.user.info.areaId
}
}
</script>
<style lang="scss" scoped>
.appPressCenter {
width: 100%;
height: 100%;
}
</style>

View File

@@ -1,154 +0,0 @@
<template>
<ai-detail class="add-article">
<template slot="title">
<ai-title :title="isEdit?'编辑文章':'发布文章'" :isShowBack="true" :isShowBottomBorder="true"
@onBackClick="$emit('goBack')"></ai-title>
</template>
<template slot="content">
<ai-card title="发布文章">
<template #content>
<el-form ref="ruleForm" :model="articInfo" :rules="rules" label-width="120px" label-position="right">
<el-form-item prop="title" label="标题:">
<el-input v-model="articInfo.title" size="small" placeholder="请输入…" maxlength="30"
show-word-limit></el-input>
</el-form-item>
<el-form-item prop="policyType" label="类型:">
<ai-select
v-model="articInfo.policyType"
placeholder="选择新闻类型"
:selectList="dict.getDict('newsCenterPolicyType')">
</ai-select>
</el-form-item>
<el-form-item label="发布地区:" prop="areaId">
<ai-area-get v-model="articInfo.areaId" :instance="instance" :root="areaId"/>
</el-form-item>
<el-form-item prop="content" label="正文:">
<ai-editor v-model="articInfo.content" :instance="instance"/>
</el-form-item>
<el-form-item prop="coverFile" label="封面:">
<ai-uploader :instance="instance" v-model="articInfo.coverFile" :limit="1" :isShowTip="true"
@change="$refs['ruleForm'].clearValidate('coverFile')" :cropOps="cropOps" is-crop>
<template slot="tips">最多上传1张图片,单个文件最大10MB支持jpgjpegpng<br/>格式图片比例1.61</template>
</ai-uploader>
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template slot="footer">
<el-button class="footer_btn" @click="$emit('goBack')">取消</el-button>
<el-button type="primary" class="footer_btn" @click="handleSubmit('1')" v-if="!isEdit">发布</el-button>
<el-button class="footer_btn" @click="handleSubmit('0')">保存</el-button>
</template>
</ai-detail>
</template>
<script>
export default {
name: "addArticle",
props: {
instance: Function,
dict: Object,
permissions: Function,
areaId: String,
detail: Object,
},
data() {
return {
articInfo: {
areaId: '',
title: "",
content: "",
policyType: '',
coverFile: [],
},
rules: {
title: {required: true, message: '请输入标题', trigger: 'blur'},
areaId: {required: true, message: '请选择 发布地区', trigger: 'blur'},
policyType: {required: true, message: '请选择类型', trigger: 'change'},
content: {required: true, message: '请填写内容', trigger: 'blur'},
coverFile: {required: true, message: '请上传封面', trigger: 'blur'},
},
cropOps: {
fixedNumber: [1.8, 1],
fixed: true
}
}
},
computed: {
isEdit() {
return !!this.$route.query.id;
}
},
methods: {
/**
* 发布、保存新闻
* @param status
*/
handleSubmit(status) {
this.$refs["ruleForm"].validate(valid => {
if (valid) {
this.addOrUpdate(status);
}
})
},
/**
* 新增、修改
* */
addOrUpdate(status) {
const msg = +status ? '发布成功' : this.isEdit ? '编辑成功' : '保存成功';
this.instance.post(`/app/appnewscenterinfo/addOrUpdate`, {
...this.articInfo,
coverFile: {
id: this.articInfo.coverFile[0].id
},
type: 0,
id: this.$route.query.id,
status: status
}).then(res => {
if (res.code == 0) {
this.$message.success(msg);
this.$emit("goBack");
}
})
},
/**
* 根据id查询详情
*/
getDetail() {
let {id} = this.$route.query
id && this.instance.post(`/app/appnewscenterinfo/queryDetailById`, null, {
params: {id}
}).then(res => {
if (res?.data) {
this.articInfo = res.data
this.articInfo.areaId = res.data.areaId
this.articInfo.title = res.data.title;
this.articInfo.content = res.data.content;
this.articInfo.policyType = res.data.policyType
this.articInfo.coverFile = [{...res.data.coverFile, url: res.data.coverFile.accessUrl}];
}
})
}
},
created() {
if (this.isEdit) {
this.getDetail();
}
}
}
</script>
<style lang="scss" scoped>
.add-article {
height: 100%;
overflow: auto;
background: #F3F6F9;
.footer_btn {
width: 106px;
}
}
</style>

View File

@@ -1,262 +0,0 @@
<template>
<ai-detail class="add-video">
<template slot="title">
<ai-title :title="isEdit?'编辑视频':'发布视频'" :isShowBack="true" :isShowBottomBorder="true"
@onBackClick="$emit('goBack')"></ai-title>
</template>
<template slot="content">
<ai-card title="发布视频">
<template #content>
<el-form ref="ruleForm" :model="newsInfo" :rules="rules" label-width="120px" label-position="right">
<el-form-item prop="title" label="标题:">
<el-input v-model="newsInfo.title" size="small" placeholder="请输入…" maxlength="30"
show-word-limit></el-input>
</el-form-item>
<el-form-item prop="policyType" label="类型:">
<ai-select
v-model="newsInfo.policyType"
placeholder="选择新闻类型"
:selectList="$dict.getDict('newsCenterPolicyType')">
</ai-select>
</el-form-item>
<el-form-item label="发布地区:" prop="areaId">
<ai-area-get v-model="newsInfo.areaId" :instance="instance" :root="areaId"/>
</el-form-item>
<el-form-item prop="videoFile" label="视频:">
<el-upload :show-file-list="false" ref="upload1"
action :http-request="submitUpload" :accept="accept" :limit="1">
<div class="video" v-if="!newsInfo.videoFile.length">
<div class="icon">
<ai-icon type="svg" icon="iconVideo"/>
<span>上传视频</span>
</div>
<span class="tips">支持mp4格式单个文件最大100MB</span>
</div>
</el-upload>
<video class="video-com" style="width:100%; height:100%; object-fit: fill;" muted
:src="newsInfo.videoFile[0].url" controls="controls" v-if="newsInfo.videoFile.length"></video>
<el-upload :show-file-list="false" ref="upload2" action :http-request="submitUpload" :accept="accept"
:limit="1" v-if="newsInfo.videoFile.length">
<el-button style="margin-top: 10px;">重新选择</el-button>
</el-upload>
</el-form-item>
<el-form-item prop="coverFile" label="封面:">
<ai-uploader :instance="instance" v-model="newsInfo.coverFile" :limit="1"
@change="$refs['ruleForm'].clearValidate('coverFile')" :cropOps="cropOps" is-crop>
<template slot="tips">图片比例1.81</template>
</ai-uploader>
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template slot="footer">
<el-button class="footer_btn" @click="$emit('goBack')">取消</el-button>
<el-button type="primary" class="footer_btn" @click="handleSubmit('1')" v-if="!isEdit">发布</el-button>
<el-button class="footer_btn" @click="handleSubmit('0')">保存</el-button>
</template>
</ai-detail>
</template>
<script>
import mp4box from 'mp4box'
export default {
name: "addVideo",
props: {
instance: Function,
dict: Object,
permissions: Function,
areaId: String,
detail: Object,
},
data() {
return {
newsInfo: {
areaId: '',
title: "",
policyType: '',
videoFile: [],
coverFile: []
},
accept: ".mp4",
rules: {
title: {required: true, message: '请输入标题', trigger: 'blur'},
areaId: {required: true, message: '请选择 发布地区', trigger: 'blur'},
policyType: {required: true, message: '请选择类型', trigger: 'change'},
videoFile: {required: true, message: '请上传视频', trigger: 'blur'},
coverFile: {required: true, message: '请上传封面', trigger: 'blur'},
},
cropOps: {
width: "320px",
height: "180px"
},
}
},
computed: {
isEdit() {
return !!this.$route.query.id;
}
},
methods: {
handleSubmit(status) {
this.$refs["ruleForm"].validate(valid => {
if (valid) {
this.addOrUpdate(status);
}
})
},
/**
* 上传视频
*/
submitUpload(file) {
this.$refs['upload1']?.clearFiles();
this.$refs['upload2']?.clearFiles();
this.$refs['ruleForm']?.clearValidate('videoFile');
const fileType = file.file.name.split(".")[1];
const size = file.file.size / 1024 / 1024 > 100;
let mp4boxfile = mp4box.createFile();
const reader = new FileReader();
reader.readAsArrayBuffer(file.file);
reader.onload = (e) => {
const arrayBuffer = e.target.result;
arrayBuffer.fileStart = 0;
mp4boxfile.appendBuffer(arrayBuffer);
};
mp4boxfile.onReady = (info) => {
let codec = info.mime.match(/codecs="(\S*),/)[1]
if (codec.indexOf('avc') === -1) {
return this.$message.error("视频编码格式不支持")
}
if (size) {
return this.$message.error("视频大小不能超过100M");
}
if (fileType && this.accept.indexOf(fileType.toLocaleLowerCase()) > -1) {
let formData = new FormData()
formData.append('file', file.file);
this.instance.post(`/admin/file/add-unlimited`, formData).then(res => {
if (res && res.data) {
let videoList = res.data[0].split(";");
this.newsInfo.videoFile.splice(0, 1, {
id: videoList[1],
url: videoList[0]
})
}
})
} else {
return this.$message.error("视频格式错误");
}
};
},
addOrUpdate(status) {
const msg = +status ? '发布成功' : this.isEdit ? '编辑成功' : '保存成功';
this.instance.post(`/app/appnewscenterinfo/addOrUpdate`, {
title: this.newsInfo.title,
videoFile: {
id: this.newsInfo.videoFile[0].id
},
coverFile: {
id: this.newsInfo.coverFile[0].id
},
policyType: this.newsInfo.policyType,
areaId: this.areaId,
type: 1,
id: this.detail.id,
status: this.isEdit ? this.detail.status : status
}).then(res => {
if (res.code == 0) {
this.$message.success(msg);
this.$emit("goBack");
}
})
},
getDetail() {
let {id} = this.$route.query
this.instance.post(`/app/appnewscenterinfo/queryDetailById`, null, {
params: {id}
}).then(res => {
if (res?.data) {
this.newsInfo.areaId = res.data.areaId
this.newsInfo.title = res.data.title;
this.newsInfo.policyType = res.data.policyType
this.newsInfo.videoFile = [{...res.data.videoFile, url: res.data.videoFile.accessUrl}];
this.newsInfo.coverFile = [{...res.data.coverFile, url: res.data.coverFile.accessUrl}];
}
})
}
},
created() {
if (this.isEdit) {
this.getDetail();
}
}
}
</script>
<style lang="scss" scoped>
.add-video {
height: 100%;
overflow: auto;
.video {
width: 640px;
height: 360px;
border-radius: 4px;
border: 1px dashed #D0D4DC;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
span:nth-child(2) {
display: inline-block;
font-size: 16px;
color: #333333;
line-height: 30px;
}
.iconfont {
display: inline-block;
font-size: 40px;
color: #2266FF;
}
}
.tips {
display: inline-block;
font-size: 12px;
color: #999999;
line-height: 26px;
}
}
.video-com {
width: 640px;
height: 360px;
background: rgba(0, 0, 0, 0.5);
border-radius: 2px;
border: 1px solid #D0D4DC;
margin-top: -40px;
}
:deep( .AiIcon ){
width: 38px;
height: 38px;
}
.footer_btn {
width: 106px;
}
}
</style>

View File

@@ -1,123 +0,0 @@
<template>
<ai-list class="comment-list" isTabs>
<template slot="content">
<ai-search-bar>
<template slot="right">
<el-input
v-model="searchObj.title"
size="small"
placeholder="搜索内容/用户"
clearable
v-throttle="() => {page.current = 1, getList()}"
@clear="page.current = 1, searchObj.title = '', getList()"
suffix-icon="iconfont iconSearch" />
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
stripe
:total="total"
:current.sync="page.current"
:size.sync="page.size"
style="margin-top: 10px;"
@getList="getList">
<el-table-column slot="options" label="操作" fixed="right" width="120" align="center" >
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" title="删除" :disabled="!permissions('app_appnewscentercomment_del')" @click="handleDelete(row)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import moment from "dayjs"
export default {
name: "commentList",
props: {
instance: Function,
dict: Object,
permissions: Function,
areaId:String
},
data() {
return {
tableData:[],
total:0,
isClick: false,
page:{
current:1,
size:10
},
searchObj:{
title:'',
},
}
},
computed:{
colConfigs () {
return [
{prop: 'title', label: '评论对象',align:'left', width:180},
{prop: 'content', label: '评论内容',width:280},
{prop: 'name', label: '用户',align: "center"},
{prop: 'commentTime', label: '评论时间'},
{slot: 'options', label: '操作'}
]
},
},
methods: {
resetSearch() {
this.searchObj.title = "";
this.getList();
},
handleDelete({id}){
this.$confirm("是否删除?").then(()=>this.deleteComment(id));
},
/**
* 删除评论
*/
deleteComment(id){
this.instance.post(`/app/appnewscentercomment/delete?id=${id}`).then(res=>{
if(res.code==0){
this.$message.success("删除成功");
this.getList();
}
})
},
getList() {
this.instance.post(`/app/appnewscentercomment/list`, null, {
params: {
...this.page,
...this.searchObj,
areaId: this.areaId
}
}).then(res => {
if (res && res.data) {
this.tableData = res.data.records.map(e=>{
return{
...e,
commentTime:moment(e.commentTime).format("YYYY-MM-DD HH:mm")
}
});
this.total = res.data.total;
}
})
},
},
mounted(){
this.getList();
}
}
</script>
<style lang="scss" scoped>
.comment-list{
height: 100%;
overflow: auto;
background: #f3f6f9;
}
</style>

View File

@@ -1,6 +0,0 @@
export {default as newsList} from "./newsList";
export {default as commentList} from "./commentList";
export {default as addVideo} from "./addVideo";
export {default as addArticle} from "./addArticle";
export {default as newsDetail} from "./newsDetail";
export {default as videoDetail} from "./videoDetail";

View File

@@ -1,143 +0,0 @@
<template>
<ai-detail class="news-detail">
<template slot="title">
<ai-title title="新闻文章详情" isShowBack isShowBottomBorder @onBackClick="$emit('goBack')"></ai-title>
</template>
<template slot="content">
<ai-card titlePosition="center">
<template #title>
<h2>{{ detail.title }}</h2>
<p class="subTitle">类型{{ dict.getLabel('newsCenterPolicyType', +detail.policyType) }}</p>
</template>
<template slot="right">
<el-button type="text" size="small" icon="iconfont iconEdit" @click="handleEdit">修改</el-button>
</template>
<template #content>
<ai-article :value="detail.content"></ai-article>
</template>
</ai-card>
<ai-card title="封面信息">
<template #content>
<div class="content">
<div class="img">
<span>封面</span>
<img v-if="detail.coverFile" :src="detail.coverFile.url" alt="" v-viewer>
</div>
</div>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
import Viewer from 'v-viewer';
import Vue from 'vue';
Vue.use(Viewer);
export default {
name: "newsDetail",
props: {
instance: Function,
dict: Object,
},
data() {
return {
detail: {},
}
},
methods: {
/**
* 修改
* */
handleEdit() {
this.$emit("goPage", {key: "addArticle", row: this.detail});
},
/**
* 根据id查询详情
*/
getDetail() {
let {id} = this.$route.query
id && this.instance.post(`/app/appnewscenterinfo/queryDetailById`, null, {
params: {id}
}).then(res => {
if (res?.data) {
this.detail = res.data;
}
})
}
},
created() {
this.getDetail();
}
}
</script>
<style lang="scss" scoped>
.news-detail {
height: 100%;
overflow: auto;
:deep( .ai-detail__content ){
background: #F3F6F9 !important;
}
.content {
height: 100%;
width: 100%;
position: relative;
label {
display: flex;
align-items: center;
justify-content: center;
border-bottom: 1px solid #eee;
margin-bottom: 24px;
p {
font-size: 16px;
color: #333333;
line-height: 21px;
box-sizing: border-box;
padding-bottom: 24px;
text-align: center;
}
.iconfont {
font-size: 14px;
color: #5088FF;
line-height: 16px;
text-align: right;
position: absolute;
right: 16px;
top: 16px;
}
}
.title {
font-size: 16px;
color: #333333;
line-height: 21px;
border-bottom: 1px solid #eee;
padding-bottom: 24px;
margin-bottom: 17px;
}
.img {
display: flex;
span {
font-size: 14px;
color: #999999;
line-height: 19px;
}
img {
width: 319px;
height: 179px;
border-radius: 1px;
}
}
}
}
</style>

View File

@@ -1,278 +0,0 @@
<template>
<ai-list class="news-list" isTabs>
<template slot="content">
<ai-search-bar>
<template slot="left">
<ai-select
v-model="searchObj.type"
@change="page.current = 1, getList()"
placeholder="选择新闻类别"
:selectList="$dict.getDict('newsCenterType')">
</ai-select>
</template>
<template slot="right">
<el-input
v-model="searchObj.title"
size="small"
placeholder="搜索标题/发布地区"
clearable
v-throttle="() => {page.current = 1, getList()}"
@clear="page.current = 1, searchObj.title = '', getList()"
suffix-icon="iconfont iconSearch"/>
</template>
</ai-search-bar>
<ai-search-bar>
<template slot="left">
<el-dropdown @visible-change="v=>isClick=v" @command="addNews"
v-if="permissions('app_appnewscenterinfo_edit')">
<el-button type="primary" icon="iconfont iconAdd" size="small">发布新闻
<i class="el-icon--right" :class="dropIcon"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="video">发布视频</el-dropdown-item>
<el-dropdown-item command="article">发布文章</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
stripe
:current.sync="page.current"
:size.sync="page.size"
@getList="getList">
<el-table-column slot="title" label="标题" width="280" align="left" show-overflow-tooltip>
<template slot-scope="{ row }">
<span style="color: #2266FF;margin-right:40px;" v-if="row.isTop == 1">[置顶]</span>
<span>{{ row.title }}</span>
</template>
</el-table-column>
<el-table-column slot="options" label="操作" fixed="right" width="260" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" title="取消置顶" v-if="row.isTop==1" @click="setTop(row)">取消置顶</el-button>
<el-button type="text" title="置顶" v-else @click="setTop(row)">置顶</el-button>
<el-button type="text" title="取消发布" v-if="+row.status" @click="changeStatus(row)">取消发布</el-button>
<el-button type="text" v-else title="发布" @click="changeStatus(row)">发布</el-button>
<el-button type="text" title="查看" @click="hangeleDetail(row)"
:disabled="!permissions('app_appnewscenterinfo_detail')">查看
</el-button>
<el-button type="text" title="编辑" @click="handleEdit(row)"
:disabled="!permissions('app_appnewscenterinfo_edit')">编辑
</el-button>
<el-button type="text" title="删除" @click="handleDelete(row)"
:disabled="!permissions('app_appnewscenterinfo_del')">删除
</el-button>
<el-button type="text" title="分享" @click="handleCopyShare(row)">小程序链接</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import moment from "dayjs"
export default {
name: "newsList",
props: {
instance: Function,
dict: Object,
permissions: Function,
areaId: String
},
data() {
return {
tableData: [],
total: 0,
isClick: false,
page: {
current: 1,
size: 10
},
searchObj: {
title: '',
type: ''
},
}
},
computed: {
colConfigs() {
return [
{slot: 'title', label: '标题', width: 280},
{
prop: 'type', label: '类别', align: 'center',
render: (h, {row}) => {
return h('span', null, this.dict.getLabel('newsCenterType', +row.type))
}
},
{
prop: 'policyType', label: '类型', align: 'center',
render: (h, {row}) => {
return h('span', null, this.dict.getLabel('newsCenterPolicyType', +row.policyType))
}
},
{
prop: 'viewCount', label: '浏览/播放量', align: "center",
render: (h, {row}) => {
return h('span', null, row.viewCount >= 10000 ? ((row.viewCount / 10000).toFixed(2) + '万') : row.viewCount)
}
},
{prop: 'msgCount', label: '评论数', align: "center"},
{prop: 'areaName', label: '发布地区', align: 'center'},
{prop: 'createTime', label: '发布时间'},
{
prop: 'status', label: '发布状态', align: 'center',
render: (h, {row}) => {
return h('span', {
style: {
color: row.status ? this.$dict.getColor('newsCenterStatus', row.status) : 'auto'
}
}, this.$dict.getLabel('newsCenterStatus', row.status))
}
},
{slot: 'options', label: '操作'}
]
},
dropIcon() {
return this.isClick ? 'el-icon-arrow-up' : 'el-icon-arrow-down'
},
},
methods: {
/**
* 查看详情
* */
hangeleDetail(row) {
if (+row.type) {
this.$emit("goPage", {key: "videoDetail", row});
} else {
this.$emit("goPage", {key: "newsDetail", row});
}
},
/**
* 编辑
* */
handleEdit(row) {
if (+row.type) {
this.$emit("goPage", {key: "addVideo", row});
} else {
this.$emit("goPage", {key: "addArticle", row});
}
},
/**
* 修改新闻中心状态-发布、取消发布
* */
changeStatus(row) {
const msg = +row.status ? "是否取消发布" : "是否发布";
this.$confirm(msg).then(() => this.changeInfo(row));
},
/**
* 置顶新闻
* */
setTop(row) {
const msg = !row.topping ? "是否要置顶" : "是否要取消置顶"
this.$confirm(msg).then(() => this.setTopInfo(row));
},
/**
* 删除新闻
* */
handleDelete({id}) {
this.$confirm("是否要删除").then(() => this.deleteInfo(id));
},
resetSearch() {
this.searchObj.title = "";
this.searchObj.type = "";
this.getList();
},
/**
* 添加新闻、视频
* */
addNews(command) {
switch (command) {
case "video":
this.$emit('goPage', {key: "addVideo"});
break;
case "article":
this.$emit('goPage', {key: "addArticle"});
break;
}
},
/**
* 修改发布状态
* */
changeInfo({id, status}) {
const msg = +status ? "取消发布成功" : "发布成功";
status = +status ? 0 : 1;
this.instance.post(`/app/appnewscenterinfo/release?id=${id}&status=${status}`).then(() => {
this.$message.success(msg);
this.getList();
})
},
/**
* 置顶新闻
* */
setTopInfo(row) {
const msg = !row.topping ? "置顶成功" : "取消置顶成功";
this.instance.post(`/app/appnewscenterinfo/topping?id=${row.id}&areaId=${this.areaId}`).then(() => {
this.$message.success(msg);
this.getList();
})
},
/**
* 删除新闻
* @param id
*/
deleteInfo(id) {
this.instance.post(`/app/appnewscenterinfo/delete?ids=${id}`).then(() => {
this.$message.success("删除成功");
this.getList();
})
},
getList() {
this.instance.post(`/app/appnewscenterinfo/list`, null, {
params: {
...this.page,
...this.searchObj,
areaId: this.areaId
}
}).then(res => {
if (res && res.data) {
this.tableData = res.data.records.map(e => {
return {
...e,
createTime: +e.status ? moment(e.createTime).format("YYYY-MM-DD HH:mm") : ''
}
});
this.total = res.data.total;
}
})
},
handleCopyShare(row) {
navigator.clipboard.writeText(`/subPages/live/newsDetail?id=${row.id}`)
this.$message.success("小程序链接已复制!")
}
},
created() {
this.dict.load('newsCenterType', 'newsCenterStatus', 'newsCenterPolicyType').then(() => this.getList());
},
}
</script>
<style lang="scss" scoped>
.news-list {
height: 100%;
overflow: auto;
background: #f3f6f9;
:deep(.has-gutter th:nth-child(1) div ){
margin-left: 40px;
}
}
</style>

View File

@@ -1,90 +0,0 @@
<template>
<ai-detail class="video-detail">
<template slot="title">
<ai-title title="视频新闻详情" isShowBack isShowBottomBorder @onBackClick="$emit('goBack')"/>
</template>
<template slot="content">
<ai-card title="视频信息">
<template slot="right">
<el-button type="text" icon="iconfont iconEdit" @click="handleEdit">修改</el-button>
</template>
<template #content>
<ai-wrapper
:columnsNumber="1">
<ai-info-item label="标题:" :value="detail.title"></ai-info-item>
<ai-info-item label="类型:"
:value="dict.getLabel('newsCenterPolicyType', + detail.policyType)"></ai-info-item>
<ai-info-item label="视频:" isLine>
<video :src="detail.videoFile && detail.videoFile.url"
style="width: 100%; height:100%; object-fit: fill;" muted controls="controls"></video>
</ai-info-item>
<ai-info-item label="封面:" isLine v-viewer>
<img :src="detail.videoFile && detail.coverFile.url" alt="">
</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
import Viewer from 'v-viewer';
export default {
name: "videoDetail",
components: {Viewer},
props: {
instance: Function,
dict: Object,
},
data() {
return {
detail: {}
}
},
methods: {
handleEdit() {
this.$emit("goPage", {key: "addVideo", row: this.detail});
},
/**
* 根据id查询详情
*/
getDetail() {
let {id} = this.$route.query
this.instance.post(`/app/appnewscenterinfo/queryDetailById`, null, {
params: {id}
}).then(res => {
if (res?.data) {
this.detail = res.data;
}
})
}
},
created() {
this.getDetail();
}
}
</script>
<style lang="scss" scoped>
.video-detail {
height: 100%;
overflow: hidden;
video {
width: 640px;
height: 360px;
background: rgba(0, 0, 0, 0.5);
border-radius: 2px;
border: 1px solid #D0D4DC;
}
img {
width: 319px;
height: 179px;
border-radius: 1px;
}
}
</style>