Compare commits
16 Commits
b64e9830ea
...
58a27586a3
Author | SHA1 | Date | |
---|---|---|---|
58a27586a3 | |||
7ae5762c78 | |||
58ba6d3fe2 | |||
f3e0692bff | |||
12c926b103 | |||
1538f5620f | |||
912e23ad44 | |||
8d77b9855c | |||
f98b460c14 | |||
ce06bcd7b6 | |||
377888d6e2 | |||
40c8ca0565 | |||
2ad995d565 | |||
8ebe23bf49 | |||
ecef636640 | |||
b93d0f1515 |
50
yudao-admin-vue3/src/api/mall/promotion/advertising/index.ts
Normal file
50
yudao-admin-vue3/src/api/mall/promotion/advertising/index.ts
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
// 开屏广告 VO
|
||||||
|
export interface AdvertisingVO {
|
||||||
|
id: number // id
|
||||||
|
status: number // 广告状态
|
||||||
|
time: number // 广告时间(秒)
|
||||||
|
property: string // 广告属性
|
||||||
|
picData: []
|
||||||
|
stat: boolean,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开屏广告 API
|
||||||
|
export const AdvertisingApi = {
|
||||||
|
// 查询开屏广告分页
|
||||||
|
getAdvertisingPage: async (params: any) => {
|
||||||
|
return await request.get({ url: `/promotion/advertising/page`, params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 查询开屏广告详情
|
||||||
|
getAdvertising: async () => {
|
||||||
|
return await request.get({ url: `/promotion/advertising/getAdvertising`})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增开屏广告
|
||||||
|
createAdvertising: async (data: AdvertisingVO) => {
|
||||||
|
return await request.post({ url: `/promotion/advertising/create`, data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 修改开屏广告
|
||||||
|
updateAdvertising: async (data: AdvertisingVO) => {
|
||||||
|
return await request.put({ url: `/promotion/advertising/update`, data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除开屏广告
|
||||||
|
deleteAdvertising: async (id: number) => {
|
||||||
|
return await request.delete({ url: `/promotion/advertising/delete?id=` + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 导出开屏广告 Excel
|
||||||
|
exportAdvertising: async (params) => {
|
||||||
|
return await request.download({ url: `/promotion/advertising/export-excel`, params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增修稿开屏广告
|
||||||
|
saveAdvertising: async (data: AdvertisingVO) => {
|
||||||
|
return await request.post({ url: `/promotion/advertising/saveAdvertising`, data })
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
@ -56,3 +56,32 @@ export const getDiyTemplateProperty = async (id: number) => {
|
|||||||
export const updateDiyTemplateProperty = async (data: DiyTemplateVO) => {
|
export const updateDiyTemplateProperty = async (data: DiyTemplateVO) => {
|
||||||
return await request.put({ url: `/promotion/diy-template/update-property`, data })
|
return await request.put({ url: `/promotion/diy-template/update-property`, data })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 设置商品分类接口
|
||||||
|
export const setDiyProjuctClass = async (id) => {
|
||||||
|
return await request.get({
|
||||||
|
url: `/system/dict-data/diy-template-goods?id=` + id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取商品分类接口
|
||||||
|
export const getDiyProjuctClass = async () => {
|
||||||
|
return await request.get({
|
||||||
|
url: `/system/dict-data/getGoods`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置主题风格
|
||||||
|
export const setDiyZtClass = async (id) => {
|
||||||
|
return await request.get({
|
||||||
|
url: `/system/dict-data/diy-template-theme?id=` + id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取主题风格
|
||||||
|
export const getDiyZtClass = async () => {
|
||||||
|
return await request.get({
|
||||||
|
url: `/system/dict-data/getTheme`
|
||||||
|
})
|
||||||
|
}
|
BIN
yudao-admin-vue3/src/assets/imgs/quxiao.png
Normal file
BIN
yudao-admin-vue3/src/assets/imgs/quxiao.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
@ -65,11 +65,11 @@ export const APP_LINK_GROUP_LIST = [
|
|||||||
name: '商品搜索',
|
name: '商品搜索',
|
||||||
path: '/pages/index/search'
|
path: '/pages/index/search'
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: '自定义页面',
|
// name: '自定义页面',
|
||||||
path: '/pages/index/page',
|
// path: '/pages/index/page',
|
||||||
type: APP_LINK_TYPE_ENUM.DIY_PAGE_DETAIL
|
// type: APP_LINK_TYPE_ENUM.DIY_PAGE_DETAIL
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
name: '客服',
|
name: '客服',
|
||||||
path: '/pages/chat/index'
|
path: '/pages/chat/index'
|
||||||
@ -78,13 +78,25 @@ export const APP_LINK_GROUP_LIST = [
|
|||||||
name: '系统设置',
|
name: '系统设置',
|
||||||
path: '/pages/public/setting'
|
path: '/pages/public/setting'
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: '常见问题',
|
// name: '常见问题',
|
||||||
path: '/pages/public/faq'
|
// path: '/pages/public/faq'
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
name: '积分商城',
|
name: '积分商城',
|
||||||
path: '/pages/public/faq'
|
path: '/pages/index/page?id=3'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name:'我的积分',
|
||||||
|
path:'/pages/user/wallet/score'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name:'兑换记录',
|
||||||
|
path:'/pages/activity/point/exchange_list'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name:'积分商品列表',
|
||||||
|
path:'/pages/activity/point/exchange_listall?id=3'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -111,11 +123,11 @@ export const APP_LINK_GROUP_LIST = [
|
|||||||
path: '/pages/goods/seckill',
|
path: '/pages/goods/seckill',
|
||||||
type: APP_LINK_TYPE_ENUM.PRODUCT_DETAIL_SECKILL
|
type: APP_LINK_TYPE_ENUM.PRODUCT_DETAIL_SECKILL
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: '促销列表',
|
// name: '促销列表',
|
||||||
path: '/pages/goods/sales',
|
// path: '/pages/goods/sales',
|
||||||
type: APP_LINK_TYPE_ENUM.PRODUCT_DETAIL_SECKILL
|
// type: APP_LINK_TYPE_ENUM.PRODUCT_DETAIL_SECKILL
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
name: '门店管理',
|
name: '门店管理',
|
||||||
path: '/pages/user/goods_details_store/index',
|
path: '/pages/user/goods_details_store/index',
|
||||||
@ -195,11 +207,12 @@ export const APP_LINK_GROUP_LIST = [
|
|||||||
{
|
{
|
||||||
name: '充值记录',
|
name: '充值记录',
|
||||||
path: '/pages/pay/recharge-log'
|
path: '/pages/pay/recharge-log'
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '核销记录',
|
|
||||||
path: '/pages/pay/recharge-log'
|
|
||||||
}
|
}
|
||||||
|
// ,
|
||||||
|
// {
|
||||||
|
// name: '核销记录',
|
||||||
|
// path: '/pages/pay/recharge-log'
|
||||||
|
// }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -248,6 +261,18 @@ export const APP_LINK_GROUP_LIST = [
|
|||||||
{
|
{
|
||||||
name: '会员中心',
|
name: '会员中心',
|
||||||
path: '/pages/user/user_vip/index'
|
path: '/pages/user/user_vip/index'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name:'付费会员',
|
||||||
|
path:'/pages/user/user_vip/list'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name:'预约中心',
|
||||||
|
path:'/pages/subscribe/subscribe'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name:'预约记录',
|
||||||
|
path:'pages/reservation_record/reservation_record'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -2,32 +2,33 @@
|
|||||||
<ComponentContainerProperty v-model="formData.style">
|
<ComponentContainerProperty v-model="formData.style">
|
||||||
<!-- 表单 -->
|
<!-- 表单 -->
|
||||||
<el-form label-width="80px" :model="formData" class="m-t-8px">
|
<el-form label-width="80px" :model="formData" class="m-t-8px">
|
||||||
<el-form-item label="每行数量" prop="column">
|
<!-- <el-form-item label="每行数量" prop="column">
|
||||||
<el-radio-group v-model="formData.column">
|
<el-radio-group v-model="formData.column">
|
||||||
<el-radio :label="3">3个</el-radio>
|
<el-radio :label="3">3个</el-radio>
|
||||||
<el-radio :label="4">4个</el-radio>
|
<el-radio :label="4">4个</el-radio>
|
||||||
<el-radio :label="5">5个</el-radio>
|
<el-radio :label="5">5个</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
|
|
||||||
<el-card header="菜单设置" class="property-group" shadow="never">
|
<el-card header="菜单设置" class="property-group" shadow="never">
|
||||||
<Draggable v-model="formData.list" :empty-item="EMPTY_MENU_GRID_ITEM_PROPERTY">
|
<Draggable v-model="formData.list" handle="false">
|
||||||
<template #default="{ element }">
|
<template #default="{ element }">
|
||||||
<el-form-item label="图标" prop="iconUrl">
|
<!-- <el-form-item label="图标" prop="iconUrl">
|
||||||
<UploadImg v-model="element.iconUrl" height="80px" width="80px">
|
<UploadImg v-model="element.iconUrl" height="80px" width="80px">
|
||||||
<template #tip> 建议尺寸:44 * 44 </template>
|
<template #tip> 建议尺寸:44 * 44 </template>
|
||||||
</UploadImg>
|
</UploadImg>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="标题" prop="title">
|
<el-form-item label="标题" prop="title">
|
||||||
<InputWithColor v-model="element.title" v-model:color="element.titleColor" />
|
<!-- <InputWithColor v-model="element.title" v-model:color="element.titleColor" /> -->
|
||||||
|
<div>{{element.title}}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="副标题" prop="subtitle">
|
<!-- <el-form-item label="副标题" prop="subtitle">
|
||||||
<InputWithColor v-model="element.subtitle" v-model:color="element.subtitleColor" />
|
<InputWithColor v-model="element.subtitle" v-model:color="element.subtitleColor" />
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="链接" prop="url">
|
<el-form-item label="链接" prop="url">
|
||||||
<AppLinkInput v-model="element.url" />
|
<AppLinkInput v-model="element.url" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="显示角标" prop="badge.show">
|
<!-- <el-form-item label="显示角标" prop="badge.show">
|
||||||
<el-switch v-model="element.badge.show" />
|
<el-switch v-model="element.badge.show" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<template v-if="element.badge.show">
|
<template v-if="element.badge.show">
|
||||||
@ -40,7 +41,7 @@
|
|||||||
<el-form-item label="背景颜色" prop="badge.bgColor">
|
<el-form-item label="背景颜色" prop="badge.bgColor">
|
||||||
<ColorInput v-model="element.badge.bgColor" />
|
<ColorInput v-model="element.badge.bgColor" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template> -->
|
||||||
</template>
|
</template>
|
||||||
</Draggable>
|
</Draggable>
|
||||||
</el-card>
|
</el-card>
|
||||||
@ -61,6 +62,46 @@ defineOptions({ name: 'MenuGridProperty' })
|
|||||||
const props = defineProps<{ modelValue : MenuGridProperty }>()
|
const props = defineProps<{ modelValue : MenuGridProperty }>()
|
||||||
const emit = defineEmits(['update:modelValue'])
|
const emit = defineEmits(['update:modelValue'])
|
||||||
const { formData } = usePropertyForm(props.modelValue, emit)
|
const { formData } = usePropertyForm(props.modelValue, emit)
|
||||||
|
if (formData.value.list.length == 1 || formData.value.list.length == 2 || formData.value.list.length == 3) {
|
||||||
|
formData.value = {
|
||||||
|
column: 3,
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
title: "今日推荐",
|
||||||
|
url: '/pages/index/page?id=19'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "热门榜单",
|
||||||
|
url: '/pages/index/page?id=21'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "首发新品",
|
||||||
|
url: '/pages/index/page?id=22'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "促销单品",
|
||||||
|
url: '/pages/index/page?id=23'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
style: {
|
||||||
|
bgColor: "#fff",
|
||||||
|
bgType: "color",
|
||||||
|
borderBottomLeftRadius: 8,
|
||||||
|
borderBottomRightRadius: 8,
|
||||||
|
borderRadius: 8,
|
||||||
|
borderTopLeftRadius: 8,
|
||||||
|
borderTopRightRadius: 8,
|
||||||
|
marginBottom: 8,
|
||||||
|
marginLeft: 8,
|
||||||
|
marginRight: 8,
|
||||||
|
padding: 0,
|
||||||
|
paddingBottom: 0,
|
||||||
|
paddingLeft: 0,
|
||||||
|
paddingRight: 0,
|
||||||
|
paddingTop: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss"></style>
|
<style scoped lang="scss"></style>
|
@ -0,0 +1,118 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="100px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-form-item label="广告状态" prop="status">
|
||||||
|
<el-radio-group v-model="formData.status">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_DIY_ADVERTISING)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value"
|
||||||
|
>
|
||||||
|
{{ dict.label }}
|
||||||
|
</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="广告时间(秒)" prop="time">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="formData.time"
|
||||||
|
type="date"
|
||||||
|
value-format="x"
|
||||||
|
placeholder="选择广告时间(秒)"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="广告属性" prop="property">
|
||||||
|
<el-input v-model="formData.property" placeholder="请输入广告属性" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
|
import { AdvertisingApi, AdvertisingVO } from '@/api/mall/promotion/advertising'
|
||||||
|
|
||||||
|
/** 开屏广告 表单 */
|
||||||
|
defineOptions({ name: 'AdvertisingForm' })
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
status: undefined,
|
||||||
|
time: undefined,
|
||||||
|
property: undefined
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
status: [{ required: true, message: '广告状态不能为空', trigger: 'blur' }],
|
||||||
|
time: [{ required: true, message: '广告时间(秒)不能为空', trigger: 'blur' }],
|
||||||
|
property: [{ required: true, message: '广告属性不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const open = async (type: string, id?: number) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
dialogTitle.value = t('action.' + type)
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await AdvertisingApi.getAdvertising(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
await formRef.value.validate()
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = formData.value as unknown as AdvertisingVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await AdvertisingApi.createAdvertising(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await AdvertisingApi.updateAdvertising(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
status: undefined,
|
||||||
|
time: undefined,
|
||||||
|
property: undefined
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
225
yudao-admin-vue3/src/views/mall/promotion/advertising/index.vue
Normal file
225
yudao-admin-vue3/src/views/mall/promotion/advertising/index.vue
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
<template>
|
||||||
|
<ContentWrap>
|
||||||
|
<span>数据配置</span>
|
||||||
|
<el-button type="primary" @click="baocun" style="margin-left:85%">保存</el-button>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<ContentWrap>
|
||||||
|
<div class="container">
|
||||||
|
<div class="left" >
|
||||||
|
|
||||||
|
<img :src="image"
|
||||||
|
style="width: 100%;height: 100%;border-radius: 10px;" v-show="check == 1" />
|
||||||
|
|
||||||
|
<span v-show="check == 2" style="margin-left:80px">暂无图片,请添加~</span>
|
||||||
|
</div>
|
||||||
|
<div class="right">
|
||||||
|
<div>
|
||||||
|
<p style="font-weight: 700;">引导页设置</p>
|
||||||
|
<span>开屏广告:</span><span> <el-switch v-model="formData.stat" size="large" /> </span>
|
||||||
|
<br />
|
||||||
|
<span>广告时间:</span><span> <el-input v-model="formData.time" style="width: 240px"
|
||||||
|
placeholder="请输入秒" /></span><span> 单位(秒)</span>
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<div v-for="(item, index) in timeRanges" :key="index" class="rectangle-container">
|
||||||
|
<div class="imageLeft">
|
||||||
|
<UploadImg width="100px" height="100px" v-model="item.pic" />
|
||||||
|
</div>
|
||||||
|
<div class="inputRight">
|
||||||
|
<div style="margin-top: 3%;">
|
||||||
|
<span>图片名称:</span><span><el-input style="width: 200px;" type="text" v-model="item.name"
|
||||||
|
placeholder="请输入名称" /></span>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
<span>链接地址:</span><span><el-input style="width: 200px;" type="text" v-model="item.url"
|
||||||
|
placeholder="请输入地址" /></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="top-right-image">
|
||||||
|
<img @click="removePic(index)" style="width: 25px;height: 25px;"
|
||||||
|
src="@/assets/imgs/quxiao.png" />
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<el-button type="primary" @click="addNewPic">添加图片</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ContentWrap>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { AdvertisingApi, AdvertisingVO } from '@/api/mall/promotion/advertising'
|
||||||
|
|
||||||
|
|
||||||
|
/** 开屏广告 列表 */
|
||||||
|
defineOptions({ name: 'Advertising' })
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
status: undefined,
|
||||||
|
stat: false,
|
||||||
|
time: undefined,
|
||||||
|
property: undefined,
|
||||||
|
picData: [{ pic: '', name: '', url: '' }]
|
||||||
|
})
|
||||||
|
|
||||||
|
const image = ref('')
|
||||||
|
const check = ref(2)
|
||||||
|
|
||||||
|
const timeRanges = ref([{ pic: '', name: '', url: '' }]);
|
||||||
|
//添加
|
||||||
|
const addNewPic = () => {
|
||||||
|
if (timeRanges.value.length <= 5) {
|
||||||
|
timeRanges.value.push({ pic: '', name: '', url: '' });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//移出
|
||||||
|
const removePic = (index : number) => {
|
||||||
|
if (timeRanges.value.length >= 1) {
|
||||||
|
timeRanges.value.splice(index, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//提交保存
|
||||||
|
const baocun = async () => {
|
||||||
|
|
||||||
|
formData.value.picData = timeRanges.value
|
||||||
|
const data = formData.value as unknown as AdvertisingVO
|
||||||
|
await AdvertisingApi.saveAdvertising(data)
|
||||||
|
getAdvertising()
|
||||||
|
message.success('保存成功')
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** 查询开屏广告数据配置 */
|
||||||
|
const getAdvertising = async () => {
|
||||||
|
|
||||||
|
formData.value = await AdvertisingApi.getAdvertising()
|
||||||
|
|
||||||
|
if(formData.value.id == null){
|
||||||
|
console.log('11111:',formData.value)
|
||||||
|
}else{
|
||||||
|
console.log('22222:',formData.value)
|
||||||
|
check.value = 1
|
||||||
|
timeRanges.value = formData.value.picData
|
||||||
|
if (formData.value.picData && formData.value.picData.length > 0) {
|
||||||
|
image.value = formData.value.picData[0].pic
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// if(formData.value.picData.length < 1){
|
||||||
|
// timeRanges.value = [{ pic: '', name: '', url: '' }]
|
||||||
|
// }
|
||||||
|
// if(formData.value.picData.length > 0){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
getAdvertising()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
/* justify-content: space-between; /* 左右分布 */
|
||||||
|
width: 1000px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.left {
|
||||||
|
margin-left: 20px;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
width: 300px;
|
||||||
|
height: 550px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
|
||||||
|
/* background-color: lightblue; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
margin-left: 50px;
|
||||||
|
/* background-color: lightgreen; */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传图片
|
||||||
|
*/
|
||||||
|
.rectangle-container {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 8px;
|
||||||
|
position: relative;
|
||||||
|
margin-top: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.imageLeft {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
margin-right: 20px;
|
||||||
|
|
||||||
|
/* position: relative; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.inputRight {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-right-image {
|
||||||
|
position: absolute;
|
||||||
|
/* 使图片定位到父容器的右上角 */
|
||||||
|
top: 1px;
|
||||||
|
/* 控制图片与上边缘的距离 */
|
||||||
|
right: 1px;
|
||||||
|
/* 控制图片与右边缘的距离 */
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-preview {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
/* object-fit: cover;
|
||||||
|
border-radius: 8px; */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* .inputRight input {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 8px;
|
||||||
|
width: 200px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 4px;
|
||||||
|
} */
|
||||||
|
</style>
|
@ -10,11 +10,11 @@
|
|||||||
|
|
||||||
<div class="mainBottom">
|
<div class="mainBottom">
|
||||||
<div class='item' :class="currItem == 1 ? 'on': ''" @click="clickItem(1)">
|
<div class='item' :class="currItem == 1 ? 'on': ''" @click="clickItem(1)">
|
||||||
<img class="img" src="https://zysc.fjptzykj.com:3000/shangcheng/a7d0409cbf5335a2780409756914c530fc7c88bec85fc81302b53760d9be4a03.jpg" />
|
<img class="img" src="https://zysc.fjptzykj.com:3000/shangcheng/921278a710b8035ac2e4fd40a08f64e3652c5130c08c633b7e136714d57c1001.jpg" />
|
||||||
<div class="text">样式1</div>
|
<div class="text">样式1</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='item' :class="currItem == 2 ? 'on': ''" @click="clickItem(2)">
|
<div class='item' :class="currItem == 2 ? 'on': ''" @click="clickItem(2)">
|
||||||
<img class="img" src="https://zysc.fjptzykj.com:3000/shangcheng/9096b2c04a6e46ea562999a93a1b975100c6b4557e680dcb31de6d3555407841.png" />
|
<img class="img" src="https://zysc.fjptzykj.com:3000/shangcheng/909ef630cff7cdc957962ae782ee9a882c86c35732140b1c9e013341fa559126.jpg" />
|
||||||
<div class="text">样式2</div>
|
<div class="text">样式2</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -23,12 +23,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// TODO @疯狂:要不要建个 decorate 目录,然后挪进去,改成 index.vue,这样可以更明确看到是个独立界面哈,更好找
|
// TODO @疯狂:要不要建个 decorate 目录,然后挪进去,改成 index.vue,这样可以更明确看到是个独立界面哈,更好找
|
||||||
import * as DiyTemplateApi from '@/api/mall/promotion/diy/template'
|
import * as DiyTemplateApi from '@/api/mall/promotion/diy/template'
|
||||||
import * as DiyPageApi from '@/api/mall/promotion/diy/page'
|
|
||||||
import { useTagsdivStore } from '@/store/modules/tagsdiv'
|
import { useTagsdivStore } from '@/store/modules/tagsdiv'
|
||||||
import { DiyComponentLibrary, PAGE_LIBS } from '@/components/DiyEditor/util' // 商城的 DIY 组件,在 DiyEditor 目录下
|
import { DiyComponentLibrary, PAGE_LIBS } from '@/components/DiyEditor/util' // 商城的 DIY 组件,在 DiyEditor 目录下
|
||||||
import { toNumber } from 'lodash-es'
|
import { toNumber } from 'lodash-es'
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
const currItem = ref(1);
|
const currItem = ref();
|
||||||
|
|
||||||
function clickItem (val){
|
function clickItem (val){
|
||||||
currItem.value = val;
|
currItem.value = val;
|
||||||
@ -39,9 +38,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function save (){
|
function save (){
|
||||||
// currItem.value = val;
|
setProjuctClass(currItem.value);
|
||||||
console.log("请求接口还没有写啊!!!!快让后端提供啊")
|
// console.log("请求接口还没有写啊!!!!快让后端提供啊")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置商品分类
|
||||||
|
const setProjuctClass = async (id) => {
|
||||||
|
const res = await DiyTemplateApi.setDiyProjuctClass(id);
|
||||||
|
console.log(res, "sssss");
|
||||||
|
if(res){
|
||||||
|
message.success('保存成功')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取商品分类
|
||||||
|
const getProjuctClass = async () => {
|
||||||
|
const res = await DiyTemplateApi.getDiyProjuctClass();
|
||||||
|
currItem.value = res
|
||||||
|
}
|
||||||
|
getProjuctClass()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -10,23 +10,48 @@
|
|||||||
|
|
||||||
<div class="ztfg">
|
<div class="ztfg">
|
||||||
<div class='top'>
|
<div class='top'>
|
||||||
<div class="item" :class="currItem== 1 ? 'on': ''" @click="clickItem(1)">
|
<div class="item" :class="currItem== '' ? 'on': ''" @click="clickItem('')">
|
||||||
|
<div class="le" style="background: rgb(233, 52, 34);"></div>
|
||||||
|
<div class="ri">红色</div>
|
||||||
|
</div>
|
||||||
|
<div class="item" :class="currItem== 'blue' ? 'on': ''" @click="clickItem('blue')">
|
||||||
<div class="le"></div>
|
<div class="le"></div>
|
||||||
<div class="ri">天空蓝</div>
|
<div class="ri">天空蓝</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item" :class="currItem== 2 ? 'on': ''" @click="clickItem(2)">
|
<div class="item" :class="currItem== 'lv' ? 'on': ''" @click="clickItem('lv')">
|
||||||
<div class="le" style="background:rgb(66, 202, 77);"></div>
|
<div class="le" style="background:rgb(66, 202, 77);"></div>
|
||||||
<div class="ri">生鲜绿</div>
|
<div class="ri">生鲜绿</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="item" :class="currItem== 'pink' ? 'on': ''" @click="clickItem('pink')">
|
||||||
|
<div class="le" style="background:#ff448f;"></div>
|
||||||
|
<div class="ri">魅力粉</div>
|
||||||
|
</div>
|
||||||
|
<div class="item" :class="currItem== 'orange' ? 'on': ''" @click="clickItem('orange')">
|
||||||
|
<div class="le" style="background:#fe5c2d;"></div>
|
||||||
|
<div class="ri">活力橙</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mainBottom">
|
<div class="mainBottom">
|
||||||
<div class='item' v-show="currItem== 1">
|
<div class='item' v-show="currItem== ''">
|
||||||
<img class="img"
|
<img class="img"
|
||||||
src="https://zysc.fjptzykj.com:3000/shangcheng/4bffe9f0cee9605262a579ee45156c9e37a16e2a24035a0e49b8a4433075f793.jpg" />
|
src="https://zysc.fjptzykj.com:3000/shangcheng/f973a0a4648d476a25b14a29250356d065507a1b9134b6303d7acd0b2d2d9cc7.jpg"/>
|
||||||
</div>
|
</div>
|
||||||
<div class='item' v-show="currItem== 2">
|
|
||||||
|
<div class='item' v-show="currItem== 'blue'">
|
||||||
<img class="img"
|
<img class="img"
|
||||||
src="https://zysc.fjptzykj.com:3000/shangcheng/0d0a7ab210afb5cee674e402ca3ec197a30523687acbec2e8e5f16fb52075e9b.jpg" />
|
src="https://zysc.fjptzykj.com:3000/shangcheng/f2c0e04f8491b618d691eb95c3df2f89ba565134cacc9b4e39ff96caa4d1cec0.jpg" />
|
||||||
|
</div>
|
||||||
|
<div class='item' v-show="currItem== 'lv'">
|
||||||
|
<img class="img"
|
||||||
|
src="https://zysc.fjptzykj.com:3000/shangcheng/1ba06619f3f87677b51dd735b03e0378da352abbe47b188dd43c58262ed47cca.jpg" />
|
||||||
|
</div>
|
||||||
|
<div class='item' v-show="currItem== 'pink'">
|
||||||
|
<img class="img"
|
||||||
|
src="https://zysc.fjptzykj.com:3000/shangcheng/13fd006f8883b492db10df8f1d03347b88c8836e68a603db874fd68bc01c7a71.jpg" />
|
||||||
|
</div>
|
||||||
|
<div class='item' v-show="currItem== 'orange'">
|
||||||
|
<img class="img"
|
||||||
|
src="https://zysc.fjptzykj.com:3000/shangcheng/da61c583680494e23a31f39acbb0246cf1d439080ceb53d85dc564da2c1ecfe9.jpg" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -39,21 +64,49 @@
|
|||||||
import { useTagsdivStore } from '@/store/modules/tagsdiv'
|
import { useTagsdivStore } from '@/store/modules/tagsdiv'
|
||||||
import { DiyComponentLibrary, PAGE_LIBS } from '@/components/DiyEditor/util' // 商城的 DIY 组件,在 DiyEditor 目录下
|
import { DiyComponentLibrary, PAGE_LIBS } from '@/components/DiyEditor/util' // 商城的 DIY 组件,在 DiyEditor 目录下
|
||||||
import { toNumber } from 'lodash-es'
|
import { toNumber } from 'lodash-es'
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
const currItem = ref(1);
|
const currItem = ref('blue');
|
||||||
|
|
||||||
function clickItem(val) {
|
function clickItem(val) {
|
||||||
currItem.value = val;
|
currItem.value = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
function cz(val) {
|
function cz(val) {
|
||||||
currItem.value = 1;
|
currItem.value = 'blue';
|
||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
|
const val = '';
|
||||||
// currItem.value = val;
|
// currItem.value = val;
|
||||||
console.log("请求接口还没有写啊!!!!快让后端提供啊")
|
if(currItem.value == 'lv'){
|
||||||
|
setZtClass('lv')
|
||||||
|
}else if(currItem.value == 'blue'){
|
||||||
|
setZtClass('blue')
|
||||||
|
}else if(currItem.value == 'pink'){
|
||||||
|
setZtClass('pink')
|
||||||
|
}else if(currItem.value == 'orange'){
|
||||||
|
setZtClass('orange')
|
||||||
|
}else{
|
||||||
|
setZtClass('')
|
||||||
}
|
}
|
||||||
|
// console.log("请求接口还没有写啊!!!!快让后端提供啊")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置主题风格
|
||||||
|
const setZtClass = async (id) => {
|
||||||
|
const res = await DiyTemplateApi.setDiyZtClass(id);
|
||||||
|
console.log(res, "sssss");
|
||||||
|
if(res || res == ''){
|
||||||
|
message.success('保存成功')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取商品分类
|
||||||
|
const getZtClass = async () => {
|
||||||
|
const res = await DiyTemplateApi.getDiyZtClass();
|
||||||
|
currItem.value = res
|
||||||
|
}
|
||||||
|
getZtClass()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -0,0 +1,228 @@
|
|||||||
|
<template>
|
||||||
|
<ContentWrap>
|
||||||
|
<span>数据配置</span>
|
||||||
|
<el-button style="margin-left:85%">重置</el-button>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<ContentWrap>
|
||||||
|
<div class="container">
|
||||||
|
<div class="left">
|
||||||
|
<img src="../../../kefu/components/asserts/aini.png" style="width: 100%;height: 100%;" />
|
||||||
|
</div>
|
||||||
|
<div class="right">
|
||||||
|
<div>
|
||||||
|
<p style="font-weight: 700;">引导页设置</p>
|
||||||
|
<span>开屏广告:</span><span> <el-switch v-model="value" size="large" /> </span>
|
||||||
|
<br />
|
||||||
|
<span>广告时间:</span><span> <el-input v-model="input" style="width: 240px" placeholder="请输入秒" /></span><span> 单位(秒)</span>
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
<br/>
|
||||||
|
<div>
|
||||||
|
<!-- 动态生成多个长方体区域 -->
|
||||||
|
<div class="rectangle-container">
|
||||||
|
<div class="imageLeft">
|
||||||
|
|
||||||
|
<UploadImg width="100px" height="100px" v-model="pic" />
|
||||||
|
<!-- <img v-if="pic" :src="pic" alt="Uploaded image" class="image-preview" /> -->
|
||||||
|
</div>
|
||||||
|
<div class="inputRight">
|
||||||
|
<!-- 上下排列的输入框 -->
|
||||||
|
<input type="text" v-model="input1" placeholder="输入框 1" />
|
||||||
|
<input type="text" v-model="input2" placeholder="输入框 2" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 添加按钮 -->
|
||||||
|
<el-button type="primary" @click="addNewItem">添加图片</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p style="font-weight: 700;">引导页设置</p>
|
||||||
|
<span>开屏广告:</span><span> <el-switch v-model="value" size="large" /> </span>
|
||||||
|
<br />
|
||||||
|
<span>广告时间:</span><span> <el-input v-model="input" style="width: 240px" placeholder="请输入秒" /></span><span> 单位(秒)</span>
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
<br/>
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<div class="rectangle-container">
|
||||||
|
<div class="imageLeft">
|
||||||
|
|
||||||
|
<UploadImg width="100px" height="100px" v-model="pic" />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="inputRight">
|
||||||
|
|
||||||
|
<input type="text" v-model="input1" placeholder="输入框 1" />
|
||||||
|
<input type="text" v-model="input2" placeholder="输入框 2" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<el-button type="primary" @click="addNewItem">添加图片</el-button>
|
||||||
|
</div>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
|
import download from '@/utils/download'
|
||||||
|
import { AdvertisingApi, AdvertisingVO } from '@/api/mall/promotion/'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
|
const loading = ref(true) // 列表的加载中
|
||||||
|
// const list = ref<AdvertisingVO[]>([]) // 列表的数据
|
||||||
|
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
status: undefined,
|
||||||
|
time: [],
|
||||||
|
property: undefined,
|
||||||
|
createTime: []
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const input1 = '0'
|
||||||
|
const input2 = ''
|
||||||
|
const items = [{id: '', image: '', input1: '', input2: '' }]
|
||||||
|
|
||||||
|
|
||||||
|
// const addNewItem = () => {
|
||||||
|
// items.push({id: '', image: '', input1: '', input2: '' });
|
||||||
|
// }
|
||||||
|
|
||||||
|
/** 查询列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await AdvertisingApi.getAdvertisingPage(queryParams)
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// /** 添加/修改操作 */
|
||||||
|
// const formRef = ref()
|
||||||
|
// const openForm = (type: string, id?: number) => {
|
||||||
|
// formRef.value.open(type, id)
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// /** 初始化 **/
|
||||||
|
// onMounted(() => {
|
||||||
|
// getList()
|
||||||
|
// })
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
/* justify-content: space-between; /* 左右分布 */
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.left {
|
||||||
|
width: 300px;
|
||||||
|
height: 500px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 8px;
|
||||||
|
/* background-color: lightblue; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
margin-left: 50px;
|
||||||
|
/* background-color: lightgreen; */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传图片
|
||||||
|
*/
|
||||||
|
.rectangle-container {
|
||||||
|
display: flex;
|
||||||
|
/* align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 20px; /* 给每个区域之间添加间隔 */
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.imageLeft {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
margin-right: 20px;
|
||||||
|
/* position: relative; */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .imageLeft input[type="file"] {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 50%;
|
||||||
|
height: 50%;
|
||||||
|
opacity: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.image-preview {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
/* object-fit: cover;
|
||||||
|
border-radius: 8px; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.inputRight {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inputRight input {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 8px;
|
||||||
|
width: 200px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* button {
|
||||||
|
padding: 10px 15px;
|
||||||
|
background-color: #4CAF50;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
} */
|
||||||
|
|
||||||
|
/* button:hover {
|
||||||
|
background-color: #45a049;
|
||||||
|
} */
|
||||||
|
</style>
|
@ -2,7 +2,7 @@
|
|||||||
<DiyEditor v-if="formData && !formLoading" v-model="currentFormData!.property"
|
<DiyEditor v-if="formData && !formLoading" v-model="currentFormData!.property"
|
||||||
:title="templateItems[selectedTemplateItem].name" :libs="libs" :show-page-config="selectedTemplateItem !== 0"
|
:title="templateItems[selectedTemplateItem].name" :libs="libs" :show-page-config="selectedTemplateItem !== 0"
|
||||||
:show-tab-bar="selectedTemplateItem === 0" :show-navigation-bar="selectedTemplateItem !== 0"
|
:show-tab-bar="selectedTemplateItem === 0" :show-navigation-bar="selectedTemplateItem !== 0"
|
||||||
:preview-url="previewUrl" @save="submitForm" @reset="handleEditorReset">
|
:preview-url="previewUrl" @save="submitForm" @reset="handleEditorReset" :showTabBar = "false">
|
||||||
<template #toolBarLeft>
|
<template #toolBarLeft>
|
||||||
<!-- <el-radio-group
|
<!-- <el-radio-group
|
||||||
v-model="selectedTemplateItem"
|
v-model="selectedTemplateItem"
|
||||||
|
@ -0,0 +1,102 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.controller.admin.advertising;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.advertising.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.advertising.AdvertisingDO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.service.advertising.AdvertisingService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 开屏广告")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/promotion/advertising")
|
||||||
|
@Validated
|
||||||
|
public class AdvertisingController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdvertisingService advertisingService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建开屏广告")
|
||||||
|
@PreAuthorize("@ss.hasPermission('promotion:advertising:create')")
|
||||||
|
public CommonResult<Long> createAdvertising(@Valid @RequestBody AdvertisingSaveReqVO createReqVO) {
|
||||||
|
return success(advertisingService.createAdvertising(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新开屏广告")
|
||||||
|
@PreAuthorize("@ss.hasPermission('promotion:advertising:update')")
|
||||||
|
public CommonResult<Boolean> updateAdvertising(@Valid @RequestBody AdvertisingSaveReqVO updateReqVO) {
|
||||||
|
advertisingService.updateAdvertising(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除开屏广告")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('promotion:advertising:delete')")
|
||||||
|
public CommonResult<Boolean> deleteAdvertising(@RequestParam("id") Long id) {
|
||||||
|
advertisingService.deleteAdvertising(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得开屏广告分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('promotion:advertising:query')")
|
||||||
|
public CommonResult<PageResult<AdvertisingRespVO>> getAdvertisingPage(@Valid AdvertisingPageReqVO pageReqVO) {
|
||||||
|
PageResult<AdvertisingDO> pageResult = advertisingService.getAdvertisingPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, AdvertisingRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出开屏广告 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('promotion:advertising:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportAdvertisingExcel(@Valid AdvertisingPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<AdvertisingDO> list = advertisingService.getAdvertisingPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "开屏广告.xls", "数据", AdvertisingRespVO.class,
|
||||||
|
BeanUtils.toBean(list, AdvertisingRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//添加修改开屏广告
|
||||||
|
@PostMapping("/saveAdvertising")
|
||||||
|
public CommonResult<Long> saveAdvertising(@Valid @RequestBody AdvertisingSaveReqVO createReqVO) {
|
||||||
|
return success(advertisingService.saveAdvertising(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getAdvertising")
|
||||||
|
public CommonResult<AdvertisingRespVO> getAdvertising() {
|
||||||
|
AdvertisingDO advertising = advertisingService.getAdvertising();
|
||||||
|
return success(BeanUtils.toBean(advertising, AdvertisingRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.controller.admin.advertising.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 开屏广告分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class AdvertisingPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "广告状态", example = "2")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "广告时间(秒)")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private Integer[] time;
|
||||||
|
|
||||||
|
@Schema(description = "广告属性")
|
||||||
|
private String property;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.controller.admin.advertising.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 开屏广告 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class AdvertisingRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "684")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "广告状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@ExcelProperty(value = "广告状态", converter = DictConvert.class)
|
||||||
|
@DictFormat("promotion_diy_advertising") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "广告时间(秒)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("广告时间(秒)")
|
||||||
|
private Integer time;
|
||||||
|
|
||||||
|
@Schema(description = "广告属性", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("广告属性")
|
||||||
|
private String property;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
private List<Object> picData;
|
||||||
|
|
||||||
|
private Boolean stat;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.controller.admin.advertising.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 开屏广告新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class AdvertisingSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "684")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "广告状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "广告时间(秒)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "广告时间(秒)不能为空")
|
||||||
|
private Integer time;
|
||||||
|
|
||||||
|
@Schema(description = "广告属性", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String property;
|
||||||
|
|
||||||
|
@Schema(description = "图片添加不能为空", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private List<Object> picData;
|
||||||
|
|
||||||
|
private Boolean stat;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.dal.dataobject.advertising;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开屏广告 DO
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
@TableName("promotion_diy_template_advertising")
|
||||||
|
@KeySequence("promotion_diy_template_advertising_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AdvertisingDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 广告状态
|
||||||
|
*
|
||||||
|
* 枚举 {@link TODO promotion_diy_advertising 对应的类}
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 广告时间(秒)
|
||||||
|
*/
|
||||||
|
private Integer time;
|
||||||
|
/**
|
||||||
|
* 广告属性
|
||||||
|
*/
|
||||||
|
private String property;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片数据
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Object> picData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开屏状态
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean stat;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.dal.mysql.advertising;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.advertising.AdvertisingDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.advertising.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开屏广告 Mapper
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface AdvertisingMapper extends BaseMapperX<AdvertisingDO> {
|
||||||
|
|
||||||
|
default PageResult<AdvertisingDO> selectPage(AdvertisingPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<AdvertisingDO>()
|
||||||
|
.eqIfPresent(AdvertisingDO::getStatus, reqVO.getStatus())
|
||||||
|
.betweenIfPresent(AdvertisingDO::getTime, reqVO.getTime())
|
||||||
|
.eqIfPresent(AdvertisingDO::getProperty, reqVO.getProperty())
|
||||||
|
.betweenIfPresent(AdvertisingDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(AdvertisingDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.service.advertising;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.advertising.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.advertising.AdvertisingDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开屏广告 Service 接口
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
public interface AdvertisingService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建开屏广告
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createAdvertising(@Valid AdvertisingSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新开屏广告
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateAdvertising(@Valid AdvertisingSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除开屏广告
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteAdvertising(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得开屏广告
|
||||||
|
*
|
||||||
|
* @return 开屏广告
|
||||||
|
*/
|
||||||
|
AdvertisingDO getAdvertising();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得开屏广告分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 开屏广告分页
|
||||||
|
*/
|
||||||
|
PageResult<AdvertisingDO> getAdvertisingPage(AdvertisingPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
|
||||||
|
Long saveAdvertising(@Valid AdvertisingSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,108 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.service.advertising;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.advertising.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.advertising.AdvertisingDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.mysql.advertising.AdvertisingMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开屏广告 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class AdvertisingServiceImpl implements AdvertisingService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdvertisingMapper advertisingMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createAdvertising(AdvertisingSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
AdvertisingDO advertising = BeanUtils.toBean(createReqVO, AdvertisingDO.class);
|
||||||
|
advertisingMapper.insert(advertising);
|
||||||
|
// 返回
|
||||||
|
return advertising.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAdvertising(AdvertisingSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateAdvertisingExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
AdvertisingDO updateObj = BeanUtils.toBean(updateReqVO, AdvertisingDO.class);
|
||||||
|
advertisingMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAdvertising(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateAdvertisingExists(id);
|
||||||
|
// 删除
|
||||||
|
advertisingMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateAdvertisingExists(Long id) {
|
||||||
|
if (advertisingMapper.selectById(id) == null) {
|
||||||
|
throw exception(ADVERTISING_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AdvertisingDO getAdvertising() {
|
||||||
|
List<AdvertisingDO> advertisingDOS = advertisingMapper.selectList();
|
||||||
|
if (advertisingDOS.isEmpty()){
|
||||||
|
return new AdvertisingDO();
|
||||||
|
}
|
||||||
|
AdvertisingDO advertisingDO = advertisingDOS.get(0);
|
||||||
|
advertisingDO.setPicData(JSON.parseArray(advertisingDO.getProperty()));
|
||||||
|
if (advertisingDO.getStatus() == 1){
|
||||||
|
advertisingDO.setStat(true);
|
||||||
|
}
|
||||||
|
if (advertisingDO.getStatus() == 2){
|
||||||
|
advertisingDO.setStat(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return advertisingDO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<AdvertisingDO> getAdvertisingPage(AdvertisingPageReqVO pageReqVO) {
|
||||||
|
return advertisingMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long saveAdvertising(@Valid AdvertisingSaveReqVO createReqVO) {
|
||||||
|
if (createReqVO.getStat()){
|
||||||
|
createReqVO.setStatus(1);
|
||||||
|
}else {
|
||||||
|
createReqVO.setStatus(2);
|
||||||
|
}
|
||||||
|
List<AdvertisingDO> advertisingDOS = advertisingMapper.selectList();
|
||||||
|
if (advertisingDOS.isEmpty()){
|
||||||
|
createReqVO.setProperty(JSON.toJSONString(createReqVO.getPicData()));
|
||||||
|
AdvertisingDO advertising = BeanUtils.toBean(createReqVO, AdvertisingDO.class);
|
||||||
|
return (long) advertisingMapper.insert(advertising);
|
||||||
|
}
|
||||||
|
AdvertisingDO advertisingDO = advertisingDOS.get(0);
|
||||||
|
advertisingDO.setProperty(JSON.toJSONString(createReqVO.getPicData()));
|
||||||
|
return (long)advertisingMapper.updateById(advertisingDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user