diff --git a/src/components/footer-nav/footer-nav-content.vue b/src/components/footer-nav/footer-nav-content.vue index 16e1e9a9..b27748a5 100644 --- a/src/components/footer-nav/footer-nav-content.vue +++ b/src/components/footer-nav/footer-nav-content.vue @@ -54,16 +54,7 @@ import { get_math } from '@/utils'; const props = defineProps({ value: { type: Object, - default: () => ({ - nav_style: '0', - nav_type: '0', - nav_content: [ - { id: '1', name: '首页', src: [{ id: 1, url: '/src/assets/images/layout/main/phone.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: 'tabs', href: {} }, - { id: '2', name: '分类', src: [{ id: 1, url: '/src/assets/images/layout/main/phone.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: 'tabs', href: {} }, - { id: '3', name: '购物车', src: [{ id: 1, url: '/src/assets/images/layout/main/phone.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: 'tabs', href: {} }, - { id: '4', name: '我的', src: [{ id: 1, url: '/src/assets/images/layout/main/phone.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: 'tabs', href: {} }, - ], - }), + default: () => {}, }, }); const form = reactive(props.value); diff --git a/src/layout/components/main/default/footer-nav.ts b/src/layout/components/main/default/footer-nav.ts index 877bb618..051d2e61 100644 --- a/src/layout/components/main/default/footer-nav.ts +++ b/src/layout/components/main/default/footer-nav.ts @@ -1,4 +1,8 @@ import defaultCommon from './index'; +import { online_url } from '@/utils'; + +let new_url = await online_url(); + interface DefaultFooterNav { content: { nav_style: string; @@ -16,10 +20,10 @@ const defaultFooterNav: DefaultFooterNav = { nav_style: '0', nav_type: '0', nav_content: [ - { id: '1', name: '首页', src: [{ id: 1, url: '/src/assets/images/layout/main/foot/home.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: [{ id: 1, url: '/src/assets/images/layout/main/foot/home-checked.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], href: {} }, - { id: '2', name: '分类', src: [{ id: 1, url: '/src/assets/images/layout/main/foot/category.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: [{ id: 1, url: '/src/assets/images/layout/main/foot/category-checked.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], href: {} }, - { id: '3', name: '购物车', src: [{ id: 1, url: '/src/assets/images/layout/main/foot/cart.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: [{ id: 1, url: '/src/assets/images/layout/main/foot/cart-checked.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], href: {} }, - { id: '4', name: '我的', src: [{ id: 1, url: '/src/assets/images/layout/main/foot/user.png', original: '头像1', title: '头像1', ext: '.png', type: 'img' }], src_checked: [{ id: 1, url: '/src/assets/images/layout/main/foot/user-checked.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/utils/index.ts b/src/utils/index.ts index a595302c..feb8ee67 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -304,7 +304,7 @@ export const set_cookie = (name: string, value: string, expire_time?: number) => export const tabs_style = (color: string, style: string | number | boolean | undefined) => { const color_list = ['rgba(51,51,51,1)', 'rgba(255, 34, 34, 1)', 'rgba(255, 255, 255, 1)']; if (color_list.includes(color)) { - if ((style == '2' || style == '4')) { + if (style == '2' || style == '4') { return 'rgba(255, 255, 255, 1)'; } else if (style == '3') { return 'rgba(255, 34, 34, 1)'; @@ -314,4 +314,13 @@ export const tabs_style = (color: string, style: string | number | boolean | und } else { return color; } -} \ No newline at end of file +}; +// 在线地址 +export const online_url = async () => { + if (import.meta.env.VITE_APP_BASE_API == '/dev-api') { + let temp_value = await import('../../temp.d'); + return temp_value.default.temp_attachment_host + '/static/app/tabbar/'; + } else { + return (await get_cookie('temp_attachment_host')) + '/static/app/tabbar/'; + } +}; diff --git a/src/utils/request.ts b/src/utils/request.ts index 87a04ac7..24095b1b 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -15,8 +15,8 @@ service.interceptors.request.use( // 如果是本地则使用静态tonken如果是线上则使用cookie的token const cookie = get_cookie('admin_info'); if (import.meta.env.VITE_APP_BASE_API == '/dev-api') { - let temp_token = await import('../../temp.d'); - config.url = config.url + '?token=' + temp_token.default; + let temp_data = await import('../../temp.d'); + config.url = config.url + '?token=' + temp_data.default.temp_token; } else { if (cookie) { config.url = config.url + '&token=' + JSON.parse(cookie).token;