markdown修复

master
yujialong 1 year ago
parent ce8cd2d0a7
commit 288164f0f4
  1. 31
      src/components/quill/index.vue
  2. 21
      src/pages/product/list/index.vue
  3. 11
      src/pages/project/add/index.vue

@ -2,12 +2,12 @@
<div> <div>
<el-radio-group v-if="!readonly" <el-radio-group v-if="!readonly"
class="type-radio" class="type-radio"
v-model="type" v-model="editorType"
@change="typeChange"> @change="typeChange">
<el-radio :label="0">富文本</el-radio> <el-radio label="0">富文本</el-radio>
<el-radio :label="1">markdown</el-radio> <el-radio label="1">markdown</el-radio>
</el-radio-group> </el-radio-group>
<div v-show="!type" <div v-show="editorType == 0"
class="quill" class="quill"
ref="quill" ref="quill"
:class="classes"> :class="classes">
@ -26,10 +26,13 @@
</div> </div>
<mavon-editor class="md" <mavon-editor class="md"
v-model="mdVal" v-model="mdVal"
v-show="type" v-show="editorType == 1"
ref="md" ref="md"
:ishljs="true" :ishljs="true"
:subfield="false" :subfield="false"
:editable="false"
:toolbarsFlag="false"
:boxShadowStyle="none"
@change="mdChange" @change="mdChange"
@imgAdd="imgAdd" /> @imgAdd="imgAdd" />
</div> </div>
@ -87,6 +90,11 @@ export default {
type: Number, type: Number,
default: 0 default: 0
}, },
//
type: {
type: String,
default: '0'
},
}, },
data () { data () {
const that = this const that = this
@ -94,7 +102,7 @@ export default {
headers: { headers: {
token: util.local.get(Setting.tokenKey) token: util.local.get(Setting.tokenKey)
}, },
type: 0, editorType: '0',
mdVal: '', mdVal: '',
Quill: null, Quill: null,
currentValue: "", currentValue: "",
@ -144,17 +152,23 @@ export default {
}, },
watch: { watch: {
type: {
handler (val) {
this.editorType = val
},
immediate: true
},
value: { value: {
handler (val) { handler (val) {
if (!this.type) { if (this.type == 0) {
if (val !== this.currentValue) { if (val !== this.currentValue) {
this.currentValue = val; this.currentValue = val;
if (this.Quill) { if (this.Quill) {
this.Quill.pasteHTML(this.value); this.Quill.pasteHTML(this.value);
} }
} }
if (!this.mdVal) this.mdVal = val
} }
if (!this.mdVal) this.mdVal = val
}, },
immediate: true immediate: true
} }
@ -179,6 +193,7 @@ export default {
methods: { methods: {
// //
typeChange (val) { typeChange (val) {
this.$emit('update:type', val)
if (!this.mdVal) this.mdVal = this.value if (!this.mdVal) this.mdVal = this.value
}, },

@ -47,19 +47,14 @@
</div> </div>
<div class="filter"> <div class="filter">
<dl v-if="curTab == 1"> <dl v-if="curTab == 1">
<dt>学科类别</dt> <dt>学科专业</dt>
<div class="vals"> <div class="vals">
<dd :class="{active: categoryId === ''}" <dd :class="{active: categoryId === ''}"
@click="catetoryClick('')">全部</dd> @click="catetoryClick('')">全部</dd>
<dd :class="{active: categoryId === 1}" <dd :class="{active: categoryId === 1}"
style="margin-right: 20px" style="margin-right: 20px"
@click="catetoryClick(1)">不限</dd> @click="catetoryClick(1)">不限</dd>
<dd v-for="(item, i) in category" <div v-for="(item, i) in category"
:key="i"
:class="{active: categoryId === item.value}"
@click="categoryClick(item, 1)">{{ item.label }}</dd>
<!-- <div v-for="(item, i) in category"
:key="i" :key="i"
:class="['category-item', {active: item.disciplineId == categoryId}]"> :class="['category-item', {active: item.disciplineId == categoryId}]">
<span class="name" <span class="name"
@ -70,8 +65,8 @@
:options="item.list" :options="item.list"
:props="{ checkStrictly: true }" :props="{ checkStrictly: true }"
placeholder="" placeholder=""
@change="id => categoryChange(id, item, i)"></el-cascader> --> @change="id => categoryChange(id, item, i)"></el-cascader>
<!-- </div> --> </div>
</div> </div>
</dl> </dl>
<dl v-if="curTab == 3"> <dl v-if="curTab == 3">
@ -430,14 +425,6 @@ export default {
e.val = [] e.val = []
}) })
}, },
categoryClick (item, i) {
this.clearCategory()
item.val = val
this[i === 1 ? 'categoryId' : i === 2 ? 'professionalCategoryId' : 'professionalId'] = item.disciplineId
this.professionalCategoryId = val[0] || ''
this.professionalId = val[1] || ''
this.initData()
},
categoryChange (val, item, i) { categoryChange (val, item, i) {
const name = this.$refs['category' + i][0].getCheckedNodes()[0].pathLabels const name = this.$refs['category' + i][0].getCheckedNodes()[0].pathLabels
console.log("🚀 ~ file: index.vue:431 ~ categoryChange ~ val, item:", val, item, name) console.log("🚀 ~ file: index.vue:431 ~ categoryChange ~ val, item:", val, item, name)

@ -73,6 +73,7 @@
<quill :border="true" <quill :border="true"
:readonly="isDetail" :readonly="isDetail"
v-model="projectManage.experimentTarget" v-model="projectManage.experimentTarget"
:type.sync="projectManage.experimentTargetType"
:minHeight="150" :minHeight="150"
:height="150" /> :height="150" />
</el-form-item> </el-form-item>
@ -89,6 +90,7 @@
<quill :border="true" <quill :border="true"
:readonly="isDetail" :readonly="isDetail"
v-model="projectManage.experimentDescription" v-model="projectManage.experimentDescription"
:type.sync="projectManage.experimentDescriptionType"
:minHeight="150" :minHeight="150"
:height="150" :height="150"
:index="1" /> :index="1" />
@ -213,6 +215,7 @@
<quill :border="true" <quill :border="true"
:readonly="isDetail" :readonly="isDetail"
v-model="projectManage.experimentHint" v-model="projectManage.experimentHint"
:type.sync="projectManage.experimentHintType"
:minHeight="150" :minHeight="150"
:height="150" :height="150"
:index="3" /> :index="3" />
@ -311,7 +314,10 @@ export default {
experimentDescription: "", // experimentDescription: "", //
state: 0, // (0稿 1) state: 0, // (0稿 1)
isOpen: 0, // (0 1 0) isOpen: 0, // (0 1 0)
isDel: 0 // (0 1 0) isDel: 0, // (0 1 0)
experimentTargetType: '0',
experimentDescriptionType: '0',
experimentHintType: '0',
}, },
projectJudgmentData: [], //() projectJudgmentData: [], //()
selectedProjectJudgment: [], // selectedProjectJudgment: [], //
@ -426,6 +432,9 @@ export default {
this.mallIds = [mallId] this.mallIds = [mallId]
systemId && this.mallIds.push(systemId) systemId && this.mallIds.push(systemId)
} }
if (!projectManage.experimentDescriptionType) projectManage.experimentDescriptionType = '0'
if (!projectManage.experimentHintType) projectManage.experimentHintType = '0'
if (!projectManage.experimentTargetType) projectManage.experimentTargetType = '0'
this.projectManage = projectManage; this.projectManage = projectManage;
this.originName = projectManage.projectName this.originName = projectManage.projectName
this.projectJudgmentData = projectJudgmentVos; this.projectJudgmentData = projectJudgmentVos;

Loading…
Cancel
Save