This commit is contained in:
Leo_Ding 2026-01-30 14:05:07 +08:00
parent f6ece66b1a
commit 9e6da05991
9 changed files with 72 additions and 39 deletions

View File

@ -2,5 +2,5 @@
NODE_ENV=development
# api
VITE_API_BASIC="http://10.10.1.30:8888"
VITE_API_BASIC="http://10.10.1.11:8888"

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GxDL算力</title>
<title>FAST亼算</title>
</head>
<body>
<div id="app"></div>

7
src/utils/debounce.js Normal file
View File

@ -0,0 +1,7 @@
export function debounce(func, delay = 500) {
let timer;
return function (...args) {
clearTimeout(timer);
timer = setTimeout(() => func.apply(this, args), delay);
};
}

View File

@ -199,6 +199,7 @@ import {
} from '@ant-design/icons-vue'
import { useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
import { debounce } from '@/utils/debounce.js'
const router = useRouter()
//
const switch1 = ref(true)
@ -246,10 +247,14 @@ const fetchUserAssets = () => {
//
const generateInviteLink = () => {
// API
message.success('邀请链接生成成功!')
debouncedSubmit()
// API
// const link = await api.generateInviteLink()
}
const debouncedSubmit = debounce(() => {
message.success('邀请链接生成成功!')
}, 800)
//
const goToRules = () => {

View File

@ -1,7 +1,7 @@
<template>
<div class="gx_layout">
<div :class="isHome ? 'gx_layout_header_home' : 'gx_layout_header_noHome'" class="gx_layout_header">
<div class="logo">GxDL算力</div>
<div class="logo">FAST亼算</div>
</div>
<div style="height: 60px;width: 100%;"></div>
<div class="gx_layout_content">

View File

@ -19,7 +19,7 @@
</div>
<div class="one">
<div v-for="item in oneList" style="display: flex;justify-content: center;align-items: center;cursor: pointer;"
@click="router.push(item.path)">
@click="router.push(item.link_url)">
<div style="margin-right: 10px;"><img :src="item.img" alt="" srcset="" width="50" height="50"></div>
<div>
<h3>{{ item.title }}</h3>
@ -179,39 +179,39 @@ const fetchBannerList = async () => {
};
//
const getOneList = async () => {
try {
const res: any = await getApiOneList();
//
if (res && Array.isArray(res) && res.length > 0) {
oneList.value = res;
} else {
// API使
oneList.value = [{ id: 0, image_url: defaultBanner }];
}
} catch (error: any) {
console.error('轮播图请求失败:', error);
// try {
// const res: any = await getApiOneList();
// //
// if (res && Array.isArray(res) && res.length > 0) {
// oneList.value = res;
// } else {
// // API使
// oneList.value = [{ id: 0, image_url: defaultBanner }];
// }
// } catch (error: any) {
// console.error(':', error);
// 使
oneList.value = [
{
img: youhuiquan,
title: '算力免费领',
description: '完成认证/问卷获得算力券',
path: '/active/newUser'
link_url: '/active/newUser'
},
{
img: yaoqinghaoyou,
title: '邀约优算友',
description: '邀请好友可获得算力券',
path: '/active/invite'
link_url: '/active/invite'
},
{
img: goumaijilu,
title: '开业重磅福利',
description: '购算力,享豪礼',
path: '/active/newUser'
link_url: '/active/newUser'
}
]
}
// }
};
// GPU
const getGPUList = async () => {
@ -231,17 +231,17 @@ const getAdvantageList = async () => {
const res: any = await getAdvantage();
const list = res || [];
// item img
// list.forEach((item: any, index: number) => {
// if (index === 0) {
// item.img = one;
// } else if (index === 1) {
// item.img = two;
// } else if (index === 2) {
// item.img = three;
// } else {
// item.img = firth;
// }
// });
list.forEach((item: any, index: number) => {
if (index === 0) {
item.img = one;
} else if (index === 1) {
item.img = two;
} else if (index === 2) {
item.img = three;
} else {
item.img = firth;
}
});
advantageList.value = list;
} catch (error: any) {

View File

@ -23,7 +23,15 @@
</a-radio-group>
</div>
</div>
<div class="filter-item" v-if="billingType != 'PayOnTime'">
<span class="filter-label">租用时长<span style="color: #ff4d4f;margin: 0 2px">*</span>:</span>
<div class="filter-content">
<a-select ref="select" v-model:value="priceCount" style="width: 300px">
<a-select-option v-for="item in priceCounts" :value="item.id">{{ item.label
}}</a-select-option>
</a-select>
</div>
</div>
<!-- GPU数量 -->
<div class="filter-item">
<span class="filter-label">GPU数量<span
@ -160,6 +168,7 @@ const voucherList = ref<any[]>([])
const instanceName = ref('')
const checked = ref(false)
const totalMoney = ref(0)
const priceCount = ref(1)
const voucherId = ref('')
//
const billingType = ref('PayOnTime')
@ -204,14 +213,26 @@ async function fetchTotalCost() {
const res: any = await getTotalCost({
billingMethod: billingType.value,
gpuNum: gpuCount.value,
host_id: HostId.value
host_id: HostId.value,
price_count:priceCount.value
})
totalMoney.value = res.amount
computingPowerPoint.value = res.computingPowerPoint
}
const dayList = ref([{ id: 1, label: '1日' }, { id: 2, label: '2日' }, { id: 3, label: '3日' }, { id: 4, label: '4日' }, { id: 5, label: '5日' }, { id: 6, label: '6日' }])
const weekList = ref([{ id: 1, label: '1周' }, { id: 2, label: '2周' }, { id: 3, label: '3周' }])
const weekMonth = ref([{ id: 1, label: '1个月' }, { id: 2, label: '2个月' }, { id: 3, label: '3个月' }, { id: 3, label: '4个月' }, { id: 3, label: '5个月' }, { id: 3, label: '6个月' }, { id: 3, label: '7个月' }, { id: 3, label: '8个月' }, { id: 3, label: '9个月' }, { id: 3, label: '10个月' }, { id: 3, label: '11个月' }])
const priceCounts = computed(() => {
if (billingType.value === 'PayOnDay') {
return dayList.value
} else if (billingType.value === 'PayOnWeek') {
return weekList.value
} else if (billingType.value === 'PayOnMonth') {
return weekMonth.value
}
})
//
watch([billingType, gpuCount], () => {
watch([billingType, gpuCount,priceCount], () => {
fetchTotalCost()
getSingleHost()
}) //

View File

@ -1,7 +1,7 @@
<template>
<div class="gx_layout">
<div :class="isHome ? 'gx_layout_header_home' : 'gx_layout_header_noHome'" class="gx_layout_header">
<div class="logo">GxDL算力</div>
<div class="logo">FAST亼算</div>
<div class="menu">
<a-menu v-model:selectedKeys="current" :class="isHome ? 'custom-menu' : ''" mode="horizontal"
:items="leftRoutes" @click="({ key }) => handleMenuClick(key)" />

View File

@ -21,7 +21,7 @@ export default defineConfig({
open: true, // 可选:启动时自动打开浏览器
proxy: {
'/api': {
target: 'http://10.10.1.34:8888', // 目标服务器的地址
target: 'http://10.10.1.11:8888', // 目标服务器的地址
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},