|
|
|
@ -1,6 +1,7 @@ |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<base-page ref="basePage" |
|
|
|
<base-page |
|
|
|
ref="basePage" |
|
|
|
:searchParams="searchParams" |
|
|
|
:tableParams="tableParams" |
|
|
|
:tableUrl="tableUrl" |
|
|
|
@ -18,54 +19,124 @@ |
|
|
|
:editElseRules="editElseRules" |
|
|
|
:editConfig="editConfig" |
|
|
|
:editParamsDiv="5" |
|
|
|
:editBtnName="(item) => (!item.latitude ? '待完善' : '修改')" |
|
|
|
:editBtnName="(item) => '修改'" |
|
|
|
:formBtnFixed="true" |
|
|
|
idName="articleId"> |
|
|
|
idName="articleId" |
|
|
|
> |
|
|
|
<template v-slot:editOperateSup="{ id, formType, info }"> |
|
|
|
<el-button v-if="formType != 'watch'" |
|
|
|
<el-button |
|
|
|
v-if="formType == 'add'" |
|
|
|
type="warning" |
|
|
|
size="small" |
|
|
|
:disabled="draftBtnDisable" |
|
|
|
@click="handleClickDraft(info)">存草稿</el-button> |
|
|
|
@click="handleClickDraft(info)" |
|
|
|
>存草稿</el-button |
|
|
|
> |
|
|
|
</template> |
|
|
|
|
|
|
|
<template v-slot:listBtnSup="{ item }"> |
|
|
|
<el-button v-if=" |
|
|
|
<el-button |
|
|
|
v-if=" |
|
|
|
item.statusFlag == 'published' && |
|
|
|
item.agencyId == $store.state.user.agencyId |
|
|
|
" |
|
|
|
@click="handleOfflineShow(item)" |
|
|
|
type="text" |
|
|
|
size="small" |
|
|
|
style="color: #666">下线</el-button> |
|
|
|
style="color: #666" |
|
|
|
>下线</el-button |
|
|
|
> |
|
|
|
</template> |
|
|
|
|
|
|
|
<template v-slot:listBtnbefore="{ item }"> |
|
|
|
<el-button v-if="item.isTop == '1'" |
|
|
|
@click="handleTopArticle(item,'cancel_top')" |
|
|
|
<el-button |
|
|
|
v-if="item.isTop == '1'" |
|
|
|
@click="handleCancleTopArticle(item, 'cancel_top')" |
|
|
|
type="text" |
|
|
|
size="small" |
|
|
|
style="color: #fe6252">取消置顶</el-button> |
|
|
|
<el-button v-else |
|
|
|
style="color: #fe6252" |
|
|
|
>取消置顶</el-button |
|
|
|
> |
|
|
|
<el-button |
|
|
|
v-else |
|
|
|
@click="handleTopArticle(item, 'top')" |
|
|
|
type="text" |
|
|
|
size="small" |
|
|
|
style="color: #22c1c3">置顶</el-button> |
|
|
|
style="color: #22c1c3" |
|
|
|
>置顶</el-button |
|
|
|
> |
|
|
|
</template> |
|
|
|
|
|
|
|
</base-page> |
|
|
|
|
|
|
|
<el-dialog :visible.sync="offlineShowed" |
|
|
|
<el-dialog |
|
|
|
:visible.sync="offlineShowed" |
|
|
|
:close-on-click-modal="false" |
|
|
|
:close-on-press-escape="false" |
|
|
|
title="下线" |
|
|
|
width="850px" |
|
|
|
top="5vh" |
|
|
|
class="dialog-h" |
|
|
|
@closed="offlineShowed = false"> |
|
|
|
<offline ref="offlineForm" |
|
|
|
@closed="offlineShowed = false" |
|
|
|
> |
|
|
|
<offline |
|
|
|
ref="offlineForm" |
|
|
|
@close="offlineShowed = false" |
|
|
|
@afterOffline="handleOfflineSuccess"></offline> |
|
|
|
@afterOffline="handleOfflineSuccess" |
|
|
|
></offline> |
|
|
|
</el-dialog> |
|
|
|
<el-dialog |
|
|
|
:visible.sync="showAddImage" |
|
|
|
:close-on-click-modal="false" |
|
|
|
:close-on-press-escape="false" |
|
|
|
title="上传封面图片" |
|
|
|
width="650px" |
|
|
|
top="5vh" |
|
|
|
class="dialog-h" |
|
|
|
@closed="showAddImage = false" |
|
|
|
> |
|
|
|
<div class="dialog-h-content scroll-h"> |
|
|
|
<!-- <span>请先上 传封面图片</span> --> |
|
|
|
<el-form |
|
|
|
ref="ref_form" |
|
|
|
:inline="true" |
|
|
|
:model="formData" |
|
|
|
class="div_form" |
|
|
|
> |
|
|
|
<div class="form_flex"> |
|
|
|
<div class="form_item"> |
|
|
|
<el-form-item |
|
|
|
label="" |
|
|
|
prop="selImgUrl" |
|
|
|
label-width="150px" |
|
|
|
style="display: block" |
|
|
|
> |
|
|
|
<el-upload |
|
|
|
:headers="$getElUploadHeaders()" |
|
|
|
:class="['avatar-uploader', { hide: hideUploadBtn }]" |
|
|
|
ref="uploadPic" |
|
|
|
:action="uploadUlr" |
|
|
|
list-type="picture-card" |
|
|
|
:on-exceed="exceedPic" |
|
|
|
:before-upload="beforeAvatarUpload" |
|
|
|
:on-remove="removePic" |
|
|
|
:file-list="replayImgList" |
|
|
|
:on-change="handleEditChange" |
|
|
|
:on-success="handleSuccess" |
|
|
|
:limit="1" |
|
|
|
> |
|
|
|
<span class="font-14">选择图片</span> |
|
|
|
</el-upload> |
|
|
|
</el-form-item> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
|
</div> |
|
|
|
<div class="div_btn"> |
|
|
|
<el-button size="small" @click="showAddImage = false">取 消</el-button> |
|
|
|
<el-button size="small" type="primary" @click="handleAddImage" |
|
|
|
>确 定</el-button |
|
|
|
> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
@ -195,14 +266,14 @@ export default { |
|
|
|
exportUrl: "", |
|
|
|
|
|
|
|
addUrl: "/gov/voice/article/addOrSaveDraft", |
|
|
|
editUrl: "", |
|
|
|
editUrl: "/gov/voice/article/updateArticle", |
|
|
|
infoUrl: "/gov/voice/article/detailV2", |
|
|
|
delUrl: "", |
|
|
|
delUrl: "/gov/voice/article/delete批量", |
|
|
|
editAuth(item) { |
|
|
|
return false; |
|
|
|
return item.statusFlagName == "已发布"; |
|
|
|
}, |
|
|
|
delAuth(item) { |
|
|
|
return false; |
|
|
|
return item.statusFlagName == "已下线"; |
|
|
|
}, |
|
|
|
|
|
|
|
editParams: [ |
|
|
|
@ -475,6 +546,15 @@ export default { |
|
|
|
return true; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
formData: {}, |
|
|
|
showAddImage: false, |
|
|
|
uploadUlr: window.SITE_CONFIG["apiURL"] + "/oss/file/uploadvariedfile", |
|
|
|
replayImgList: [], |
|
|
|
hideUploadBtn: false, |
|
|
|
selType: "top", |
|
|
|
selArticleId: "", |
|
|
|
selImgUrl: "", |
|
|
|
}; |
|
|
|
}, |
|
|
|
components: { basePage, offline }, |
|
|
|
@ -491,24 +571,99 @@ export default { |
|
|
|
this.$refs.offlineForm.initForm(item); |
|
|
|
}, |
|
|
|
|
|
|
|
async handleAddImage() { |
|
|
|
console.log("formData", this.formData); |
|
|
|
this.topArticle(); |
|
|
|
}, |
|
|
|
async handleCancleTopArticle(item, type) { |
|
|
|
this.selType = type; |
|
|
|
this.selArticleId = item.articleId; |
|
|
|
await this.topArticle(); |
|
|
|
}, |
|
|
|
|
|
|
|
async handleTopArticle(item, type) { |
|
|
|
this.selType = type; |
|
|
|
this.selArticleId = item.articleId; |
|
|
|
|
|
|
|
const url = "/gov/voice/article/topArticle"; |
|
|
|
let hasImage = await this.isHasImage(); |
|
|
|
|
|
|
|
if (hasImage === "refrsh") { |
|
|
|
this.$message.error("请求失败,请重新尝试"); |
|
|
|
} else if (hasImage === "no") { |
|
|
|
// this.$message.info("请先上传封面图片"); |
|
|
|
this.showAddImage = true; |
|
|
|
} else { |
|
|
|
await this.topArticle(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
async isHasImage() { |
|
|
|
const url = "/gov/voice/article/detailV2"; |
|
|
|
const { tableData } = this; |
|
|
|
|
|
|
|
const { data, code, msg } = await requestPost(url, { |
|
|
|
articleId: item.articleId, |
|
|
|
type: type |
|
|
|
articleId: this.selArticleId, |
|
|
|
}); |
|
|
|
|
|
|
|
if (code === 0) { |
|
|
|
// this.formData = data |
|
|
|
if (data.imgUrl) { |
|
|
|
return "has"; |
|
|
|
} else { |
|
|
|
return "no"; |
|
|
|
} |
|
|
|
} else { |
|
|
|
return "refrsh"; |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
async topArticle() { |
|
|
|
const url = "/gov/voice/article/topArticle"; |
|
|
|
const { tableData } = this; |
|
|
|
let params = { |
|
|
|
articleId: this.selArticleId, |
|
|
|
type: this.selType, |
|
|
|
}; |
|
|
|
if (this.selImgUrl) { |
|
|
|
params.imgUrl = this.selImgUrl; |
|
|
|
} |
|
|
|
const { data, code, msg } = await requestPost(url, params); |
|
|
|
|
|
|
|
if (code === 0) { |
|
|
|
this.$message.success("操作成功!"); |
|
|
|
this.showAddImage = false; |
|
|
|
this.$refs.basePage.refresh(); |
|
|
|
} else { |
|
|
|
this.$message.success("操作失败!"); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
removePic(file, fileList) { |
|
|
|
this.selImgUrl = ""; |
|
|
|
this.replayImgList = []; |
|
|
|
this.hideUploadBtn = fileList.length >= 1; |
|
|
|
}, |
|
|
|
// 最多上传3张图,超过时隐藏上传按钮 |
|
|
|
handleEditChange(file, fileList) { |
|
|
|
this.hideUploadBtn = fileList.length >= 1; |
|
|
|
}, |
|
|
|
exceedPic() { |
|
|
|
this.$message.warning("只能上传1张封面图"); |
|
|
|
}, |
|
|
|
beforeAvatarUpload(file) { |
|
|
|
const isJPG = file.type === "image/jpeg"; |
|
|
|
const isLt2M = file.size / 1024 / 1024 < 10; |
|
|
|
|
|
|
|
if (!isLt2M) { |
|
|
|
this.$message.error("上传图片大小不能超过 10MB!"); |
|
|
|
} |
|
|
|
return isLt2M; |
|
|
|
}, |
|
|
|
handleSuccess(response, file, fileList) { |
|
|
|
this.replayImgList.push(file); |
|
|
|
this.selImgUrl = response.data.url; |
|
|
|
}, |
|
|
|
|
|
|
|
handleOfflineSuccess() { |
|
|
|
this.$refs.basePage.refresh(); |
|
|
|
this.offlineShowed = false; |
|
|
|
@ -541,4 +696,18 @@ export default { |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped></style> |
|
|
|
<style lang="scss" scoped> |
|
|
|
@import "@/assets/scss/modules/management/form-main.scss"; |
|
|
|
|
|
|
|
.avatar-uploader { |
|
|
|
margin: 0 0 0 20px; |
|
|
|
} |
|
|
|
</style> |
|
|
|
|
|
|
|
<style lang="scss"> |
|
|
|
.hide { |
|
|
|
.el-upload--picture-card { |
|
|
|
display: none !important; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|
|