提交公微

This commit is contained in:
2025-05-22 13:06:07 +08:00
parent b9ddba2488
commit 845785686d
17 changed files with 721 additions and 269 deletions

BIN
dist.zip

Binary file not shown.

View File

@@ -27,7 +27,7 @@ window.MathJax = window.MathJax || {
// **定义全局渲染方法**
window.renderMathJax = function (tinymceId) {
if (window.MathJax && typeof window.MathJax.typesetPromise === "function") {
console.log("正在渲染 MathJax 公式...");
// console.log("正在渲染 MathJax 公式...");
// 如果提供了 TinyMCE 编辑器 ID
if (tinymceId) {

View File

@@ -451,9 +451,18 @@ const en = {
"icon_placeholder": "Please enter the author's avatar URL",
"remove_author": "Remove Author",
"add_author": "Add Author"
}
},
AIArticleStatusEn: {
1: 'WeChat AI content generated',
2: 'WeChat AI content not generated',
3: 'Draft not created',
4: 'Draft created but not published',
10: 'WeChat article published successfully',
11: 'WeChat article publishing in progress',
fail: 'WeChat article publishing failed',
unknown: 'Unknown status'
}
}

View File

@@ -444,6 +444,16 @@ const zh = {
"icon_placeholder": "请输入作者头像地址",
"remove_author": "删除作者",
"add_author": "添加作者"
},
AIArticleStatus: {
1: '公微 AI 内容已生成',
2: '公微 AI 内容未生成',
3: '尚未生成草稿',
4: '草稿已生成,尚未发布',
10: '公微文章已成功发布',
11: '公微文章正在发布中',
fail: '公微文章发布失败',
unknown: '状态未知'
}
}

View File

@@ -1137,7 +1137,7 @@ export default {
}
},
updateChange(content, type) {
console.log('content at line 1154:', content);
// console.log('content at line 1154:', content);
// console.log('content at line 976:', content);
var str = this.$commonJS.transformHtmlString(content);
if (type == 'imgNote') {
@@ -1153,7 +1153,7 @@ export default {
this.currentId = null;
this.clearButton();
var data = this.Main_List.find((item) => item.am_id == dataId);
console.log('data at line 667:', data);
// console.log('data at line 667:', data);
if (data.type == 1) {
var extension = data.image.url.split('.').pop().toLowerCase();
if (extension == 'tif') {

View File

@@ -200,9 +200,10 @@
>
<el-form ref="editMes" :model="lineStyle" label-width="80px">
<!-- <common-late-x></common-late-x> -->
<!-- :id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-title`" -->
<el-form-item label="Title:">
<common-content
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-title`"
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-title`"
:isAutomaticUpdate="true"
:value="lineStyle.title"
@getContent="getContent"
@@ -228,8 +229,9 @@
></common-table>
</el-form-item>
<el-form-item label="Note:">
<!-- :id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-note`" -->
<common-content
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-note`"
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-note`"
:isAutomaticUpdate="true"
:value="lineStyle.note"
@getContent="getContent"
@@ -512,10 +514,12 @@ export default {
addContentVisible: false,
addContent: {},
lineStyle: {},
lineStyle1: {},
contentStyle: {},
lineTable: [],
threeVisible: false,
picStyle: {},
picStyle1: {},
commentForm: {},
commentVisible: false,
pictVisible: false,
@@ -1261,14 +1265,8 @@ export default {
this.threeVisible = true;
},
addUploadWordTable(data) {
this.lineStyle = {};
this.lineStyle = {
...data,
table: data.table_data,
html_data: data.html_data,
note: '',
title: ''
};
this.lineStyle = { note: '', table: data.table_data, html_data: data.html_data };
this.lineStyle.visiTitle = 'Insert Table';
this.threeVisible = true;
},
@@ -1294,16 +1292,19 @@ export default {
}
},
updateChange(content, type) {
console.log('content at line 1154:', content);
// console.log('content at line 1154:', content);
// console.log('content at line 976:', content);
var str = this.$commonJS.transformHtmlString(content);
if (type == 'imgNote') {
this.picStyle.note = str;
this.picStyle1.note = str;
} else if (type == 'imgTitle') {
this.picStyle.title = str;
this.picStyle1.title = str;
} else {
this.lineStyle[type] = str;
this.lineStyle1[type] = str;
}
},
onEdit(dataId) {
this.currentContent = {};
@@ -1312,7 +1313,7 @@ export default {
this.currentId = null;
this.clearButton();
var data = this.Main_List.find((item) => item.am_id == dataId);
console.log('data at line 667:', data);
// console.log('data at line 667:', data);
if (data.type == 1) {
var extension = data.image.url.split('.').pop().toLowerCase();
if (extension == 'tif') {
@@ -1674,8 +1675,8 @@ export default {
async savePic() {
this.picStyle.picUrl;
var str = this.picStyle.note?await this.$commonJS.decodeHtml(this.picStyle.note):'';
var titleStr = this.picStyle.title?await this.$commonJS.decodeHtml(this.picStyle.title):"";
var str = this.picStyle1.note ? await this.$commonJS.decodeHtml(this.picStyle1.note) : '';
var titleStr = this.picStyle1.title ? await this.$commonJS.decodeHtml(this.picStyle1.title) : '';
if (this.picStyle.visiTitle == 'Edit Figure') {
this.$api
.post(this.urlList.editImage, {
@@ -1760,25 +1761,26 @@ export default {
}
};
var cleanedTableList = content.table ? content.table : [];
console.log('content at line 998:', content);
console.log('content at line 998:', this.lineStyle);
cleanedTableList = cleanTableData(content.table);
var strTitle = this.lineStyle.title;
strTitle = await this.$commonJS.decodeHtml(strTitle);
var strTitle = this.lineStyle1.title? this.lineStyle1.title : '';
var strNote = this.lineStyle.note;
var strNote = this.lineStyle1.note? this.lineStyle1.note : '';
if (strNote != '') {
strNote = await this.$commonJS.decodeHtml(strNote);
}
if (strTitle != '') {
strTitle = await this.$commonJS.decodeHtml(strTitle);
}
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
if (content && cleanedTableList && cleanedTableList.length > 0) {
if (this.lineStyle.visiTitle == 'Edit Table') {
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$api
.post(this.urlList.editTable, {
amt_id: this.lineStyle.amt_id,
@@ -1811,14 +1813,15 @@ export default {
article_id: this.articleId,
table_data: JSON.stringify(cleanedTableList),
html_data: content.html_data,
note: this.lineStyle.note,
title: this.lineStyle.title
note: strNote,
title: strTitle
})
.then((res) => {
if (res.code == 0) {
this.$message.success('Successfully Add Table!');
this.threeVisible = false;
this.getDate();
loading.close();
this.$refs.commonWordHtmlTypeSetting.refresh('table');
} else {
this.$message.error(res.msg);

View File

@@ -56,8 +56,8 @@
<span>{{ item.npp }}.</span>
<font @click="lookView(item)">{{ item.title }}</font>
<commonOnlineOperations ref="onlineOperations" :data="item" style="display: inline-block;">
<el-dropdown-item> <p @click="htmlContet(item)"><i class="el-icon-notebook-2"></i>Html</p> </el-dropdown-item>
<commonOnlineOperations ref="onlineOperations" :data="item" style="display: inline-block;" type="online">
<span @click="htmlContet(item)" class="onlineOperationsButton"><i class="el-icon-notebook-2"></i>Html</span>
<!-- <el-button
style="margin-left: 20px; padding: 4px 10px !important"
@@ -70,6 +70,9 @@
Html</el-button
> -->
</commonOnlineOperations>
<span style="font-size: 13px;" :style="{ color: getStatusColor(item.ai_wechat_status) }" v-if="item.ai_wechat_status&&['Article', 'Review', 'Mini Review'].includes(item.type)">
{{ getStatusText(item.ai_wechat_status) }}
</span>
<!-- <el-button
style="margin-left: 20px; padding: 4px 10px !important; background: #ccf7e46e !important;color: #00bc66 !important;border-color:#00bc66 !important;"
@@ -224,7 +227,22 @@ export default {
this.getDate();
},
methods: {
getStatusText(status) {
const key = status > 11 ? 'fail' : status;
return this.$t(`AIArticleStatus.${key}`);
},
getStatusColor(status) {
// 字段名 ai_wechat_status 1 Ai内容已生成 2ai内容未生成 3未生成草稿 4 已生成草稿未发布 10 发布成功 11 发布中 >11发布失败
if (status == 1) return '#67C23A';
if (status == 2) return '#C0C4CC';
if (status == 3) return '#C0C4CC';
if (status == 4) return '#ff9800';
if (status == 10) return '#67C23A';
if (status == 11) return '#409eff';
if (status > 11) return 'red';
return '';
},
htmlContet(data) {
console.log('data at line 189:', data);
this.$nextTick((e) => {

View File

@@ -1,5 +1,6 @@
<template>
<div>
<div class="tab_post">
<div v-for="(item, index) in tabsList" @click="jumpTab(index,item)"
:class="tabName==item.refName?'P_style':''">

View File

@@ -48,6 +48,9 @@
<el-table-column label="Title">
<template slot-scope="scope">
<p v-html="scope.row.title"></p>
<span style="font-size: 13px;" :style="{ color: getStatusColor(scope.row.ai_wechat_status) }" v-if="scope.row.ai_wechat_status&&['Article', 'Review', 'Mini Review'].includes(scope.row.type)">
{{ getStatusText(scope.row.ai_wechat_status) }}
</span>
</template>
</el-table-column>
<el-table-column label="Cite" width="80px" align="center">
@@ -92,7 +95,7 @@
>
<i class="el-icon-edit"></i> Edit</el-button
>
<commonOnlineOperations ref="onlineOperations" :data="scope.row" style="display: inline-block">
<commonOnlineOperations ref="onlineOperations" :data="scope.row" style="display: inline-block" type="publish">
<el-dropdown-item
><p @click="htmlContet(scope.row)"><i class="el-icon-notebook-2"></i>Html</p></el-dropdown-item
>
@@ -587,6 +590,23 @@ export default {
}
},
methods: {
getStatusText(status) {
const key = status > 11 ? 'fail' : status;
return this.$t(`AIArticleStatus.${key}`);
},
getStatusColor(status) {
// 字段名 ai_wechat_status 1 Ai内容已生成 2ai内容未生成 3未生成草稿 4 已生成草稿未发布 10 发布成功 11 发布中 >11发布失败
if (status == 1) return '#67C23A';
if (status == 2) return '#C0C4CC';
if (status == 3) return '#C0C4CC';
if (status == 4) return '#ff9800';
if (status == 10) return '#67C23A';
if (status == 11) return '#409eff';
if (status > 11) return 'red';
return '';
},
//跳转婴用列表
goCite(row) {
console.log('row at line 483:', row.article_id);

View File

@@ -742,7 +742,7 @@ export default {
this.currentId = null;
this.clearButton();
var data = this.Main_List.find((item) => item.am_id == dataId);
console.log('data at line 667:', data);
// console.log('data at line 667:', data);
if (data.type == 1) {
var extension = data.image.url.split('.').pop().toLowerCase();
if (extension == 'tif') {

View File

@@ -424,7 +424,7 @@ export default {
// 去除所有 $ 符号
const latexContent = latexContentRaw.replace(/\$/g, '').trim();
console.log('at line 489: cleaned =', latexContent);
// console.log('at line 489: cleaned =', latexContent);
// 编码后用于传递到弹窗
const encoded = encodeURIComponent(latexContent);
@@ -482,9 +482,11 @@ export default {
// 创建 MutationObserver 监听内容变化
const observer = new MutationObserver(() => {
const currentContent = ed.getContent();
// console.log('currentContent at line 484:', currentContent)
// console.log('currentContent at line 447:', currentContent);
if (_this.isAutomaticUpdate) {
_this.$emit('updateChange', currentContent);
// _this.$emit('updateChange', _this.$commonJS.decodeHtml(currentContent));
//暂时注释掉数字公式
// _this.$commonJS.replaceWMathContent(currentContent, (res) => {
@@ -553,7 +555,7 @@ export default {
if (_this.value) {
editor.setContent(_this.value);
console.log('at line 489:', ' 页面');
// console.log('at line 489:', ' 页面');
setTimeout(() => {
window.renderMathJax(_this.tinymceId); // 初始化时渲染 MathJax
}, 10);
@@ -563,7 +565,7 @@ export default {
this.hasChange = true;
this.$emit('input', editor.getContent());
console.log('at line 518:', '改变');
// console.log('at line 518:', '改变');
// setTimeout(() => {
// window.renderMathJax(); // 初始化时渲染 MathJax
// }, 50);
@@ -578,7 +580,7 @@ export default {
// 👂 message 监听器:处理编辑 + 新增两种情况
window.addEventListener('message', function (event) {
const data = event.data;
console.log('data at line 648:', data);
// console.log('data at line 648:', data);
// ✅ 编辑现有公式:替换或删除
if (data && data.type === 'update-wmath') {
const { editorId, wmathId, latex } = data;

View File

@@ -1,11 +1,13 @@
<template>
<div>
 <el-dropdown :hide-on-click="false" style="">
 <el-dropdown :hide-on-click="false" style="" v-if="type == 'publish'">
<span class="el-dropdown-link" style="margin-left: 10px">
<el-link type="primary">More operations<i class="el-icon-arrow-down el-icon--right"></i></el-link>     
</span>
 
<span class="el-dropdown-link" style="margin-left: 10px;"> <el-link type="primary">More operations<i class="el-icon-arrow-down el-icon--right"></i></el-link>      </span>  
<el-dropdown-menu slot="dropdown">
           <slot ></slot>
           <slot></slot>
<el-dropdown-item divided
><p @click="EditDetail(data)"><i class="el-icon-edit"></i>Topics</p>
</el-dropdown-item>
@@ -13,12 +15,19 @@
<el-dropdown-item divided>
<p @click="ChoseRelated(data)"><i class="el-icon-tickets"></i>Relevant</p>
</el-dropdown-item>
<el-dropdown-item divided>
<p @click="htmlWeChatPreview(data)"><i class="el-icon-tickets"></i>WeChat Preview</p>
<el-dropdown-item divided v-if="['Article', 'Review', 'Mini Review'].includes(data.type)">
<p @click="htmlWeChatPreview(data)"><i class="el-icon-tickets"></i>Public Micro</p>
</el-dropdown-item>
 
</el-dropdown-menu>
</el-dropdown>
 
<div v-if="type == 'online'">
<slot></slot>
<span @click="EditDetail(data)" class="onlineOperationsButton"><i class="el-icon-edit"></i>Topics</span>
<span @click="ChoseRelated(data)" class="onlineOperationsButton"><i class="el-icon-tickets"></i>Relevant</span>
<span @click="htmlWeChatPreview(data)" class="onlineOperationsButton" v-if="['Article', 'Review', 'Mini Review'].includes(data.type)"><i class="el-icon-tickets"></i>Public Micro</span>
</div>
<!-- 修改信息 -->
<el-dialog title="" :visible.sync="EditVisible" width="750px" :close-on-click-modal="false">
@@ -125,21 +134,20 @@
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="RelatVisible = false" plain>Close</el-button>
</span>
</el-dialog> <commonHtmlWeChatPreview ref="htmlWeChatPreview"></commonHtmlWeChatPreview>
</el-dialog>
<commonHtmlWeChatPreview ref="htmlWeChatPreview"></commonHtmlWeChatPreview>
</div>
</template>
<script>import commonHtmlWeChatPreview from '@/components/page/components/htmlWeChatPreview/index.vue';
<script>
import commonHtmlWeChatPreview from '@/components/page/components/htmlWeChatPreview/index.vue';
import { Loading } from 'element-ui';
import { watch } from 'vue';
export default {
props: ['data'],
props: ['data', 'type'],
components: {
commonHtmlWeChatPreview,
commonHtmlWeChatPreview
},
data() {
return {
@@ -1225,7 +1233,16 @@ export default {
background: #e4e7ed !important;
color: #777 !important;
}
/deep/.el-table .el-table__cell.is-center{
/deep/.el-table .el-table__cell.is-center {
text-align: left !important;
}
.onlineOperationsButton {
padding: 4px 10px;
color: #409eff !important;
background: #ecf5ff !important;
border-color: #b3d8ff !important;
margin: 0 10px;
border-radius: 4px;
cursor: pointer;
}
</style>

View File

@@ -42,196 +42,243 @@
font-size: 16px;
font-weight: 500;
line-height: 40px;
cursor: pointer;
"
@click="handlePush"
type="primary"
v-if="ArticleForm.ai_article_id && !disablePush"
v-if="ArticleForm.ai_article_id && stepValue == 1"
>
<img style="width: 30px; margin-right: 10px" src="@/assets/img/weixin.png" alt="" /> Push To Draft Box
</div>
<div
style="
display: flex;
align-items: center;
justify-content: center;
background: #006699;
color: #fff;
width: 90%;
margin: 0 auto;
margin-top: 20px;
border-radius: 50px;
font-size: 16px;
font-weight: 500;
line-height: 40px;cursor: pointer;
"
@click="handleRelease"
type="primary"
v-if="ArticleForm.ai_article_id && draft_status == 1 && publish_status == -1"
>
<img style="width: 30px; margin-right: 10px" src="@/assets/img/weixin.png" alt="" /> Quick Release
</div>
</div>
</div>
<div class="right">
<div class="right" style="padding: 0">
<div>
<el-form ref="form" :model="ArticleForm" label-width="160px" size="mini" v-if="ArticleForm.ai_article_id">
<el-form-item>
<template #label>
<span @click="handleTitleClick('covered')" class="form_title">
{{ $t('AIhtmlWeChatPreview.covered') + ' :' }}
</span>
</template>
<p v-if="disablePush">{{ ArticleForm.covered }}</p>
<el-input v-else type="textarea" v-model="ArticleForm.covered" :autosize="{ minRows: 1, maxRows: 3 }" />
</el-form-item>
<el-steps :active="stepValue" :process-status="processStatus" :finish-status="finishStatus" align-center>
<el-step
class="custom-process-step"
:status="v.status"
:title="v.title"
:description="v.description"
v-for="(v, i) in stepList"
></el-step>
</el-steps>
<el-form-item>
<template #label>
<span @click="handleTitleClick('digest')" class="form_title">
{{ $t('AIhtmlWeChatPreview.digest') + ' :' }}
</span>
</template>
<p v-if="disablePush">{{ ArticleForm.digest }}</p>
<el-input v-else type="textarea" v-model="ArticleForm.digest" :autosize="{ minRows: 2, maxRows: 10 }" />
</el-form-item>
<div style="padding: 20px 20px 0">
<el-form ref="form" :model="ArticleForm" label-width="160px" size="mini" v-if="ArticleForm.ai_article_id">
<el-form-item>
<template #label>
<span @click="handleTitleClick('covered')" class="form_title">
{{ $t('AIhtmlWeChatPreview.covered') + ' :' }}
</span>
</template>
<p v-if="disablePush">{{ ArticleForm.covered }}</p>
<el-input v-else type="textarea" v-model="ArticleForm.covered" :autosize="{ minRows: 1, maxRows: 3 }" />
</el-form-item>
<el-form-item>
<template #label>
<span @click="handleTitleClick('research_background')" class="form_title">
{{ $t('AIhtmlWeChatPreview.research_background') + ' :' }}
</span>
</template>
<p v-if="disablePush">{{ ArticleForm.research_background }}</p>
<el-input
v-else
type="textarea"
v-model="ArticleForm.research_background"
:autosize="{ minRows: 2, maxRows: 5 }"
/>
</el-form-item>
<el-form-item>
<template #label>
<span @click="handleTitleClick('digest')" class="form_title">
{{ $t('AIhtmlWeChatPreview.digest') + ' :' }}
</span>
</template>
<p v-if="disablePush">{{ ArticleForm.digest }}</p>
<el-input v-else type="textarea" v-model="ArticleForm.digest" :autosize="{ minRows: 2, maxRows: 10 }" />
</el-form-item>
<el-form-item>
<template #label>
<span @click="handleTitleClick('research_result')" class="form_title">
{{ $t('AIhtmlWeChatPreview.research_result') + ' :' }}
</span>
</template>
<p v-if="disablePush">{{ ArticleForm.research_result }}</p>
<el-input
v-else
type="textarea"
v-model="ArticleForm.research_result"
:autosize="{ minRows: 2, maxRows: 5 }"
/>
</el-form-item>
<el-form-item>
<template #label>
<span @click="handleTitleClick('research_background')" class="form_title">
{{ $t('AIhtmlWeChatPreview.research_background') + ' :' }}
</span>
</template>
<p v-if="disablePush">{{ ArticleForm.research_background }}</p>
<el-input
v-else
type="textarea"
v-model="ArticleForm.research_background"
:autosize="{ minRows: 2, maxRows: 5 }"
/>
</el-form-item>
<el-form-item>
<template #label>
<span @click="handleTitleClick('discussion')" class="form_title">
{{ $t('AIhtmlWeChatPreview.discussion') + ' :' }}
</span>
</template>
<p v-if="disablePush">{{ ArticleForm.discussion }}</p>
<el-input v-else type="textarea" v-model="ArticleForm.discussion" :autosize="{ minRows: 2, maxRows: 5 }" />
</el-form-item>
<el-form-item>
<template #label>
<span @click="handleTitleClick('research_result')" class="form_title">
{{ $t('AIhtmlWeChatPreview.research_result') + ' :' }}
</span>
</template>
<p v-if="disablePush">{{ ArticleForm.research_result }}</p>
<el-input
v-else
type="textarea"
v-model="ArticleForm.research_result"
:autosize="{ minRows: 2, maxRows: 5 }"
/>
</el-form-item>
<el-form-item>
<template #label>
<span @click="handleTitleClick('prospect')" class="form_title">
{{ $t('AIhtmlWeChatPreview.prospect') + ' :' }}
</span>
</template>
<p v-if="disablePush">{{ ArticleForm.prospect }}</p>
<el-input v-else type="textarea" v-model="ArticleForm.prospect" :autosize="{ minRows: 2, maxRows: 5 }" />
</el-form-item>
<el-form-item>
<template #label>
<span @click="handleTitleClick('discussion')" class="form_title">
{{ $t('AIhtmlWeChatPreview.discussion') + ' :' }}
</span>
</template>
<p v-if="disablePush">{{ ArticleForm.discussion }}</p>
<el-input
v-else
type="textarea"
v-model="ArticleForm.discussion"
:autosize="{ minRows: 2, maxRows: 5 }"
/>
</el-form-item>
<!-- 作者列表 -->
<div style="margin-top: 10px">
<el-collapse v-model="activeNames" style="width: 100%">
<el-collapse-item
:title="$t('AIhtmlWeChatPreview.author') + ' (' + ArticleForm.authors.length + ')'"
name="1"
><div class="authorBox">
<div
v-for="(author, index) in ArticleForm.authors"
:key="index"
class="authorItem"
style="
border: 1px solid #eee;
margin-bottom: 10px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
"
:style="
ArticleForm.authors && ArticleForm.authors.length == 1
? 'width:100%;margin-right:0;'
: ''
"
>
<p
class="authorTitle"
@click="handleTitleClick('author_' + author.user_id)"
<el-form-item>
<template #label>
<span @click="handleTitleClick('prospect')" class="form_title">
{{ $t('AIhtmlWeChatPreview.prospect') + ' :' }}
</span>
</template>
<p v-if="disablePush">{{ ArticleForm.prospect }}</p>
<el-input
v-else
type="textarea"
v-model="ArticleForm.prospect"
:autosize="{ minRows: 2, maxRows: 5 }"
/>
</el-form-item>
<!-- 作者列表 -->
<div style="margin-top: 10px" v-if="ArticleForm.authors && ArticleForm.authors.length > 0">
<el-collapse v-model="activeNames" style="width: 100%">
<el-collapse-item
:title="$t('AIhtmlWeChatPreview.author') + ' (' + ArticleForm.authors.length + ')'"
name="1"
><div class="authorBox">
<div
v-for="(author, index) in ArticleForm.authors"
:key="index"
class="authorItem"
style="
cursor: pointer;
padding: 0 10px;
background-color: #b3d8ff80;
border-bottom: 1px solid #b3d8ff;
font-weight: 700;
border: 1px solid #eee;
margin-bottom: 10px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
"
:style="
ArticleForm.authors && ArticleForm.authors.length == 1
? 'width:100%;margin-right:0;'
: ''
"
>
{{ index + 1 }} : {{ author.author_name }}
</p>
<div style="padding: 10px; box-sizing: border-box">
<el-form-item :label="$t('AIhtmlWeChatPreview.icon') + ' :'" label-width="100px">
<div class="portrait" @click="changeUser(author, index)">
<p v-if="disablePush">
<img
v-if="author.icon"
:src="mediaUrl + 'usericon/' + author.icon"
class="avatar"
accept=".png,.jpg"
/>
</p>
<el-upload
v-else
class="avatar-uploader"
ref="upIconIMg"
:action="baseUrl + 'api/Ucenter/up_userIcon_file'"
:show-file-list="false"
name="icon"
:on-success="handleAvatarSuccess2"
:on-error="handleAvatarError2"
:before-upload="beforeAvatarUpload2"
>
<img
v-if="author.icon"
:src="mediaUrl + 'usericon/' + author.icon"
class="avatar"
accept=".png,.jpg"
/>
<i
v-else
class="el-icon-plus avatar-uploader-icon"
style="line-height: 70px"
></i>
</el-upload>
</div>
</el-form-item>
<el-form-item :label="$t('AIhtmlWeChatPreview.technical') + ' :'" label-width="100px">
<p v-if="disablePush">{{ author.technical }}</p>
<el-input
v-else
v-model="author.technical"
:placeholder="$t('AIhtmlWeChatPreview.technical')"
/>
</el-form-item>
<el-form-item :label="$t('AIhtmlWeChatPreview.company') + ' :'" label-width="100px">
<p v-if="disablePush">{{ author.company }}</p>
<el-input
v-else
v-model="author.company"
:placeholder="$t('AIhtmlWeChatPreview.company')"
/>
</el-form-item>
<el-form-item
:label="$t('AIhtmlWeChatPreview.introduction') + ' :'"
label-width="100px"
<p
class="authorTitle"
@click="handleTitleClick('author_' + author.user_id)"
style="
cursor: pointer;
padding: 0 10px;
background-color: #b3d8ff80;
border-bottom: 1px solid #b3d8ff;
font-weight: 700;
"
>
<p v-if="disablePush">{{ author.introduction }}</p>
<el-input
v-else
type="textarea"
rows="3"
v-model="author.introduction"
:placeholder="$t('AIhtmlWeChatPreview.introduction')"
/>
</el-form-item>
{{ index + 1 }} : {{ author.author_name }}
</p>
<div style="padding: 10px; box-sizing: border-box">
<el-form-item :label="$t('AIhtmlWeChatPreview.icon') + ' :'" label-width="100px">
<div class="portrait" @click="changeUser(author, index)">
<p v-if="disablePush">
<img
v-if="author.icon"
:src="mediaUrl + 'usericon/' + author.icon"
class="avatar"
accept=".png,.jpg"
/>
</p>
<el-upload
v-else
class="avatar-uploader"
ref="upIconIMg"
:action="baseUrl + 'api/Ucenter/up_userIcon_file'"
:show-file-list="false"
name="icon"
:on-success="handleAvatarSuccess2"
:on-error="handleAvatarError2"
:before-upload="beforeAvatarUpload2"
>
<img
v-if="author.icon"
:src="mediaUrl + 'usericon/' + author.icon"
class="avatar"
accept=".png,.jpg"
/>
<i
v-else
class="el-icon-plus avatar-uploader-icon"
style="line-height: 70px"
></i>
</el-upload>
</div>
</el-form-item>
<el-form-item
:label="$t('AIhtmlWeChatPreview.technical') + ' :'"
label-width="100px"
>
<p v-if="disablePush">{{ author.technical }}</p>
<el-input
v-else
v-model="author.technical"
:placeholder="$t('AIhtmlWeChatPreview.technical')"
/>
</el-form-item>
<el-form-item :label="$t('AIhtmlWeChatPreview.company') + ' :'" label-width="100px">
<p v-if="disablePush">{{ author.company }}</p>
<el-input
v-else
v-model="author.company"
:placeholder="$t('AIhtmlWeChatPreview.company')"
/>
</el-form-item>
<el-form-item
:label="$t('AIhtmlWeChatPreview.introduction') + ' :'"
label-width="100px"
>
<p v-if="disablePush">{{ author.introduction }}</p>
<el-input
v-else
type="textarea"
rows="3"
v-model="author.introduction"
:placeholder="$t('AIhtmlWeChatPreview.introduction')"
/>
</el-form-item>
</div>
</div>
</div>
</div>
</el-collapse-item>
</el-collapse>
</div>
</el-form>
</el-collapse-item>
</el-collapse>
</div>
</el-form>
</div>
</div>
<!-- </el-collapse-item>
</el-collapse> -->
@@ -252,6 +299,29 @@ import { watch } from 'vue';
export default {
data() {
return {
publish_status: null,
draft_status: null,
stepValue: null,
processStatus: 'process',
finishStatus: 'success',
stepList: [
{
title: 'Step 1',
description: 'Article Generation',
status: 'wait'
},
{
title: 'Step 2',
description: 'Push draft box',
status: 'wait'
},
{
title: 'Step 3',
description: 'The article has been published',
status: 'wait'
}
],
uploadDrafts: [],
pushFormData: {},
activeNames: ['1'],
innerVisible: false,
@@ -400,8 +470,9 @@ export default {
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$api
.post('api/Aiarticle/syncWechat', {
.post('api/Aiarticle/uploadMaterial', {
article_id: this.articleId,
template_id: this.selectTemplate,
article_type: 'news',
@@ -409,26 +480,74 @@ export default {
only_fans_can_comment: 1 //粉丝才可评论
})
.then((res) => {
// if (res.status == 1) {
// this.$message.success(res.msg);
// const loading = this.$loading({
// lock: true,
// text: 'Loading...',
// spinner: 'el-icon-loading',
// background: 'rgba(0, 0, 0, 0.7)'
// });
// this.getDate(loading);
// console.log(res);
// } else {
// this.$message.error(res.msg);
// }
if (res.status == 1) {
this.$api
.post('api/Aiarticle/syncWechat', {
article_id: this.articleId,
template_id: this.selectTemplate,
article_type: 'news',
need_open_comment: 1, //打开评论
only_fans_can_comment: 1 //粉丝才可评论
})
.then((res) => {
if (res.status == 1) {
} else {
this.$message.error(res.msg);
loading.close();
return false;
}
this.intervalId = setInterval(() => {
this.getStatus();
}, 5000); // 5000 毫秒 = 5 秒
// 处理创建文章的响应
})
.catch((err) => {});
} else {
this.$message.error(res.msg);
loading.close();
return false;
}
// 处理创建文章的响应
})
.catch((err) => {});
setTimeout(() => {
this.$message.success('Push successful, please check later !');
loading.close();
},1000*6);
.catch((err) => {
loading.close();
});
});
},
handleRelease() {
this.$confirm('Are you sure you want to Release?', 'Tip', {
type: 'warning'
}).then(() => {
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
// uploadDrafts
this.$api
.post('api/Aiarticle/publishDraft', {
article_id: this.articleId,
template_id: this.selectTemplate
// wechat_id: exists.wechat_id
})
.then((res) => {
if (res.status == 1) {
console.log(res);
} else {
this.$message.error(res.msg);
loading.close();
return false;
}
this.intervalId = setInterval(() => {
this.getReleaseStatus();
}, 5000); // 5000 毫秒 = 5 秒
// 处理创建文章的响应
})
.catch((err) => {
loading.close();
});
});
},
handleTitleClick(field) {
@@ -505,11 +624,12 @@ export default {
removeAuthor(index) {
this.ArticleForm.authors.splice(index, 1);
},
init(data) {
async init(data) {
this.articleId = data.article_id;
// this.articleId = 2673;
// this.stepList = this.stepList.map((e) => (e.status = ''));
await this.getStatus();
this.getStatus();
this.intervalId = setInterval(() => {
this.getStatus();
}, 5000); // 5000 毫秒 = 5 秒
@@ -552,7 +672,7 @@ export default {
};
// 触发 iframe 的加载
iframe.src = 'about:blank';
iframe.src = 'about:blank?' + new Date().getTime();
if (field) {
this.handleTitleClick(field);
}
@@ -585,6 +705,85 @@ export default {
},
// 获取列表
updateStepStatus() {
const gen = this.generate_status;
const draft = this.draft_status;
const pub = this.publish_status;
// 初始化 stepList 状态
this.stepList = [
{
title: 'Step 1',
description: 'Article Generation',
status: 'wait'
},
{
title: 'Step 2',
description: 'Push draft box',
status: 'wait'
},
{
title: 'Step 3',
description: 'The article has been published',
status: 'wait'
}
];
// Step 1: 生成状态
if (gen === 3) {
this.stepValue = 0;
this.stepList[0].status = 'wait';
this.stepList[0].description = 'Waiting to generate';
} else if (gen === 2) {
this.stepValue = 0;
this.stepList[0].status = 'process';
this.stepList[0].description = 'Generating...';
} else if (gen === 1) {
this.stepList[0].status = 'success';
this.stepList[0].description = 'Generated';
}
// Step 2: 草稿状态
if (gen === 1 && draft === 1) {
this.stepValue = 2;
this.stepList[1].status = 'success';
this.stepList[1].description = 'Draft box has been pushed';
} else if (gen === 1) {
this.stepList[1].status = 'wait';
this.stepList[1].description = 'Waiting to push';
}
// Step 3: 发布状态
if (draft === 1) {
switch (pub) {
case -1:
this.stepValue = 3;
this.stepList[2].status = 'wait';
this.stepList[2].description = 'Not published yet';
break;
case 1:
this.stepValue = 3;
this.stepList[2].status = 'process';
this.stepList[2].description = 'Publishing...';
break;
case 0:
this.stepValue = 3;
this.stepList[2].status = 'success';
this.stepList[2].description = 'Published successfully';
break;
case 2:
case 3:
case 4:
case 5:
case 6:
this.stepValue = 3;
this.stepList[2].status = 'error';
this.stepList[2].description = 'Publishing failed';
break;
}
}
},
async getStatus() {
const loading = this.$loading({
lock: true,
@@ -593,7 +792,6 @@ export default {
background: 'rgba(0, 0, 0, 0.7)'
});
this.loading = true;
this.$api
.post('api/Aiarticle/getAiArticleStatus', {
article_id: this.articleId
@@ -601,25 +799,104 @@ export default {
.then(async (res) => {
console.log('res at line 264:', res);
if (res.status == 1) {
switch (res.data.is_generate) {
this.publish_status = res.data.publish_status;
this.draft_status = res.data.draft_status;
// generate_status 1AI内容已生成 2 AI内容生成中 3AI内容未生成
switch (res.data.generate_status) {
case 1: // 已生成
// this.stopInterval();
loading.text = 'Loading...';
this.getDate(loading);
this.stepValue = 1;
this.stepList[0].status = 'success';
this.stopInterval();
break;
case 2: // 生成中
// setTimeout(() => {
// this.getStatus();
// }, 5000);
this.stepValue = null;
break;
case 3: // 未生成
this.stepValue = null;
loading.text = 'The public WeChat article is being created, please be patient and wait...';
this.createdAiArticle();
break;
}
if (res.data.generate_status == 1) {
if (res.data.draft_status == 1) {
this.stepValue = 2;
this.stepList[1].description = 'Draft box has been pushed';
this.stepList[1].status = 'success';
// this.processStatus = 'process'; // 当前是步骤2
// 发布状态判断
// 根据发布状态更新 stepValue 和 process-status
switch (res.data.publish_status) {
case 0:
// 发布成功
this.stepValue = 3;
this.stepList[2].description = 'Published successfully';
this.stepList[2].status = 'success';
this.stopInterval();
// this.processStatus = 'success'; // 发布成功时,状态为成功
break;
case 1:
// 发布中
this.stepValue = 3; // 步骤保持在“发布中”阶段
this.stepList[2].description = 'Publishing in progress';
this.stepList[2].status = 'process';
this.stopInterval();
// this.processStatus = 'process'; // 设置为“进行中”状态
break;
case 2:
case 3:
case 4:
// 发布失败,平台审核失败等错误
this.stepValue = 3;
this.stepList[2].description = 'Publishing failed';
this.stepList[2].status = 'error';
this.stopInterval();
// this.processStatus = 'error'; // 设置为“错误”状态
break;
case 5:
// 用户删除文章
this.stepValue = 3;
this.stepList[2].description = 'Deleted by user';
this.stepList[2].status = 'error';
this.stopInterval();
// this.processStatus = 'error'; // 设置为“错误”状态
break;
case 6:
// 系统封禁所有文章
this.stepValue = 3;
this.stepList[2].description = 'Blocked by system';
this.stepList[2].status = 'error';
this.stopInterval();
// this.processStatus = 'error'; // 设置为“错误”状态
break;
case -1:
// 草稿未发布
this.stepValue = 3;
this.stepList[2].description = 'Not published yet';
this.stepList[2].status = 'wait';
this.stopInterval();
// this.processStatus = 'wait'; // 草稿未发布,保持“等待”状态
break;
}
} else {
this.stepValue = 1;
this.stepList[1].description = 'Draft box has not been pushed';
this.stepList[1].status = 'wait';
this.stopInterval();
// this.processStatus = 'wait'; // 第一步没完成
}
if (this.stepValue > 1) {
this.disablePush = true;
}
}
// draft_status 1已推送到草稿箱 2 未推送到草稿箱
// publish_status -1 草稿箱内容未发布 0 草稿箱内容发布成功 1草稿箱内容发布中 2原创失败, 3: 常规失败, 4:平台审核不通过, 5:成功后用户删除所有文章, 6: 成功后系统封禁所有文章
} else {
this.$message.error(res.msg);
loading.close();
@@ -630,9 +907,97 @@ export default {
loading.close();
});
},
async getReleaseStatus() {
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
// this.loading = true;
this.$api
.post('api/Aiarticle/getAiArticleStatus', {
article_id: this.articleId
})
.then(async (res) => {
console.log('res at line 264:', res);
if (res.status == 1) {
this.publish_status = res.data.publish_status;
this.draft_status = res.data.draft_status;
switch (res.data.publish_status) {
case 0:
// 发布成功
this.stepValue = 3;
this.stepList[2].description = 'Published successfully';
this.stepList[2].status = 'success';
loading.close();
this.stopInterval();
// this.processStatus = 'success'; // 发布成功时,状态为成功
break;
case 1:
// 发布中
this.stepValue = 3; // 步骤保持在“发布中”阶段
this.stepList[2].description = 'Publishing in progress...';
this.stepList[2].status = 'process';
loading.text = 'Publishing in progress...';
// this.processStatus = 'process'; // 设置为“进行中”状态
break;
case 2:
case 3:
case 4:
// 发布失败,平台审核失败等错误
this.stepValue = 3;
this.stepList[2].description = 'Publishing failed';
this.stepList[2].status = 'error';
loading.close();
this.stopInterval();
// this.processStatus = 'error'; // 设置为“错误”状态
break;
case 5:
// 用户删除文章
this.stepValue = 3;
this.stepList[2].description = 'Deleted by user';
this.stepList[2].status = 'error';
loading.close();
this.stopInterval();
// this.processStatus = 'error'; // 设置为“错误”状态
break;
case 6:
// 系统封禁所有文章
this.stepValue = 3;
this.stepList[2].description = 'Blocked by system';
this.stepList[2].status = 'error';
loading.close();
this.stopInterval();
// this.processStatus = 'error'; // 设置为“错误”状态
break;
case -1:
// 草稿未发布
this.stepValue = 3;
this.stepList[2].description = 'Not published yet';
this.stepList[2].status = 'wait';
loading.close();
this.stopInterval();
// this.processStatus = 'wait'; // 草稿未发布,保持“等待”状态
break;
}
// draft_status 1已推送到草稿箱 2 未推送到草稿箱
// publish_status -1 草稿箱内容未发布 0 草稿箱内容发布成功 1草稿箱内容发布中 2原创失败, 3: 常规失败, 4:平台审核不通过, 5:成功后用户删除所有文章, 6: 成功后系统封禁所有文章
} else {
this.$message.error(res.msg);
loading.close();
}
})
.catch((err) => {
console.log(err);
this.stopInterval();
loading.close();
});
},
// 获取列表
async getDate(loading) {
this.disablePush = false;
this.loading = true;
this.$api
@@ -640,13 +1005,16 @@ export default {
article_id: this.articleId
})
.then(async (res) => {
this.disablePush = false;
if (res.status == 1) {
if (res.data.ai_article.upload_draft && res.data.ai_article.upload_draft.length > 0) {
if (res.data.ai_article.upload_draft.includes(this.selectTemplate)) {
this.disablePush = true;
}
}
// const uploadDrafts = res.data.ai_article.upload_draft;
// if (uploadDrafts && uploadDrafts.length > 0) {
// this.uploadDrafts = uploadDrafts;
// const exists = uploadDrafts.some((item) => item.template_id === this.selectTemplate);
// if (exists) {
// }
// }
this.HtmlVisible = true;
this.articleInfo = res.data;
this.ArticleForm = { ...res.data.ai_article, authors: res.data.ai_article_author };
@@ -1676,7 +2044,7 @@ export default {
.right {
width: calc(100%) !important;
height: 100%;
padding: 60px 20px 0;
padding: 0px 20px 0;
box-sizing: border-box;
}
@@ -1773,4 +2141,8 @@ export default {
height: 70px;
border-radius: 110px !important;
}
::v-deep .custom-process-step .is-process {
color: #409eff !important;
border-color: #409eff !important;
}
</style>

View File

@@ -67,7 +67,7 @@ export default {
mounted() {
this.typesettingType = 1;
if (this.lineStyle) {
console.log('newVal at line 37:', this.lineStyle);
// console.log('newVal at line 37:', this.lineStyle);
} else {
this.updatedHtml = '';

View File

@@ -65,7 +65,7 @@ export default {
mounted() {
this.typesettingType = 1;
if (this.lineStyle) {
console.log('newVal at line 37:', this.lineStyle);
// console.log('newVal at line 37:', this.lineStyle);
if (this.lineStyle.table) {
this.tableData = [...this.lineStyle.table];
var modalContent = `
@@ -93,7 +93,7 @@ export default {
modalContent += `</tr>`;
});
modalContent += `</table></div>`;
console.log('modalContent at line 91:', modalContent);
// console.log('modalContent at line 91:', modalContent);
this.updatedHtml = modalContent;
}
// this.updatedHtml = newVal.html_data;

View File

@@ -349,7 +349,7 @@ export default {
switch (this.currentSelectType) {
case '0':
this.tablesList = [...this.tables];
console.log('this.tablesList at line 393:', this.tablesList);
// console.log('this.tablesList at line 393:', this.tablesList);
break;
case '1':
this.tablesList = [...this.tables].filter((e) => e.has_selected == 1);

View File

@@ -692,7 +692,7 @@ export default {
switch (this.currentSelectType) {
case '0':
this.tablesList = [...this.tables];
console.log('this.tablesList at line 393:', this.tablesList);
// console.log('this.tablesList at line 393:', this.tablesList);
break;
case '1':
this.tablesList = [...this.tables].filter((e) => e.has_selected == 1);