From 4de0e9380a22b2adc6b30b09466c5c5b08768281 Mon Sep 17 00:00:00 2001 From: sws <1141121512@qq.com> Date: Fri, 6 Sep 2024 15:18:23 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=A7=A3=E5=86=B3=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E7=BA=BF=E4=B8=8A=E9=80=89=E6=8B=A9=E9=A3=8E=E6=A0=BC=E5=90=8E?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model-coupon/model-coupon-setting.vue | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/components/model-coupon/model-coupon-setting.vue b/src/components/model-coupon/model-coupon-setting.vue index 2abe4355..d1ef3be5 100644 --- a/src/components/model-coupon/model-coupon-setting.vue +++ b/src/components/model-coupon/model-coupon-setting.vue @@ -20,9 +20,9 @@ const props = defineProps({ default: () => {}, }, }); -const new_url = ref(''); const form = ref(props.value); -const default_config = { +const new_url = ref(''); +const default_config = ref({ style: { theme_1: { price_color: '#FF3830', @@ -196,21 +196,23 @@ const default_config = { background_img: [], }, theme_2: { - background_img: [{ url: new_url.value + 'theme-2-bg.png' }], + background_img: [{ url: 'theme-2-bg.png' }], }, }, -}; +}); +onMounted(async () => { + new_url.value = await online_url('/static/plugins/coupon/images/diy/').then((res) => res); + default_config.value.common_style.theme_2.background_img = [{ url: new_url.value + 'theme-2-bg.png' }]; +}); const change_theme = (val: string) => { if (val) { if (val == '2') { - form.value.style.common_style = Object.assign({}, form.value.style.common_style, (default_config.common_style)[`theme_${Number(val)}`]); + console.log(default_config.value.common_style); + form.value.style.common_style = Object.assign({}, form.value.style.common_style, (default_config.value.common_style)[`theme_${Number(val)}`]); } else { - form.value.style.common_style = Object.assign({}, form.value.style.common_style, default_config.common_style.theme_default); + form.value.style.common_style = Object.assign({}, form.value.style.common_style, default_config.value.common_style.theme_default); } - form.value.style = Object.assign({}, form.value.style, (default_config.style)[`theme_${Number(val)}`]); + form.value.style = Object.assign({}, form.value.style, (default_config.value.style)[`theme_${Number(val)}`]); } }; -onBeforeMount(async () => { - new_url.value = await online_url('/static/plugins/coupon/images/diy/').then((res) => res); -});