master
xy 1 year ago
parent 85e3d118a7
commit 356638ebf7

@ -2,6 +2,7 @@
<div>
<vxe-modal
:width="defaultModalSize.width"
v-model="showModal"
:height="defaultModalSize.height"
show-zoom
resize
@ -12,42 +13,48 @@
show-cancel-button
:fullscreen="$store.getters.device === 'mobile'"
:z-index="zIndex"
v-model="showModal"
title="文本"
@confirm="confirm"
>
<template>
<my-tinymce style="height: 100%;" v-model="myText" :disabled="readonly" />
<my-tinymce v-model="myText" style="height: 100%;" :disabled="readonly" />
</template>
</vxe-modal>
</div>
</template>
<script>
import { PopupManager } from "element-ui/lib/utils/popup";
import { defaultModalSize } from "@/settings";
import { PopupManager } from 'element-ui/lib/utils/popup'
import { defaultModalSize } from '@/settings'
export default {
name: "RichTextModal",
name: 'RichTextModal',
data() {
return {
defaultModalSize,
zIndex: PopupManager.nextZIndex(),
showModal:false,
myText: "",
showModal: false,
myText: '',
readonly: false,
fieldName: "",
fieldName: '',
row: {}
}
},
computed: {},
created() {
this.$bus.$on('rich-text', ({ text, readonly }) => this.open(text, readonly))
},
beforeDestroy() {
this.$bus.$off('rich-text')
},
methods: {
open({text, readonly, row, fieldName}) {
this.showModal = true;
open({ text, readonly, row, fieldName }) {
this.showModal = true
this.$nextTick(() => {
this.myText = text;
this.readonly = !!readonly;
this.row = row;
this.fieldName = fieldName;
this.myText = text
this.readonly = !!readonly
this.row = row
this.fieldName = fieldName
})
},
confirm() {
@ -60,13 +67,6 @@ export default {
console.log(this.myText)
}
}
},
computed: {},
created() {
this.$bus.$on('rich-text',({text, readonly}) => this.open(text, readonly))
},
beforeDestroy() {
this.$bus.$off('rich-text')
}
}
</script>

@ -79,6 +79,14 @@
:edit-render="{ name: 'VxeSelect', options: site, props: { multiple: false }, optionProps: { value: 'id', label: 'name' } }"
/>
<vxe-column
header-align="center"
field="tags"
width="160"
title="标签"
:edit-render="{ name: 'input', attrs: { type: 'text' } }"
/>
<vxe-column
header-align="center"
field="lat"
@ -268,23 +276,15 @@ export default {
tableData: [],
form: {
id: '',
name: '',
tags: '',
site_id: '',
lat: '',
lng: '',
good_at: '',
content: '',
cover_id: [],
status: 1
},
validRules: {
@ -443,7 +443,7 @@ export default {
form[key] = row[key]
}
if(Array.isArray(row['cover']) && row['cover'].length>0){
if (Array.isArray(row['cover']) && row['cover'].length > 0) {
form['cover_id'] = row['cover'][0]?.response?.id ?? ''
}
this.loading = true

@ -24,6 +24,10 @@
</el-select>
</el-form-item>
<el-form-item label="标签" prop="tags">
<el-input v-model="form['tags']" clearable placeholder="请填写标签" />
</el-form-item>
<el-form-item label="位置" class="span2">
<my-map :value="[form['lat'], form['lng']]" @input="([lat, lng]) => (form['lat']=lat,form['lng']=lng)" />
</el-form-item>
@ -106,23 +110,15 @@ export default {
loading: false,
visible: false,
form: {
name: '',
tags: '',
site_id: '',
lat: '',
lng: '',
good_at: '',
content: '',
cover_id: [],
status: 1
},
rules: {

@ -84,6 +84,7 @@
<my-tinymce
v-model="form['content']"
clearable
:disabled="false"
placeholder="请填写内容"
style="width: 100%"
/>

@ -207,13 +207,10 @@ export default {
tableData: [],
form: {
id: '',
name: '',
pid: '',
image_id: []
image_id: '',
image: []
},
validRules: {
@ -355,12 +352,13 @@ export default {
}
form['image_id'] = row['image'][0]?.response?.id ?? ''
console.log('form', form)
this.loading = true
await save(form, false)
await this.getList()
this.loading = false
} catch (err) {
console.error(err)
this.loading = false
}
},

@ -12,15 +12,15 @@
<section class="drawer-container">
<el-form class="drawer-container__form" ref="elForm" :model="form" :rules="rules" label-position="top" label-width="120px" size="small">
<div class="form-layout">
<el-form-item label="商品分类名称" prop="name">
<el-input v-model="form['name']" clearable placeholder="请填写商品分类名称" style="width: 100%;"></el-input>
</el-form-item>
<el-form-item label="上级分类" prop="pid">
<vxe-tree-select v-model="form['pid']" placeholder="请选择上级分类" :options="[{ id: 0, title: '根结点' ,children: tableData }]" clearable :multiple="false" :option-props="{ value: 'id', label: 'title' }" style="width: 100%;"></vxe-tree-select>
<vxe-tree-select v-model="form['pid']" placeholder="请选择上级分类" :options="[{ id: 0, name: '根结点' ,children: tableData }]" clearable :multiple="false" :option-props="{ value: 'id', label: 'name' }" style="width: 100%;"></vxe-tree-select>
</el-form-item>
<el-form-item label="封面图片" prop="image_id">
<el-upload :action="action"
:file-list="form['image_id']"
@ -36,7 +36,7 @@
<div slot="tip" class="el-upload__tip">文件不超过{{ formatFileSize(uploadSize) }}</div>
</el-upload>
</el-form-item>
</div>
</el-form>
@ -64,12 +64,12 @@
default: false,
required: true
},
tableData: {
type: Array,
default: () => []
},
},
data() {
return {
@ -78,16 +78,16 @@
loading: false,
visible: false,
form: {
name: '',
pid: '',
image_id: [],
},
rules: {
},
}
},
@ -142,13 +142,13 @@
reset() {
this.form = {
name: '',
pid: '',
image_id: [],
}
this.$refs['elForm'].resetFields()
},
@ -157,10 +157,10 @@
this.$message.warning("文件正在上传中")
return
}
this.form['image_id'] = this.form['image_id'][0]?.response?.id ?? ''
this.$refs['elForm'].validate(async valid => {
if (valid) {
this.loading = true

Loading…
Cancel
Save