Commit f3ee9f97 by 彭祥礼

增加富文本编辑项

parent c9591a4d
......@@ -113,7 +113,8 @@
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 9, offset: 1}" label="适用学校:">
<a-select v-model="universityName" style="width: 330px">
<a-select-option @click="universitySchoolName('请选择')" value="请选择">请选择</a-select-option>
<a-select-option @click="universitySchoolName(item)" v-for="item in universitySchool" :value="item.universityId">
<a-select-option @click="universitySchoolName(item)" v-for="item in universitySchool"
:value="item.universityId">
{{item.universityName}}
</a-select-option>
</a-select>
......@@ -139,12 +140,16 @@
</a-select>
</a-form-item>
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}" label="产品情况:">
<div v-html="productIntroduction">
</div>
<mavon-editor @save="saveProductIntroduction" ref="editor_a" v-model="productIntroduction">
</mavon-editor>
</a-form-item>
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}" label="资费介绍:">
<div v-html="productSetMealIntroduction">
</div>
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}" label="单宽资费介绍:">
<mavon-editor @save="saveProductSetMealIntroduction" ref="editor_b" v-model="productSetMealIntroduction">
</mavon-editor>
</a-form-item>
<a-form-item :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}" label="融合资费介绍:">
<mavon-editor @save="saveProductRf2" ref="editor_c" v-model="productRf2">
</mavon-editor>
</a-form-item>
</div>
</a-form>
......@@ -154,6 +159,8 @@
<script>
import STable from '@/components/table';
import {mavonEditor} from "mavon-editor";
import "mavon-editor/dist/css/index.css";
import {
productList,
productDelete,
......@@ -166,13 +173,13 @@
export default {
name: "product",
components: {
STable,
STable, mavonEditor,
},
data() {
return {
universityIdtrue: true,
universityName: '',
regularName: '',
regularName: '请选择',
visibleT: false,
visibleT2: false,
chouti: {},
......@@ -185,6 +192,7 @@
add: true,
productIntroduction: "",
productSetMealIntroduction: '',
productRf2:'',
queryParam: {
productUniversity: '', //适用学校
productRegion: '', // 区域
......@@ -201,6 +209,9 @@
productRegion: '',
productRate: '',
productId: '',
productIntroduction:'',
productSetMealIntroduction:'',
productRf2:'',
productIntroductionPic2: ''
},
columns: [
......@@ -268,6 +279,24 @@
}
},
methods: {
saveProductIntroduction(markdown, html) {
// 此时会自动将 markdown 和 html 传递到这个方法中
console.log("markdown内容:" + markdown);
//alert("html内容:" + html);
this.productIntroduction = html;
},
saveProductSetMealIntroduction(markdown, html) {
// 此时会自动将 markdown 和 html 传递到这个方法中
console.log("markdown内容:" + markdown);
this.productSetMealIntroduction = html
//alert("html内容:" + html);
},
saveProductRf2(markdown, html) {
// 此时会自动将 markdown 和 html 传递到这个方法中
console.log("markdown内容:" + markdown);
this.productRf2 = html
//alert("html内容:" + html);
},
universitySchoolName(item) {
if (item == '请选择') {
this.modelData.universityId = ''
......@@ -310,6 +339,7 @@
if (data != undefined) {
this.productIntroduction = data.productIntroduction
this.productSetMealIntroduction = data.productSetMealIntroduction
this.productRf2 = data.productRf2
this.modelData.productMealPrice = data.productMealPrice
this.modelData.productUniversity = data.productUniversity
this.universityName = data.productUniversity
......@@ -344,9 +374,12 @@
this.$notification.error({message: '请选择适用学校', duration: 4})
return
}
let that = this;
that.Formtable.validateFields(['productMeal', 'productTitle', 'productPrice', 'productRegion', 'productRate', 'productState'], {force: true}, (err, values) => {
that.Formtable.validateFields(
[
'productMeal', 'productTitle', 'productPrice', 'productRegion', 'productRate',
'productState', "productIntroduction", "productSetMealIntroduction", "productRf2"
], {force: true}, (err, values) => {
if (err) {
return;
}
......@@ -356,6 +389,9 @@
that.modelData.productRegion = values.productRegion
that.modelData.productRate = values.productRate
that.modelData.productState = values.productState
that.modelData.productIntroduction = this.$refs.editor_a.d_render;
that.modelData.productSetMealIntroduction = this.$refs.editor_b.d_render;
that.modelData.productRf2 = this.$refs.editor_c.d_render;
if (this.add) {
let obj = that.modelData;
delete obj.productId
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment