修改公共组件的显示内容
parent
b0f6021915
commit
38faaa3515
|
|
@ -4,7 +4,7 @@ class BlogAPI {
|
|||
/** 博客自动数据 */
|
||||
static getAutoList(data: any) {
|
||||
return api_request({
|
||||
url: `?s=plugins/index/pluginsname/binding/pluginscontrol/diybinding/pluginsaction/index.html`,
|
||||
url: `?s=plugins/index/pluginsname/binding/pluginscontrol/diybinding/pluginsaction/autobindinglist.html`,
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class UrlValueAPI {
|
|||
/** 组合搭配指定数据 */
|
||||
static getBindingList(data: any) {
|
||||
return api_request({
|
||||
url: `?s=plugins/index/pluginsname/binding/pluginscontrol/diybinding/pluginsaction/autobindinglist.html`,
|
||||
url: `?s=plugins/index/pluginsname/binding/pluginscontrol/diybinding/pluginsaction/index.html`,
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
<el-option v-for="item in common_store.common.article_category" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-option v-for="item in common_store.common.blog_category" :key="item.id" :label="item.name" :value="item.id" />
|
||||
<el-option v-for="item in get_data_list(common_store.common.plugins, 'blog.category_list')" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</template>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
<el-radio v-for="item in common_store.common.article_order_by_type_list" :key="item.index" :value="item.index">{{ item.name }}</el-radio>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-radio v-for="item in common_store.common.blog_order_by_type_list" :key="item.index" :value="item.index">{{ item.name }}</el-radio>
|
||||
<el-radio v-for="item in get_data_list(common_store.common.plugins, 'blog.order_by_type_list')" :key="item.index" :value="item.index">{{ item.name }}</el-radio>
|
||||
</template>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="类型">
|
||||
<el-select v-model="form.binding_type" multiple collapse-tags filterable placeholder="请选择类型">
|
||||
<el-option v-for="item in common_store.common.brand_list" :key="item.id" :label="item.name" :value="item.id" />
|
||||
<el-option v-for="item in get_data_list(common_store.common.plugins, 'binding.type_list')" :key="item.value" :label="item.name" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="显示数量">
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="排序类型">
|
||||
<el-radio-group v-model="form.order_by_type">
|
||||
<el-radio v-for="item in common_store.common.brand_order_by_type_list" :key="item.index" :value="item.index">{{ item.name }}</el-radio>
|
||||
<el-radio v-for="item in get_data_list(common_store.common.plugins, 'binding.order_by_type_list')" :key="item.index" :value="item.index">{{ item.name }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序规则">
|
||||
|
|
@ -110,8 +110,11 @@
|
|||
<el-radio v-for="item in common_store.common.data_order_by_rule_list" :key="item.index" :value="item.index">{{ item.name }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否推荐">
|
||||
<el-switch v-model="form.is_recommended" active-value="1" inactive-value="0" />
|
||||
<el-form-item label="首页显示">
|
||||
<div class="flex-row align-c gap-10">
|
||||
<el-switch v-model="form.is_home_show" active-value="1" inactive-value="0" />
|
||||
<tooltip content="开启仅读取开启首页显示的数据,否则显示全部"></tooltip>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -144,6 +147,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { commonStore } from '@/store';
|
||||
import { get_data_list } from '@/utils';
|
||||
const common_store = commonStore();
|
||||
// 定义组件的属性和事件
|
||||
const props = defineProps({
|
||||
|
|
|
|||
|
|
@ -4,42 +4,46 @@
|
|||
<div v-if="!isEmpty(item.form_name) && !isEmpty(new_dataInterface) && !isEmpty(item.type)" class="filter-style flex-row gap-12">
|
||||
<div v-if="!isEmpty(item.title)" :class="['title text-line-1', props.direction == 'vertical' ? '' : 'horizontal-title']" :style="`width: ${ Number(props.titleWidth) > 0 ? props.titleWidth + 'px;' : '100%' }`">{{ item.title }}</div>
|
||||
<div class="w h flex-1 vertical-style">
|
||||
<template v-if="item.type == 'select'">
|
||||
<template v-if="+item?.config?.is_level == 1">
|
||||
<div class="flex-row gap-10">
|
||||
<el-cascader v-model="new_dataInterface[item.form_name]" :placeholder="placeholder_config(item, 'select')" :show-all-levels="false" filterable clearable class="w h" collapse-tags popper-class="filter-form-cascader" :placement="+item?.config?.is_level == 1 && props.direction == 'vertical' ? 'left' : 'bottom'" :props="{'multiple': +item?.config?.is_multiple == 1, 'checkStrictly': true, 'emitPath': false, 'value': item?.data_key || 'id', 'label': item?.data_name || 'name', 'children': item?.config?.children || '' }" :options="selectData(item)" />
|
||||
<template v-if="+item?.config?.is_multiple == 1">
|
||||
<tooltip content="父级选中包含所有子级"></tooltip>
|
||||
</template>
|
||||
</div>
|
||||
<div class="flex-row align-c gap-10">
|
||||
<template v-if="item.type == 'select'">
|
||||
<template v-if="+item?.config?.is_level == 1">
|
||||
<div class="flex-row gap-10">
|
||||
<el-cascader v-model="new_dataInterface[item.form_name]" :placeholder="placeholder_config(item, 'select')" :show-all-levels="false" filterable clearable class="w h" collapse-tags popper-class="filter-form-cascader" :placement="+item?.config?.is_level == 1 && props.direction == 'vertical' ? 'left' : 'bottom'" :props="{'multiple': +item?.config?.is_multiple == 1, 'checkStrictly': true, 'emitPath': false, 'value': item?.data_key || 'id', 'label': item?.data_name || 'name', 'children': item?.config?.children || '' }" :options="selectData(item)" />
|
||||
<template v-if="+item?.config?.is_multiple == 1">
|
||||
<tooltip content="父级选中包含所有子级"></tooltip>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-select v-model="new_dataInterface[item.form_name]" :multiple="+item?.config?.is_multiple == 1" filterable collapse-tags :placeholder="placeholder_config(item, 'select')" clearable>
|
||||
<el-option v-for="item1 in selectData(item)" :key="item1[item?.data_key || 'id']" :label="item1[item?.data_name || 'name']" :value="item1[item?.data_key || 'id']" />
|
||||
</el-select>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-select v-model="new_dataInterface[item.form_name]" :multiple="+item?.config?.is_multiple == 1" filterable collapse-tags :placeholder="placeholder_config(item, 'select')" clearable>
|
||||
<el-option v-for="item1 in selectData(item)" :key="item1[item?.data_key || 'id']" :label="item1[item?.data_name || 'name']" :value="item1[item?.data_key || 'id']" />
|
||||
</el-select>
|
||||
<template v-else-if="item.type == 'input'">
|
||||
<template v-if="item?.config?.type == 'number'">
|
||||
<el-input-number v-model="new_dataInterface[item.form_name]" :min="item?.config?.min || 0" :max="item?.config?.max || undefined" type="number" :placeholder="placeholder_config(item, 'input')" value-on-clear="min" class="w number-show" controls-position="right"></el-input-number>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-input v-model="new_dataInterface[item.form_name]" :placeholder="placeholder_config(item, 'input')" clearable />
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else-if="item.type == 'input'">
|
||||
<template v-if="item?.config?.type == 'number'">
|
||||
<el-input-number v-model="new_dataInterface[item.form_name]" :min="item?.config?.min || 0" :max="item?.config?.max || undefined" type="number" :placeholder="placeholder_config(item, 'input')" value-on-clear="min" class="w number-show" controls-position="right"></el-input-number>
|
||||
<template v-else-if="item.type == 'switch'">
|
||||
<el-switch v-model="new_dataInterface[item.form_name]" :active-value="1" :inactive-value="0" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-input v-model="new_dataInterface[item.form_name]" :placeholder="placeholder_config(item, 'input')" clearable />
|
||||
<template v-else-if="item.type =='radio'">
|
||||
<el-radio-group v-model="new_dataInterface[item.form_name]">
|
||||
<el-radio v-for="item1 in selectData(item)" :key="item1[item?.data_key || 'id']" :value="item1[item?.data_key || 'name']">{{ item1[item?.data_name || 'name'] }}</el-radio>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else-if="item.type == 'switch'">
|
||||
<el-switch v-model="new_dataInterface[item.form_name]" :active-value="1" :inactive-value="0" />
|
||||
</template>
|
||||
<template v-else-if="item.type =='radio'">
|
||||
<el-radio-group v-model="new_dataInterface[item.form_name]">
|
||||
<el-radio v-for="item1 in selectData(item)" :key="item1[item?.data_key || 'id']" :value="item1[item?.data_key || 'name']">{{ item1[item?.data_name || 'name'] }}</el-radio>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
<template v-else-if="item.type =='checkbox'">
|
||||
<el-checkbox-group v-model="new_dataInterface[item.form_name]">
|
||||
<el-checkbox v-for="item1 in selectData(item)" :key="item1[item?.data_key || 'id']" :value="item1[item?.data_key || 'name']">{{ item1[item?.data_name || 'name'] }}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</template>
|
||||
<template v-else-if="item.type =='checkbox'">
|
||||
<el-checkbox-group v-model="new_dataInterface[item.form_name]">
|
||||
<el-checkbox v-for="item1 in selectData(item)" :key="item1[item?.data_key || 'id']" :value="item1[item?.data_key || 'name']">{{ item1[item?.data_name || 'name'] }}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</template>
|
||||
<!-- 提示信息-->
|
||||
<tooltip v-if="!isEmpty(item.tips)" :content="item?.tips || ''"></tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -56,6 +60,7 @@ interface filter {
|
|||
type: string; // 类型
|
||||
config: any;
|
||||
title: string;
|
||||
tips?: string; // 提示
|
||||
form_name: string;
|
||||
data: any[];
|
||||
data_key: string;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<div class="container">
|
||||
<div class="flex-row jc-e gap-20 mb-20">
|
||||
<el-select v-model="binding_type" class="search-w" placeholder="请选择组合搭配类型" filterable clearable @change="handle_search">
|
||||
<el-option v-for="item in article_category_list" :key="item.id" :label="item.name" :value="item.id" />
|
||||
<el-option v-for="item in article_category_list" :key="item.value" :label="item.name" :value="item.value" />
|
||||
</el-select>
|
||||
<el-input v-model="search_value" placeholder="请输入搜索内容" class="search-w" @change="handle_search">
|
||||
<template #suffix>
|
||||
|
|
@ -44,6 +44,7 @@
|
|||
<script lang="ts" setup>
|
||||
import UrlValueAPI from '@/api/url-value';
|
||||
import { commonStore } from '@/store';
|
||||
import { get_data_list } from '@/utils';
|
||||
const common_store = commonStore();
|
||||
const props = defineProps({
|
||||
// 重置
|
||||
|
|
@ -80,7 +81,7 @@ const init = () => {
|
|||
template_selection.value = '';
|
||||
binding_type.value = '';
|
||||
search_value.value = '';
|
||||
article_category_list.value = common_store.common.article_category;
|
||||
article_category_list.value = get_data_list(common_store.common.plugins, 'binding.type_list');
|
||||
get_list(1);
|
||||
};
|
||||
const handle_search = () => {
|
||||
|
|
@ -88,9 +89,8 @@ const handle_search = () => {
|
|||
};
|
||||
const binding_type = ref('');
|
||||
interface articleCategory {
|
||||
id: string;
|
||||
name: string;
|
||||
url: string;
|
||||
value: string;
|
||||
}
|
||||
const article_category_list = ref<articleCategory[]>([]);
|
||||
const template_selection = ref('');
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
<script lang="ts" setup>
|
||||
import UrlValueAPI from '@/api/url-value';
|
||||
import { commonStore } from '@/store';
|
||||
import { get_data_list } from '@/utils';
|
||||
const common_store = commonStore();
|
||||
const props = defineProps({
|
||||
// 重置
|
||||
|
|
@ -77,7 +78,7 @@ const init = () => {
|
|||
template_selection.value = '';
|
||||
category_ids.value = '';
|
||||
search_value.value = '';
|
||||
article_category_list.value = common_store.common.article_category;
|
||||
article_category_list.value = get_data_list(common_store.common.plugins, 'blog.category_list');
|
||||
get_list(1);
|
||||
};
|
||||
const handle_search = () => {
|
||||
|
|
|
|||
|
|
@ -254,14 +254,15 @@ const get_binding = () => {
|
|||
binding_number: number,
|
||||
binding_is_home_show: is_home_show,
|
||||
};
|
||||
list.value = Array(4).fill(default_list);
|
||||
//获取商品列表
|
||||
BindingAPI.getAutoList(params).then((res: any) => {
|
||||
if (!isEmpty(res.data.data_list)) {
|
||||
list.value = res.data.data_list;
|
||||
if (!isEmpty(res.data)) {
|
||||
list.value = res.data;
|
||||
} else {
|
||||
list.value = Array(4).fill(default_list);
|
||||
}
|
||||
}).catch(() => {
|
||||
list.value = Array(4).fill(default_list);
|
||||
});
|
||||
};
|
||||
// 取出监听的数据
|
||||
|
|
|
|||
|
|
@ -284,6 +284,8 @@ const get_products = () => {
|
|||
} else {
|
||||
list.value = Array(4).fill(default_list);
|
||||
}
|
||||
}).catch(() => {
|
||||
list.value = Array(4).fill(default_list);
|
||||
});
|
||||
};
|
||||
// 取出监听的数据
|
||||
|
|
|
|||
|
|
@ -169,7 +169,6 @@ const get_products = () => {
|
|||
goods_order_by_rule: order_by_rule,
|
||||
goods_number: number,
|
||||
};
|
||||
list.value = Array(4).fill(default_list);
|
||||
// 获取商品列表
|
||||
ShopAPI.getShopList(params).then((res: any) => {
|
||||
if (!isEmpty(res.data)) {
|
||||
|
|
@ -177,6 +176,8 @@ const get_products = () => {
|
|||
} else {
|
||||
list.value = Array(4).fill(default_list);
|
||||
}
|
||||
}).catch(() => {
|
||||
list.value = Array(4).fill(default_list);
|
||||
});
|
||||
};
|
||||
// 取出监听的数据
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ interface defaultRealstore {
|
|||
keywords: string,
|
||||
binding_type: string[],
|
||||
number: number,
|
||||
order_by_type: string,
|
||||
order_by_rule: string,
|
||||
order_by_type: number,
|
||||
order_by_rule: number,
|
||||
is_home_show: string,
|
||||
is_goods_show: string[];
|
||||
is_default_show_goods: string;
|
||||
|
|
@ -183,9 +183,9 @@ const defaultRealstore: defaultRealstore = {
|
|||
keywords: '',
|
||||
binding_type: [],
|
||||
number: 4,
|
||||
order_by_type: '',
|
||||
order_by_rule: '',
|
||||
is_home_show: '',
|
||||
order_by_type: 0,
|
||||
order_by_rule: 0,
|
||||
is_home_show: '0',
|
||||
is_goods_show: ['title', 'goods_img', 'price', 'save_price'],
|
||||
is_default_show_goods: '1',
|
||||
is_details_show: '1',
|
||||
|
|
|
|||
|
|
@ -37,6 +37,19 @@ export const get_history_name = (components: any) => {
|
|||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
export const get_data_list = (common_store: any, value: any): any[] => {
|
||||
if (!isEmpty(common_store)) {
|
||||
const data = get_nested_property(common_store, value);
|
||||
if (Array.isArray(data)) {
|
||||
return data;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取嵌套对象的属性值
|
||||
*
|
||||
|
|
@ -47,7 +60,7 @@ export const get_history_name = (components: any) => {
|
|||
* @param {string} path - 属性路径,使用点号分隔的字符串表示
|
||||
* @returns {string} - 返回指定路径的属性值,如果路径无效则返回空字符串
|
||||
*/
|
||||
export function get_nested_property(obj: any, path: string): string {
|
||||
export function get_nested_property(obj: any, path: string): string | string[] {
|
||||
// 检查路径参数是否为字符串且非空,若不满足条件则返回空字符串
|
||||
if (typeof path !== 'string' || !path) return '';
|
||||
|
||||
|
|
@ -405,6 +418,10 @@ const data_handling = (data_source_id: string, sourceList: any, isCustom: boolea
|
|||
if (!isEmpty(sourceList.data) && isCustom) {
|
||||
new_data = get_nested_property(sourceList.data, data_source_id);
|
||||
}
|
||||
if (Array.isArray(new_data)) {
|
||||
// 如果是数组,将其拼接为字符串
|
||||
new_data = new_data.join(';');
|
||||
}
|
||||
return new_data;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue