|
|
@ -10,19 +10,30 @@ |
|
|
|
</div> |
|
|
|
<editor mode="design" @after-init.native="onAfterInit" /> |
|
|
|
</div> |
|
|
|
<img-editor |
|
|
|
v-if="editorShow" |
|
|
|
ref="imgEditorRef" |
|
|
|
:default-bg="curImgSrc" |
|
|
|
@closeDialog="closeDialog" |
|
|
|
@fullImgBack="fullImgBack" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
|
|
|
|
import Editor from '@/components/formEditor/Editor.vue' |
|
|
|
import ImgEditor from '@/components/360View/img-editor.vue' |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'Index', |
|
|
|
components: { Editor }, |
|
|
|
components: { ImgEditor, Editor }, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
editor: null, |
|
|
|
formList: [] |
|
|
|
formList: [], |
|
|
|
editorShow: false, |
|
|
|
curImgSrc: '', |
|
|
|
curKey: '' |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
@ -37,13 +48,33 @@ export default { |
|
|
|
// }) |
|
|
|
} |
|
|
|
}, |
|
|
|
closeDialog() { |
|
|
|
this.editorShow = false |
|
|
|
}, |
|
|
|
fullImgBack(value) { |
|
|
|
if (this.curKey) { |
|
|
|
this.editor.$(`#${this.curKey}`)[0].src = value |
|
|
|
} |
|
|
|
}, |
|
|
|
imageChange() { |
|
|
|
const data = this.editor.getBindObject().BODY |
|
|
|
const keys = Object.keys(data) |
|
|
|
this.editor.$('#img_editor').click(() => { |
|
|
|
this.editor.$('#img_editor')[0].src = require('@/assets/img/od.png') |
|
|
|
// 筛选出图片编辑的字段 |
|
|
|
const imgEditorList = keys.filter(item => item.includes('imgEditor')) |
|
|
|
// 遍历图片编辑 |
|
|
|
imgEditorList.forEach(item => { |
|
|
|
// 点击打开编辑器 |
|
|
|
this.editor.$('#' + item).click(() => { |
|
|
|
this.curKey = item |
|
|
|
this.curImgSrc = data[item] // 编辑器默认背景图带入 |
|
|
|
this.editorShow = true |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.imgEditorRef.init() |
|
|
|
}) |
|
|
|
// this.editor.$('#img_editor')[0].src = require('@/assets/img/od.png') |
|
|
|
}) |
|
|
|
}) |
|
|
|
console.log(keys) |
|
|
|
// console.log(keys) |
|
|
|
}, |
|
|
|
saveForm() { |
|
|
|
const html = this.editor.getHtml() |
|
|
|