!339 商城装修

Merge pull request !339 from 疯狂的世界/dev
This commit is contained in:
芋道源码 2023-12-02 01:01:14 +00:00 committed by Gitee
commit d6ff66dc1d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
66 changed files with 1543 additions and 67 deletions

View File

@ -37,4 +37,4 @@ export const deleteDemo01Contact = async (id: number) => {
// 导出示例联系人 Excel
export const exportDemo01Contact = async (params) => {
return await request.download({ url: `/infra/demo01-contact/export-excel`, params })
}
}

View File

@ -34,4 +34,4 @@ export const deleteDemo02Category = async (id: number) => {
// 导出示例分类 Excel
export const exportDemo02Category = async (params) => {
return await request.download({ url: `/infra/demo02-category/export-excel`, params })
}
}

View File

@ -88,4 +88,4 @@ export const deleteDemo03Grade = async (id: number) => {
// 获得学生班级
export const getDemo03Grade = async (id: number) => {
return await request.get({ url: `/infra/demo03-student/demo03-grade/get?id=` + id })
}
}

View File

@ -42,12 +42,16 @@ export const exportDemo03Student = async (params) => {
// 获得学生课程列表
export const getDemo03CourseListByStudentId = async (studentId) => {
return await request.get({ url: `/infra/demo03-student/demo03-course/list-by-student-id?studentId=` + studentId })
return await request.get({
url: `/infra/demo03-student/demo03-course/list-by-student-id?studentId=` + studentId
})
}
// ==================== 子表(学生班级) ====================
// 获得学生班级
export const getDemo03GradeByStudentId = async (studentId) => {
return await request.get({ url: `/infra/demo03-student/demo03-grade/get-by-student-id?studentId=` + studentId })
}
return await request.get({
url: `/infra/demo03-student/demo03-grade/get-by-student-id?studentId=` + studentId
})
}

View File

@ -42,12 +42,16 @@ export const exportDemo03Student = async (params) => {
// 获得学生课程列表
export const getDemo03CourseListByStudentId = async (studentId) => {
return await request.get({ url: `/infra/demo03-student/demo03-course/list-by-student-id?studentId=` + studentId })
return await request.get({
url: `/infra/demo03-student/demo03-course/list-by-student-id?studentId=` + studentId
})
}
// ==================== 子表(学生班级) ====================
// 获得学生班级
export const getDemo03GradeByStudentId = async (studentId) => {
return await request.get({ url: `/infra/demo03-student/demo03-grade/get-by-student-id?studentId=` + studentId })
}
return await request.get({
url: `/infra/demo03-student/demo03-grade/get-by-student-id?studentId=` + studentId
})
}

View File

@ -17,7 +17,7 @@ export interface ArticleVO {
}
// 查询文章管理列表
export const getArticlePage = async (params) => {
export const getArticlePage = async (params: any) => {
return await request.get({ url: `/promotion/article/page`, params })
}

View File

@ -0,0 +1,198 @@
<template>
<Dialog v-model="dialogVisible" title="选择链接" width="65%">
<div class="h-500px flex gap-8px">
<!-- 左侧分组列表 -->
<el-scrollbar wrap-class="h-full" ref="groupScrollbar" view-class="flex flex-col">
<el-button
v-for="(group, groupIndex) in APP_LINK_GROUP_LIST"
:key="groupIndex"
:class="[
'm-r-16px m-l-0px! justify-start! w-90px',
{ active: activeGroup === group.name }
]"
ref="groupBtnRefs"
:text="activeGroup !== group.name"
:type="activeGroup === group.name ? 'primary' : 'default'"
@click="handleGroupSelected(group.name)"
>
{{ group.name }}
</el-button>
</el-scrollbar>
<!-- 右侧链接列表 -->
<el-scrollbar class="h-full flex-1" @scroll="handleScroll" ref="linkScrollbar">
<div v-for="(group, groupIndex) in APP_LINK_GROUP_LIST" :key="groupIndex">
<!-- 分组标题 -->
<div class="font-bold" ref="groupTitleRefs">{{ group.name }}</div>
<!-- 链接列表 -->
<el-tooltip
v-for="(appLink, appLinkIndex) in group.links"
:key="appLinkIndex"
:content="appLink.path"
placement="bottom"
>
<el-button
class="m-b-8px m-r-8px m-l-0px!"
:type="isSameLink(appLink.path, activeAppLink) ? 'primary' : 'default'"
@click="handleAppLinkSelected(appLink)"
>
{{ appLink.name }}
</el-button>
</el-tooltip>
</div>
</el-scrollbar>
</div>
<!-- 底部对话框操作按钮 -->
<template #footer>
<el-button type="primary" @click="handleSubmit"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
<Dialog v-model="detailSelectDialog.visible" title="" width="50%">
<el-form class="min-h-200px">
<el-form-item
label="选择分类"
v-if="detailSelectDialog.type === APP_LINK_TYPE_ENUM.PRODUCT_CATEGORY_LIST"
>
<ProductCategorySelect
v-model="detailSelectDialog.id"
:parent-id="0"
@update:model-value="handleProductCategorySelected"
/>
</el-form-item>
</el-form>
</Dialog>
</template>
<script lang="ts" setup>
import { APP_LINK_GROUP_LIST, APP_LINK_TYPE_ENUM } from './data'
import { ButtonInstance, ScrollbarInstance } from 'element-plus'
import { split } from 'lodash-es'
import ProductCategorySelect from '@/views/mall/product/category/components/ProductCategorySelect.vue'
import { getUrlNumberValue } from '@/utils'
// APP
defineOptions({ name: 'AppLinkSelectDialog' })
//
const activeGroup = ref(APP_LINK_GROUP_LIST[0].name)
// APP
const activeAppLink = ref('')
/** 打开弹窗 */
const dialogVisible = ref(false)
const open = (link: string) => {
activeAppLink.value = link
dialogVisible.value = true
//
const group = APP_LINK_GROUP_LIST.find((group) =>
group.links.some((linkItem) => isSameLink(linkItem.path, link))
)
if (group) {
// 使 nextTick Dom
nextTick(() => handleGroupSelected(group.name))
}
}
defineExpose({ open })
// APP
const handleAppLinkSelected = (appLink: any) => {
if (!isSameLink(appLink.path, activeAppLink.value)) {
activeAppLink.value = appLink.path
}
switch (appLink.type) {
case APP_LINK_TYPE_ENUM.PRODUCT_CATEGORY_LIST:
detailSelectDialog.value.visible = true
detailSelectDialog.value.type = appLink.type
//
detailSelectDialog.value.id =
getUrlNumberValue('id', 'http://127.0.0.1' + activeAppLink.value) || undefined
break
default:
break
}
}
//
const emit = defineEmits<{
change: [link: string]
}>()
const handleSubmit = () => {
dialogVisible.value = false
emit('change', activeAppLink.value)
}
//
const groupTitleRefs = ref<HTMLInputElement[]>([])
/**
* 处理右侧链接列表滚动
* @param scrollTop 滚动条的位置
*/
const handleScroll = ({ scrollTop }: { scrollTop: number }) => {
const titleEl = groupTitleRefs.value.find((titleEl) => {
//
const { offsetHeight, offsetTop } = titleEl
//
return scrollTop >= offsetTop && scrollTop < offsetTop + offsetHeight
})
//
if (titleEl && activeGroup.value !== titleEl.textContent) {
activeGroup.value = titleEl.textContent || ''
//
scrollToGroupBtn(activeGroup.value)
}
}
//
const linkScrollbar = ref<ScrollbarInstance>()
//
const handleGroupSelected = (group: string) => {
activeGroup.value = group
const titleRef = groupTitleRefs.value.find((item) => item.textContent === group)
if (titleRef) {
//
linkScrollbar.value?.setScrollTop(titleRef.offsetTop)
}
}
//
const groupScrollbar = ref<ScrollbarInstance>()
//
const groupBtnRefs = ref<ButtonInstance[]>([])
//
const scrollToGroupBtn = (group: string) => {
const groupBtn = groupBtnRefs.value
.map((btn) => btn['ref'])
.find((ref) => ref.textContent === group)
if (groupBtn) {
groupScrollbar.value?.setScrollTop(groupBtn.offsetTop)
}
}
//
const isSameLink = (link1: string, link2: string) => {
return split(link1, '?', 1)[0] === split(link2, '?', 1)[0]
}
//
const detailSelectDialog = ref<{
visible: boolean
id?: number
type?: APP_LINK_TYPE_ENUM
}>({
visible: false,
id: undefined,
type: undefined
})
//
const handleProductCategorySelected = (id: number) => {
const url = new URL(activeAppLink.value, 'http://127.0.0.1')
// id
url.searchParams.set('id', `${id}`)
//
activeAppLink.value = `${url.pathname}${url.search}`
//
detailSelectDialog.value.visible = false
// id
detailSelectDialog.value.id = undefined
}
</script>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,246 @@
// APP 链接类型(需要特殊处理,例如商品详情)
export const enum APP_LINK_TYPE_ENUM {
// 拼团活动
ACTIVITY_COMBINATION,
// 秒杀活动
ACTIVITY_SECKILL,
// 文章详情
ARTICLE_DETAIL,
// 优惠券详情
COUPON_DETAIL,
// 自定义页面详情
DIY_PAGE_DETAIL,
// 品类列表
PRODUCT_CATEGORY_LIST,
// 商品列表
PRODUCT_LIST,
// 商品详情
PRODUCT_DETAIL_NORMAL,
// 拼团商品详情
PRODUCT_DETAIL_COMBINATION,
// 积分商品详情
PRODUCT_DETAIL_POINT,
// 秒杀商品详情
PRODUCT_DETAIL_SECKILL
}
// APP 链接列表(做一下持久化?)
export const APP_LINK_GROUP_LIST = [
{
name: '商城',
links: [
{
name: '首页',
path: '/pages/index/index'
},
{
name: '商品分类',
path: '/pages/index/category',
type: APP_LINK_TYPE_ENUM.PRODUCT_CATEGORY_LIST
},
{
name: '购物车',
path: '/pages/index/cart'
},
{
name: '个人中心',
path: '/pages/index/user'
},
{
name: '商品搜索',
path: '/pages/index/search'
},
{
name: '自定义页面',
path: '/pages/index/page',
type: APP_LINK_TYPE_ENUM.DIY_PAGE_DETAIL
},
{
name: '客服',
path: '/pages/chat/index'
},
{
name: '系统设置',
path: '/pages/public/setting'
},
{
name: '问题反馈',
path: '/pages/public/feedback'
},
{
name: '常见问题',
path: '/pages/public/faq'
}
]
},
{
name: '商品',
links: [
{
name: '商品列表',
path: '/pages/goods/list',
type: APP_LINK_TYPE_ENUM.PRODUCT_LIST
},
{
name: '商品详情',
path: '/pages/goods/index',
type: APP_LINK_TYPE_ENUM.PRODUCT_DETAIL_NORMAL
},
{
name: '拼团商品详情',
path: '/pages/goods/groupon',
type: APP_LINK_TYPE_ENUM.PRODUCT_DETAIL_COMBINATION
},
{
name: '秒杀商品详情',
path: '/pages/goods/seckill',
type: APP_LINK_TYPE_ENUM.PRODUCT_DETAIL_SECKILL
},
{
name: '积分商品详情',
path: '/pages/goods/score',
type: APP_LINK_TYPE_ENUM.PRODUCT_DETAIL_POINT
}
]
},
{
name: '营销活动',
links: [
{
name: '拼团订单',
path: '/pages/activity/groupon/order'
},
{
name: '营销商品',
path: '/pages/activity/index'
},
{
name: '拼团活动',
path: '/pages/activity/groupon/list',
type: APP_LINK_TYPE_ENUM.ACTIVITY_COMBINATION
},
{
name: '秒杀活动',
path: '/pages/activity/seckill/list',
type: APP_LINK_TYPE_ENUM.ACTIVITY_SECKILL
},
{
name: '签到中心',
path: '/pages/app/sign'
},
{
name: '积分商城',
path: '/pages/app/score-shop'
},
{
name: '优惠券中心',
path: '/pages/coupon/list'
},
{
name: '优惠券详情',
path: '/pages/coupon/detail',
type: APP_LINK_TYPE_ENUM.COUPON_DETAIL
},
{
name: '文章详情',
path: '/pages/public/richtext',
type: APP_LINK_TYPE_ENUM.ARTICLE_DETAIL
}
]
},
{
name: '分销商城',
links: [
{
name: '分销中心',
path: '/pages/commission/index'
},
{
name: '申请分销商',
path: '/pages/commission/apply'
},
{
name: '推广商品',
path: '/pages/commission/goods'
},
{
name: '分销订单',
path: '/pages/commission/order'
},
{
name: '分享记录',
path: '/pages/commission/share-log'
},
{
name: '我的团队',
path: '/pages/commission/team'
}
]
},
{
name: '支付',
links: [
{
name: '充值余额',
path: '/pages/pay/recharge'
},
{
name: '充值记录',
path: '/pages/pay/recharge-log'
},
{
name: '申请提现',
path: '/pages/pay/withdraw'
},
{
name: '提现记录',
path: '/pages/pay/withdraw-log'
}
]
},
{
name: '用户中心',
links: [
{
name: '用户信息',
path: '/pages/user/info'
},
{
name: '用户订单',
path: '/pages/order/list'
},
{
name: '售后订单',
path: '/pages/order/aftersale/list'
},
{
name: '商品收藏',
path: '/pages/user/goods-collect'
},
{
name: '浏览记录',
path: '/pages/user/goods-log'
},
{
name: '地址管理',
path: '/pages/user/address/list'
},
{
name: '发票管理',
path: '/pages/user/invoice/list'
},
{
name: '用户佣金',
path: '/pages/user/wallet/commission'
},
{
name: '用户余额',
path: '/pages/user/wallet/money'
},
{
name: '用户积分',
path: '/pages/user/wallet/score'
}
]
}
]

