修改页面设置处理逻辑

v1.0.0
于肖磊 2024-09-18 15:04:38 +08:00
parent 9d64c9b0ea
commit a64bbb6337
4 changed files with 64 additions and 56 deletions

View File

@ -5,8 +5,8 @@
<img class="img" :style="`Filter: brightness(${new_style.function_buttons_type == 'black' ? 0 : 100})`" src="@/assets/images/layout/main/main-top.png" />
</div>
<div class="model-head tc re mlr-12 mt-6">
<div class="flex-row align-c js-sb">
<div v-if="['1', '2', '3'].includes(form.theme)" class="flex-row align-c jc-c h gap-16" :style="[{ 'justify-content': form?.indicator_location || 'center' }, text_style]">
<div class="flex-row align-c jc-sb gap-16">
<div v-if="['1', '2', '3'].includes(form.theme)" class="flex-1 flex-row align-c jc-c h gap-16" :style="[{ 'justify-content': form?.indicator_location || 'center' }, text_style]">
<template v-if="['2', '3'].includes(form.theme)">
<div class="logo-outer-style"><image-empty v-model="form.logo[0]" class="logo-style" error-img-style="width:2rem;height:2rem;"></image-empty></div>
</template>
@ -17,7 +17,7 @@
</div>
</template>
</div>
<div v-else-if="['4', '5'].includes(form.theme)" class="flex-row align-c h gap-10">
<div v-else-if="['4', '5'].includes(form.theme)" class="flex-1 flex-row align-c h gap-10">
<div class="flex-row gap-2">
<icon name="position" size="12" color="0"></icon><span class="size-14 cr-3 text-line-1">{{ form.positioning_name }}</span
><icon v-if="form.is_arrows_show == '1'" name="arrow-right" size="12" color="0"></icon>

View File

@ -84,7 +84,12 @@ const props = defineProps({
default: () => ({}),
},
});
const form = reactive(props.value);
const form = ref(props.value);
watchEffect(() => {
form.value = props.value;
});
const base_list = reactive({
themeList: [
{ id: '1', name: '风格1', url: new URL(`../../assets/images/components/page-settings/theme-1.png`, import.meta.url).href },
@ -96,13 +101,13 @@ const base_list = reactive({
});
const icon_setting_remove = (index: number) => {
form.icon_setting.splice(index, 1);
form.value.icon_setting.splice(index, 1);
};
const icon_setting_sort = (item: any) => {
form.icon_setting = item;
form.value.icon_setting = item;
};
const add = () => {
form.icon_setting.push({
form.value.icon_setting.push({
id: get_math(),
img: [],
icon: '',

View File

@ -8,6 +8,7 @@
</template>
<script setup lang="ts">
import { cloneDeep } from 'lodash';
import { get_math } from '@/utils';
const props = defineProps({
type: {
type: String,
@ -19,6 +20,13 @@ const props = defineProps({
},
});
const default_data = {
content: {
indicator_location: 'flex-start',
icon_setting: [
{ id: get_math(), img: [], icon: 'applet-me-message-acquiesce', link: {} },
],
},
style: {
header_background_type: 'color_image',
header_background_color_list: [{ color: '#fff', color_percentage: undefined }],
header_background_direction: '180deg',
@ -43,6 +51,8 @@ const default_data = {
radius_bottom_left: 16,
radius_bottom_right: 16,
},
img_size: '18',
img_space: '15',
tips_color: '#ccc',
hot_words_color: '#000',
search_border: '#E4E4E4',
@ -54,6 +64,7 @@ const default_data = {
radius_bottom_right: 16,
},
}
}
const default_config = {
style: {
theme_1: {
@ -63,27 +74,19 @@ const default_config = {
style: {}
},
theme_2: {
content: {
indicator_location: 'flex-start',
},
content: {},
style: {}
},
theme_3: {
content: {
indicator_location: 'flex-start',
},
content: {},
style: {}
},
theme_4: {
content: {
indicator_location: 'flex-start',
},
content: {},
style: {}
},
theme_5: {
content: {
indicator_location: 'flex-start',
},
content: {},
style: {}
},
},
@ -91,8 +94,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), 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));
form.value.style = Object.assign({}, form.value.style, cloneDeep(default_data.style), cloneDeep((<arrayIndex>default_config.style)[`theme_${Number(val)}`].style));
form.value.content = Object.assign({}, form.value.content, cloneDeep(default_data.content), cloneDeep((<arrayIndex>default_config.style)[`theme_${Number(val)}`].content));
}
};
</script>

View File

@ -113,8 +113,8 @@ const defaultFooterNav: DefaultFooterNav = {
radius_bottom_left: 16,
radius_bottom_right: 16,
},
img_size: '23',
img_space: '25',
img_size: '18',
img_space: '15',
tips_color: '#ccc',
hot_words_color: '#000',
search_border: '#E4E4E4',