提交
This commit is contained in:
@@ -73,7 +73,7 @@
|
||||
</common-word-html-type-setting>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 100%; width: calc(100% - 285px); float: right;height: calc(100% - 20px);; background-color: #e4e9ed">
|
||||
<div style="width: 100%; width: calc(100% - 285px); float: right; height: calc(100% - 0px); background-color: #e4e9ed">
|
||||
<!-- <div class="toolbar">
|
||||
<div class="toolbar_item" @click="handleImageAdd('img')">
|
||||
<img src="@/assets/img/upload.png" style="object-fit: contain" />
|
||||
@@ -98,7 +98,10 @@
|
||||
@editComment="editComment"
|
||||
@loaded="loadedWord"
|
||||
@onEdit="onEdit"
|
||||
@addContent="onAddContent"
|
||||
@changeSort="changeSort"
|
||||
@onDelete="onDelete"
|
||||
@onDeletes="onDeletes"
|
||||
@refresh="onRefresh"
|
||||
@onComment="onComment"
|
||||
@onAddComment="onAddComment"
|
||||
@@ -232,9 +235,10 @@
|
||||
>
|
||||
<el-form ref="editMes" :model="commentForm" label-width="115px">
|
||||
<el-form-item label="Select Content:" v-if="commentForm.content">
|
||||
<p style="background: #eef0f4; line-height: 20px; padding: 10px; box-sizing: border-box" v-html="commentForm.content">
|
||||
|
||||
</p>
|
||||
<p
|
||||
style="background: #eef0f4; line-height: 20px; padding: 10px; box-sizing: border-box"
|
||||
v-html="commentForm.content"
|
||||
></p>
|
||||
</el-form-item>
|
||||
<el-form-item label="Word">
|
||||
<span slot="label">
|
||||
@@ -293,6 +297,40 @@
|
||||
</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
destroy-on-close
|
||||
v-if="addContentVisible"
|
||||
title="Add Content"
|
||||
:visible.sync="addContentVisible"
|
||||
width="1200px"
|
||||
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form ref="editMes" :model="addContent" label-width="115px">
|
||||
<el-form-item label="Word">
|
||||
<span slot="label">
|
||||
<font style="color: #f56c6c; margin-right: 5px">*</font>
|
||||
Content :
|
||||
</span>
|
||||
<common-content
|
||||
:value="addContent.content"
|
||||
@getContent="getContent"
|
||||
v-if="addContentVisible"
|
||||
ref="addContent"
|
||||
|
||||
style="margin-left: -115px"
|
||||
></common-content>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="editVisible = false"> Cancel </el-button>
|
||||
<el-button type="primary" @click="handleSaveAddContent">
|
||||
<!-- <i class="el-icon-finished" style="margin-right: 5px"></i> -->
|
||||
Save
|
||||
</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -400,6 +438,8 @@ export default {
|
||||
ChGtpTxt: ''
|
||||
},
|
||||
txtVisible: false,
|
||||
addContentVisible: false,
|
||||
addContent: {},
|
||||
lineStyle: {},
|
||||
contentStyle: {},
|
||||
lineTable: [],
|
||||
@@ -494,11 +534,13 @@ export default {
|
||||
handleSaveContent() {
|
||||
this.$refs.commonContent.getTinymceContent('content');
|
||||
},
|
||||
handleSaveAddContent() {
|
||||
this.$refs.addContent.getTinymceContent('addcontent');
|
||||
},
|
||||
|
||||
async getContent(type, content) {
|
||||
|
||||
console.log('content at line 539:', content);
|
||||
if (type == 'content') {
|
||||
|
||||
content = content.replace(/<(?!\/?(img|b|i|sub|sup|span|strong|em |blue)\b)[^>]+>/g, '');
|
||||
|
||||
content = content.replace(/\s*style="[^"]*"/g, '');
|
||||
@@ -522,27 +564,41 @@ export default {
|
||||
|
||||
// 获取最终修改后的 HTML
|
||||
content = div.innerHTML;
|
||||
|
||||
|
||||
|
||||
this.saveContent(content, this.currentContent.am_id);
|
||||
} else if (type == 'addcontent') {
|
||||
var hasTable = /<table[\s\S]*?>[\s\S]*?<\/table>/i.test(content);
|
||||
|
||||
if (hasTable) {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: 'Table content is not supported!'
|
||||
});
|
||||
return false
|
||||
}
|
||||
var list = this.$commonJS.cleanAndParseWordContent(content);
|
||||
console.log('list at line 569:', list);
|
||||
|
||||
this.saveContentList(list, this.currentId);
|
||||
} else if (type == 'table') {
|
||||
this.saveTable(content);
|
||||
} else if (type == 'comment') {
|
||||
this.addComment(content);
|
||||
}
|
||||
},
|
||||
async saveContent(content, am_id) {
|
||||
|
||||
},
|
||||
async saveContent(content, am_id) {
|
||||
var that = this;
|
||||
var str = content.replace(/^<p>(.*?)<\/p>$/, '$1') ? content.replace(/^<p>(.*?)<\/p>$/, '$1') : '';
|
||||
if (str == '') {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: 'Please enter the content!'
|
||||
});
|
||||
}
|
||||
str= await that.$commonJS.decodeHtml(str)
|
||||
var str = content.replace(/^<p>\s*(.*?)\s*<\/p>$/, '$1').trim();
|
||||
// var str = content.replace(/^<p>(.*?)<\/p>$/, '$1') ? content.replace(/^<p>(.*?)<\/p>$/, '$1') : '';
|
||||
console.log('str at line 580:', JSON.stringify(str));
|
||||
|
||||
// if (str == '') {
|
||||
// this.$message({
|
||||
// type: 'warning',
|
||||
// message: 'Please enter the content!'
|
||||
// });
|
||||
// }
|
||||
str = await that.$commonJS.decodeHtml(str);
|
||||
await that.$api
|
||||
.post(that.urlList.editContent, {
|
||||
am_id: am_id,
|
||||
@@ -556,6 +612,28 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
async saveContentList(content, am_id) {
|
||||
if (content.length == 0) {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: 'Please enter the content!'
|
||||
});
|
||||
}
|
||||
|
||||
await this.$api
|
||||
.post('api/Preaccept/addMoreRow', {
|
||||
article_id: this.articleId,
|
||||
am_id: am_id,
|
||||
rows: content
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (res.code == 0) {
|
||||
this.addContentVisible = false;
|
||||
this.getDate();
|
||||
this.getCommentList();
|
||||
}
|
||||
});
|
||||
},
|
||||
deleteComment(comment, index) {
|
||||
console.log('comment at line 480:', comment);
|
||||
if (this.isEditComment) {
|
||||
@@ -582,7 +660,7 @@ export default {
|
||||
.catch(() => {});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
async huifu(id) {
|
||||
var that = this;
|
||||
await this.$confirm(this.$t('commonTable.reContent'), 'Prompt', {
|
||||
@@ -712,6 +790,56 @@ export default {
|
||||
console.log('err at line 466:', err);
|
||||
});
|
||||
},
|
||||
async onDeletes(dataId) {
|
||||
await this.$confirm(this.$t('commonTable.removeContent'), 'Prompt', {
|
||||
confirmButtonText: 'Submit',
|
||||
cancelButtonText: 'Cancel',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
var that = this;
|
||||
|
||||
await that.$api
|
||||
.post('/api/Preaccept/delMoreArticleMains', {
|
||||
ids: dataId
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (res.code == 0) {
|
||||
setTimeout(() => {
|
||||
that.getDate();
|
||||
that.getCommentList();
|
||||
that.$refs.commonWordHtmlTypeSetting.refresh('img');
|
||||
that.$refs.commonWordHtmlTypeSetting.refresh('table');
|
||||
that.$forceUpdate();
|
||||
});
|
||||
}
|
||||
});
|
||||
// this.Main_List.splice(
|
||||
// this.Main_List.findIndex((item) => item.p_main_id == dataId),
|
||||
// 1
|
||||
// );
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('err at line 466:', err);
|
||||
});
|
||||
},
|
||||
async changeSort(type,id) {
|
||||
var that=this
|
||||
await that.$api
|
||||
.post(type=='up'?'/api/Preaccept/upArticleMain':'/api/Preaccept/downArticleMain', {
|
||||
am_id: id
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (res.code == 0) {
|
||||
setTimeout(() => {
|
||||
that.getDate();
|
||||
that.getCommentList();
|
||||
|
||||
that.$forceUpdate();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
async addCommentSetting(content) {
|
||||
console.log('content at line 602:', content);
|
||||
await this.$api
|
||||
@@ -850,6 +978,9 @@ export default {
|
||||
async onEditTitle(data) {
|
||||
var url;
|
||||
switch (data.value) {
|
||||
case 0:
|
||||
url = 'api/Preaccept/changeNormal';
|
||||
break;
|
||||
case 1:
|
||||
url = 'api/Preaccept/changeH1';
|
||||
break;
|
||||
@@ -962,7 +1093,7 @@ export default {
|
||||
}
|
||||
},
|
||||
updateChange(content, type) {
|
||||
console.log('content at line 976:', content)
|
||||
console.log('content at line 976:', content);
|
||||
var str = this.$commonJS.transformHtmlString(content);
|
||||
if (type == 'imgNote') {
|
||||
this.picStyle.note = str;
|
||||
@@ -1005,13 +1136,19 @@ export default {
|
||||
this.lineStyle.visiTitle = 'Edit Table';
|
||||
this.threeVisible = true;
|
||||
} else {
|
||||
data.content = data.content.replace(/<span[^>]*>/g, '').replace(/<\/span>/g, ''); // 去除span标签
|
||||
data.content = data.content.replace(/<span[^>]*>/g, '').replace(/<\/span>/g, ''); // 去除span标签
|
||||
this.currentContent = data;
|
||||
|
||||
|
||||
this.editVisible = true;
|
||||
this.currentId = dataId;
|
||||
}
|
||||
},
|
||||
onAddContent(dataId) {
|
||||
this.addContentVisible = true;
|
||||
this.addContent = {};
|
||||
|
||||
this.currentId = dataId;
|
||||
},
|
||||
async onDrop(event, dataId) {
|
||||
if (event.dataTransfer.getData('image')) {
|
||||
const draggedImage = JSON.parse(event.dataTransfer.getData('image'));
|
||||
@@ -1330,16 +1467,16 @@ export default {
|
||||
},
|
||||
|
||||
// 确定保存图片
|
||||
async savePic() {
|
||||
async savePic() {
|
||||
this.picStyle.picUrl;
|
||||
var str=this.picStyle.note
|
||||
str= await this.$commonJS.decodeHtml(str)
|
||||
var str = this.picStyle.note;
|
||||
str = await this.$commonJS.decodeHtml(str);
|
||||
if (this.picStyle.visiTitle == 'Edit Figure') {
|
||||
this.$api
|
||||
.post(this.urlList.editImage, {
|
||||
ami_id: this.picStyle.ami_id,
|
||||
url: this.picStyle.picUrl,
|
||||
note:str
|
||||
note: str
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code == 0) {
|
||||
@@ -1391,16 +1528,16 @@ export default {
|
||||
this.$refs.tinymceChildComment.getContent('comment');
|
||||
});
|
||||
},
|
||||
async saveTable(content) {
|
||||
async saveTable(content) {
|
||||
console.log('content at line 998:', content);
|
||||
var strTitle=this.lineStyle.title
|
||||
strTitle= await this.$commonJS.decodeHtml(strTitle)
|
||||
|
||||
var strNote=this.lineStyle.note
|
||||
if(strNote!=''){
|
||||
strNote= await this.$commonJS.decodeHtml(strNote)
|
||||
var strTitle = this.lineStyle.title;
|
||||
strTitle = await this.$commonJS.decodeHtml(strTitle);
|
||||
|
||||
var strNote = this.lineStyle.note;
|
||||
if (strNote != '') {
|
||||
strNote = await this.$commonJS.decodeHtml(strNote);
|
||||
}
|
||||
|
||||
|
||||
if (content && content.table && content.table.length > 0) {
|
||||
if (this.lineStyle.visiTitle == 'Edit Table') {
|
||||
this.$api
|
||||
|
||||
Reference in New Issue
Block a user