This commit is contained in:
@fawn-nine
2023-06-26 10:21:58 +08:00
parent 8e7a0ac397
commit 43a14b2f21

View File

@@ -22,14 +22,14 @@
</el-form-item> </el-form-item>
<el-form-item label="协议内容" prop="content"> <el-form-item label="协议内容" prop="content">
<quill-editor v-model="dataForm.content" ref="myQuillEditor" :options="editorOption" <quill-editor v-model="dataForm.content" ref="myQuillEditor" :options="editorOption"
@blur="onEditorBlur($event)" @focus="onEditorFocus($event)" @blur="onEditorBlur($event)" @focus="onEditorFocus($event)"
@ready="onEditorReady($event)" class="shangpin_editor"> @ready="onEditorReady($event)" class="shangpin_editor">
</quill-editor> </quill-editor>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="handlereset">取消</el-button> <el-button @click="handlereset">取消</el-button>
<el-button type="primary" @click="subMit"> </el-button> <el-button type="primary" @click="subMit"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@@ -49,34 +49,43 @@
// visible: { // visible: {
// type: Boolean, // type: Boolean,
// value: false // value: false
// }, // },
// details: { // details: {
// type: Object, // type: Object,
// value: {} // value: {}
// }, // },
}, },
data () { data () {
return { return {
visible:false, visible:false,
dataForm:{ dataForm:{
content:'', content:'',
title:'', title:'',
id: 0, id: 0,
type:'' type:''
}, },
dataRule: { dataRule: {
title: [{ title: [{
required: true, required: true,
message: '请填写标题', message: '请填写标题',
trigger: 'blur' trigger: 'blur'
}],}, }],},
options: [{ options: [{
value: 'member', value: 'member',
label: '会员协议' label: '会员协议'
}, { }, {
value: 'pay', value: 'pay',
label: '充值协议' label: '充值协议'
}], },
{
value: 'user',
label: '用户协议'
},
{
value: 'privacy',
label: '隐私协议'
}
],
editorOption: { editorOption: {
modules: { modules: {
toolbar: [ toolbar: [
@@ -131,16 +140,16 @@
init(row){ init(row){
this.dataForm = row this.dataForm = row
this.visible = true this.visible = true
}, },
handlereset() { handlereset() {
this.visible = false this.visible = false
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
this.$emit('refreshDataList') this.$emit('refreshDataList')
// this.$refs['dataForm'].reset() // this.$refs['dataForm'].reset()
}, },
subMit(){ subMit(){
// 表单提交 // 表单提交
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (valid) { if (valid) {
this.$http({ this.$http({
url: this.$http.adornUrl(`/sys/agreement/${!this.dataForm.id ? 'save' : 'update'}`), url: this.$http.adornUrl(`/sys/agreement/${!this.dataForm.id ? 'save' : 'update'}`),
@@ -149,7 +158,7 @@
'id': this.dataForm.id || undefined, 'id': this.dataForm.id || undefined,
'title': this.dataForm.title, 'title': this.dataForm.title,
'content': this.dataForm.content, 'content': this.dataForm.content,
'type': this.dataForm.type 'type': this.dataForm.type
}) })
}).then(({ data }) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
@@ -171,7 +180,7 @@
}) })
} }
}) })
}, },
handleClose(){ handleClose(){
this.$emit("Close", false) this.$emit("Close", false)
@@ -180,7 +189,7 @@
}, },
// 失去焦点事件 // 失去焦点事件
onEditorBlur(quill) { onEditorBlur(quill) {
console.log('editor blur!', quill) console.log('editor blur!', quill)
}, },
// 获得焦点事件 // 获得焦点事件
onEditorFocus(quill) { onEditorFocus(quill) {
@@ -190,10 +199,10 @@
onEditorReady(quill) { onEditorReady(quill) {
// console.log('editor ready!', quill) // console.log('editor ready!', quill)
}, },
},components:{ },components:{
quillEditor quillEditor
} }
} }
</script> </script>