Merge branch 'master' of 192.168.1.40:outsource/HaniBlindBox
This commit is contained in:
commit
15107da6d8
|
|
@ -4,6 +4,7 @@
|
|||
title="编辑单页"
|
||||
width="900px"
|
||||
:close-on-click-modal="false"
|
||||
:destroy-on-close="true"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form
|
||||
|
|
@ -25,7 +26,7 @@
|
|||
</el-form-item>
|
||||
|
||||
<el-form-item label="内容" prop="content">
|
||||
<div class="editor-container">
|
||||
<div v-if="dialogVisible" class="editor-container">
|
||||
<Toolbar
|
||||
:editor="editorRef"
|
||||
:defaultConfig="toolbarConfig"
|
||||
|
|
@ -158,27 +159,47 @@ const formRules: FormRules = {
|
|||
|
||||
// 编辑器创建完成
|
||||
const handleCreated = (editor: IDomEditor) => {
|
||||
console.log('[DanyeFormDialog] handleCreated called, editor:', editor)
|
||||
console.log('[DanyeFormDialog] editor.isDestroyed:', editor.isDestroyed())
|
||||
editorRef.value = editor
|
||||
|
||||
// 如果有内容,设置到编辑器
|
||||
if (formData.content) {
|
||||
console.log('[DanyeFormDialog] Setting initial content to editor:', formData.content.substring(0, 100))
|
||||
editor.setHtml(formData.content)
|
||||
}
|
||||
}
|
||||
|
||||
// 监听弹窗打开,初始化数据
|
||||
watch(() => props.modelValue, (visible) => {
|
||||
console.log('[DanyeFormDialog] modelValue changed:', visible, 'danye:', props.danye?.id)
|
||||
if (visible && props.danye) {
|
||||
formData.title = props.danye.title
|
||||
formData.content = props.danye.content || ''
|
||||
console.log('[DanyeFormDialog] formData.content set to:', formData.content.substring(0, 100))
|
||||
console.log('[DanyeFormDialog] editorRef.value:', editorRef.value)
|
||||
console.log('[DanyeFormDialog] editorRef.value?.isDestroyed():', editorRef.value?.isDestroyed?.())
|
||||
}
|
||||
})
|
||||
|
||||
// 监听 dialogVisible 变化
|
||||
watch(dialogVisible, (visible) => {
|
||||
console.log('[DanyeFormDialog] dialogVisible changed:', visible)
|
||||
})
|
||||
|
||||
// 组件销毁时销毁编辑器
|
||||
onBeforeUnmount(() => {
|
||||
console.log('[DanyeFormDialog] onBeforeUnmount called')
|
||||
const editor = editorRef.value
|
||||
if (editor) {
|
||||
console.log('[DanyeFormDialog] Destroying editor in onBeforeUnmount')
|
||||
editor.destroy()
|
||||
}
|
||||
})
|
||||
|
||||
// 重置表单
|
||||
const resetForm = () => {
|
||||
console.log('[DanyeFormDialog] resetForm called')
|
||||
formData.title = ''
|
||||
formData.content = ''
|
||||
formRef.value?.resetFields()
|
||||
|
|
@ -186,13 +207,17 @@ const resetForm = () => {
|
|||
|
||||
// 关闭弹窗
|
||||
const handleClose = () => {
|
||||
dialogVisible.value = false
|
||||
resetForm()
|
||||
// 销毁编辑器实例
|
||||
console.log('[DanyeFormDialog] handleClose called')
|
||||
console.log('[DanyeFormDialog] editorRef.value before destroy:', editorRef.value)
|
||||
// 先销毁编辑器实例
|
||||
if (editorRef.value) {
|
||||
console.log('[DanyeFormDialog] Destroying editor, isDestroyed:', editorRef.value.isDestroyed())
|
||||
editorRef.value.destroy()
|
||||
editorRef.value = undefined
|
||||
console.log('[DanyeFormDialog] Editor destroyed and set to undefined')
|
||||
}
|
||||
dialogVisible.value = false
|
||||
resetForm()
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class QuanYiService : IQuanYiService
|
|||
levelDto.PuJiang = puJiang;
|
||||
|
||||
// Get prize rewards (type = 2)
|
||||
var gaoJiang = await _dbContext.VipLevelRewards
|
||||
var gaoJiangRaw = await _dbContext.VipLevelRewards
|
||||
.Where(r => r.VipLevelId == vipLevel.Id && r.Type == 2 && r.DeletedAt == null)
|
||||
.OrderBy(r => r.Id)
|
||||
.Select(r => new QuanYiRewardDto
|
||||
|
|
@ -77,10 +77,15 @@ public class QuanYiService : IQuanYiService
|
|||
Id = r.Id,
|
||||
Title = r.Title,
|
||||
ZNum = r.ZNum,
|
||||
ImgUrl = GetImageUrl(r.ImgUrl)
|
||||
ImgUrl = r.ImgUrl
|
||||
})
|
||||
.ToListAsync();
|
||||
levelDto.GaoJiang = gaoJiang;
|
||||
// Process image URLs after query
|
||||
foreach (var item in gaoJiangRaw)
|
||||
{
|
||||
item.ImgUrl = GetImageUrl(item.ImgUrl);
|
||||
}
|
||||
levelDto.GaoJiang = gaoJiangRaw;
|
||||
|
||||
// Check if user can claim this level's rewards
|
||||
if ((user.OuQiLevel ?? 0) >= vipLevel.Level)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user