Merge remote-tracking branch 'origin/dev-yxl' into dev-sws

v1.0.0
sws 2024-09-14 19:03:05 +08:00
commit faf52c8b4f
4 changed files with 30 additions and 29 deletions

View File

@ -8,6 +8,8 @@
</template>
<script setup lang="ts">
import { common_styles_computer } from '@/utils';
import { cloneDeep } from 'lodash';
const props = defineProps({
value: {
type: Object,
@ -15,27 +17,25 @@ const props = defineProps({
},
});
const style_container = ref('');
const article_tabs = ref(props.value);
watch(
article_tabs.value,
(newVal, oldValue) => {
const new_style = newVal?.style;
let new_data = newVal;
new_data.content.theme = new_data.content.article_theme;
new_data.content.data_type = new_data.content.tabs_list[0].data_type;
new_data.content.category_ids = new_data.content.tabs_list[0].category_ids;
new_data.content.carousel_col = new_data.content.article_carousel_col;
new_data.content.data_list = new_data.content.tabs_list[0].data_list;
new_data.content.data_ids = new_data.content.tabs_list[0].data_ids;
new_data.content.number = new_data.content.tabs_list[0].number;
new_data.content.order_by_type = new_data.content.tabs_list[0].order_by_type;
new_data.content.order_by_rule = new_data.content.tabs_list[0].order_by_rule;
new_data.content.field_show = new_data.content.field_show;
new_data.content.is_cover = new_data.content.tabs_list[0].is_cover;
article_tabs.value = new_data;
style_container.value += common_styles_computer(new_style.common_style);
},
{ immediate: true, deep: true }
);
const article_tabs = ref({});
watch(() => props.value, (val) => {
const newVal = cloneDeep(val);
const new_style = newVal?.style;
let new_data = newVal;
new_data.content.theme = new_data.content.article_theme;
new_data.content.data_type = new_data.content.tabs_list[0].data_type;
new_data.content.category_ids = new_data.content.tabs_list[0].category_ids;
new_data.content.carousel_col = new_data.content.article_carousel_col;
new_data.content.data_list = new_data.content.tabs_list[0].data_list;
new_data.content.data_ids = new_data.content.tabs_list[0].data_ids;
new_data.content.number = new_data.content.tabs_list[0].number;
new_data.content.order_by_type = new_data.content.tabs_list[0].order_by_type;
new_data.content.order_by_rule = new_data.content.tabs_list[0].order_by_rule;
new_data.content.field_show = new_data.content.field_show;
new_data.content.is_cover = new_data.content.tabs_list[0].is_cover;
article_tabs.value = new_data;
style_container.value += common_styles_computer(new_style.common_style);
}, { immediate: true, deep: true });
</script>
<style lang="scss" scoped></style>

View File

@ -254,8 +254,6 @@ const get_products = () => {
};
//
ShopAPI.getShopLists(params).then((res: any) => {
form.value.data_auto_list = res.data;
console.log(form.value);
if (!isEmpty(res.data)) {
list.value = res.data;
} else {

View File

@ -8,6 +8,7 @@
</template>
<script setup lang="ts">
import { common_styles_computer } from '@/utils';
import { cloneDeep } from 'lodash';
const props = defineProps({
value: {
@ -19,11 +20,12 @@ const props = defineProps({
});
const style_container = ref('');
const tabs_list = ref(props.value);
const tabs_list = ref({});
watch(tabs_list.value, (val) => {
const new_style = val?.style;
let new_data = val;
watch(() => props.value, (val) => {
const new_val = cloneDeep(val);
const new_style = new_val?.style;
let new_data = new_val;
//
new_data.content.data_type = new_data.content.tabs_list[0].data_type;
new_data.content.category_ids = new_data.content.tabs_list[0].category_ids;

View File

@ -91,7 +91,8 @@ const default_config = {
const form = ref(props.value);
const change_theme = (val: string) => {
if (val) {
form.value.style = Object.assign({}, form.value.style, cloneDeep(default_data), (<arrayIndex>default_config.style)[`theme_${Number(val)}`]);
form.value.style = Object.assign({}, form.value.style, cloneDeep(default_data), cloneDeep((<arrayIndex>default_config.style)[`theme_${Number(val)}`].style));
form.value.content = Object.assign({}, form.value.content, cloneDeep((<arrayIndex>default_config.style)[`theme_${Number(val)}`].content));
}
};
</script>