|
@@ -1,97 +1,119 @@
|
|
|
<template>
|
|
|
<div class="m-container">
|
|
|
<h2>
|
|
|
- <el-page-header
|
|
|
- @back="onCancel"
|
|
|
- :content="(pageType == 'create' ? '添加' : '修改') + typeChange(type)"
|
|
|
- ></el-page-header>
|
|
|
+ <el-page-header @back="onCancel"
|
|
|
+ :content="(pageType == 'create' ? '添加' : '修改') + typeChange(type)"></el-page-header>
|
|
|
</h2>
|
|
|
|
|
|
<div class="m-core">
|
|
|
- <el-form :model="form" :rules="rules" ref="form" label-width="120px" style="width: 100%">
|
|
|
- <el-form-item label="标题" prop="title">
|
|
|
+ <el-form :model="form"
|
|
|
+ :rules="rules"
|
|
|
+ ref="form"
|
|
|
+ label-width="120px"
|
|
|
+ style="width: 100%">
|
|
|
+ <el-form-item label="标题"
|
|
|
+ prop="title">
|
|
|
<el-input v-model.trim="form.title"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="排序值">
|
|
|
<el-input v-model.trim="form.order"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="适用范围" prop="tenantId">
|
|
|
+ <el-form-item label="适用范围"
|
|
|
+ prop="tenantId">
|
|
|
<el-select v-model="form.tenantId">
|
|
|
- <el-option label="对内" value="1"></el-option>
|
|
|
- <el-option label="对外" value="2"></el-option>
|
|
|
+ <el-option label="对内"
|
|
|
+ value="1"></el-option>
|
|
|
+ <el-option label="对外"
|
|
|
+ value="2"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<!-- banner图 && app按钮管理,才需要添加版本号 -->
|
|
|
- <el-form-item label="版本号" v-if="type == 3 || type == 6">
|
|
|
+ <el-form-item label="版本号"
|
|
|
+ v-if="type == 3 || type == 6">
|
|
|
<el-input v-model="form.memo"></el-input>
|
|
|
</el-form-item>
|
|
|
<!-- -->
|
|
|
- <el-form-item v-if="type == 3 || type == 6" label="链接地址">
|
|
|
+ <el-form-item v-if="type == 3 || type == 6"
|
|
|
+ label="链接地址">
|
|
|
<el-input v-model.trim="form.linkUrl"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item v-else label="链接地址" prop="linkUrl">
|
|
|
+ <el-form-item v-else
|
|
|
+ label="链接地址"
|
|
|
+ prop="linkUrl">
|
|
|
<el-input v-model.trim="form.linkUrl"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="封面图" prop="coverImage">
|
|
|
- <el-upload
|
|
|
- class="avatar-uploader"
|
|
|
- action="/api-web/uploadFile"
|
|
|
- :headers="headers"
|
|
|
- :show-file-list="false"
|
|
|
- accept=".jpg, .jpeg, .png"
|
|
|
- :on-success="handleAvatarSuccess"
|
|
|
- :before-upload="beforeAvatarUpload"
|
|
|
- >
|
|
|
- <img v-if="form.coverImage" :src="form.coverImage" class="avatar" />
|
|
|
- <i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
+ <el-form-item label="封面图"
|
|
|
+ prop="coverImage">
|
|
|
+ <el-upload class="avatar-uploader"
|
|
|
+ action="/api-web/uploadFile"
|
|
|
+ :headers="headers"
|
|
|
+ :show-file-list="false"
|
|
|
+ accept=".jpg, .jpeg, .png"
|
|
|
+ :on-success="handleAvatarSuccess"
|
|
|
+ :before-upload="beforeAvatarUpload">
|
|
|
+ <img v-if="form.coverImage"
|
|
|
+ :src="form.coverImage"
|
|
|
+ class="avatar" />
|
|
|
+ <i v-else
|
|
|
+ class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
</el-upload>
|
|
|
- <p class="imageSize" v-if="imageSize">上传图片尺寸为:{{ imageSize }}</p>
|
|
|
+ <p class="imageSize"
|
|
|
+ v-if="imageSize">上传图片尺寸为:{{ imageSize }}</p>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="内容" prop="content">
|
|
|
+ <el-form-item label="内容"
|
|
|
+ prop="content">
|
|
|
<!-- bidirectional data binding(双向数据绑定) -->
|
|
|
- <quill-editor
|
|
|
- class="ql-editor"
|
|
|
- v-model="form.content"
|
|
|
- ref="myQuillEditor"
|
|
|
- :options="editorOption"
|
|
|
- @change="onEditorChange($event)"
|
|
|
- ></quill-editor>
|
|
|
+ <quill-editor class="ql-editor"
|
|
|
+ v-model="form.content"
|
|
|
+ ref="myQuillEditor"
|
|
|
+ :options="editorOption"
|
|
|
+ @change="onEditorChange($event)"></quill-editor>
|
|
|
|
|
|
- <el-upload
|
|
|
- class="ivu-upload"
|
|
|
- :show-upload-list="false"
|
|
|
- :headers="headers"
|
|
|
- :on-success="handleSuccess"
|
|
|
- accept=".jpg, .jpeg, .png"
|
|
|
- :max-size="2048"
|
|
|
- multiple
|
|
|
- action="/api-web/uploadFile"
|
|
|
- >
|
|
|
+ <el-upload class="ivu-upload"
|
|
|
+ :show-upload-list="false"
|
|
|
+ :headers="headers"
|
|
|
+ :on-success="handleSuccess"
|
|
|
+ accept=".jpg, .jpeg, .png"
|
|
|
+ :max-size="2048"
|
|
|
+ multiple
|
|
|
+ action="/api-web/uploadFile">
|
|
|
<Button icon="ios-cloud-upload-outline"></Button>
|
|
|
</el-upload>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button
|
|
|
- @click="onSubmit('form')"
|
|
|
- type="primary"
|
|
|
- >立即{{ pageType == "create" ? '创建' : '修改' }}</el-button>
|
|
|
+ <el-button @click="onSubmit('form')"
|
|
|
+ type="primary">立即{{ pageType == "create" ? '创建' : '修改' }}</el-button>
|
|
|
<el-button @click="onReSet('form')">重置</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
|
|
|
- <el-dialog title="插入视屏" width="500px" :visible.sync="dialogFormVisible">
|
|
|
- <el-form :model="dialogForm" ref="diologForm" :rules="dialogFormRules">
|
|
|
- <el-form-item label="封面图" label-width="90px" prop="poster">
|
|
|
- <el-input v-model="dialogForm.poster" style="width: 100%;" autocomplete="off"></el-input>
|
|
|
+ <el-dialog title="插入视屏"
|
|
|
+ width="500px"
|
|
|
+ :visible.sync="dialogFormVisible">
|
|
|
+ <el-form :model="dialogForm"
|
|
|
+ ref="diologForm"
|
|
|
+ :rules="dialogFormRules">
|
|
|
+ <el-form-item label="封面图"
|
|
|
+ label-width="90px"
|
|
|
+ prop="poster">
|
|
|
+ <el-input v-model="dialogForm.poster"
|
|
|
+ style="width: 100%;"
|
|
|
+ autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="视屏地址" label-width="90px" prop="url">
|
|
|
- <el-input v-model="dialogForm.url" style="width: 100%;" autocomplete="off"></el-input>
|
|
|
+ <el-form-item label="视屏地址"
|
|
|
+ label-width="90px"
|
|
|
+ prop="url">
|
|
|
+ <el-input v-model="dialogForm.url"
|
|
|
+ style="width: 100%;"
|
|
|
+ autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
+ <div slot="footer"
|
|
|
+ class="dialog-footer">
|
|
|
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="onVideoComfirm('diologForm')">确 定</el-button>
|
|
|
+ <el-button type="primary"
|
|
|
+ @click="onVideoComfirm('diologForm')">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -161,7 +183,7 @@ export default {
|
|
|
components: {
|
|
|
quillEditor
|
|
|
},
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
let that = this;
|
|
|
return {
|
|
|
categoryList: [],
|
|
@@ -180,7 +202,7 @@ export default {
|
|
|
toolbar: {
|
|
|
container: toolbarOptions,
|
|
|
handlers: {
|
|
|
- image: function(value) {
|
|
|
+ image: function (value) {
|
|
|
if (value) {
|
|
|
// 调用iview图片上传
|
|
|
document.querySelector(".ivu-upload .el-upload").click();
|
|
@@ -188,7 +210,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;
|
|
@@ -220,7 +242,7 @@ export default {
|
|
|
type: this.$route.query.type,
|
|
|
status: 1,
|
|
|
content: null,
|
|
|
- tenantId:null,
|
|
|
+ tenantId: null,
|
|
|
},
|
|
|
rules: {
|
|
|
title: [
|
|
@@ -239,11 +261,11 @@ export default {
|
|
|
imageSize: null
|
|
|
};
|
|
|
},
|
|
|
- created() {},
|
|
|
- mounted() {
|
|
|
+ created () { },
|
|
|
+ mounted () {
|
|
|
this.init();
|
|
|
},
|
|
|
- activated() {
|
|
|
+ activated () {
|
|
|
if (this.$route.query.pageType == "create") {
|
|
|
this.form = {
|
|
|
title: null,
|
|
@@ -253,7 +275,7 @@ export default {
|
|
|
type: this.$route.query.type,
|
|
|
status: 1,
|
|
|
content: null,
|
|
|
- tenantId:null
|
|
|
+ tenantId: null
|
|
|
};
|
|
|
this.$refs["form"].resetFields();
|
|
|
}
|
|
@@ -262,7 +284,7 @@ export default {
|
|
|
this.init();
|
|
|
},
|
|
|
methods: {
|
|
|
- init() {
|
|
|
+ init () {
|
|
|
this.getList();
|
|
|
this.addQuillTitle();
|
|
|
|
|
@@ -275,7 +297,7 @@ export default {
|
|
|
};
|
|
|
this.imageSize = tempTitle[this.form.type];
|
|
|
},
|
|
|
- onVideoComfirm(formName) {
|
|
|
+ onVideoComfirm (formName) {
|
|
|
this.$refs[formName].validate(valid => {
|
|
|
if (valid) {
|
|
|
let dialogForm = this.dialogForm;
|
|
@@ -296,11 +318,11 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- addQuillTitle() {
|
|
|
+ addQuillTitle () {
|
|
|
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") {
|
|
@@ -311,11 +333,11 @@ 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) {
|
|
|
+ onSubmit (formName) {
|
|
|
this.$refs[formName].validate(valid => {
|
|
|
if (valid) {
|
|
|
if (this.pageType == "create") {
|
|
@@ -337,7 +359,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- messageTips(title, res) {
|
|
|
+ messageTips (title, res) {
|
|
|
if (res.code == 200) {
|
|
|
this.$message.success(title + "成功");
|
|
|
this.$router.push({
|
|
@@ -350,7 +372,7 @@ export default {
|
|
|
this.$message.error(res.msg);
|
|
|
}
|
|
|
},
|
|
|
- onCancel() {
|
|
|
+ onCancel () {
|
|
|
this.$router.push({
|
|
|
path: "/contentManager/contentManager",
|
|
|
query: {
|
|
@@ -358,7 +380,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- handleSuccess(res) {
|
|
|
+ handleSuccess (res) {
|
|
|
// 获取富文本组件实例
|
|
|
let quill = this.editor;
|
|
|
// 如果上传成功
|
|
@@ -374,10 +396,10 @@ export default {
|
|
|
this.$message.error("图片插入失败");
|
|
|
}
|
|
|
},
|
|
|
- onReSet(formName) {
|
|
|
+ onReSet (formName) {
|
|
|
this.$refs[formName].resetFields();
|
|
|
},
|
|
|
- getList() {
|
|
|
+ getList () {
|
|
|
if (this.pageType == "create") {
|
|
|
return;
|
|
|
} else {
|
|
@@ -395,16 +417,16 @@ export default {
|
|
|
status: result.status,
|
|
|
memo: result.memo,
|
|
|
content: result.content,
|
|
|
- tenantId:result.tenantId.toString()
|
|
|
+ tenantId: result.tenantId.toString()
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- handleAvatarSuccess(res, file) {
|
|
|
+ handleAvatarSuccess (res, file) {
|
|
|
this.form.coverImage = res.data.url;
|
|
|
},
|
|
|
- beforeAvatarUpload(file) {
|
|
|
+ beforeAvatarUpload (file) {
|
|
|
const imageType = {
|
|
|
"image/png": true,
|
|
|
"image/jpeg": true
|
|
@@ -420,18 +442,19 @@ export default {
|
|
|
}
|
|
|
return isImage && isLt2M;
|
|
|
},
|
|
|
- typeChange(type) {
|
|
|
+ typeChange (type) {
|
|
|
let tempTitle = {
|
|
|
1: "精彩活动",
|
|
|
2: "热门资讯",
|
|
|
4: "专项训练",
|
|
|
5: "闪页管理",
|
|
|
3: "BANNER管理",
|
|
|
- 6: "APP按钮管理"
|
|
|
+ 6: "APP按钮管理",
|
|
|
+ 7: "知识库管理"
|
|
|
};
|
|
|
return tempTitle[type];
|
|
|
},
|
|
|
- typeIndex(type) {
|
|
|
+ typeIndex (type) {
|
|
|
let tempTitle = {
|
|
|
1: 0,
|
|
|
2: 1,
|
|
@@ -442,12 +465,12 @@ export default {
|
|
|
};
|
|
|
return tempTitle[type];
|
|
|
},
|
|
|
- onEditorChange({ quill, html, text }) {
|
|
|
+ onEditorChange ({ quill, html, text }) {
|
|
|
this.form.content = html;
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- editor() {
|
|
|
+ editor () {
|
|
|
return this.$refs.myQuillEditor.quill;
|
|
|
}
|
|
|
}
|
|
@@ -464,7 +487,7 @@ export default {
|
|
|
min-height: 300px;
|
|
|
padding: 0;
|
|
|
}
|
|
|
-/deep/.ql-container .ql-editor{
|
|
|
+/deep/.ql-container .ql-editor {
|
|
|
max-height: 500px;
|
|
|
}
|
|
|
.el-button--primary {
|