generated from Leo_Ding/web-template
产品优势
This commit is contained in:
parent
88e3e43b28
commit
40ee8e83c5
@ -15,12 +15,18 @@ export const deleteTag = (id) => request.basic.delete(`/api/v1/home-top-labels/$
|
||||
//获取产品优势列表
|
||||
export const getAdvanceList = (params) => request.basic.get('/api/v1/advance', params)
|
||||
|
||||
// 新增产品优势
|
||||
export const createAdvance = (data) => request.basic.post('/api/v1/advance', data)
|
||||
// 获取产品优势详情
|
||||
export const getAdvance = (id) => request.basic.get(`/api/v1/advance/${id}`)
|
||||
|
||||
// 编辑产品优势
|
||||
export const updateAdvance = (id, data) => request.basic.put(`/api/v1/advance/${id}`, data)
|
||||
|
||||
// 删除产品优势
|
||||
export const deleteActive = (id) => request.basic.delete(`/api/v1/advance/${id}`)
|
||||
|
||||
// 新增产品优势
|
||||
export const createAdvance = (data) => request.basic.post('/api/v1/advance', data)
|
||||
|
||||
//获取单个banner
|
||||
export const getBanner = (id) => request.basic.get(`/api/v1/banners/${id}`)
|
||||
//创建banner
|
||||
|
||||
@ -99,7 +99,6 @@ async function handleEdit(record = {}) {
|
||||
formRecord.value = data
|
||||
formData.value = cloneDeep(data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定
|
||||
*/
|
||||
|
||||
@ -5,31 +5,31 @@
|
||||
<a-card class="mb-8-2">
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'标题'" name="name">
|
||||
<a-input v-model:value="formData.name"></a-input>
|
||||
<a-form-item :label="'标题'" name="title">
|
||||
<a-input v-model:value="formData.title"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="$t('pages.system.role.form.sequence')" name="sequence">
|
||||
<a-input :defaultValue="0" type="number" v-model:value="formData.sequence"></a-input>
|
||||
<a-form-item :label="$t('pages.system.role.form.sequence')" name="order">
|
||||
<a-input :defaultValue="0" type="number" v-model:value="formData.order"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="$t('pages.system.role.form.status')" name="status">
|
||||
<a-radio-group v-model:value="formData.status" :options="[
|
||||
{ label: $t('pages.system.role.form.status.enabled'), value: 'enabled' },
|
||||
{ label: $t('pages.system.role.form.status.disabled'), value: 'disabled' },
|
||||
<a-form-item :label="'推荐首页'" name="is_recommend">
|
||||
<a-radio-group v-model:value="formData.is_recommend" :options="[
|
||||
{ label:'是', value: true },
|
||||
{ label: '否', value: false },
|
||||
]"></a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'描述'">
|
||||
<a-form-item :label="'描述'" name="description">
|
||||
<a-textarea v-model:value="formData.description"></a-textarea>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'上传图片'" name="permissions">
|
||||
<a-form-item :label="'上传图片'" name="imgUrl">
|
||||
<GxUpload :fileNumber="1" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@ -49,6 +49,7 @@ import { useForm, useModal } from '@/hooks'
|
||||
import GxUpload from '@/components/GxUpload/index.vue'
|
||||
const emit = defineEmits(['ok'])
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { FacialCleanser } from '@icon-park/vue-next'
|
||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
@ -81,19 +82,13 @@ async function handleEdit(record = {}) {
|
||||
title: '编辑产品优势',
|
||||
})
|
||||
|
||||
const { data, success } = await apis.banner.getBanner(record.id).catch()
|
||||
const { data, success } = await apis.platform.getAdvance(record.id).catch()
|
||||
if (!success) {
|
||||
message.error(t('component.message.error.save'))
|
||||
hideModal()
|
||||
return
|
||||
}
|
||||
let menus = []
|
||||
if (data.menus) {
|
||||
for (let item of data.menus) {
|
||||
menus.push(item.menu_id)
|
||||
}
|
||||
}
|
||||
checkedKeys.value = menus
|
||||
|
||||
formRecord.value = data
|
||||
formData.value = cloneDeep(data)
|
||||
}
|
||||
|
||||
@ -40,25 +40,14 @@
|
||||
<a-table :columns="columns" :data-source="listData" :loading="loading" :pagination="paginationState"
|
||||
:scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="'banner_type' === column.key">
|
||||
<!--状态-->
|
||||
<a-tag v-if="record.banner_type == 1" color="processing">
|
||||
首页轮播图
|
||||
</a-tag>
|
||||
<!--状态-->
|
||||
<a-tag v-else color="processing">
|
||||
营销活动图
|
||||
</a-tag>
|
||||
</template>
|
||||
|
||||
<template v-if="'is_recommend' === column.key">
|
||||
<!--状态-->
|
||||
<a-tag v-if="record.banner_type == true" color="processing">
|
||||
启用
|
||||
<a-tag v-if="record.is_recommend == true" color="processing">
|
||||
是
|
||||
</a-tag>
|
||||
<!--状态-->
|
||||
<a-tag v-else color="processing">
|
||||
禁用
|
||||
否
|
||||
</a-tag>
|
||||
</template>
|
||||
|
||||
@ -111,11 +100,11 @@ const columns = [
|
||||
{ title: '标题', dataIndex: 'title', width: 200 },
|
||||
{ title: '描述', dataIndex: 'description', width: 150 },
|
||||
{
|
||||
title: '是否启用',
|
||||
title: '是否推荐',
|
||||
dataIndex: 'is_recommend',
|
||||
key: 'is_recommend',
|
||||
width: 150,
|
||||
customRender: ({ text }) => (text ? '启用' : '禁用'),
|
||||
customRender: ({ text }) => (text ? '是' : '否'),
|
||||
},
|
||||
{ title: '图片地址', key: 'imgUrl', dataIndex: 'imgUrl', width: 160 },
|
||||
{ title: '页面地址', key: 'pageUrl', dataIndex: 'pageUrl', width: 160 },
|
||||
@ -161,14 +150,14 @@ async function getPageList() {
|
||||
*/
|
||||
function handleRemove({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.role.delTip'),
|
||||
title: '是否删除该产品优势?',
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.role.delRole(id).catch(() => {
|
||||
const { success } = await apis.platform.deleteActive(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user