Browse Source

Merge branch 'dev-临时bug'

V1.0
dai 3 years ago
parent
commit
af720945c2
  1. 4
      package.json
  2. 25
      src/views/components/tinymce2/index.vue
  3. 144
      src/views/modules/communityParty/article/index.vue
  4. 11
      src/views/modules/cpts/base/index.vue

4
package.json

@ -59,7 +59,7 @@
}, },
"devDependencies": { "devDependencies": {
"@antv/f2": "^3.8.10-beta.1", "@antv/f2": "^3.8.10-beta.1",
"@tinymce/tinymce-vue": "^3.2.8", "@tinymce/tinymce-vue": "3.2.8",
"@vue/cli-plugin-babel": "^3.10.0", "@vue/cli-plugin-babel": "^3.10.0",
"@vue/cli-plugin-eslint": "^3.10.0", "@vue/cli-plugin-eslint": "^3.10.0",
"@vue/cli-service": "^3.10.0", "@vue/cli-service": "^3.10.0",
@ -70,7 +70,7 @@
"ol": "^6.9.0", "ol": "^6.9.0",
"sass-loader": "^7.3.1", "sass-loader": "^7.3.1",
"script-loader": "^0.7.2", "script-loader": "^0.7.2",
"tinymce": "^5.8.2", "tinymce": "5.8.2",
"vue-template-compiler": "^2.6.11" "vue-template-compiler": "^2.6.11"
}, },
"eslintConfig": { "eslintConfig": {

25
src/views/components/tinymce2/index.vue

@ -87,11 +87,12 @@ export default {
toolbar_mode: "none", toolbar_mode: "none",
toolbar_drawer: "sliding", toolbar_drawer: "sliding",
toolbar_mode: "sliding", toolbar_mode: "sliding",
outputFormat: 'p', outputFormat: "p",
plugins: plugins:
"wordcount visualchars visualblocks toc textpattern template tabfocus spellchecker searchreplace save quickbars print preview paste pagebreak noneditable nonbreaking media insertdatetime importcss imagetools image hr help fullscreen fullpage directionality codesample code charmap link code table lists advlist anchor autolink autoresize autosave", // import "wordcount visualchars visualblocks toc textpattern template tabfocus spellchecker searchreplace save quickbars print preview paste pagebreak noneditable nonbreaking media insertdatetime importcss imagetools image hr help fullscreen fullpage directionality codesample code charmap link code table lists advlist anchor autolink autoresize autosave", // import
toolbar: toolbar:
"formats undo redo paste print fontsizeselect fontselect template fullpage|wordcount ltr rtl visualchars visualblocks toc spellchecker searchreplace|save preview pagebreak nonbreaking|media image|outdent indent aligncenter alignleft alignright alignjustify lineheight underline quicklink h2 h3 blockquote numlist bullist table removeformat forecolor backcolor bold italic strikethrough hr charmap link insertdatetime|subscript superscript cut codesample code |anchor preview fullscreen|help", // "formats undo redo paste print fontsizeselect fontselect template fullpage|wordcount ltr rtl visualchars visualblocks toc spellchecker searchreplace|save preview pagebreak nonbreaking|media image|outdent indent aligncenter alignleft alignright alignjustify lineheight underline quicklink h2 h3 blockquote numlist bullist table removeformat forecolor backcolor bold italic strikethrough hr charmap link insertdatetime|subscript superscript cut codesample code |anchor preview fullscreen|help",
"formats undo redo|fontsizeselect|fontselect|forecolor backcolor bold italic underline strikethrough removeformat|image media link|outdent indent|aligncenter alignleft alignright alignjustify lineheight quicklink h2 h3 blockquote numlist bullist table|subscript superscript codesample code|preview fullscreen|wordcount|help",
content_style: "p {margin: 5px 0; font-size: 14px}", content_style: "p {margin: 5px 0; font-size: 14px}",
fontsize_formats: "12px 14px 16px 18px 24px 36px 48px 56px 72px", fontsize_formats: "12px 14px 16px 18px 24px 36px 48px 56px 72px",
font_formats: font_formats:
@ -171,17 +172,16 @@ export default {
if (editor && val !== prevVal && val !== editor.getContent()) { if (editor && val !== prevVal && val !== editor.getContent()) {
if (typeof val !== "string") val = val.toString(); if (typeof val !== "string") val = val.toString();
debounceSetContent.call(editor, val); debounceSetContent.call(editor, val);
return return;
} }
// debounceSetContent.call(editor, this.dormatHtml(val)); // debounceSetContent.call(editor, this.dormatHtml(val));
}); });
editor.on("change keyup undo redo", () => { editor.on("change keyup undo redo", () => {
// console.log('editor.getContent()---', editor.getContent({ format : 'p' })) // console.log('editor.getContent()---', editor.getContent({ format : 'p' }))
const c = editor.getContent({ format : 'p' }) const c = editor.getContent({ format: "p" });
this.$emit("input", editor.getContent()); this.$emit("input", editor.getContent());
// debounce(500, this.$emit("input", editor.getContent({ format : 'p' }))); // debounce(500, this.$emit("input", editor.getContent({ format : 'p' })));
;
}); });
editor.on("blur", () => { editor.on("blur", () => {
// console.log('editor.blur--', editor.getContent({ format : 'p' })) // console.log('editor.blur--', editor.getContent({ format : 'p' }))
@ -190,12 +190,12 @@ export default {
}); });
}, },
dormatHtml(content) { dormatHtml(content) {
let c = '' let c = "";
if (content.indexOf('DOCTYPE') != -1) { if (content.indexOf("DOCTYPE") != -1) {
c = content.slice(45, -16); c = content.slice(45, -16);
} }
console.log('content', typeof content) console.log("content", typeof content);
return c || content return c || content;
}, },
getUserToken() { getUserToken() {
return localStorage.getItem("token"); return localStorage.getItem("token");
@ -211,3 +211,10 @@ export default {
}, },
}; };
</script> </script>
<style lang="scss">
//
.tox-tinymce-aux {
z-index: 5000 !important;
}
</style>

