fix: 【装修】todo修复

This commit is contained in:
hw
2025-12-01 15:48:27 +08:00
parent aedcf2d05c
commit a9a075346f
8 changed files with 20 additions and 29 deletions

View File

@@ -133,9 +133,8 @@ function handleSliderChange(prop: string) {
</TabPane> </TabPane>
<!-- 每个组件的通用内容 --> <!-- 每个组件的通用内容 -->
<!-- TODO @xingyu装修这里的样式貌似没 ele 版本的好看 -->
<TabPane tab="样式" key="style" force-render> <TabPane tab="样式" key="style" force-render>
<p class="text-lg font-bold">组件样式</p> <div class="mb-2 bg-gray-100 p-2 text-sm">组件样式</div>
<div class="flex flex-col gap-2 rounded-md p-4 shadow-lg"> <div class="flex flex-col gap-2 rounded-md p-4 shadow-lg">
<Form :model="formData"> <Form :model="formData">
<FormItem <FormItem
@@ -181,7 +180,7 @@ function handleSliderChange(prop: string) {
class="mb-0 w-full" class="mb-0 w-full"
> >
<Row> <Row>
<Col :span="11"> <Col :span="19">
<Slider <Slider
v-model:value=" v-model:value="
formData[dataRef.prop as keyof ComponentStyle] formData[dataRef.prop as keyof ComponentStyle]
@@ -192,8 +191,9 @@ function handleSliderChange(prop: string) {
class="mr-4" class="mr-4"
/> />
</Col> </Col>
<Col :span="2"> <Col :span="4">
<InputNumber <InputNumber
class="w-[50px]"
:max="100" :max="100"
:min="0" :min="0"
v-model:value=" v-model:value="

View File

@@ -98,7 +98,7 @@ const handleDeleteComponent = () => {
<component :is="component.id" :property="component.property" /> <component :is="component.id" :property="component.property" />
</div> </div>
<div <div
class="component-wrap absolute -bottom-1 -left-0.5 -right-0.5 -top-1 block h-full w-full" class="component-wrap absolute -bottom-1 -left-0.5 -right-0.5 block h-full w-full"
> >
<!-- 左侧组件名悬浮的小贴条 --> <!-- 左侧组件名悬浮的小贴条 -->
<div class="component-name" v-if="component.name"> <div class="component-name" v-if="component.name">
@@ -109,9 +109,6 @@ const handleDeleteComponent = () => {
class="component-toolbar" class="component-toolbar"
v-if="showToolbar && component.name && active" v-if="showToolbar && component.name && active"
> >
<!-- TODO @xingyu装修按钮少的时候会存在遮住的情况 -->
<!-- TODO @xingyu装修貌似中间的选中框框没全部框柱上面多了点下面少了点 -->
<!-- TODO @xingyu装修从左侧的组件拖拽到中间时没有这个组件的小卡片预览ele 版本是有的 -->
<VerticalButtonGroup size="small"> <VerticalButtonGroup size="small">
<Button <Button
:disabled="!canMoveUp" :disabled="!canMoveUp"
@@ -172,7 +169,6 @@ const handleDeleteComponent = () => {
</div> </div>
</div> </div>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
$active-border-width: 2px; $active-border-width: 2px;
$hover-border-width: 1px; $hover-border-width: 1px;

View File

@@ -100,5 +100,4 @@ function handleCloneComponent(component: DiyComponent<any>) {
</Collapse.Panel> </Collapse.Panel>
</Collapse> </Collapse>
</div> </div>
<!-- TODO @xingyu装修ele 里面有一些 style看看是不是都迁移完了特别是 drag-area 是全局样式 -->
</template> </template>

View File

@@ -106,7 +106,6 @@ watch(
</div> </div>
</Carousel> </Carousel>
</template> </template>
<style lang="scss"> <style lang="scss">
// Ant Design Vue Carousel 样式调整 // Ant Design Vue Carousel 样式调整
:deep(.ant-carousel .ant-carousel-dots) { :deep(.ant-carousel .ant-carousel-dots) {

View File

@@ -14,7 +14,7 @@ defineProps<{ property: UserCardProperty }>();
<div class="flex flex-col"> <div class="flex flex-col">
<div class="flex items-center justify-between px-4 py-6"> <div class="flex items-center justify-between px-4 py-6">
<div class="flex flex-1 items-center gap-4"> <div class="flex flex-1 items-center gap-4">
<Avatar :size="60"> <Avatar :size="60" class="flex items-center">
<IconifyIcon icon="ep:avatar" :size="60" /> <IconifyIcon icon="ep:avatar" :size="60" />
</Avatar> </Avatar>
<span class="text-[18px] font-bold">芋道源码</span> <span class="text-[18px] font-bold">芋道源码</span>

View File

@@ -175,8 +175,7 @@ function handleComponentSelected(
index: number = -1, index: number = -1,
) { ) {
// 使用深拷贝避免响应式追踪循环警告 // 使用深拷贝避免响应式追踪循环警告
// TODO @xingyu【装修】这个是必须的么ele 没有哈。 selectedComponent.value = component;
selectedComponent.value = cloneDeep(component);
selectedComponentIndex.value = index; selectedComponentIndex.value = index;
} }
@@ -344,7 +343,7 @@ onMounted(() => {
<!-- 中心设计区域ComponentContainer --> <!-- 中心设计区域ComponentContainer -->
<Col :span="12"> <Col :span="12">
<div <div
class="relative flex max-h-[calc(80vh)] w-full flex-1 flex-col justify-center overflow-y-auto" class="editor-center relative flex max-h-[calc(80vh)] w-full flex-1 flex-col overflow-y-auto"
@click="handlePageSelected" @click="handlePageSelected"
> >
<!-- 手机顶部 --> <!-- 手机顶部 -->
@@ -378,20 +377,20 @@ onMounted(() => {
</div> </div>
<!-- 手机页面编辑区域 --> <!-- 手机页面编辑区域 -->
<div <div
class="min-h-full w-full" class="mx-auto min-h-full w-96 bg-no-repeat"
:style="{ :style="{
// backgroundColor: pageConfigComponent.property.backgroundColor, // backgroundColor: pageConfigComponent.property.backgroundColor,
backgroundImage: `url(${pageConfigComponent.property.backgroundImage})`, backgroundImage: `url(${pageConfigComponent.property.backgroundImage})`,
}" }"
> >
<div <div
class="relative mx-auto my-0 min-h-full w-96 items-center justify-center bg-auto bg-no-repeat" class="relative my-0 min-h-full w-full items-center justify-center bg-auto bg-no-repeat"
> >
<draggable <draggable
v-model="pageComponents" v-model="pageComponents"
:animation="200" :animation="200"
:force-fallback="false" :force-fallback="false"
class="min-h-full w-full" class="min-h-[70vh] w-full"
filter=".component-toolbar" filter=".component-toolbar"
ghost-class="draggable-ghost" ghost-class="draggable-ghost"
group="component" group="component"
@@ -508,5 +507,4 @@ onMounted(() => {
</div> </div>
</PreviewModal> </PreviewModal>
</Page> </Page>
<!-- TODO @xingyu装修这里改造完后类似 web-ele/src/views/mall/promotion/components/diy-editor/index.vue 里的全局样式递推到子组件里的就没没了类似 property-group -->
</template> </template>

View File

@@ -1,7 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { Space } from 'ant-design-vue'; import { Space } from 'ant-design-vue';
// TODO @xingyu【装修】貌似上下移动的按钮被遮住了
/** /**
* 垂直按钮组 * 垂直按钮组
* Ant Design Vue 的按钮组,通过 Space 实现垂直布局 * Ant Design Vue 的按钮组,通过 Space 实现垂直布局

View File

@@ -20,7 +20,6 @@ import {
} from '#/api/mall/promotion/diy/template'; } from '#/api/mall/promotion/diy/template';
import { DiyEditor, PAGE_LIBS } from '#/views/mall/promotion/components'; import { DiyEditor, PAGE_LIBS } from '#/views/mall/promotion/components';
// TODO @xingyu【装修】左上角的“基础设施”、“首页”、“我的”切换时中间的编辑器内容没有正确切换。可对比 ele 版本的效果!
/** 装修模板表单 */ /** 装修模板表单 */
defineOptions({ name: 'DiyTemplateDecorate' }); defineOptions({ name: 'DiyTemplateDecorate' });
@@ -73,24 +72,25 @@ async function getPageDetail(id: any) {
} }
} }
/** 模板选项切换 */
/** 模板选项切换 */ /** 模板选项切换 */
function handleTemplateItemChange(val: any) { function handleTemplateItemChange(val: any) {
const changeValue = val.target.value; const valIndex = val.target.value;
// 缓存模版编辑数据 // 缓存模版编辑数据
currentFormDataMap.value.set( currentFormDataMap.value.set(
templateItems.value[changeValue]!.name, templateItems.value[selectedTemplateItem.value]?.name || '',
currentFormData.value!, currentFormData.value!,
); );
// 切换模版
selectedTemplateItem.value = changeValue;
// 读取模版缓存 // 读取模版缓存
const data = currentFormDataMap.value.get( const data = currentFormDataMap.value.get(
templateItems.value[changeValue]!.name, templateItems.value[valIndex]?.name || '',
); );
// 切换模版
selectedTemplateItem.value = valIndex;
// 情况一:编辑模板 // 情况一:编辑模板
if (changeValue === 0) { if (valIndex === 0) {
libs.value = templateLibs; libs.value = templateLibs;
currentFormData.value = (isEmpty(data) ? formData.value : data) as currentFormData.value = (isEmpty(data) ? formData.value : data) as
| MallDiyPageApi.DiyPage | MallDiyPageApi.DiyPage
@@ -104,7 +104,7 @@ function handleTemplateItemChange(val: any) {
isEmpty(data) isEmpty(data)
? formData.value!.pages.find( ? formData.value!.pages.find(
(page: MallDiyPageApi.DiyPage) => (page: MallDiyPageApi.DiyPage) =>
page.name === templateItems.value[changeValue]!.name, page.name === templateItems.value[valIndex]?.name,
) )
: data : data
) as MallDiyPageApi.DiyPage | MallDiyTemplateApi.DiyTemplateProperty; ) as MallDiyPageApi.DiyPage | MallDiyTemplateApi.DiyTemplateProperty;