View File

@ -0,0 +1,43 @@
<template>
<el-input v-model="appLink" placeholder="输入或选择链接">
<template #append>
<el-button @click="handleOpenDialog">选择</el-button>
</template>
</el-input>
<AppLinkSelectDialog ref="dialogRef" @change="handleLinkSelected" />
</template>
<script lang="ts" setup>
import { propTypes } from '@/utils/propTypes'
// APP
defineOptions({ name: 'AppLinkInput' })
//
const props = defineProps({
//
modelValue: propTypes.string.def('')
})
//
const appLink = ref('')
//
const dialogRef = ref()
//
const handleOpenDialog = () => dialogRef.value?.open(appLink.value)
// APP
const handleLinkSelected = (link: string) => (appLink.value = link)
// getter
watch(
() => props.modelValue,
() => (appLink.value = props.modelValue),
{ immediate: true }
)
// setter
const emit = defineEmits<{
'update:modelValue': [link: string]
}>()
watch(
() => appLink,
() => emit('update:modelValue', appLink.value)
)
</script>

View File

@ -1,6 +1,6 @@
<template>
<el-tabs stretch>
<el-tab-pane label="内容">
<el-tab-pane label="内容" v-if="$slots.default">
<slot></slot>
</el-tab-pane>
<el-tab-pane label="样式" lazy>

View File

@ -103,7 +103,7 @@
</el-form-item>
</template>
<el-form-item label="链接" class="m-b-8px!" label-width="50px">
<el-input placeholder="链接" v-model="element.url" />
<AppLinkInput v-model="element.url" />
</el-form-item>
</div>
</template>

View File

@ -13,7 +13,7 @@
</UploadImg>
</el-form-item>
<el-form-item label="链接" prop="url">
<el-input placeholder="链接" v-model="formData.url" />
<AppLinkInput v-model="formData.url" />
</el-form-item>
</el-form>
</ComponentContainerProperty>

View File

@ -17,7 +17,7 @@
<UploadImg v-model="hotArea.imgUrl" height="80px" width="80px" />
</el-form-item>
<el-form-item label="链接" :prop="`list[${index}].url`">
<el-input v-model="hotArea.url" placeholder="请输入链接" />
<AppLinkInput v-model="hotArea.url" />
</el-form-item>
</template>
</template>

View File

@ -38,7 +38,7 @@
<InputWithColor v-model="element.subtitle" v-model:color="element.subtitleColor" />
</el-form-item>
<el-form-item label="链接" prop="url">
<el-input v-model="element.url" />
<AppLinkInput v-model="element.url" />
</el-form-item>
<el-form-item label="显示角标" prop="badge.show">
<el-switch v-model="element.badge.show" />

View File

@ -31,7 +31,7 @@
<InputWithColor v-model="element.subtitle" v-model:color="element.subtitleColor" />
</el-form-item>
<el-form-item label="链接" prop="url">
<el-input v-model="element.url" />
<AppLinkInput v-model="element.url" />
</el-form-item>
</div>
</template>

View File

@ -48,7 +48,7 @@
<InputWithColor v-model="element.title" v-model:color="element.titleColor" />
</el-form-item>
<el-form-item label="链接" prop="url">
<el-input v-model="element.url" />
<AppLinkInput v-model="element.url" />
</el-form-item>
<el-form-item label="显示角标" prop="badge.show">
<el-switch v-model="element.badge.show" />

View File

@ -35,7 +35,7 @@
</div>
<div class="w-full flex flex-col gap-8px">
<el-input v-model="element.text" placeholder="请输入公告" />
<el-input v-model="element.url" placeholder="请输入链接" />
<AppLinkInput v-model="element.url" />
</div>
</div>
</template>

View File