144
src/views/modules/communityParty/article/index.vue

@ -1,6 +1,7 @@
<template> <template>
<div> <div>
<base-page ref="basePage" <base-page
ref="basePage"
:searchParams="searchParams" :searchParams="searchParams"
:tableParams="tableParams" :tableParams="tableParams"
:tableUrl="tableUrl" :tableUrl="tableUrl"
@ -18,77 +19,101 @@
:editElseRules="editElseRules" :editElseRules="editElseRules"
:editConfig="editConfig" :editConfig="editConfig"
:editParamsDiv="5" :editParamsDiv="5"
:editBtnName="(item) => (!item.latitude ? '待完善' : '修改')" :editBtnName="(item) => '修改'"
:formBtnFixed="true" :formBtnFixed="true"
idName="articleId"> idName="articleId"
>
<template v-slot:editOperateSup="{ id, formType, info }"> <template v-slot:editOperateSup="{ id, formType, info }">
<el-button v-if="formType != 'watch'" <el-button
v-if="formType == 'add'"
type="warning" type="warning"
size="small" size="small"
:disabled="draftBtnDisable" :disabled="draftBtnDisable"
@click="handleClickDraft(info)">存草稿</el-button> @click="handleClickDraft(info)"
>存草稿</el-button
>
</template> </template>
<template v-slot:listBtnSup="{ item }"> <template v-slot:listBtnSup="{ item }">
<el-button v-if=" <el-button
v-if="
item.statusFlag == 'published' && item.statusFlag == 'published' &&
item.agencyId == $store.state.user.agencyId item.agencyId == $store.state.user.agencyId
" "
@click="handleOfflineShow(item)" @click="handleOfflineShow(item)"
type="text" type="text"
size="small" size="small"
style="color: #666">下线</el-button> style="color: #666"
>下线</el-button
>
</template> </template>
<template v-slot:listBtnbefore="{ item }"> <template v-slot:listBtnbefore="{ item }">
<el-button v-if="item.isTop == '1'" <el-button
v-if="item.isTop == '1'"
v-show="item.statusFlag == 'published'"
@click="handleCancleTopArticle(item, 'cancel_top')" @click="handleCancleTopArticle(item, 'cancel_top')"
type="text" type="text"
size="small" size="small"
style="color: #fe6252">取消置顶</el-button> style="color: #fe6252"
<el-button v-else >取消置顶</el-button
>
<el-button
v-show="item.statusFlag == 'published'"
v-else
@click="handleTopArticle(item, 'top')" @click="handleTopArticle(item, 'top')"
type="text" type="text"
size="small" size="small"
style="color: #22c1c3">置顶</el-button> style="color: #22c1c3"
>置顶</el-button
>
</template> </template>
</base-page> </base-page>
<el-dialog :visible.sync="offlineShowed" <el-dialog
:visible.sync="offlineShowed"
:close-on-click-modal="false" :close-on-click-modal="false"
:close-on-press-escape="false" :close-on-press-escape="false"
title="下线" title="下线"
width="850px" width="850px"
top="5vh" top="5vh"
class="dialog-h" class="dialog-h"
@closed="offlineShowed = false"> @closed="offlineShowed = false"
<offline ref="offlineForm" >
<offline
ref="offlineForm"
@close="offlineShowed = false" @close="offlineShowed = false"
@afterOffline="handleOfflineSuccess"></offline> @afterOffline="handleOfflineSuccess"
></offline>
</el-dialog> </el-dialog>
<el-dialog :visible.sync="showAddImage" <el-dialog
:visible.sync="showAddImage"
:close-on-click-modal="false" :close-on-click-modal="false"
:close-on-press-escape="false" :close-on-press-escape="false"
title="上传封面图片" title="上传封面图片"
width="650px" width="650px"
top="5vh" top="5vh"
class="dialog-h" class="dialog-h"
@closed="showAddImage = false"> @closed="showAddImage = false"
>
<div class="dialog-h-content scroll-h"> <div class="dialog-h-content scroll-h">
<!-- <span>请先上 传封面图片</span> --> <!-- <span>请先上 传封面图片</span> -->
<el-form ref="ref_form" <el-form
ref="ref_form"
:inline="true" :inline="true"
:model="formData" :model="formData"
class="div_form"> class="div_form"
>
<div class="form_flex"> <div class="form_flex">
<div class="form_item"> <div class="form_item">
<el-form-item
<el-form-item label="" label=""
prop="selImgUrl" prop="selImgUrl"
label-width="150px" label-width="150px"
style="display: block"> style="display: block"
<el-upload :headers="$getElUploadHeaders()" >
<el-upload
:headers="$getElUploadHeaders()"
:class="['avatar-uploader', { hide: hideUploadBtn }]" :class="['avatar-uploader', { hide: hideUploadBtn }]"
ref="uploadPic" ref="uploadPic"
:action="uploadUlr" :action="uploadUlr"
@ -99,23 +124,20 @@
:file-list="replayImgList" :file-list="replayImgList"
:on-change="handleEditChange" :on-change="handleEditChange"
:on-success="handleSuccess" :on-success="handleSuccess"
:limit="1"> :limit="1"
>
<span class="font-14">选择图片</span> <span class="font-14">选择图片</span>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
</div> </div>
</div> </div>
</el-form> </el-form>
</div> </div>
<div class="div_btn"> <div class="div_btn">
<el-button size="small" <el-button size="small" @click="showAddImage = false"> </el-button>
@click="showAddImage = false"> </el-button> <el-button size="small" type="primary" @click="handleAddImage"
<el-button size="small" > </el-button
type="primary" >
@click="handleAddImage"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
@ -246,14 +268,14 @@ export default {
exportUrl: "", exportUrl: "",
addUrl: "/gov/voice/article/addOrSaveDraft", addUrl: "/gov/voice/article/addOrSaveDraft",
editUrl: "", editUrl: "/gov/voice/article/updateArticle",
infoUrl: "/gov/voice/article/detailV2", infoUrl: "/gov/voice/article/detailV2",
delUrl: "", delUrl: "/gov/voice/article/delete批量",
editAuth(item) { editAuth(item) {
return false; return item.statusFlagName == "已发布";
}, },
delAuth(item) { delAuth(item) {
return false; return item.statusFlagName == "已下线";
}, },
editParams: [ editParams: [
@ -532,9 +554,9 @@ export default {
uploadUlr: window.SITE_CONFIG["apiURL"] + "/oss/file/uploadvariedfile", uploadUlr: window.SITE_CONFIG["apiURL"] + "/oss/file/uploadvariedfile",
replayImgList: [], replayImgList: [],
hideUploadBtn: false, hideUploadBtn: false,
selType: 'top', selType: "top",
selArticleId: '', selArticleId: "",
selImgUrl: '' selImgUrl: "",
}; };
}, },
components: { basePage, offline }, components: { basePage, offline },
@ -552,32 +574,29 @@ export default {
}, },
async handleAddImage() { async handleAddImage() {
console.log('formData', this.formData) console.log("formData", this.formData);
this.topArticle() this.topArticle();
}, },
async handleCancleTopArticle(item, type) { async handleCancleTopArticle(item, type) {
this.selType = type this.selType = type;
this.selArticleId = item.articleId this.selArticleId = item.articleId;
await this.topArticle() await this.topArticle();
}, },
async handleTopArticle(item, type) { async handleTopArticle(item, type) {
this.selType = type;
this.selArticleId = item.articleId;
this.selType = type let hasImage = await this.isHasImage();
this.selArticleId = item.articleId
let hasImage = await this.isHasImage() if (hasImage === "refrsh") {
if (hasImage === 'refrsh') {
this.$message.error("请求失败,请重新尝试"); this.$message.error("请求失败,请重新尝试");
} else if (hasImage === "no") {
} else if (hasImage === 'no') {
// this.$message.info(""); // this.$message.info("");
this.showAddImage = true this.showAddImage = true;
} else { } else {
await this.topArticle() await this.topArticle();
} }
}, },
async isHasImage() { async isHasImage() {
@ -586,18 +605,17 @@ export default {
const { data, code, msg } = await requestPost(url, { const { data, code, msg } = await requestPost(url, {
articleId: this.selArticleId, articleId: this.selArticleId,
}); });
if (code === 0) { if (code === 0) {
// this.formData = data // this.formData = data
if (data.imgUrl) { if (data.imgUrl) {
return 'has' return "has";
} else { } else {
return 'no' return "no";
} }
} else { } else {
return 'refrsh' return "refrsh";
} }
}, },
@ -606,16 +624,16 @@ export default {
const { tableData } = this; const { tableData } = this;
let params = { let params = {
articleId: this.selArticleId, articleId: this.selArticleId,
type: this.selType type: this.selType,
} };
if (this.selImgUrl) { if (this.selImgUrl) {
params.imgUrl = this.selImgUrl params.imgUrl = this.selImgUrl;
} }
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
this.$message.success("操作成功!"); this.$message.success("操作成功!");
this.showAddImage = false this.showAddImage = false;
this.$refs.basePage.refresh(); this.$refs.basePage.refresh();
} else { } else {
this.$message.success("操作失败!"); this.$message.success("操作失败!");

11
src/views/modules/cpts/base/index.vue

@ -720,13 +720,18 @@ export default {
const { tableData, idName } = this; const { tableData, idName } = this;
const idValue = tableData[rowIndex][idName]; const idValue = tableData[rowIndex][idName];
let param = {
[idName]: idValue,
};
if (url.endsWith("/")) { if (url.endsWith("/")) {
url += idValue; url += idValue;
} }
if (url.endsWith("批量")) {
url = url.slice(0, -2);
param = [idValue];
}
const { data, code, msg } = await requestPost(url, { const { data, code, msg } = await requestPost(url, param);
[idName]: idValue,
});
if (code === 0) { if (code === 0) {
this.$message.success("删除成功!"); this.$message.success("删除成功!");

Loading…
Cancel
Save