1.代码测试优化

sws 2024-08-26
v1.0.0
sws 2024-08-27 14:47:00 +08:00
parent 6e8ab5b8b1
commit 65aca0f8df
4 changed files with 22 additions and 18 deletions

View File

@ -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);

View File

@ -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: {

View File

@ -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;
}
}
};
// 在线地址
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/';
}
};

View File

@ -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;