@ -1,6 +1,6 @@
import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util'
/** 商品卡片属性 */
/** 商品属性 */
export interface ProductListProperty {
// 布局类型:双列 | 三列 | 水平滑动
layoutType: 'twoCol' | 'threeCol' | 'horizSwiper'

View File

@ -66,7 +66,7 @@
import { ProductListProperty } from './config'
import * as ProductSpuApi from '@/api/mall/product/spu'
/** 商品卡片 */
/** 商品 */
defineOptions({ name: 'ProductList' })
//
const props = defineProps<{ property: ProductListProperty }>()

View File

@ -88,7 +88,7 @@ import { ProductListProperty } from './config'
import { usePropertyForm } from '@/components/DiyEditor/util'
import SpuShowcase from '@/views/mall/product/spu/components/SpuShowcase.vue'
//
//
defineOptions({ name: 'ProductListProperty' })
const props = defineProps<{ modelValue: ProductListProperty }>()

View File

@ -0,0 +1,25 @@
import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util'
/** 营销文章属性 */
export interface PromotionArticleProperty {
// 文章编号
id: number
// 组件样式
style: ComponentStyle
}
// 定义组件
export const component = {
id: 'PromotionArticle',
name: '营销文章',
icon: 'ph:article-medium',
property: {
style: {
bgType: 'color',
bgColor: '',
marginLeft: 8,
marginRight: 8,
marginBottom: 8
} as ComponentStyle
}
} as DiyComponent<PromotionArticleProperty>

View File

@ -0,0 +1,27 @@
<template>
<div class="min-h-30px" v-html="article.content"></div>
</template>
<script setup lang="ts">
import { PromotionArticleProperty } from './config'
import * as ArticleApi from '@/api/mall/promotion/article/index'
/** 营销文章 */
defineOptions({ name: 'PromotionArticle' })
//
const props = defineProps<{ property: PromotionArticleProperty }>()
//
const article = ref<ArticleApi.ArticleVO[]>({})
watch(
() => props.property.id,
async () => {
if (props.property.id) {
article.value = await ArticleApi.getArticle(props.property.id)
}
},
{
immediate: true
}
)
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,56 @@
<template>
<ComponentContainerProperty v-model="formData.style">
<el-form label-width="40px" :model="formData">
<el-form-item label="文章" prop="id">
<el-select
v-model="formData.id"
placeholder="请选择文章"
class="w-full"
filterable
remote
:remote-method="queryArticleList"
:loading="loading"
>
<el-option
v-for="article in articles"
:key="article.id"
:label="article.title"
:value="article.id"
/>
</el-select>
</el-form-item>
</el-form>
</ComponentContainerProperty>
</template>
<script setup lang="ts">
import { PromotionArticleProperty } from './config'
import { usePropertyForm } from '@/components/DiyEditor/util'
import * as ArticleApi from '@/api/mall/promotion/article/index'
//
defineOptions({ name: 'PromotionArticleProperty' })
const props = defineProps<{ modelValue: PromotionArticleProperty }>()
const emit = defineEmits(['update:modelValue'])
const { formData } = usePropertyForm(props.modelValue, emit)
//
const articles = ref<ArticleApi.ArticleVO>([])
//
const loading = ref(false)
//
const queryArticleList = async (title?: string) => {
loading.value = true
const { list } = await ArticleApi.getArticlePage({ title, pageSize: 10 })
articles.value = list
loading.value = false
}
//
onMounted(() => {
queryArticleList()
})
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,64 @@
import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util'
/** 拼团属性 */
export interface PromotionCombinationProperty {
// 布局类型:单列 | 三列
layoutType: 'oneCol' | 'threeCol'
// 商品字段
fields: {
// 商品名称
name: PromotionCombinationFieldProperty
// 商品价格
price: PromotionCombinationFieldProperty
}
// 角标
badge: {
// 是否显示
show: boolean
// 角标图片
imgUrl: string
}
// 上圆角
borderRadiusTop: number
// 下圆角
borderRadiusBottom: number
// 间距
space: number
// 拼团活动编号
activityId: number
// 组件样式
style: ComponentStyle
}
// 商品字段
export interface PromotionCombinationFieldProperty {
// 是否显示
show: boolean
// 颜色
color: string
}
// 定义组件
export const component = {
id: 'PromotionCombination',
name: '拼团',
icon: 'mdi:account-group',
property: {
activityId: undefined,
layoutType: 'oneCol',
fields: {
name: { show: true, color: '#000' },
price: { show: true, color: '#ff3000' }
},
badge: { show: false, imgUrl: '' },
borderRadiusTop: 8,
borderRadiusBottom: 8,
space: 8,
style: {
bgType: 'color',
bgColor: '',
marginLeft: 8,
marginRight: 8,
marginBottom: 8
} as ComponentStyle
}
} as DiyComponent<PromotionCombinationProperty>

View File

@ -0,0 +1,125 @@
<template>
<el-scrollbar class="z-1 min-h-30px" wrap-class="w-full" ref="containerRef">
<!-- 商品网格 -->
<div
class="grid overflow-x-auto"
:style="{
gridGap: `${property.space}px`,
gridTemplateColumns,
width: scrollbarWidth
}"
>
<!-- 商品 -->
<div
class="relative box-content flex flex-row flex-wrap overflow-hidden bg-white"
:style="{
borderTopLeftRadius: `${property.borderRadiusTop}px`,
borderTopRightRadius: `${property.borderRadiusTop}px`,
borderBottomLeftRadius: `${property.borderRadiusBottom}px`,
borderBottomRightRadius: `${property.borderRadiusBottom}px`
}"
v-for="(spu, index) in spuList"
:key="index"
>
<!-- 角标 -->
<div
v-if="property.badge.show"
class="absolute left-0 top-0 z-1 items-center justify-center"
>
<el-image fit="cover" :src="property.badge.imgUrl" class="h-26px w-38px" />
</div>
<!-- 商品封面图 -->
<el-image fit="cover" :src="spu.picUrl" :style="{ width: imageSize, height: imageSize }" />
<div
:class="[
'flex flex-col gap-8px p-8px box-border',
{
'w-[calc(100%-64px)]': columns === 2,
'w-full': columns === 3
}
]"
>
<!-- 商品名称 -->
<div
v-if="property.fields.name.show"
class="truncate text-12px"
:style="{ color: property.fields.name.color }"
>
{{ spu.name }}
</div>
<div>
<!-- 商品价格 -->
<span
v-if="property.fields.price.show"
class="text-12px"
:style="{ color: property.fields.price.color }"
>
{{ spu.price }}
</span>
</div>
</div>
</div>
</div>
</el-scrollbar>
</template>
<script setup lang="ts">
import { PromotionCombinationProperty } from './config'
import * as ProductSpuApi from '@/api/mall/product/spu'
import * as CombinationActivityApi from '@/api/mall/promotion/combination/combinationActivity'
/** 拼团 */
defineOptions({ name: 'PromotionCombination' })
//
const props = defineProps<{ property: PromotionCombinationProperty }>()
//
const spuList = ref<ProductSpuApi.Spu[]>([])
watch(
() => props.property.activityId,
async () => {
if (!props.property.activityId) return
const activity = await CombinationActivityApi.getCombinationActivity(props.property.activityId)
if (!activity?.spuId) return
spuList.value = [await ProductSpuApi.getSpu(activity.spuId)]
},
{
immediate: true,
deep: true
}
)
//
const phoneWidth = ref(375)
//
const containerRef = ref()
//
const columns = ref(2)
//
const scrollbarWidth = ref('100%')
//
const imageSize = ref('0')
//
const gridTemplateColumns = ref('')
//
watch(
() => [props.property, phoneWidth, spuList.value.length],
() => {
//
columns.value = props.property.layoutType === 'oneCol' ? 1 : 3
// - * ( - 1)/
const productWidth =
(phoneWidth.value - props.property.space * (columns.value - 1)) / columns.value
// 2 3
imageSize.value = columns.value === 2 ? '64px' : `${productWidth}px`
//
gridTemplateColumns.value = `repeat(${columns.value}, auto)`
//
scrollbarWidth.value = '100%'
},
{ immediate: true, deep: true }
)
onMounted(() => {
//
phoneWidth.value = containerRef.value?.wrapRef?.offsetWidth || 375
})
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,112 @@
<template>
<ComponentContainerProperty v-model="formData.style">
<el-form label-width="80px" :model="formData">
<el-card header="拼团活动" class="property-group" shadow="never">
<el-form-item label="拼团活动" prop="activityId">
<el-select v-model="formData.activityId">
<el-option
v-for="activity in activityList"
:key="activity.id"
:label="activity.name"
:value="activity.id"
/>
</el-select>
</el-form-item>
</el-card>
<el-card header="商品样式" class="property-group" shadow="never">
<el-form-item label="布局" prop="type">
<el-radio-group v-model="formData.layoutType">
<el-tooltip class="item" content="单列" placement="bottom">
<el-radio-button label="oneCol">
<Icon icon="fluent:text-column-one-24-filled" />
</el-radio-button>
</el-tooltip>
<el-tooltip class="item" content="三列" placement="bottom">
<el-radio-button label="threeCol">
<Icon icon="fluent:text-column-three-24-filled" />
</el-radio-button>
</el-tooltip>
</el-radio-group>
</el-form-item>
<el-form-item label="商品名称" prop="fields.name.show">
<div class="flex gap-8px">
<ColorInput v-model="formData.fields.name.color" />
<el-checkbox v-model="formData.fields.name.show" />
</div>
</el-form-item>
<el-form-item label="商品价格" prop="fields.price.show">
<div class="flex gap-8px">
<ColorInput v-model="formData.fields.price.color" />
<el-checkbox v-model="formData.fields.price.show" />
</div>
</el-form-item>
</el-card>
<el-card header="角标" class="property-group" shadow="never">
<el-form-item label="角标" prop="badge.show">
<el-switch v-model="formData.badge.show" />
</el-form-item>
<el-form-item label="角标" prop="badge.imgUrl" v-if="formData.badge.show">
<UploadImg v-model="formData.badge.imgUrl" height="44px" width="72px">
<template #tip> 建议尺寸36 * 22 </template>
</UploadImg>
</el-form-item>
</el-card>
<el-card header="商品样式" class="property-group" shadow="never">
<el-form-item label="上圆角" prop="borderRadiusTop">
<el-slider
v-model="formData.borderRadiusTop"
:max="100"
:min="0"
show-input
input-size="small"
:show-input-controls="false"
/>
</el-form-item>
<el-form-item label="下圆角" prop="borderRadiusBottom">
<el-slider
v-model="formData.borderRadiusBottom"
:max="100"
:min="0"
show-input
input-size="small"
:show-input-controls="false"
/>
</el-form-item>
<el-form-item label="间隔" prop="space">
<el-slider
v-model="formData.space"
:max="100"
:min="0"
show-input
input-size="small"
:show-input-controls="false"
/>
</el-form-item>
</el-card>
</el-form>
</ComponentContainerProperty>
</template>
<script setup lang="ts">
import { PromotionCombinationProperty } from './config'
import { usePropertyForm } from '@/components/DiyEditor/util'
import * as CombinationActivityApi from '@/api/mall/promotion/combination/combinationActivity'
import { CommonStatusEnum } from '@/utils/constants'
//
defineOptions({ name: 'PromotionCombinationProperty' })
const props = defineProps<{ modelValue: PromotionCombinationProperty }>()
const emit = defineEmits(['update:modelValue'])
const { formData } = usePropertyForm(props.modelValue, emit)
//
const activityList = ref<CombinationActivityApi.CombinationActivityVO>([])
onMounted(async () => {
const { list } = await CombinationActivityApi.getCombinationActivityPage({
status: CommonStatusEnum.ENABLE
})
activityList.value = list
})
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,64 @@
import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util'
/** 秒杀属性 */
export interface PromotionSeckillProperty {
// 布局类型:单列 | 三列
layoutType: 'oneCol' | 'threeCol'
// 商品字段
fields: {
// 商品名称
name: PromotionSeckillFieldProperty
// 商品价格
price: PromotionSeckillFieldProperty
}
// 角标
badge: {
// 是否显示
show: boolean
// 角标图片
imgUrl: string
}
// 上圆角
borderRadiusTop: number
// 下圆角
borderRadiusBottom: number
// 间距
space: number
// 秒杀活动编号
activityId: number
// 组件样式
style: ComponentStyle
}
// 商品字段
export interface PromotionSeckillFieldProperty {
// 是否显示
show: boolean
// 颜色
color: string
}
// 定义组件
export const component = {
id: 'PromotionSeckill',
name: '秒杀',
icon: 'mdi:calendar-time',
property: {
activityId: undefined,
layoutType: 'oneCol',
fields: {
name: { show: true, color: '#000' },
price: { show: true, color: '#ff3000' }
},
badge: { show: false, imgUrl: '' },
borderRadiusTop: 8,
borderRadiusBottom: 8,
space: 8,
style: {
bgType: 'color',
bgColor: '',
marginLeft: 8,
marginRight: 8,
marginBottom: 8
} as ComponentStyle
}
} as DiyComponent<PromotionSeckillProperty>

