Review代码修改

This commit is contained in:
owen 2024-01-11 12:25:34 +08:00
parent bdf95dc0f8
commit 2b8eb49f71
13 changed files with 16 additions and 34 deletions

View File

@ -23,7 +23,7 @@
<template #tip>建议宽度 750px</template> <template #tip>建议宽度 750px</template>
</UploadImg> </UploadImg>
</el-form-item> </el-form-item>
<el-tree :data="treeData" :expand-on-click-node="false"> <el-tree :data="treeData" :expand-on-click-node="false" default-expand-all>
<template #default="{ node, data }"> <template #default="{ node, data }">
<el-form-item <el-form-item
:label="data.label" :label="data.label"
@ -43,7 +43,7 @@
</el-form-item> </el-form-item>
</template> </template>
</el-tree> </el-tree>
<slot name="style" :formData="formData"></slot> <slot name="style" :style="formData"></slot>
</el-form> </el-form>
</el-card> </el-card>
</el-tab-pane> </el-tab-pane>

View File

@ -2,15 +2,13 @@ import * as CouponTemplateApi from '@/api/mall/promotion/coupon/couponTemplate'
import { CouponTemplateValidityTypeEnum, PromotionDiscountTypeEnum } from '@/utils/constants' import { CouponTemplateValidityTypeEnum, PromotionDiscountTypeEnum } from '@/utils/constants'
import { floatToFixed2 } from '@/utils' import { floatToFixed2 } from '@/utils'
import { formatDate } from '@/utils/formatTime' import { formatDate } from '@/utils/formatTime'
import { object } from 'vue-types'
// 优惠值 // 优惠值
// TODO @疯狂idea 有告警
export const CouponDiscount = defineComponent({ export const CouponDiscount = defineComponent({
name: 'CouponDiscount', name: 'CouponDiscount',
props: { props: {
coupon: { coupon: object<CouponTemplateApi.CouponTemplateVO>()
type: CouponTemplateApi.CouponTemplateVO
}
}, },
setup(props) { setup(props) {
const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO
@ -35,9 +33,7 @@ export const CouponDiscount = defineComponent({
export const CouponDiscountDesc = defineComponent({ export const CouponDiscountDesc = defineComponent({
name: 'CouponDiscountDesc', name: 'CouponDiscountDesc',
props: { props: {
coupon: { coupon: object<CouponTemplateApi.CouponTemplateVO>()
type: CouponTemplateApi.CouponTemplateVO
}
}, },
setup(props) { setup(props) {
const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO
@ -61,9 +57,7 @@ export const CouponDiscountDesc = defineComponent({
export const CouponValidTerm = defineComponent({ export const CouponValidTerm = defineComponent({
name: 'CouponValidTerm', name: 'CouponValidTerm',
props: { props: {
coupon: { coupon: object<CouponTemplateApi.CouponTemplateVO>()
type: CouponTemplateApi.CouponTemplateVO
}
}, },
setup(props) { setup(props) {
const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO

View File

@ -24,7 +24,6 @@ export interface CouponCardProperty {
} }
// 定义组件 // 定义组件
// TODO @疯狂idea 有告警
export const component = { export const component = {
id: 'CouponCard', id: 'CouponCard',
name: '优惠券', name: '优惠券',

View File

@ -31,7 +31,6 @@ export interface MagicCubeItemProperty {
} }
// 定义组件 // 定义组件
// TODO @疯狂:有 idea 爆红告警
export const component = { export const component = {
id: 'MagicCube', id: 'MagicCube',
name: '广告魔方', name: '广告魔方',

View File

@ -59,7 +59,6 @@ export interface ProductCardFieldProperty {
} }
// 定义组件 // 定义组件
// TODO @疯狂idea 有告警
export const component = { export const component = {
id: 'ProductCard', id: 'ProductCard',
name: '商品卡片', name: '商品卡片',

View File

@ -38,7 +38,6 @@ export interface ProductListFieldProperty {
} }
// 定义组件 // 定义组件
// TODO @疯狂idea 有告警
export const component = { export const component = {
id: 'ProductList', id: 'ProductList',
name: '商品栏', name: '商品栏',

View File

@ -1,17 +1,16 @@
<template> <template>
<div class="min-h-30px" v-html="article.content"></div> <div class="min-h-30px" v-html="article?.content"></div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PromotionArticleProperty } from './config' import { PromotionArticleProperty } from './config'
import * as ArticleApi from '@/api/mall/promotion/article/index' import * as ArticleApi from '@/api/mall/promotion/article/index'
/** 营销文章 */ /** 营销文章 */
// TODO @idea
defineOptions({ name: 'PromotionArticle' }) defineOptions({ name: 'PromotionArticle' })
// //
const props = defineProps<{ property: PromotionArticleProperty }>() const props = defineProps<{ property: PromotionArticleProperty }>()
// //
const article = ref<ArticleApi.ArticleVO[]>({}) const article = ref<ArticleApi.ArticleVO>()
watch( watch(
() => props.property.id, () => props.property.id,
async () => { async () => {

View File

@ -39,13 +39,11 @@ export interface PromotionCombinationFieldProperty {
} }
// 定义组件 // 定义组件
// TODO @疯狂idea 有告警
export const component = { export const component = {
id: 'PromotionCombination', id: 'PromotionCombination',
name: '拼团', name: '拼团',
icon: 'mdi:account-group', icon: 'mdi:account-group',
property: { property: {
activityId: undefined,
layoutType: 'oneCol', layoutType: 'oneCol',
fields: { fields: {
name: { show: true, color: '#000' }, name: { show: true, color: '#000' },

View File

@ -17,7 +17,6 @@ export interface SearchProperty {
export type PlaceholderPosition = 'left' | 'center' export type PlaceholderPosition = 'left' | 'center'
// 定义组件 // 定义组件
// TODO @疯狂idea 这里爆红可以卡看咋优化下哇is missing the following properties from type DiyComponent<SearchProperty>: uid, position
export const component = { export const component = {
id: 'SearchBar', id: 'SearchBar',
name: '搜索框', name: '搜索框',

View File

@ -19,7 +19,6 @@ export interface VideoPlayerStyle extends ComponentStyle {
} }
// 定义组件 // 定义组件
// TODO @疯狂idea 有告警
export const component = { export const component = {
id: 'VideoPlayer', id: 'VideoPlayer',
name: '视频播放', name: '视频播放',
@ -33,6 +32,6 @@ export const component = {
bgColor: '#fff', bgColor: '#fff',
marginBottom: 8, marginBottom: 8,
height: 300 height: 300
} as ComponentStyle } as VideoPlayerStyle
} }
} as DiyComponent<VideoPlayerProperty> } as DiyComponent<VideoPlayerProperty>

View File

@ -1,9 +1,9 @@
<template> <template>
<ComponentContainerProperty v-model="formData.style"> <ComponentContainerProperty v-model="formData.style">
<template #style="{ formData }"> <template #style>
<el-form-item label="高度" prop="height"> <el-form-item label="高度" prop="height">
<el-slider <el-slider
v-model="formData.height" v-model="formData.style.height"
:max="500" :max="500"
:min="100" :min="100"
show-input show-input

View File

@ -6,7 +6,7 @@ import { TabBarProperty } from '@/components/DiyEditor/components/mobile/TabBar/
// 页面装修组件 // 页面装修组件
export interface DiyComponent<T> { export interface DiyComponent<T> {
// 用于区分同一种组件的不同实例 // 用于区分同一种组件的不同实例
uid: number uid?: number
// 组件唯一标识 // 组件唯一标识
id: string id: string
// 组件名称 // 组件名称
@ -21,7 +21,7 @@ export interface DiyComponent<T> {
center center
fixed: 由组件自己决定位置 fixed: 由组件自己决定位置
*/ */
position: 'top' | 'bottom' | 'center' | '' | 'fixed' position?: 'top' | 'bottom' | 'center' | '' | 'fixed'
// 组件属性 // 组件属性
property: T property: T
} }
@ -103,8 +103,7 @@ export function usePropertyForm<T>(modelValue: T, emit: Function): { formData: R
} }
) )
// TODO @疯狂:这个 idea 爆红,看看怎么可以解决哈 return { formData } as { formData: Ref<T> }
return { formData }
} }
// 页面组件库 // 页面组件库

View File

@ -473,8 +473,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
title: '模板装修', title: '模板装修',
noCache: true, noCache: true,
hidden: true, hidden: true,
// TODO @疯狂:建议 menu 那的 /mall/promotion/diy-template/diy-template 改成 /mall/promotion/diy/template activeMenu: '/mall/promotion/diy/template'
activeMenu: '/mall/promotion/diy-template/diy-template'
}, },
component: () => import('@/views/mall/promotion/diy/template/decorate.vue') component: () => import('@/views/mall/promotion/diy/template/decorate.vue')
}, },
@ -485,8 +484,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
title: '页面装修', title: '页面装修',
noCache: true, noCache: true,
hidden: true, hidden: true,
// TODO @疯狂:建议 menu 那的 /mall/promotion/diy-template/diy-page 改成 /mall/promotion/diy/page activeMenu: '/mall/promotion/diy/page'
activeMenu: '/mall/promotion/diy-template/diy-page'
}, },
component: () => import('@/views/mall/promotion/diy/page/decorate.vue') component: () => import('@/views/mall/promotion/diy/page/decorate.vue')
} }