+
{{ item.show_price_symbol }}{{ item.min_price }}{{ item.show_price_unit }}
{{ item.show_original_price_symbol }}{{ item.min_original_price }}{{ item.show_original_price_unit }}
@@ -133,17 +133,6 @@ const default_list = {
new_src: []
}
const list = ref
([]);
-watchEffect(() => {
- if (form.value.product_check == '0') {
- if (!isEmpty(form.value.product_list)) {
- list.value = form.value.product_list;
- } else {
- list.value = Array(4).fill(default_list);
- }
- } else {
- get_products();
- }
-});
const get_products = () => {
const { goods_category_ids, goods_brand_ids, number, sort, sort_rules } = form.value;
const params = {
@@ -163,6 +152,17 @@ const get_products = () => {
}
});
};
+watchEffect(() => {
+ if (form.value.product_check == '0') {
+ if (!isEmpty(form.value.product_list)) {
+ list.value = form.value.product_list;
+ } else {
+ list.value = Array(4).fill(default_list);
+ }
+ } else {
+ get_products();
+ }
+});
// 圆角设置
const content_radius = computed(() => radius_computer(new_style.value.shop_radius));
@@ -376,7 +376,7 @@ const style_container = computed(() => {
height: 11.4rem;
}
.flex-img4 {
- width: 100%;
+ width: 7rem;
height: 7rem;
}
.flex-img5 {
diff --git a/src/components/model-shop-list/model-shop-list-content.vue b/src/components/model-shop-list/model-shop-list-content.vue
index 800e7be0..1f28acef 100644
--- a/src/components/model-shop-list/model-shop-list-content.vue
+++ b/src/components/model-shop-list/model-shop-list-content.vue
@@ -91,7 +91,7 @@ const state = reactive({
// 如果需要解构,确保使用toRefs
const { form } = toRefs(state);
-const base_list = {
+const base_list = reactive({
product_style_list: [
{ name: '单列展示', value: '0' },
{ name: '大图展示', value: '2' },
@@ -117,16 +117,6 @@ const base_list = {
{ name: '降序(desc)', value: '0' },
{ name: '升序(asc)', value: '1' },
]
-};
-
-onBeforeMount(() => {
- if (!shop_store.is_shop_api) {
- shop_store.set_is_shop_api(true);
- init();
- } else {
- base_list.product_category_list = shop_store.category_list;
- base_list.product_brand_list = shop_store.brand_list;
- }
});
const init = () => {
@@ -138,6 +128,16 @@ const init = () => {
});
};
+onMounted(() => {
+ if (!shop_store.is_shop_api) {
+ shop_store.set_is_shop_api(true);
+ init();
+ } else {
+ base_list.product_category_list = shop_store.category_list;
+ base_list.product_brand_list = shop_store.brand_list;
+ }
+});
+
const product_list_remove = (index: number) => {
form.value.product_list.splice(index, 1);
};
diff --git a/src/store/index.ts b/src/store/index.ts
index f34bf617..9b0b1f55 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -11,4 +11,5 @@ export * from './modules/footer-nav-content';
export * from './modules/upload';
export * from './modules/shop';
export * from './modules/url-value';
+export * from './modules/custom';
export { store };
From b8bd964a2b5efbf60f3ad83e14d3028cdd48f831 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com>
Date: Mon, 19 Aug 2024 18:20:44 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=87=AA=E5=AE=9A?=
=?UTF-8?q?=E4=B9=89=E7=9A=84=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/custom.ts | 13 +++++++++++++
src/store/modules/custom.ts | 29 +++++++++++++++++++++++++++++
2 files changed, 42 insertions(+)
create mode 100644 src/api/custom.ts
create mode 100644 src/store/modules/custom.ts
diff --git a/src/api/custom.ts b/src/api/custom.ts
new file mode 100644
index 00000000..26af9682
--- /dev/null
+++ b/src/api/custom.ts
@@ -0,0 +1,13 @@
+import request from '@/utils/request';
+
+class CustomAPI {
+ /** 分类品牌查询接口*/
+ static getCustominit() {
+ return request({
+ url: `diyapi/custominit`,
+ method: 'post',
+ });
+ }
+}
+
+export default CustomAPI;
diff --git a/src/store/modules/custom.ts b/src/store/modules/custom.ts
new file mode 100644
index 00000000..5b58d086
--- /dev/null
+++ b/src/store/modules/custom.ts
@@ -0,0 +1,29 @@
+import { ref } from 'vue';
+import { defineStore } from 'pinia';
+
+export const DataSourceStore = defineStore('dataSource', () => {
+ interface product_list {
+ id: number;
+ name: string;
+ };
+ // 上传是否需要调接口判断
+ const is_data_source_api = ref(false);
+ // 数据源
+ const data_source_list = ref([]);
+ // 存储上传分类列表
+ const set_data_source = (category: product_list[], brand: product_list[]) => {
+ data_source_list.value = category;
+ is_data_source_api.value = true;
+ };
+ // 如果为false 则转为true
+ const set_is_shop_api = (bool: boolean) => {
+ is_data_source_api.value = bool;
+ };
+
+ return {
+ data_source_list,
+ is_data_source_api,
+ set_data_source,
+ set_is_shop_api,
+ };
+});
From 3de196663ce7258e7e15672b9263c16dfbf15b6b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com>
Date: Tue, 20 Aug 2024 09:35:57 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=87=AA=E5=AE=9A?=
=?UTF-8?q?=E4=B9=89=E6=8E=A5=E5=8F=A3=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../model-image/model-image-style.vue | 2 +-
.../model-text/model-text-style.vue | 5 +-
.../model-custom/model-custom-content.vue | 51 +++++++++++++++----
.../model-shop-list-content.vue | 9 +++-
src/store/modules/custom.ts | 20 +++++---
5 files changed, 63 insertions(+), 24 deletions(-)
diff --git a/src/components/common/custom-module/model-image/model-image-style.vue b/src/components/common/custom-module/model-image/model-image-style.vue
index 19009184..d6dfbd33 100644
--- a/src/components/common/custom-module/model-image/model-image-style.vue
+++ b/src/components/common/custom-module/model-image/model-image-style.vue
@@ -8,7 +8,7 @@
-
+
diff --git a/src/components/common/custom-module/model-text/model-text-style.vue b/src/components/common/custom-module/model-text/model-text-style.vue
index 1bd36fc8..bf7d5a44 100644
--- a/src/components/common/custom-module/model-text/model-text-style.vue
+++ b/src/components/common/custom-module/model-text/model-text-style.vue
@@ -8,7 +8,7 @@
-
+
@@ -21,9 +21,6 @@
-
-
-
diff --git a/src/components/model-custom/model-custom-content.vue b/src/components/model-custom/model-custom-content.vue
index 0905ad95..2c7eb54a 100644
--- a/src/components/model-custom/model-custom-content.vue
+++ b/src/components/model-custom/model-custom-content.vue
@@ -4,8 +4,8 @@
数据源
-
-
+
+
内容设置
@@ -17,10 +17,10 @@
-
+
-
+
@@ -39,6 +39,7 @@
import Dialog from './components/dialog.vue';
import DragIndex from './components/index.vue';
import { cloneDeep } from 'lodash';
+import CustomAPI from '@/api/custom';
import { DataSourceStore } from '@/store';
const data_source = DataSourceStore();
@@ -56,12 +57,33 @@ const form = reactive(props.value);
let custom_list = reactive([]);
const center_height = ref(0);
-const options = [
- { id: 1, label: 'Option A', desc: 'Option A - 230506' },
- { id: 2, label: 'Option B', desc: 'Option B - 230506' },
- { id: 3, label: 'Option C', desc: 'Option C - 230506' },
- { id: 4, label: 'Option A', desc: 'Option A - 230507' },
-];
+const options = ref([]);
+interface data_list {
+ name: string;
+ field: string;
+ type: string;
+};
+interface source_list {
+ name: string;
+ data: data_list[];
+ type: string;
+};
+const init = () => {
+ CustomAPI.getCustominit().then((res) => {
+ const { data_source } = res.data;
+ options.value = data_source;
+ data_source.set_data_source(data_source);
+ });
+}
+
+onBeforeMount(() => {
+ if (!data_source.is_data_source_api) {
+ data_source.set_is_data_source_api(true);
+ init();
+ } else {
+ options.value = data_source.data_source_list;
+ }
+});
const diy_data = ref({
key: '',
@@ -99,6 +121,15 @@ const accomplish = () => {
}
form.height = center_height.value;
};
+const model_data_source = ref([])
+const changeDataSource = (key: any) => {
+ const list = options.value.filter(item => item.type == key);
+ if (list.length > 0) {
+ model_data_source.value = list[0].data;
+ } else {
+ model_data_source.value = [];
+ }
+}
diff --git a/src/store/modules/custom.ts b/src/store/modules/custom.ts
index 5b58d086..9a08ac96 100644
--- a/src/store/modules/custom.ts
+++ b/src/store/modules/custom.ts
@@ -2,21 +2,27 @@ import { ref } from 'vue';
import { defineStore } from 'pinia';
export const DataSourceStore = defineStore('dataSource', () => {
- interface product_list {
- id: number;
+ interface data_list {
name: string;
+ field: string;
+ type: string;
+ };
+ interface source_list {
+ name: string;
+ data: data_list[];
+ type: string;
};
// 上传是否需要调接口判断
const is_data_source_api = ref(false);
// 数据源
- const data_source_list = ref([]);
+ const data_source_list = ref([]);
// 存储上传分类列表
- const set_data_source = (category: product_list[], brand: product_list[]) => {
- data_source_list.value = category;
+ const set_data_source = (source_list: source_list[]) => {
+ data_source_list.value = source_list;
is_data_source_api.value = true;
};
// 如果为false 则转为true
- const set_is_shop_api = (bool: boolean) => {
+ const set_is_data_source_api = (bool: boolean) => {
is_data_source_api.value = bool;
};
@@ -24,6 +30,6 @@ export const DataSourceStore = defineStore('dataSource', () => {
data_source_list,
is_data_source_api,
set_data_source,
- set_is_shop_api,
+ set_is_data_source_api,
};
});
From 3a44989332d0579a4f9ce0fa843ca58b162f7260 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com>
Date: Tue, 20 Aug 2024 10:09:26 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E9=80=89=E9=A1=B9=E5=8D=A1=E7=9A=84?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../model-shop-tabs-content.vue | 40 +++++++++++++++----
.../components/main/default/shop-tabs.ts | 12 +++---
2 files changed, 40 insertions(+), 12 deletions(-)
diff --git a/src/components/model-shop-tabs/model-shop-tabs-content.vue b/src/components/model-shop-tabs/model-shop-tabs-content.vue
index c3f4b836..60debdb3 100644
--- a/src/components/model-shop-tabs/model-shop-tabs-content.vue
+++ b/src/components/model-shop-tabs/model-shop-tabs-content.vue
@@ -59,12 +59,12 @@
-
+
-
+
@@ -95,6 +95,14 @@