View File

@ -0,0 +1,125 @@
<template>
<el-scrollbar class="z-1 min-h-30px" wrap-class="w-full" ref="containerRef">
<!-- 商品网格 -->
<div
class="grid overflow-x-auto"
:style="{
gridGap: `${property.space}px`,
gridTemplateColumns,
width: scrollbarWidth
}"
>
<!-- 商品 -->
<div
class="relative box-content flex flex-row flex-wrap overflow-hidden bg-white"
:style="{
borderTopLeftRadius: `${property.borderRadiusTop}px`,
borderTopRightRadius: `${property.borderRadiusTop}px`,
borderBottomLeftRadius: `${property.borderRadiusBottom}px`,
borderBottomRightRadius: `${property.borderRadiusBottom}px`
}"
v-for="(spu, index) in spuList"
:key="index"
>
<!-- 角标 -->
<div
v-if="property.badge.show"
class="absolute left-0 top-0 z-1 items-center justify-center"
>
<el-image fit="cover" :src="property.badge.imgUrl" class="h-26px w-38px" />
</div>
<!-- 商品封面图 -->
<el-image fit="cover" :src="spu.picUrl" :style="{ width: imageSize, height: imageSize }" />
<div
:class="[
'flex flex-col gap-8px p-8px box-border',
{
'w-[calc(100%-64px)]': columns === 2,
'w-full': columns === 3
}
]"
>
<!-- 商品名称 -->
<div
v-if="property.fields.name.show"
class="truncate text-12px"
:style="{ color: property.fields.name.color }"
>
{{ spu.name }}
</div>
<div>
<!-- 商品价格 -->
<span
v-if="property.fields.price.show"
class="text-12px"
:style="{ color: property.fields.price.color }"
>
{{ spu.price }}
</span>
</div>
</div>
</div>
</div>
</el-scrollbar>
</template>
<script setup lang="ts">
import { PromotionSeckillProperty } from './config'
import * as ProductSpuApi from '@/api/mall/product/spu'
import * as SeckillActivityApi from '@/api/mall/promotion/seckill/seckillActivity'
/** 秒杀 */
defineOptions({ name: 'PromotionSeckill' })
//
const props = defineProps<{ property: PromotionSeckillProperty }>()
//
const spuList = ref<ProductSpuApi.Spu[]>([])
watch(
() => props.property.activityId,
async () => {
if (!props.property.activityId) return
const activity = await SeckillActivityApi.getSeckillActivity(props.property.activityId)
if (!activity?.spuId) return
spuList.value = [await ProductSpuApi.getSpu(activity.spuId)]
},
{
immediate: true,
deep: true
}
)
//
const phoneWidth = ref(375)
//
const containerRef = ref()
//
const columns = ref(2)
//
const scrollbarWidth = ref('100%')
//
const imageSize = ref('0')
//
const gridTemplateColumns = ref('')
//
watch(
() => [props.property, phoneWidth, spuList.value.length],
() => {
//
columns.value = props.property.layoutType === 'oneCol' ? 1 : 3
// - * ( - 1)/
const productWidth =
(phoneWidth.value - props.property.space * (columns.value - 1)) / columns.value
// 2 3
imageSize.value = columns.value === 2 ? '64px' : `${productWidth}px`
//
gridTemplateColumns.value = `repeat(${columns.value}, auto)`
//
scrollbarWidth.value = '100%'
},
{ immediate: true, deep: true }
)
onMounted(() => {
//
phoneWidth.value = containerRef.value?.wrapRef?.offsetWidth || 375
})
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,112 @@
<template>
<ComponentContainerProperty v-model="formData.style">
<el-form label-width="80px" :model="formData">
<el-card header="秒杀活动" class="property-group" shadow="never">
<el-form-item label="秒杀活动" prop="activityId">
<el-select v-model="formData.activityId">
<el-option
v-for="activity in activityList"
:key="activity.id"
:label="activity.name"
:value="activity.id"
/>
</el-select>
</el-form-item>
</el-card>
<el-card header="商品样式" class="property-group" shadow="never">
<el-form-item label="布局" prop="type">
<el-radio-group v-model="formData.layoutType">
<el-tooltip class="item" content="单列" placement="bottom">
<el-radio-button label="oneCol">
<Icon icon="fluent:text-column-one-24-filled" />
</el-radio-button>
</el-tooltip>
<el-tooltip class="item" content="三列" placement="bottom">
<el-radio-button label="threeCol">
<Icon icon="fluent:text-column-three-24-filled" />
</el-radio-button>
</el-tooltip>
</el-radio-group>
</el-form-item>
<el-form-item label="商品名称" prop="fields.name.show">
<div class="flex gap-8px">
<ColorInput v-model="formData.fields.name.color" />
<el-checkbox v-model="formData.fields.name.show" />
</div>
</el-form-item>
<el-form-item label="商品价格" prop="fields.price.show">
<div class="flex gap-8px">
<ColorInput v-model="formData.fields.price.color" />
<el-checkbox v-model="formData.fields.price.show" />
</div>
</el-form-item>
</el-card>
<el-card header="角标" class="property-group" shadow="never">
<el-form-item label="角标" prop="badge.show">
<el-switch v-model="formData.badge.show" />
</el-form-item>
<el-form-item label="角标" prop="badge.imgUrl" v-if="formData.badge.show">
<UploadImg v-model="formData.badge.imgUrl" height="44px" width="72px">
<template #tip> 建议尺寸36 * 22 </template>
</UploadImg>
</el-form-item>
</el-card>
<el-card header="商品样式" class="property-group" shadow="never">
<el-form-item label="上圆角" prop="borderRadiusTop">
<el-slider
v-model="formData.borderRadiusTop"
:max="100"
:min="0"
show-input
input-size="small"
:show-input-controls="false"
/>
</el-form-item>
<el-form-item label="下圆角" prop="borderRadiusBottom">
<el-slider
v-model="formData.borderRadiusBottom"
:max="100"
:min="0"
show-input
input-size="small"
:show-input-controls="false"
/>
</el-form-item>
<el-form-item label="间隔" prop="space">
<el-slider
v-model="formData.space"
:max="100"
:min="0"
show-input
input-size="small"
:show-input-controls="false"
/>
</el-form-item>
</el-card>
</el-form>
</ComponentContainerProperty>
</template>
<script setup lang="ts">
import { PromotionSeckillProperty } from './config'
import { usePropertyForm } from '@/components/DiyEditor/util'
import * as SeckillActivityApi from '@/api/mall/promotion/seckill/seckillActivity'
import { CommonStatusEnum } from '@/utils/constants'
//
defineOptions({ name: 'PromotionSeckillProperty' })
const props = defineProps<{ modelValue: PromotionSeckillProperty }>()
const emit = defineEmits(['update:modelValue'])
const { formData } = usePropertyForm(props.modelValue, emit)
//
const activityList = ref<SeckillActivityApi.SeckillActivityVO>([])
onMounted(async () => {
const { list } = await SeckillActivityApi.getSeckillActivityPage({
status: CommonStatusEnum.ENABLE
})
activityList.value = list
})
</script>
<style scoped lang="scss"></style>

