This commit is contained in:
徐哼唧L
2023-06-07 09:22:26 +08:00
parent d20483d6e2
commit 186cc1b552
24 changed files with 3062 additions and 345 deletions

View File

@@ -34,6 +34,19 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="User Country :" prop="china_type">
<el-radio-group v-model="EmailData.china_type" @change="getTarUser()">
<el-radio :label="0">
All countries
</el-radio>
<el-radio :label="1">
Only China
</el-radio>
<el-radio :label="2">
Without China
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="Target personnel :" prop="category">
<div class="senderKuan" style="position: relative;">
<el-radio-group v-model="EmailData.category" @change="numCateGory">
@@ -54,6 +67,9 @@
placeholder="Please select a major" @change="majorChange" popper-class='majorSelct'
:key="keyValue" style="width: 200px;position: absolute;top: 17px;left: 480px;">
</el-cascader>
<div>
</div>
<p class="tolPeoUse">
A total of <b>{{userListNum}}</b> users meet the filtering criteria.
</p>
@@ -121,35 +137,51 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="Content :" prop="substance">
<el-form-item label="Content :">
<div class="emaStyle">
<img src="../../assets/img/mailPT.png" v-if="EmailData.has_hb==1"
style="margin-bottom: -10px;">
<div style="background-color: #fff;padding: 20px 35px;">
<!-- <el-input type="textarea" v-model="EmailData.substance" autosize></el-input> -->
<div v-html="EmailData.substance"></div>
<div style="background-color: #fff;" v-if="EmailData.range==1">
<quill-editor ref="myTextEditor" v-model="EmailData.substance" :options="editorOption"
@focus="myTextMark='myTextEditor'">
</quill-editor>
</div>
<div style="background-color: #fff;" v-if="EmailData.range==2">
<quill-editor ref="myTextEditor1" v-model="EmailData.substance_top"
:options="editorOption" @focus="myTextMark='myTextEditor1'">
</quill-editor>
<div v-for="(item,index) in artChoseList" class="artCLise">
<a :href="'https://www.tmrjournals.com/article.html?J_num='+item.journal_id+'&a_id='+item.article_id"
target="_blank">
<font></font> {{item.title}}
</a>
<p style="color: #444;font-family: Calibri;font-size: 16px;">{{item.authortitle}}
</p>
<p style="color: #333;">
{{item.journal_title}}
<font style="display:inline-block;margin: 0 20px 0 20px;">|</font>
<a :href="'https://www.tmrjournals.com/public/articlePDF/'+item.file_pdf"
target="_blank">
<img src="https://www.tmrjournals.cn/img/link_3.jpg">PDF
</a>
</p>
<p>
<b>Cite this article :</b>
<font v-html="item.cite"></font>
</p>
</div>
<quill-editor ref="myTextEditor2" v-model="EmailData.substance_bom"
:options="editorOption" @focus="myTextMark='myTextEditor2'">
</quill-editor>
</div>
<img src="../../assets/img/mailPB.png" v-if="EmailData.has_hb==1"
style="margin-bottom: -10px;">
<!-- <div v-for="(item,index) in artChoseList" class="artCLise" v-if="EmailData.range==2">
<a :href="'https://www.tmrjournals.com/article.html?J_num='+item.journal_id+'&a_id='+item.article_id"
target="_blank">
<font></font> {{item.title}}
</a>
<p style="color: #444;font-family: Calibri;font-size: 16px;">{{item.authortitle}}</p>
<p style="color: #333;">
{{item.journal_title}}
<font style="display:inline-block;margin: 0 20px 0 20px;">|</font>
<a :href="'https://www.tmrjournals.com/public/articlePDF/'+item.file_pdf"
target="_blank">
<img src="https://www.tmrjournals.cn/img/link_3.jpg">PDF
</a>
</p>
<p>
<b>Cite this article :</b>
<font v-html="item.cite"></font>
</p>
</div> -->
<el-upload class="avatar-uploader avatar-uploader-foot"
:action="baseUrl+'api/Promotion/up_promotion_file'" name="promotion"
:show-file-list="false" :on-success="uploadSuccess">
</el-upload>
</div>
</el-form-item>
<el-form-item label="Public Image :" prop="has_hb">
@@ -247,6 +279,7 @@
return {
loading: false,
baseUrl: this.Common.baseUrl,
mediaUrl: this.Common.mediaUrl,
EmailData: {
user_id: localStorage.getItem('U_id'),
email_title: '',
@@ -256,25 +289,25 @@
category: 'keyword',
keyword: '',
major: '',
china_type: 0,
pagesize: 100,
range: 1,
template: '',
has_hb: 2,
substance: '',
substance_top: '',
substance_bom: '',
substanceOld: '',
frequency: 'day',
},
keyValue: 0,
userListNum: 0,
rangeList: [{
title: 'Appointment',
title: 'Promotion',
id: 1
}, {
title: 'Article Recommendation',
id: 2
}, {
title: 'Promotion',
id: 3
}],
numberList: [],
journalList: [],
@@ -308,6 +341,7 @@
children: 'children',
checkStrictly: true,
},
myTextMark: 'myTextEditor',
rules: {
range: [{
required: true,
@@ -359,12 +393,16 @@
message: "please input",
trigger: "blur"
}],
china_type: [{
required: true,
message: "please select",
trigger: "blur"
}],
pagesize: [{
required: true,
message: "please select a pagesize",
trigger: "blur"
}],
},
editorOption: {
placeholder: 'Please enter...',
@@ -372,7 +410,6 @@
toolbar: {
container: [
['bold', 'italic', 'underline', 'strike'],
['blockquote', 'code-block'],
[{
'header': 1
}, {
@@ -388,14 +425,6 @@
}, {
'script': 'super'
}],
[{
'indent': '-1'
}, {
'indent': '+1'
}],
[{
'direction': 'rtl'
}],
[{
'size': ['small', false, 'large', 'huge']
}],
@@ -407,14 +436,22 @@
}, {
'background': []
}],
[{
'font': []
}],
[{
'align': []
}],
['link']
]
['link', 'image']
],
// 工具栏
handlers: {
image: function(value) {
if (value) {
// upload点击上传事件
document.querySelector('.avatar-uploader input').click()
} else {
this.quill.format('image', false)
}
}
}
}
}
},
@@ -422,7 +459,7 @@
},
created: function() {
this.getData();
this.templeData();
this.changeRange();
},
computed: {
@@ -453,11 +490,6 @@
},
// 切换范围
changeRange() {
},
// 更换期刊
getIssnMajor() {
this.EmailData.major = ''
@@ -502,10 +534,16 @@
});
},
// 获取模板
templeData() {
// 切换范围获取模板
changeRange() {
this.EmailData.template = ''
this.EmailData.substance = ''
this.EmailData.substance_top = ''
this.EmailData.substance_bom = ''
this.$api
.post('api/Promotion/getEmailModel')
.post('api/Promotion/getEmailModel', {
type: this.EmailData.range
})
.then(res => {
if (res.code == 0) {
this.templeList = res.data.list;
@@ -518,13 +556,21 @@
});
},
// 切换模板
changeTemple(e) {
for (let i = 0; i < this.templeList.length; i++) {
if (this.templeList[i].pro_email_id == e) {
this.EmailData.email_title = this.templeList[i].title
this.EmailData.substanceOld = JSON.parse(JSON.stringify(this.templeList[i].content))
this.pushArticle()
if (this.EmailData.range == 1) {
this.EmailData.substance = this.templeList[i].content
} else if (this.EmailData.range == 2) {
this.EmailData.substance = this.templeList[i].content.split('{{articles}}\r\n\r\n')
this.EmailData.substance_top = this.EmailData.substance[0]
this.EmailData.substance_bom = this.EmailData.substance[1]
}
console.log()
}
}
},
@@ -532,7 +578,6 @@
// 插入文章列表
pushArticle() {
this.EmailData.substance = JSON.parse(JSON.stringify(this.EmailData.substanceOld))
let artHtml = ''
if (this.artChoseList.length > 0 && this.EmailData.range == 2) {
for (let i = 0; i < this.artChoseList.length; i++) {
@@ -553,9 +598,37 @@
artHtml = artHtml +
'<br/><style>.artCLise p{margin: 3px 0 0 2px;font-size: 13px;}.artCLise a{text-decoration: none;}.artCLise a:hover{text-decoration: underline;}</style>'
// for (let i = 0; i < this.artChoseList.length; i++) {
// artHtml +=
// '<a href="https://www.tmrjournals.com/article.html?J_num=' + this.artChoseList[
// i]
// .journal_id +
// '&a_id=' + this.artChoseList[i].article_id +
// '" target="_blank" style="font-size: 14px;line-height: 22px;color: #4e8374;font-weight: bold;"><font style="display: inline-block;width: 7px;height: 7px;border-radius: 10px;margin: 0 3px 0 0;background-color: #4e8374;"></font>' +
// this.artChoseList[i].title +
// '</a><p style="color: #444;font-family: Calibri;font-size: 16px;line-height: 20px;">' +
// this
// .artChoseList[i]
// .authortitle + '</p><p style="color: #333;">' + this.artChoseList[i]
// .journal_title +
// '<text style="display: inline-block;margin: 0 20px 0 20px;">|</text><a href="https://www.tmrjournals.cn/public/articlePDF/' +
// this.artChoseList[i].file_pdf +
// '" target="_blank" style="color: #7a2702;"><img src="https://www.tmrjournals.cn/img/link_3.jpg" style="width: 14px;vertical-align: text-bottom;margin: 0 5px 0 0;">PDF</a></p><p style="margin: 5px 0 15px 2px;padding:0 0 18px 0;line-height: 20px;font-size: 12px;color: #777;border-bottom: 1px dashed #4e837480;"><b style="margin: 0 5px 0 0;letter-spacing: -0.5px;color: #4e8374;font-weight: normal;">Cite this article :</b><font>' +
// this.artChoseList[i].cite + '</font></p>'
// };
// artHtml =
// '<div class="artCLise">' + artHtml +
// '</div><p style="height:20px"></p><style>.artCLise p{margin: 3px 0 0 2px;font-size: 13px;}.artCLise a{text-decoration: none;}.artCLise a:hover{text-decoration: underline;}</style>'
if (this.EmailData.substance.indexOf("{{articles}}\r\n\r\n") != -1) {
this.EmailData.substance = this.EmailData.substance.replace('{{articles}}\r\n\r\n', artHtml)
// console.log(this.EmailData.substance)
}
}
},
@@ -571,6 +644,7 @@
'lib': this.EmailData.library,
'category': 'keyword',
'body': this.EmailData.keyword,
'china_type': this.EmailData.china_type,
})
.then(res => {
if (res.code == 0) {
@@ -588,6 +662,7 @@
'lib': this.EmailData.library,
'category': 'major',
'body': this.EmailData.major,
'china_type': this.EmailData.china_type,
})
.then(res => {
if (res.code == 0) {
@@ -689,7 +764,7 @@
}
this.artTicleList[e].chooState = 1
this.artChoseList.push(this.artTicleList[e])
this.pushArticle()
// this.pushArticle()
},
// 删除文章
@@ -698,7 +773,7 @@
for (let i = 0; i < this.artChoseList.length; i++) {
if (this.artChoseList[i].article_id == row.article_id) {
this.artChoseList.splice(i, 1);
this.pushArticle()
// this.pushArticle()
}
};
},
@@ -710,7 +785,7 @@
if (this.artTicleList[i].article_id == value.article_id) {
this.artTicleList[i].chooState = 0
this.$forceUpdate()
this.pushArticle()
// this.pushArticle()
}
};
},
@@ -723,6 +798,10 @@
// 保存邮件
saveData() {
// const reg = /<\/?.+?\/?>/g
// this.EmailData.substance = this.EmailData.substance.replace(/<p>/gim,"")
// console.log(this.EmailData.substance)
if (this.userListNum == 0) {
this.$message.error('Please select target personnel!');
return
@@ -731,40 +810,61 @@
this.$refs.emailRef.validate((valid) => {
if (valid) {
let artHtml = ''
this.EmailData.template = JSON.parse(JSON.stringify(this.EmailData.substanceOld))
if (this.artChoseList.length > 0 && this.EmailData.range == 2) {
for (let i = 0; i < this.artChoseList.length; i++) {
artHtml +=
'<a href="https://www.tmrjournals.com/article.html?J_num=' + this.artChoseList[
i]
.journal_id +
'&a_id=' + this.artChoseList[i].article_id +
'" target="_blank" style="font-size: 14px;line-height: 22px;color: #4e8374;font-weight: bold;"><font style="display: inline-block;width: 7px;height: 7px;border-radius: 10px;margin: 0 3px 0 0;background-color: #4e8374;"></font>' +
this.artChoseList[i].title +
'</a><p style="color: #444;font-family: Calibri;font-size: 16px;line-height: 20px;">' +
this
.artChoseList[i]
.authortitle + '</p><p style="color: #333;">' + this.artChoseList[i]
.journal_title +
'<text style="display: inline-block;margin: 0 20px 0 20px;">|</text><a href="https://www.tmrjournals.cn/public/articlePDF/' +
this.artChoseList[i].file_pdf +
'" target="_blank" style="color: #7a2702;"><img src="https://www.tmrjournals.cn/img/link_3.jpg" style="width: 14px;vertical-align: text-bottom;margin: 0 5px 0 0;">PDF</a></p><p style="margin: 5px 0 15px 2px;padding:0 0 18px 0;line-height: 20px;font-size: 12px;color: #777;border-bottom: 1px dashed #4e837480;"><b style="margin: 0 5px 0 0;letter-spacing: -0.5px;color: #4e8374;font-weight: normal;">Cite this article :</b><font>' +
this.artChoseList[i].cite + '</font></p>'
};
if (this.EmailData.range == 1) {
this.EmailData.template = this.EmailData.substance.replace(/<p><br><\/p>/gim, '<br/>')
this.EmailData.template = this.EmailData.template.replace(/<p>/gim, "")
this.EmailData.template = this.EmailData.template.replace(/<\/p>/gim, '<br/>')
} else if (this.EmailData.range == 2) {
if (this.artChoseList.length == 0) {
this.$message.error('Please select articles!');
return
} else {
for (let i = 0; i < this.artChoseList.length; i++) {
artHtml +=
'<a href="https://www.tmrjournals.com/article.html?J_num=' + this
.artChoseList[
i]
.journal_id +
'&a_id=' + this.artChoseList[i].article_id +
'" target="_blank" style="font-size: 14px;line-height: 22px;color: #4e8374;font-weight: bold;"><font style="display: inline-block;width: 7px;height: 7px;border-radius: 10px;margin: 0 3px 0 0;background-color: #4e8374;"></font>' +
this.artChoseList[i].title +
'</a><p style="color: #444;font-family: Calibri;font-size: 16px;line-height: 20px;">' +
this
.artChoseList[i]
.authortitle + '</p><p style="color: #333;">' + this.artChoseList[i]
.journal_title +
'<text style="display: inline-block;margin: 0 20px 0 20px;">|</text><a href="https://www.tmrjournals.cn/public/articlePDF/' +
this.artChoseList[i].file_pdf +
'" target="_blank" style="color: #7a2702;"><img src="https://www.tmrjournals.cn/img/link_3.jpg" style="width: 14px;vertical-align: text-bottom;margin: 0 5px 0 0;">PDF</a></p><p style="margin: 5px 0 15px 2px;padding:0 0 18px 0;line-height: 20px;font-size: 12px;color: #777;border-bottom: 1px dashed #4e837480;"><b style="margin: 0 5px 0 0;letter-spacing: -0.5px;color: #4e8374;font-weight: normal;">Cite this article :</b><font>' +
this.artChoseList[i].cite + '</font></p>'
};
artHtml =
'<div class="artCLise">' + artHtml +
'</div><style>.artCLise p{margin: 3px 0 0 2px;font-size: 13px;}.artCLise a{text-decoration: none;}.artCLise a:hover{text-decoration: underline;}</style>'
artHtml =
'<div class="artCLise">' + artHtml +
'</div><p style="height:20px"></p><style>.artCLise p{margin: 3px 0 0 2px;font-size: 13px;}.artCLise a{text-decoration: none;}.artCLise a:hover{text-decoration: underline;}</style>'
this.EmailData.substance_top = this.EmailData.substance_top.replace(
/<p><br><\/p>/gim, '<br/>')
this.EmailData.substance_top = this.EmailData.substance_top.replace(/<p>/gim, "")
this.EmailData.substance_top = this.EmailData.substance_top.replace(/<\/p>/gim,
'<br/>')
this.EmailData.substance_bom = this.EmailData.substance_bom.replace(
/<p><br><\/p>/gim, '<br/>')
this.EmailData.substance_bom = this.EmailData.substance_bom.replace(/<p>/gim, "")
this.EmailData.substance_bom = this.EmailData.substance_bom.replace(/<\/p>/gim,
'<br/>')
if (this.EmailData.template.indexOf("{{articles}}\r\n\r\n") != -1) {
this.EmailData.template = this.EmailData.template.replace('{{articles}}\r\n\r\n',
artHtml)
this.EmailData.template = this.EmailData.substance_top + artHtml + this.EmailData
.substance_bom
}
}
// if (this.EmailData.template.indexOf("{{articles}}\r\n\r\n") != -1) {
// this.EmailData.template = this.EmailData.template.replace('{{articles}}\r\n\r\n',
// artHtml)
// }
this.$api
.post('api/Promotion/addPromotion', this.EmailData)
@@ -813,19 +913,16 @@
});
},
// 富文本编辑器
onEditorChange({
editor,
html,
text
}) {
this.EmailData.substance = html;
},
// 富文本编辑器上传
uploadSuccess(res) {
let quill = this.$refs[this.myTextMark].quill;
// 获取光标所在位置
let length = quill.getSelection().index
// 插入图片 res.upurl为服务器返回的图片地址
quill.insertEmbed(length, 'image', this.mediaUrl + 'promotion/' + res.upurl)
// 调整光标到最后
quill.setSelection(length + 1)
}
},
watch: {
@@ -1008,7 +1105,7 @@
.emaStyle .artCLise {
line-height: 22px;
margin-bottom: 15px;
margin: 15px 20px;
padding-bottom: 18px;
border-bottom: 1px dashed #4e837480;
}
@@ -1066,6 +1163,15 @@
vertical-align: text-bottom;
margin: 0 5px 0 0;
}
.avatar-uploader-foot {
height: 0;
}
.avatar-uploader-foot .el-upload--text {
height: 0 !important;
border: 0;
}
</style>