|
|
@@ -502,6 +502,9 @@ export default {
|
|
|
toolbarConfig: {
|
|
|
excludeKeys: ['header', 'lineHeight', 'letterSpacing', 'marginTop', 'export', 'marginBottom', 'fontFamily', 'indentDec', 'indentInc', 'scriptSub', 'scriptSuper', 'direction', 'video', 'listCheck', 'divider', 'removeFormat'],
|
|
|
},
|
|
|
+ editorInitialized: false, // 标记编辑器是否已初始化
|
|
|
+ pendingRichText: '', // 存储待设置的富文本内容
|
|
|
+ editorCtx: null, // 编辑器上下文
|
|
|
video: '',
|
|
|
tabIndex: '0',
|
|
|
mode: 5,
|
|
|
@@ -516,7 +519,7 @@ export default {
|
|
|
saleTime: '',
|
|
|
virtualSales: '',
|
|
|
sellingTimeType: '',
|
|
|
- serviceDescription: [],
|
|
|
+ serviceDescription: ["期限", "范围"],
|
|
|
richText: '',
|
|
|
// 为"每天"选项添加单独的时间段数组
|
|
|
sellingDay: [],
|
|
|
@@ -541,12 +544,12 @@ export default {
|
|
|
],
|
|
|
optionsDescription: [
|
|
|
{
|
|
|
- text: '说明1',
|
|
|
- value: '说明1'
|
|
|
+ text: '期限',
|
|
|
+ value: '期限'
|
|
|
},
|
|
|
{
|
|
|
- text: '说明2',
|
|
|
- value: '说明2'
|
|
|
+ text: '范围',
|
|
|
+ value: '范围'
|
|
|
}
|
|
|
],
|
|
|
fmImageList: [], //封面图回显
|
|
|
@@ -1323,14 +1326,12 @@ export default {
|
|
|
this.form.localProductSellingWeeks = this.localProductSellingWeeks
|
|
|
}
|
|
|
if (!res.data.result.serviceDescription) {
|
|
|
- this.form.serviceDescription = []
|
|
|
+ this.form.serviceDescription = ["期限", "范围"]
|
|
|
}
|
|
|
// 初始化编辑器内容
|
|
|
if (res.data.result.richText) {
|
|
|
this.form.richText = res.data.result.richText || ''
|
|
|
- this.editorCtx.setContents({
|
|
|
- html: this.form.richText
|
|
|
- })
|
|
|
+ this.setEditorContent(this.form.richText)
|
|
|
}
|
|
|
uni.setStorage({
|
|
|
key: 'group',
|
|
|
@@ -1365,7 +1366,28 @@ export default {
|
|
|
onEditorInit(editorCtx, editorId) {
|
|
|
this.editorCtx = editorCtx // 保存编辑器上下文
|
|
|
this.editorId = editorId // 保存编辑器ID
|
|
|
+ this.editorInitialized = true // 标记编辑器已初始化
|
|
|
console.log('编辑器初始化完成')
|
|
|
+
|
|
|
+ // 如果有待设置的内容,现在设置它
|
|
|
+ if (this.pendingRichText) {
|
|
|
+ this.setEditorContent(this.pendingRichText)
|
|
|
+ this.pendingRichText = '' // 清空待设置内容
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 设置编辑器内容
|
|
|
+ setEditorContent(content) {
|
|
|
+ if (!this.editorInitialized || !this.editorCtx) {
|
|
|
+ // 如果编辑器未初始化,存储内容等待初始化完成
|
|
|
+ this.pendingRichText = content
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.editorCtx.setContents({
|
|
|
+ html: content
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
// 实时获取富文本内容
|
|
|
onEditorInput(e) {
|