View File

@ -88,7 +88,7 @@
<el-input v-model="element.text" placeholder="请输入文字" />
</el-form-item>
<el-form-item prop="url" label-width="0" class="m-b-0!">
<el-input v-model="element.url" placeholder="请选择链接" />
<AppLinkInput v-model="element.url" />
</el-form-item>
</div>
</div>

View File

@ -92,7 +92,7 @@
<el-input v-model="formData.more.text" />
</el-form-item>
<el-form-item label="跳转链接" prop="more.url">
<el-input v-model="formData.more.url" placeholder="请输入跳转链接" />
<AppLinkInput v-model="formData.more.url" />
</el-form-item>
</template>
</el-form>

View File

@ -0,0 +1,21 @@
import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util'
/** 用户卡片属性 */
export interface UserCardProperty {
// 组件样式
style: ComponentStyle
}
// 定义组件
export const component = {
id: 'UserCard',
name: '用户卡片',
icon: 'mdi:user-card-details',
property: {
style: {
bgType: 'color',
bgColor: '',
marginBottom: 8
} as ComponentStyle
}
} as DiyComponent<UserCardProperty>

View File

@ -0,0 +1,29 @@
<template>
<div class="flex flex-col">
<div class="flex items-center justify-between p-x-18px p-y-24px">
<div class="flex flex-1 items-center gap-16px">
<el-avatar :size="60">
<Icon icon="ep:avatar" :size="60" />
</el-avatar>
<span class="text-18px font-bold">芋道源码</span>
</div>
<Icon icon="tdesign:qrcode" :size="20" />
</div>
<div
class="flex items-center justify-between justify-between bg-white p-x-20px p-y-8px text-12px"
>
<span class="color-#ff690d">点击绑定手机号</span>
<span class="rounded-26px bg-#ff6100 p-x-8px p-y-5px color-white">去绑定</span>
</div>
</div>
</template>
<script setup lang="ts">
import { UserCardProperty } from './config'
/** 用户卡片 */
defineOptions({ name: 'UserCard' })
//
defineProps<{ property: UserCardProperty }>()
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,17 @@
<template>
<ComponentContainerProperty v-model="formData.style" />
</template>
<script setup lang="ts">
import { UserCardProperty } from './config'
import { usePropertyForm } from '@/components/DiyEditor/util'
//
defineOptions({ name: 'UserCardProperty' })
const props = defineProps<{ modelValue: UserCardProperty }>()
const emit = defineEmits(['update:modelValue'])
const { formData } = usePropertyForm(props.modelValue, emit)
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,23 @@
import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util'
/** 用户卡券属性 */
export interface UserCouponProperty {
// 组件样式
style: ComponentStyle
}
// 定义组件
export const component = {
id: 'UserCoupon',
name: '用户卡券',
icon: 'ep:ticket',
property: {
style: {
bgType: 'color',
bgColor: '',
marginLeft: 8,
marginRight: 8,
marginBottom: 8
} as ComponentStyle
}
} as DiyComponent<UserCouponProperty>

View File

@ -0,0 +1,15 @@
<template>
<el-image
src="https://shopro.sheepjs.com/admin/static/images/shop/decorate/couponCardStyle.png"
/>
</template>
<script setup lang="ts">
import { UserCouponProperty } from './config'
/** 用户卡券 */
defineOptions({ name: 'UserCoupon' })
//
defineProps<{ property: UserCouponProperty }>()
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,17 @@
<template>
<ComponentContainerProperty v-model="formData.style" />
</template>
<script setup lang="ts">
import { UserCouponProperty } from './config'
import { usePropertyForm } from '@/components/DiyEditor/util'
//
defineOptions({ name: 'UserCouponProperty' })
const props = defineProps<{ modelValue: UserCouponProperty }>()
const emit = defineEmits(['update:modelValue'])
const { formData } = usePropertyForm(props.modelValue, emit)
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,23 @@
import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util'
/** 用户订单属性 */
export interface UserOrderProperty {
// 组件样式
style: ComponentStyle
}
// 定义组件
export const component = {
id: 'UserOrder',
name: '用户订单',
icon: 'ep:list',
property: {
style: {
bgType: 'color',
bgColor: '',
marginLeft: 8,
marginRight: 8,
marginBottom: 8
} as ComponentStyle
}
} as DiyComponent<UserOrderProperty>

View File

@ -0,0 +1,13 @@
<template>
<el-image src="https://shopro.sheepjs.com/admin/static/images/shop/decorate/orderCardStyle.png" />
</template>
<script setup lang="ts">
import { UserOrderProperty } from './config'
/** 用户订单 */
defineOptions({ name: 'UserOrder' })
//
defineProps<{ property: UserOrderProperty }>()
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,17 @@
<template>
<ComponentContainerProperty v-model="formData.style" />
</template>
<script setup lang="ts">
import { UserOrderProperty } from './config'
import { usePropertyForm } from '@/components/DiyEditor/util'
//
defineOptions({ name: 'UserOrderProperty' })
const props = defineProps<{ modelValue: UserOrderProperty }>()
const emit = defineEmits(['update:modelValue'])
const { formData } = usePropertyForm(props.modelValue, emit)
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,23 @@
import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util'
/** 用户资产属性 */
export interface UserWalletProperty {
// 组件样式
style: ComponentStyle
}
// 定义组件
export const component = {
id: 'UserWallet',
name: '用户资产',
icon: 'ep:wallet-filled',
property: {
style: {
bgType: 'color',
bgColor: '',
marginLeft: 8,
marginRight: 8,
marginBottom: 8
} as ComponentStyle
}
} as DiyComponent<UserWalletProperty>

View File

@ -0,0 +1,15 @@
<template>
<el-image
src="https://shopro.sheepjs.com/admin/static/images/shop/decorate/walletCardStyle.png"
/>
</template>
<script setup lang="ts">
import { UserWalletProperty } from './config'
/** 用户资产 */
defineOptions({ name: 'UserWallet' })
//
defineProps<{ property: UserWalletProperty }>()
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,17 @@
<template>
<ComponentContainerProperty v-model="formData.style" />
</template>
<script setup lang="ts">
import { UserWalletProperty } from './config'
import { usePropertyForm } from '@/components/DiyEditor/util'
//
defineOptions({ name: 'UserWalletProperty' })
const props = defineProps<{ modelValue: UserWalletProperty }>()
const emit = defineEmits(['update:modelValue'])
const { formData } = usePropertyForm(props.modelValue, emit)
</script>
<style scoped lang="scss"></style>

View File

@ -109,13 +109,19 @@ export const PAGE_LIBS = [
},
{ name: '商品组件', extended: true, components: ['ProductCard', 'ProductList'] },
{
name: '会员组件',
name: '用户组件',
extended: true,
components: ['UserCard', 'UserOrder', 'UserWallet', 'UserCoupon']
},
{
name: '营销组件',
extended: true,
components: ['CombinationCard', 'SeckillCard', 'PointCard', 'CouponCard']
components: [
'PromotionCombination',
'PromotionSeckill',
'PromotionPoint',
'CouponCard',
'PromotionArticle'
]
}
] as DiyComponentLibrary[]

View File

@ -29,7 +29,12 @@
:class="showTopSearch ? 'w-220px ml2' : 'w-0'"
@change="handleChange"
>
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</template>
@ -73,7 +78,7 @@ function remoteMethod(data) {
function handleChange(path) {
router.push({ path })
hiddenTopSearch();
hiddenTopSearch()
}
function hiddenTopSearch() {

View File

@ -65,7 +65,7 @@ export default defineComponent({
{screenfull.value ? (
<Screenfull class="custom-hover" color="var(--top-header-text-color)"></Screenfull>
) : undefined}
{search.value ? (<RouterSearch isModal={false} />) : undefined}
{search.value ? <RouterSearch isModal={false} /> : undefined}
{size.value ? (
<SizeDropdown class="custom-hover" color="var(--top-header-text-color)"></SizeDropdown>
) : undefined}

View File

@ -1,3 +1,5 @@
import { toNumber } from 'lodash-es'
/**
*
* @param component
@ -263,3 +265,23 @@ export const calculateRelativeRate = (value?: number, reference?: number) => {
return ((100 * ((value || 0) - reference)) / reference).toFixed(0)
}
/**
*
* @param key
* @param urlStr
*/
export const getUrlValue = (key: string, urlStr: string = location.href): string => {
if (!urlStr || !key) return ''
const url = new URL(decodeURIComponent(urlStr))
return url.searchParams.get(key) ?? ''
}
/**
*
* @param key
* @param urlStr
*/
export const getUrlNumberValue = (key: string, urlStr: string = location.href): number => {
return toNumber(getUrlValue(key, urlStr))
}

View File

@ -95,7 +95,7 @@ const list = ref([]) // 列表的数据
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
pageSize: 10
})
const queryFormRef = ref() //
const exportLoading = ref(false) //

View File

@ -12,9 +12,9 @@
v-model="formData.userIds"
:data="userTree"
:props="defaultProps"
check-on-click-node
multiple
filterable
check-on-click-node
node-key="id"
placeholder="请选择规则适用人群"
/>
@ -25,8 +25,8 @@
:data="deptTree"
:props="defaultProps"
multiple
check-strictly
filterable
check-strictly
node-key="id"
placeholder="请选择规则适用部门"
/>

View File

@ -8,7 +8,11 @@
<colum-info-form ref="columInfoRef" :columns="formData.columns" />
</el-tab-pane>
<el-tab-pane label="生成信息" name="generateInfo">
<generate-info-form ref="generateInfoRef" :table="formData.table" :columns="formData.columns" />
<generate-info-form
ref="generateInfoRef"
:table="formData.table"
:columns="formData.columns"
/>
</el-tab-pane>
</el-tabs>
<el-form>

View File

@ -123,4 +123,4 @@ const resetForm = () => {
}
formRef.value?.resetFields()
}
</script>
</script>

View File

@ -111,4 +111,4 @@ const getDemo02CategoryTree = async () => {
root.children = handleTree(data, 'id', 'parentId')
demo02CategoryTree.value.push(root)
}
</script>
</script>

View File

@ -118,4 +118,4 @@ const resetForm = () => {
}
formRef.value?.resetFields()
}
</script>
</script>

