| | |
| | | this.fromReview, |
| | | this.outWord |
| | | ); |
| | | |
| | | // 如果是来自编辑按钮跳转且没有文案内容,尝试根据ID获取文案详情 |
| | | if (this.fromEdit && !this.editorContent && this.id) { |
| | | this.loadCopywritingDetail(this.id); |
| | | } |
| | | |
| | | // 从路由参数获取附件信息 |
| | | const selectedAttachmentId = this.$route.query.selectedAttachmentId; |
| | |
| | | this.attachmentLoading = false; |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * 附件选择变化事件 |
| | | */ |
| | | handleAttachmentChange(value) { |
| | | this.selectedAttachment = value; |
| | | // 更新客户资料附件 |
| | |
| | | console.log('已更新客户资料附件:', this.jianli); |
| | | } |
| | | }, |
| | | |
| | | // 根据ID加载文案详情 |
| | | async loadCopywritingDetail(id) { |
| | | try { |
| | | this.loading = true; |
| | | // 调用文案详情接口获取最新内容 |
| | | const response = await defHttp.get({ |
| | | url: '/copywriting/copywriting/list', |
| | | params: { |
| | | id: id |
| | | } |
| | | }); |
| | | |
| | | if (response?.records && response.records.length > 0) { |
| | | const copywriting = response.records[0]; |
| | | // 更新编辑器内容 |
| | | if (copywriting.text) { |
| | | this.editorContent = copywriting.text; |
| | | console.log('已加载文案详情:', copywriting.text); |
| | | } |
| | | // 更新标题 |
| | | if (copywriting.title) { |
| | | this.title = copywriting.title; |
| | | } |
| | | } |
| | | } catch (error) { |
| | | console.error('加载文案详情失败:', error); |
| | | message.warning('加载文案详情失败,编辑器可能为空'); |
| | | } finally { |
| | | this.loading = false; |
| | | } |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |