diff --git a/src/utils/index.ts b/src/utils/index.ts index 8176d88b..94b4c333 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,5 +1,11 @@ -import { isEmpty } from 'lodash'; +import { createApp } from 'vue'; +import { createPinia } from 'pinia'; import { commonStore } from '@/store'; +import App from '@/App.vue'; +const app = createApp(App); +const pinia = createPinia(); +app.use(pinia); +const { common } = commonStore(); // 定义一组预定义的颜色数组,用于在各种场景中轻松引用这些颜色 // 这些颜色包括从白色到黑色的不同灰度,以及一些鲜艳的颜色,格式有十六进制、RGB、RGBA、HSV、HSL等 export const predefine_colors = ['#fff', '#ddd', '#ccc', '#999', '#666', '#333', '#000', '#ff4500', '#ff8c00', '#ffd700', '#90ee90', '#00ced1', '#c71585', 'rgba(255, 69, 0, 0.68)', 'rgb(255, 120, 0)', 'hsv(51, 100, 98)', 'hsva(120, 40, 94, 0.5)', 'hsl(181, 100%, 37%)', '#1F93FF', '#c7158577']; @@ -335,7 +341,6 @@ export const tabs_style = (color: string, style: string | number | boolean | und * @returns {Promise} 返回一个Promise,解析为包含资源URL的字符串 */ export const online_url = async (directory: string) => { - const { common } = commonStore(); const attachemnt_host = common.config.attachment_host; if (import.meta.env.VITE_APP_BASE_API == '/dev-api') { let temp_data = await import(import.meta.env.VITE_APP_BASE_API == '/dev-api' ? '../../temp.d' : '../../temp_pro.d'); diff --git a/src/views/layout/components/main/default/footer-nav.ts b/src/views/layout/components/main/default/footer-nav.ts index 3951bc37..93ae601d 100644 --- a/src/views/layout/components/main/default/footer-nav.ts +++ b/src/views/layout/components/main/default/footer-nav.ts @@ -1,11 +1,6 @@ import defaultCommon from './index'; import { online_url } from '@/utils'; -import { onActivated } from 'vue'; - -const new_url = ref(''); -onActivated(async () => { - new_url.value = await online_url('/static/app/tabbar/').then((res) => res); -}); +const new_url = await online_url('/static/app/tabbar/').then((res) => res); interface DefaultFooterNav { content: { nav_style: string; @@ -23,10 +18,10 @@ const defaultFooterNav = ref({ nav_style: '0', nav_type: '0', nav_content: [ - { id: '1', name: '首页', src: [{ id: 1, url: new_url.value + 'home.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: [{ id: 1, url: new_url.value + 'active/home.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], href: {} }, - { id: '2', name: '分类', src: [{ id: 1, url: new_url.value + 'category.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: [{ id: 1, url: new_url.value + 'active/category.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], href: {} }, - { id: '3', name: '购物车', src: [{ id: 1, url: new_url.value + 'cart.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: [{ id: 1, url: new_url.value + 'active/cart.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], href: {} }, - { id: '4', name: '我的', src: [{ id: 1, url: new_url.value + 'user.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: [{ id: 1, url: new_url.value + 'active/user.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], href: {} }, + { id: '1', name: '首页', src: [{ id: 1, url: new_url + 'home.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: [{ id: 1, url: new_url + 'active/home.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], href: {} }, + { id: '2', name: '分类', src: [{ id: 1, url: new_url + 'category.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: [{ id: 1, url: new_url + 'active/category.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], href: {} }, + { id: '3', name: '购物车', src: [{ id: 1, url: new_url + 'cart.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: [{ id: 1, url: new_url + 'active/cart.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], href: {} }, + { id: '4', name: '我的', src: [{ id: 1, url: new_url + 'user.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: [{ id: 1, url: new_url + 'active/user.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], href: {} }, ], }, style: { diff --git a/src/views/layout/components/main/default/seckill.ts b/src/views/layout/components/main/default/seckill.ts index 3f0788ed..7ec0a525 100644 --- a/src/views/layout/components/main/default/seckill.ts +++ b/src/views/layout/components/main/default/seckill.ts @@ -1,13 +1,6 @@ import defaultCommon from './index'; import { online_url } from '@/utils'; -import { onMounted } from 'vue'; - -const new_url = ref(''); -onMounted(() => { - online_url('/static/app/tabbar/').then((res) => { - new_url.value = res; - }); -}); +const new_url = await online_url('/static/plugins/seckill/images/diy/').then((res) => res); interface DefaultSeckill { content: { head_state: string; @@ -19,7 +12,7 @@ interface DefaultSeckill { button_text: string; shop_style_type: string; carousel_col: number; - shop_number: number, + shop_number: number; is_show: string[]; shop_type: string; shop_button_text: string; @@ -53,10 +46,10 @@ interface DefaultSeckill { shop_price_typeface: string; shop_price_size: number; shop_price_color: string; - shop_button_typeface:string; + shop_button_typeface: string; shop_button_size: number; shop_button_color: color_list[]; - shop_button_text_color: string, + shop_button_text_color: string; shop_icon_size: number; shop_icon_color: string; original_price_color: string; @@ -80,7 +73,7 @@ const defaultSeckill: DefaultSeckill = { head_state: '1', theme: '1', topic_type: 'image', - topic_src: [{ id: 1, url: new_url.value + 'header-title.png', original: '标题', title: '标题', ext: '.png', type: 'img' }], + topic_src: [{ id: 1, url: new_url + 'header-title.png', original: '标题', title: '标题', ext: '.png', type: 'img' }], topic_text: '限时秒杀', button_status: '1', button_text: '更多', @@ -107,7 +100,7 @@ const defaultSeckill: DefaultSeckill = { header_background_color_list: [{ color: '', color_percentage: undefined }], header_background_direction: '180deg', header_background_img_style: '2', - header_background_img_url: [{ id: 1, url: new_url.value + 'header-bg.png', original: '背景', title: '背景1', ext: '.png', type: 'img' }], + header_background_img_url: [{ id: 1, url: new_url + 'header-bg.png', original: '背景', title: '背景1', ext: '.png', type: 'img' }], shop_radius: { radius: 8, radius_top_left: 8, @@ -137,22 +130,22 @@ const defaultSeckill: DefaultSeckill = { shop_title_color: '#333333', shop_price_typeface: '500', shop_price_size: 18, - shop_price_color: "#EA3323;", - shop_button_typeface:'400', + shop_price_color: '#EA3323;', + shop_button_typeface: '400', shop_button_size: 12, shop_button_color: [ { color: '#FF3D53', - color_percentage: undefined + color_percentage: undefined, }, { color: '#D73A3A', - color_percentage: undefined - } + color_percentage: undefined, + }, ], shop_button_text_color: '#fff', shop_icon_size: 10, - shop_icon_color: "#fff", + shop_icon_color: '#fff', original_price_color: '#999', seckill_subscript_location: 'top-left', seckill_subscript_text_color: '#fff', diff --git a/vite.config.ts b/vite.config.ts index 192aca0b..6d61d4b2 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -113,11 +113,11 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { rollupOptions: { output: { // 自定义 chunk 文件的输出路径和文件名格式 - chunkFileNames: 'diy/js/chunk/[name]-[hash].js', + chunkFileNames: 'static/admin/default/diy/js/chunk/[name]-[hash].js', // 自定义 entry chunk 的输出路径和文件名格式 - entryFileNames: 'diy/js/entry/[name]-[hash].js', + entryFileNames: 'static/admin/default/diy/js/entry/[name]-[hash].js', //非js文件夹,按照文件类型分类css,png,jpg - assetFileNames: 'diy/[ext]/[name]-[hash].[ext]', + assetFileNames: 'static/admin/default/diy/[ext]/[name]-[hash].[ext]', }, }, },