View File

@ -96,4 +96,4 @@ const resetForm = () => {
}
formRef.value?.resetFields()
}
</script>
</script>

View File

@ -11,7 +11,7 @@
</el-button>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="名字" align="center" prop="name" />
<el-table-column label="名字" align="center" prop="name" />
<el-table-column label="分数" align="center" prop="score" />
<el-table-column
label="创建时间"
@ -49,8 +49,8 @@
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<Demo03CourseForm ref="formRef" @success="getList" />
<!-- 表单弹窗添加/修改 -->
<Demo03CourseForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
@ -123,4 +123,4 @@ const handleDelete = async (id: number) => {
await getList()
} catch {}
}
</script>
</script>

View File

@ -96,4 +96,4 @@ const resetForm = () => {
}
formRef.value?.resetFields()
}
</script>
</script>

View File

@ -11,7 +11,7 @@
</el-button>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="名字" align="center" prop="name" />
<el-table-column label="名字" align="center" prop="name" />
<el-table-column label="班主任" align="center" prop="teacher" />
<el-table-column
label="创建时间"
@ -49,8 +49,8 @@
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<Demo03GradeForm ref="formRef" @success="getList" />
<!-- 表单弹窗添加/修改 -->
<Demo03GradeForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
@ -123,4 +123,4 @@ const handleDelete = async (id: number) => {
await getList()
} catch {}
}
</script>
</script>

View File

@ -150,4 +150,4 @@ const resetForm = () => {
}
formRef.value?.resetFields()
}
</script>
</script>

View File

@ -9,7 +9,7 @@
>
<el-table :data="formData" class="-mt-10px">
<el-table-column label="序号" type="index" width="100" />
<el-table-column label="名字" min-width="150">
<el-table-column label="名字" min-width="150">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.name`" :rules="formRules.name" class="mb-0px!">
<el-input v-model="row.name" placeholder="请输入名字" />
@ -57,7 +57,7 @@ watch(
formData.value = []
// 2. val
if (!val) {
return;
return
}
try {
formLoading.value = true
@ -97,4 +97,4 @@ const getData = () => {
}
defineExpose({ validate, getData })
</script>
</script>

View File

@ -48,4 +48,4 @@ const handleQuery = () => {
onMounted(() => {
getList()
})
</script>
</script>

View File

@ -6,7 +6,7 @@
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="名字" prop="name">
<el-form-item label="名字" prop="name">
<el-input v-model="formData.name" placeholder="请输入名字" />
</el-form-item>
<el-form-item label="班主任" prop="teacher">
@ -38,11 +38,11 @@ watch(
id: undefined,
studentId: undefined,
name: undefined,
teacher: undefined,
teacher: undefined
}
// 2. val
if (!val) {
return;
return
}
try {
formLoading.value = true
@ -69,4 +69,4 @@ const getData = () => {
}
defineExpose({ validate, getData })
</script>
</script>

View File

@ -52,4 +52,4 @@ const handleQuery = () => {
onMounted(() => {
getList()
})
</script>
</script>

View File

@ -150,4 +150,4 @@ const resetForm = () => {
}
formRef.value?.resetFields()
}
</script>
</script>

View File

@ -9,7 +9,7 @@
>
<el-table :data="formData" class="-mt-10px">
<el-table-column label="序号" type="index" width="100" />
<el-table-column label="名字" min-width="150">
<el-table-column label="名字" min-width="150">
<template #default="{ row, $index }">
<el-form-item :prop="`${$index}.name`" :rules="formRules.name" class="mb-0px!">
<el-input v-model="row.name" placeholder="请输入名字" />
@ -57,7 +57,7 @@ watch(
formData.value = []
// 2. val
if (!val) {
return;
return
}
try {
formLoading.value = true
@ -97,4 +97,4 @@ const getData = () => {
}
defineExpose({ validate, getData })
</script>
</script>

View File

@ -6,7 +6,7 @@
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="名字" prop="name">
<el-form-item label="名字" prop="name">
<el-input v-model="formData.name" placeholder="请输入名字" />
</el-form-item>
<el-form-item label="班主任" prop="teacher">
@ -38,11 +38,11 @@ watch(
id: undefined,
studentId: undefined,
name: undefined,
teacher: undefined,
teacher: undefined
}
// 2. val
if (!val) {
return;
return
}
try {
formLoading.value = true
@ -69,4 +69,4 @@ const getData = () => {
}
defineExpose({ validate, getData })
</script>
</script>

View File

@ -20,8 +20,12 @@ import { propTypes } from '@/utils/propTypes'
defineOptions({ name: 'ProductCategorySelect' })
const props = defineProps({
modelValue: oneOfType([propTypes.number.def(undefined), propTypes.array.def([])]).def(undefined), // ID
multiple: propTypes.bool.def(false) //
// ID
modelValue: oneOfType<number | number[]>([Number, Array<Number>]),
//
multiple: propTypes.bool.def(false),
//
parentId: propTypes.number.def(undefined)
})
/** 选中的分类 ID */
@ -38,10 +42,10 @@ const selectCategoryId = computed({
const emit = defineEmits(['update:modelValue'])
/** 初始化 **/
const categoryList = ref([]) //
const categoryList = ref<ProductCategoryApi.CategoryVO[]>([]) //
onMounted(async () => {
//
const data = await ProductCategoryApi.getCategoryList({})
const data = await ProductCategoryApi.getCategoryList({ parentId: props.parentId })
categoryList.value = handleTree(data, 'id', 'parentId')
})
</script>