修改接口为空报错问题
parent
f73f063d2f
commit
de2677f8e1
|
|
@ -194,9 +194,9 @@ const theme_bg_img = ref<themeBgImg>({
|
||||||
});
|
});
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (!isEmpty(form.value.data_list) && form.value.data_type == '1') {
|
if (!isEmpty(form.value.data_list) && form.value.data_type == '0') {
|
||||||
data_list.value = form.value.data_list;
|
data_list.value = form.value.data_list;
|
||||||
} else if (form.value.data_type == '0') {
|
} else if (form.value.data_type == '1') {
|
||||||
if (!isEmpty(form.value.data_auto_list)) {
|
if (!isEmpty(form.value.data_auto_list)) {
|
||||||
data_list.value = form.value.data_auto_list;
|
data_list.value = form.value.data_auto_list;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -243,7 +243,7 @@ const data_list_computer = computed(() => {
|
||||||
watch(
|
watch(
|
||||||
() => data_list_computer.value,
|
() => data_list_computer.value,
|
||||||
(new_value) => {
|
(new_value) => {
|
||||||
if (new_value.data_type == '0') {
|
if (new_value.data_type == '1') {
|
||||||
get_coupon();
|
get_coupon();
|
||||||
} else {
|
} else {
|
||||||
if (!isEmpty(form.value.data_list)) {
|
if (!isEmpty(form.value.data_list)) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<el-radio v-for="item in base_list.data_type_list" :key="item.value" :value="item.value">{{ item.name }}</el-radio>
|
<el-radio v-for="item in base_list.data_type_list" :key="item.value" :value="item.value">{{ item.name }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<template v-if="form.data_type === '1'">
|
<template v-if="form.data_type === '0'">
|
||||||
<el-form-item label="手动选择">
|
<el-form-item label="手动选择">
|
||||||
<div class="flex-col gap-20 w">
|
<div class="flex-col gap-20 w">
|
||||||
<drag v-if="form.data_list.length > 0" :data="form.data_list" :space-col="20" @remove="remove" @on-sort="on_sort">
|
<drag v-if="form.data_list.length > 0" :data="form.data_list" :space-col="20" @remove="remove" @on-sort="on_sort">
|
||||||
|
|
@ -107,8 +107,8 @@ const url_value_dialog_visible = ref(false);
|
||||||
const new_url = ref('');
|
const new_url = ref('');
|
||||||
const base_list = reactive({
|
const base_list = reactive({
|
||||||
data_type_list: [
|
data_type_list: [
|
||||||
{ name: '自动', value: '0' },
|
{ name: '手动', value: '0' },
|
||||||
{ name: '手动', value: '1' },
|
{ name: '自动', value: '1' },
|
||||||
],
|
],
|
||||||
themeList: Array.from({ length: 7 }, (_, index) => ({
|
themeList: Array.from({ length: 7 }, (_, index) => ({
|
||||||
id: String(index + 1),
|
id: String(index + 1),
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,8 @@ import ShopAPI from '@/api/shop';
|
||||||
import { Swiper, SwiperSlide } from 'swiper/vue';
|
import { Swiper, SwiperSlide } from 'swiper/vue';
|
||||||
import { Autoplay } from 'swiper/modules';
|
import { Autoplay } from 'swiper/modules';
|
||||||
const modules = [Autoplay];
|
const modules = [Autoplay];
|
||||||
|
import { commonStore } from '@/store';
|
||||||
|
const common_store = commonStore();
|
||||||
/**
|
/**
|
||||||
* @description: 文章列表(渲染)
|
* @description: 文章列表(渲染)
|
||||||
* @param value{Object} 样式数据
|
* @param value{Object} 样式数据
|
||||||
|
|
@ -118,28 +120,35 @@ type data_list = {
|
||||||
const default_list = {
|
const default_list = {
|
||||||
name: '测试商户标题',
|
name: '测试商户标题',
|
||||||
describe: '测试商户描述',
|
describe: '测试商户描述',
|
||||||
icon_list: [{ icon: 'http://shopxo.com/static/diy/images/layout/siderbar/data-magic.png'}, { icon: ''}],
|
icon_list: [{ icon: common_store.common.config.attachment_host + `/static/diy/images/components/model-shop/auth.png`}, { icon: ''}],
|
||||||
logo: '',
|
logo: '',
|
||||||
new_cover: [],
|
new_cover: [],
|
||||||
};
|
};
|
||||||
const list = ref<data_list[]>([]);
|
const list = ref<data_list[]>([]);
|
||||||
const new_url_list = computed(() => {
|
const new_url_list = computed(() => {
|
||||||
return (icon_list: url[]) => {
|
return (icon_list: url[]) => {
|
||||||
|
if (isEmpty(icon_list)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
return icon_list.filter(item1 => !isEmpty(item1.icon));
|
return icon_list.filter(item1 => !isEmpty(item1.icon));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 标题图片样式
|
// 标题图片样式
|
||||||
const title_img_style = computed(() => {
|
const title_img_style = computed(() => {
|
||||||
return (icon_list: url[], index: number) => {
|
return (icon_list: url[], index: number) => {
|
||||||
const { shop_title_img_width = 0, shop_title_img_height = 0, shop_title_img_radius, shop_title_img_inner_spacing, shop_title_img_outer_spacing} = new_style.value;
|
if (isEmpty(icon_list)) {
|
||||||
let style = `width: ${shop_title_img_width || 0 }px;height: ${ shop_title_img_height || 0 }px;${ radius_computer(shop_title_img_radius) }`;
|
return '';
|
||||||
const list = icon_list.filter(item1 => !isEmpty(item1.icon));
|
|
||||||
if (index < list.length - 1) {
|
|
||||||
style += `margin-right: ${ shop_title_img_inner_spacing || 0}px;`;
|
|
||||||
} else {
|
} else {
|
||||||
style += `margin-right: ${ shop_title_img_outer_spacing || 0}px;`;
|
const { shop_title_img_width = 0, shop_title_img_height = 0, shop_title_img_radius, shop_title_img_inner_spacing, shop_title_img_outer_spacing} = new_style.value;
|
||||||
|
let style = `width: ${shop_title_img_width || 0 }px;height: ${ shop_title_img_height || 0 }px;${ radius_computer(shop_title_img_radius) }`;
|
||||||
|
const list = icon_list.filter(item1 => !isEmpty(item1.icon));
|
||||||
|
if (index < list.length - 1) {
|
||||||
|
style += `margin-right: ${ shop_title_img_inner_spacing || 0}px;`;
|
||||||
|
} else {
|
||||||
|
style += `margin-right: ${ shop_title_img_outer_spacing || 0}px;`;
|
||||||
|
}
|
||||||
|
return style;
|
||||||
}
|
}
|
||||||
return style;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 初始化的时候执行
|
// 初始化的时候执行
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@ const save_formmat_form_data = (data: diy_data_item, close: boolean = false, is_
|
||||||
item.com_data.content.data_ids = item.com_data.content.data_list.map((item: any) => item.id).join(',') || '';
|
item.com_data.content.data_ids = item.com_data.content.data_list.map((item: any) => item.id).join(',') || '';
|
||||||
item.com_data.content.data_list = [];
|
item.com_data.content.data_list = [];
|
||||||
item.com_data.content.data_auto_list = [];
|
item.com_data.content.data_auto_list = [];
|
||||||
if (item.com_data.content.data_type == '1') {
|
if (item.com_data.content.data_type == '0') {
|
||||||
item.com_data.content = {
|
item.com_data.content = {
|
||||||
keywords: '',
|
keywords: '',
|
||||||
type: defaultConfigSetting.coupon_ids,
|
type: defaultConfigSetting.coupon_ids,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue