|
@@ -51,7 +51,7 @@
|
|
|
prop="linkUrl"
|
|
|
v-if="outUrlRadio == 1"
|
|
|
:rules="[
|
|
|
- { required: true, message: '请输入外链地址', trigger: 'blur' },
|
|
|
+ { required: true, message: '请输入外链地址', trigger: 'blur' }
|
|
|
]"
|
|
|
>
|
|
|
<el-input
|
|
@@ -126,8 +126,8 @@
|
|
|
{
|
|
|
required: uploadType == 2 ? true : false,
|
|
|
message: '请上传封面图',
|
|
|
- trigger: 'blur',
|
|
|
- },
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
]"
|
|
|
label-width="120px"
|
|
|
>
|
|
@@ -260,7 +260,7 @@ const toolbarOptions = [
|
|
|
[{ font: [] }], // 字体种类
|
|
|
[{ align: [] }], // 对齐方式
|
|
|
["clean"], // 清除文本格式
|
|
|
- ["image", "video"], // 链接、图片、视频
|
|
|
+ ["image", "video"] // 链接、图片、视频
|
|
|
// ["link", "image", "video"] // 链接、图片、视频
|
|
|
];
|
|
|
// 标题
|
|
@@ -287,7 +287,7 @@ const titleConfig = {
|
|
|
"ql-image": "图片",
|
|
|
"ql-video": "视频",
|
|
|
"ql-clean": "清除字体样式",
|
|
|
- "ql-upload": "文件",
|
|
|
+ "ql-upload": "文件"
|
|
|
};
|
|
|
|
|
|
// 这里引入修改过的video模块并注册
|
|
@@ -298,7 +298,7 @@ export default {
|
|
|
props: ["options"],
|
|
|
name: "contentOperation",
|
|
|
components: {
|
|
|
- quillEditor,
|
|
|
+ quillEditor
|
|
|
},
|
|
|
data() {
|
|
|
let that = this;
|
|
@@ -320,7 +320,7 @@ export default {
|
|
|
title: "",
|
|
|
type: query.type,
|
|
|
updateTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
|
|
- content: null,
|
|
|
+ content: null
|
|
|
},
|
|
|
editorIndex: 0, // 光标位置
|
|
|
editorOption: {
|
|
@@ -329,7 +329,7 @@ export default {
|
|
|
toolbar: {
|
|
|
container: toolbarOptions,
|
|
|
handlers: {
|
|
|
- image: function (value) {
|
|
|
+ image: function(value) {
|
|
|
if (value) {
|
|
|
// 调用iview图片上传
|
|
|
document.querySelector(".ivu-upload .el-upload").click();
|
|
@@ -337,7 +337,7 @@ export default {
|
|
|
this.quill.format("image", false);
|
|
|
}
|
|
|
},
|
|
|
- video: function (value) {
|
|
|
+ video: function(value) {
|
|
|
if (value) {
|
|
|
that.dialogFormVisible = true;
|
|
|
let editor = that.$refs.myQuillEditor.quill;
|
|
@@ -346,22 +346,22 @@ export default {
|
|
|
} else {
|
|
|
this.quill.format("image", false);
|
|
|
}
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
dialogForm: {
|
|
|
poster: null,
|
|
|
url: null,
|
|
|
- videoUrl: null,
|
|
|
+ videoUrl: null
|
|
|
},
|
|
|
uploadLoading: false,
|
|
|
uploadImgLoading: false,
|
|
|
fileList: [],
|
|
|
dialogFormRules: {
|
|
|
url: [{ required: true, message: "请输入视频地址", trigger: "blur" }],
|
|
|
- videoUrl: [{ required: true, message: "请上传视频", trigger: "blur" }],
|
|
|
+ videoUrl: [{ required: true, message: "请上传视频", trigger: "blur" }]
|
|
|
},
|
|
|
outUrlRadio: 0, // 是否使用外部连接,默认不使用
|
|
|
form: {
|
|
@@ -371,7 +371,7 @@ export default {
|
|
|
type: query.type,
|
|
|
status: 0,
|
|
|
content: null,
|
|
|
- organIdList: [],
|
|
|
+ organIdList: []
|
|
|
},
|
|
|
rules: {
|
|
|
title: [
|
|
@@ -380,12 +380,12 @@ export default {
|
|
|
min: 2,
|
|
|
max: 30,
|
|
|
message: "长度在 2 到 30 个字符",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
],
|
|
|
organIdList: [
|
|
|
- { required: true, message: "请选择分部", trigger: "change" },
|
|
|
- ],
|
|
|
+ { required: true, message: "请选择分部", trigger: "change" }
|
|
|
+ ]
|
|
|
},
|
|
|
imageSize: null,
|
|
|
dataObj: {
|
|
@@ -395,11 +395,12 @@ export default {
|
|
|
KSSAccessKeyId: "",
|
|
|
// dir: "",
|
|
|
acl: "public-read",
|
|
|
- name: "",
|
|
|
+ name: ""
|
|
|
// bucket_name: props.bucket_name
|
|
|
},
|
|
|
- ossUploadUrl: "https://ks3-cn-beijing.ksyuncs.com/" + "news-info",
|
|
|
- bucket_name: "news-info",
|
|
|
+ // ossUploadUrl: "https://ks3-cn-beijing.ksyuncs.com/" + "news-info",
|
|
|
+ ossUploadUrl: `https://news-info.ks3-cn-beijing.ksyuncs.com`,
|
|
|
+ bucket_name: "news-info"
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -420,14 +421,14 @@ export default {
|
|
|
5: "图片不能超过 2M;",
|
|
|
6: "图片不能超过 2M;",
|
|
|
7: "图片不能超过 2M;",
|
|
|
- 8: "1242px * 2208px; 图片不能超过 2M;",
|
|
|
+ 8: "1242px * 2208px; 图片不能超过 2M;"
|
|
|
};
|
|
|
this.imageSize = tempTitle[this.form.type];
|
|
|
|
|
|
this.$refs["form"].clearValidate();
|
|
|
},
|
|
|
onVideoComfirm(formName) {
|
|
|
- this.$refs[formName].validate((valid) => {
|
|
|
+ this.$refs[formName].validate(valid => {
|
|
|
if (valid) {
|
|
|
let dialogForm = this.dialogForm;
|
|
|
// 编辑器输入视频
|
|
@@ -436,7 +437,7 @@ export default {
|
|
|
// 插入图片,res为服务器返回的图片链接地址
|
|
|
const params = {
|
|
|
poster: dialogForm.poster,
|
|
|
- url: this.formRadio == 1 ? dialogForm.url : dialogForm.videoUrl,
|
|
|
+ url: this.formRadio == 1 ? dialogForm.url : dialogForm.videoUrl
|
|
|
};
|
|
|
quill.insertEmbed(this.editorIndex, "video", params);
|
|
|
// 调整光标到最后
|
|
@@ -446,7 +447,7 @@ export default {
|
|
|
this.dialogForm = {
|
|
|
poster: null,
|
|
|
url: null,
|
|
|
- videoUrl: null,
|
|
|
+ videoUrl: null
|
|
|
};
|
|
|
} else {
|
|
|
return false;
|
|
@@ -457,7 +458,7 @@ export default {
|
|
|
this.dialogForm = {
|
|
|
poster: null,
|
|
|
url: null,
|
|
|
- videoUrl: null,
|
|
|
+ videoUrl: null
|
|
|
};
|
|
|
this.$refs[diologForm].resetFields();
|
|
|
},
|
|
@@ -465,7 +466,7 @@ export default {
|
|
|
const oToolBar = document.querySelector(".ql-toolbar"),
|
|
|
aButton = oToolBar.querySelectorAll("button"),
|
|
|
aSelect = oToolBar.querySelectorAll("select");
|
|
|
- aButton.forEach(function (item) {
|
|
|
+ aButton.forEach(function(item) {
|
|
|
if (item.className === "ql-script") {
|
|
|
item.value === "sub" ? (item.title = "下标") : (item.title = "上标");
|
|
|
} else if (item.className === "ql-indent") {
|
|
@@ -476,12 +477,12 @@ export default {
|
|
|
item.title = titleConfig[item.classList[0]];
|
|
|
}
|
|
|
});
|
|
|
- aSelect.forEach(function (item) {
|
|
|
+ aSelect.forEach(function(item) {
|
|
|
item.parentNode.title = titleConfig[item.classList[0]];
|
|
|
});
|
|
|
},
|
|
|
onSubmit(formName) {
|
|
|
- this.$refs[formName].validate(async (valid) => {
|
|
|
+ this.$refs[formName].validate(async valid => {
|
|
|
if (valid) {
|
|
|
let { organIdList, linkUrl, content, ...rest } = this.form;
|
|
|
if (this.outUrlRadio == 1) {
|
|
@@ -493,7 +494,7 @@ export default {
|
|
|
...rest,
|
|
|
linkUrl,
|
|
|
content,
|
|
|
- organIdList: organIdList ? organIdList.join(",") : null,
|
|
|
+ organIdList: organIdList ? organIdList.join(",") : null
|
|
|
};
|
|
|
if (this.pageType == "create") {
|
|
|
if (form.id) {
|
|
@@ -501,11 +502,11 @@ export default {
|
|
|
delete form.id;
|
|
|
}
|
|
|
// return false
|
|
|
- await newsAdd(form).then((res) => {
|
|
|
+ await newsAdd(form).then(res => {
|
|
|
this.messageTips("添加", res);
|
|
|
});
|
|
|
} else if (this.pageType == "update") {
|
|
|
- await newsUpdate(form).then((res) => {
|
|
|
+ await newsUpdate(form).then(res => {
|
|
|
this.messageTips("修改", res);
|
|
|
});
|
|
|
}
|
|
@@ -514,7 +515,7 @@ export default {
|
|
|
let isError = document.getElementsByClassName("is-error");
|
|
|
isError[0].scrollIntoView({
|
|
|
block: "center",
|
|
|
- behavior: "smooth",
|
|
|
+ behavior: "smooth"
|
|
|
});
|
|
|
});
|
|
|
return false;
|
|
@@ -532,7 +533,7 @@ export default {
|
|
|
},
|
|
|
handleSuccess(res) {
|
|
|
// 获取富文本组件实例
|
|
|
- this.uploadImgLoading = false;
|
|
|
+ this.uploadImgLoading = false;
|
|
|
let quill = this.editor;
|
|
|
// 如果上传成功
|
|
|
let url = this.ossUploadUrl + "/" + this.dataObj.key;
|
|
@@ -557,7 +558,7 @@ export default {
|
|
|
type: this.type,
|
|
|
status: 1,
|
|
|
content: null,
|
|
|
- organIdList: [],
|
|
|
+ organIdList: []
|
|
|
};
|
|
|
this.$refs[formName].resetFields();
|
|
|
},
|
|
@@ -570,14 +571,14 @@ export default {
|
|
|
setTimeout(() => {
|
|
|
let imgNode = document.querySelectorAll(".msgWrap img");
|
|
|
if (imgNode.length > 0) {
|
|
|
- imgNode.forEach((item) => {
|
|
|
+ imgNode.forEach(item => {
|
|
|
item.style.width = "100%";
|
|
|
});
|
|
|
}
|
|
|
|
|
|
let videoNode = document.querySelectorAll(".msgWrap .ql-video");
|
|
|
if (videoNode.length > 0) {
|
|
|
- videoNode.forEach((item) => {
|
|
|
+ videoNode.forEach(item => {
|
|
|
item.style.width = "100%";
|
|
|
item.style.height = "195px";
|
|
|
});
|
|
@@ -589,7 +590,7 @@ export default {
|
|
|
if (this.pageType == "create") {
|
|
|
return;
|
|
|
} else {
|
|
|
- await newsQueryId({ id: this.options.id }).then((res) => {
|
|
|
+ await newsQueryId({ id: this.options.id }).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
let result = res.data;
|
|
|
let organ = result.organIdList ? result.organIdList.split(",") : [];
|
|
@@ -606,10 +607,10 @@ export default {
|
|
|
linkUrl: result.linkUrl,
|
|
|
type: result.type,
|
|
|
status: result.status,
|
|
|
- organIdList: organ.map((item) => {
|
|
|
+ organIdList: organ.map(item => {
|
|
|
return +item;
|
|
|
}),
|
|
|
- content: result.content,
|
|
|
+ content: result.content
|
|
|
};
|
|
|
this.dataInfo.updateTime = result.updateTime;
|
|
|
}
|
|
@@ -632,7 +633,7 @@ export default {
|
|
|
async beforeImgUpload(file) {
|
|
|
const imageType = {
|
|
|
"image/png": true,
|
|
|
- "image/jpeg": true,
|
|
|
+ "image/jpeg": true
|
|
|
};
|
|
|
const isImage = imageType[file.type];
|
|
|
const isLt2M = file.size / 1024 / 1024 < 2;
|
|
@@ -657,8 +658,8 @@ export default {
|
|
|
filename: fileName,
|
|
|
acl: "public-read",
|
|
|
key: key,
|
|
|
- unknowValueField: [],
|
|
|
- },
|
|
|
+ unknowValueField: []
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const res = await policy(obj);
|
|
@@ -669,7 +670,7 @@ export default {
|
|
|
KSSAccessKeyId: res.data.kssAccessKeyId,
|
|
|
// dir: "",
|
|
|
acl: "public-read",
|
|
|
- name: fileName,
|
|
|
+ name: fileName
|
|
|
// bucket_name: props.bucket_name
|
|
|
};
|
|
|
} catch (e) {
|
|
@@ -684,7 +685,7 @@ export default {
|
|
|
2: "热门资讯",
|
|
|
4: "专项训练",
|
|
|
7: "知识库",
|
|
|
- 19: "系统通知",
|
|
|
+ 19: "系统通知"
|
|
|
};
|
|
|
return params[type] ? params[type] : "管乐迷";
|
|
|
},
|
|
@@ -698,7 +699,7 @@ export default {
|
|
|
6: 5,
|
|
|
7: 6,
|
|
|
8: 7,
|
|
|
- 19: 8,
|
|
|
+ 19: 8
|
|
|
};
|
|
|
return tempTitle[type];
|
|
|
},
|
|
@@ -726,8 +727,8 @@ export default {
|
|
|
filename: fileName,
|
|
|
acl: "public-read",
|
|
|
key: key,
|
|
|
- unknowValueField: [],
|
|
|
- },
|
|
|
+ unknowValueField: []
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const res = await policy(obj);
|
|
@@ -738,7 +739,7 @@ export default {
|
|
|
KSSAccessKeyId: res.data.kssAccessKeyId,
|
|
|
// dir: "",
|
|
|
acl: "public-read",
|
|
|
- name: fileName,
|
|
|
+ name: fileName
|
|
|
// bucket_name: props.bucket_name
|
|
|
};
|
|
|
} catch (e) {
|
|
@@ -763,13 +764,13 @@ export default {
|
|
|
},
|
|
|
handleExceed(files, fileList) {
|
|
|
this.$message.error("您已上传过视频");
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
editor() {
|
|
|
return this.$refs.myQuillEditor.quill;
|
|
|
- },
|
|
|
- },
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|