Merge branch 'master' of 192.168.1.40:outsource/HaniBlindBox
This commit is contained in:
commit
15107da6d8
|
|
@ -4,6 +4,7 @@
|
||||||
title="编辑单页"
|
title="编辑单页"
|
||||||
width="900px"
|
width="900px"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
|
:destroy-on-close="true"
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form
|
||||||
|
|
@ -25,7 +26,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="内容" prop="content">
|
<el-form-item label="内容" prop="content">
|
||||||
<div class="editor-container">
|
<div v-if="dialogVisible" class="editor-container">
|
||||||
<Toolbar
|
<Toolbar
|
||||||
:editor="editorRef"
|
:editor="editorRef"
|
||||||
:defaultConfig="toolbarConfig"
|
:defaultConfig="toolbarConfig"
|
||||||
|
|
@ -158,27 +159,47 @@ const formRules: FormRules = {
|
||||||
|
|
||||||
// 编辑器创建完成
|
// 编辑器创建完成
|
||||||
const handleCreated = (editor: IDomEditor) => {
|
const handleCreated = (editor: IDomEditor) => {
|
||||||
|
console.log('[DanyeFormDialog] handleCreated called, editor:', editor)
|
||||||
|
console.log('[DanyeFormDialog] editor.isDestroyed:', editor.isDestroyed())
|
||||||
editorRef.value = editor
|
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) => {
|
watch(() => props.modelValue, (visible) => {
|
||||||
|
console.log('[DanyeFormDialog] modelValue changed:', visible, 'danye:', props.danye?.id)
|
||||||
if (visible && props.danye) {
|
if (visible && props.danye) {
|
||||||
formData.title = props.danye.title
|
formData.title = props.danye.title
|
||||||
formData.content = props.danye.content || ''
|
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(() => {
|
onBeforeUnmount(() => {
|
||||||
|
console.log('[DanyeFormDialog] onBeforeUnmount called')
|
||||||
const editor = editorRef.value
|
const editor = editorRef.value
|
||||||
if (editor) {
|
if (editor) {
|
||||||
|
console.log('[DanyeFormDialog] Destroying editor in onBeforeUnmount')
|
||||||
editor.destroy()
|
editor.destroy()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 重置表单
|
// 重置表单
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
|
console.log('[DanyeFormDialog] resetForm called')
|
||||||
formData.title = ''
|
formData.title = ''
|
||||||
formData.content = ''
|
formData.content = ''
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
|
|
@ -186,13 +207,17 @@ const resetForm = () => {
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
dialogVisible.value = false
|
console.log('[DanyeFormDialog] handleClose called')
|
||||||
resetForm()
|
console.log('[DanyeFormDialog] editorRef.value before destroy:', editorRef.value)
|
||||||
// 销毁编辑器实例
|
// 先销毁编辑器实例
|
||||||
if (editorRef.value) {
|
if (editorRef.value) {
|
||||||
|
console.log('[DanyeFormDialog] Destroying editor, isDestroyed:', editorRef.value.isDestroyed())
|
||||||
editorRef.value.destroy()
|
editorRef.value.destroy()
|
||||||
editorRef.value = undefined
|
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;
|
levelDto.PuJiang = puJiang;
|
||||||
|
|
||||||
// Get prize rewards (type = 2)
|
// 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)
|
.Where(r => r.VipLevelId == vipLevel.Id && r.Type == 2 && r.DeletedAt == null)
|
||||||
.OrderBy(r => r.Id)
|
.OrderBy(r => r.Id)
|
||||||
.Select(r => new QuanYiRewardDto
|
.Select(r => new QuanYiRewardDto
|
||||||
|
|
@ -77,10 +77,15 @@ public class QuanYiService : IQuanYiService
|
||||||
Id = r.Id,
|
Id = r.Id,
|
||||||
Title = r.Title,
|
Title = r.Title,
|
||||||
ZNum = r.ZNum,
|
ZNum = r.ZNum,
|
||||||
ImgUrl = GetImageUrl(r.ImgUrl)
|
ImgUrl = r.ImgUrl
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.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
|
// Check if user can claim this level's rewards
|
||||||
if ((user.OuQiLevel ?? 0) >= vipLevel.Level)
|
if ((user.OuQiLevel ?? 0) >= vipLevel.Level)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user