diff --git a/.env.dev b/.env.dev index a715d52..2169dad 100644 --- a/.env.dev +++ b/.env.dev @@ -2,5 +2,5 @@ NODE_ENV=development # api -VITE_API_BASIC="http://10.10.1.35:8888" +VITE_API_BASIC="http://10.10.1.32:8888" diff --git a/src/apis/home.ts b/src/apis/home.ts index 89918d4..f7c85b5 100644 --- a/src/apis/home.ts +++ b/src/apis/home.ts @@ -21,4 +21,10 @@ export const getMyCouponTotal = () => request.get('/v1/voucher/voucher_value') export const getRecommendList = () => request.get('/v1/voucher/voucher_list') //获取消息列表 -export const getMessageList = (params:any) => request.get('/v1/message/message_list', { params }) \ No newline at end of file +export const getMessageList = (params:any) => request.get('/v1/message/message_list', { params }) + +//验证码合法性 +export const CodeAuth=(params:any)=>request.put("/v1/auth/update_password_auth",params) + +//提现 +export const tixian=(params:any)=>request.put("/v1/balance/withdraw",params) \ No newline at end of file diff --git a/src/components/sidebar.vue b/src/components/sidebar.vue index 046d444..e83e57f 100644 --- a/src/components/sidebar.vue +++ b/src/components/sidebar.vue @@ -57,12 +57,7 @@ interface MenuItem { } const menuItems: MenuItem[] = [ - { path: '/controlPanel/overview', name: '总览', icon: HomeOutlined }, - { path: '/controlPanel/container', name: '容器实例', icon: ConsoleSqlOutlined }, - { path: '/controlPanel/fileStore', name: '文件存储', icon: FolderOpenOutlined }, - { path: '/controlPanel/image', name: '镜像', icon: GlobalOutlined }, - { path: '/controlPanel/publicData', name: '公开数据', icon: LaptopOutlined }, - { + { path: '/contract', name: '费用中心', icon: MoneyCollectOutlined, @@ -80,7 +75,12 @@ const menuItems: MenuItem[] = [ { path: '/accountHistory', name: '访问记录' }, // { path: '/controlPanel/account/security', name: '安全设置' } ] - } + }, + { path: '/controlPanel/container', name: '容器实例', icon: ConsoleSqlOutlined }, + { path: '/controlPanel/fileStore', name: '文件存储', icon: FolderOpenOutlined }, + { path: '/controlPanel/image', name: '镜像', icon: GlobalOutlined }, + { path: '/controlPanel/publicData', name: '公开数据', icon: LaptopOutlined }, + ] const selectedKeys = computed(() => [route.path]) diff --git a/src/utils/index.ts b/src/utils/index.ts index 03612ca..05b7a64 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,17 +1,19 @@ // src/utils/request.ts -import axios, { AxiosInstance, InternalAxiosRequestConfig } from 'axios'; - +import axios, { AxiosInstance, InternalAxiosRequestConfig } from "axios"; +import { message } from "ant-design-vue"; +import { useRouter, useRoute } from "vue-router"; // 从环境变量读取基础 URL -const BASE_URL = import.meta.env.VITE_API_BASIC -console.log('API Basic URL:',import.meta.env.VITE_API_BASIC); -console.log('All env:', import.meta.env); +const BASE_URL = import.meta.env.VITE_API_BASIC; +console.log("API Basic URL:", import.meta.env.VITE_API_BASIC); +console.log("All env:", import.meta.env); +const router = useRouter(); // 创建 axios 实例 const request: AxiosInstance = axios.create({ baseURL: BASE_URL, timeout: 10000, // 10 秒超时 withCredentials: false, // 跨域请求时发送 cookies headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", }, }); @@ -19,7 +21,7 @@ const request: AxiosInstance = axios.create({ request.interceptors.request.use( (config: InternalAxiosRequestConfig) => { // 例如:从 localStorage 获取 token - const token = localStorage.getItem('token'); + const token = localStorage.getItem("token"); if (token) { config.headers.Authorization = `Bearer ${token}`; } @@ -33,22 +35,31 @@ request.interceptors.request.use( // 响应拦截器(统一处理错误、code 等) request.interceptors.response.use( (response) => { - + console.log("response", response); // 假设后端返回格式为 { code: 200, data: ..., message: '' } const { code, data, message } = response.data; - console.log('Response Data:', response.data); + console.log("Response Data:", response.data); if (code === 1) { - return data; + return data??code; } else { // 可抛出业务错误 - return Promise.reject(new Error(message || '请求失败')); + return Promise.reject(new Error(message || "请求失败")); } }, (error) => { // 网络错误 or 超时等 - - return Promise.reject(error.response.data); + console.log(error); + const res = error.response; + if (res.status === 401) { + message.error("登录已过期,请重新登录"); + localStorage.clear(); + setTimeout(() => { + window.location.href = "/login"; + }, 3000); + } else { + return Promise.reject(error.response.data); + } } ); -export default request; \ No newline at end of file +export default request; diff --git a/src/views/admin/account/accountSet/index.vue b/src/views/admin/account/accountSet/index.vue index 23477a3..d626a80 100644 --- a/src/views/admin/account/accountSet/index.vue +++ b/src/views/admin/account/accountSet/index.vue @@ -16,13 +16,18 @@ -
账户17044054908
-
账户ID123456789123456789
+
账户{{ userInfo.phone }}
+
账户ID{{ userInfo.id }}
-
+
认证类型未实名认证
-
前往认证
+
前往认证 +
+
+ 认证类型{{ certificationInfo.certificationType + }} +
@@ -30,38 +35,30 @@
- 手机号{{ currentPhone }} + 手机号{{ userInfo.phone }}
-
修改
+
绑定微信未绑定微信
-
绑定
+
绑定
- 登录密码******** + 登录密码********
-
修改
+
修改
- +
@@ -77,7 +74,7 @@
验证手机号
- {{ maskedPhone }} + {{ userInfo.phone }}
@@ -85,19 +82,10 @@
验证码
- - + + {{ countdownText }}
@@ -112,16 +100,9 @@ - +
@@ -134,13 +115,8 @@
新手机号
- +
{{ phoneError }}
@@ -148,19 +124,10 @@
验证码
- - + + {{ newCountdownText }}
@@ -170,16 +137,9 @@ - +
@@ -192,26 +152,16 @@
原密码
- +
{{ oldPasswordError }}
新密码
- +
{{ newPasswordError }}
@@ -232,13 +182,8 @@
确认密码
- +
{{ confirmPasswordError }}
@@ -247,19 +192,20 @@ @@ -874,11 +820,11 @@ onBeforeMount(()=>{ span:first-child { width: 80px; } - + div[style*="color:#1677ff"] { cursor: pointer; transition: color 0.3s; - + &:hover { color: #0958d9; } @@ -1074,11 +1020,11 @@ onBeforeMount(()=>{ font-size: 12px; color: #8c8c8c; margin-bottom: 4px; - + &:last-child { margin-bottom: 0; } - + &.valid { color: #52c41a; } @@ -1099,7 +1045,7 @@ onBeforeMount(()=>{ flex-direction: column; gap: 8px; } - + .send-code-btn { width: 100%; } diff --git a/src/views/admin/account/cost/myMoney/index.vue b/src/views/admin/account/cost/myMoney/index.vue index f76264f..815863c 100644 --- a/src/views/admin/account/cost/myMoney/index.vue +++ b/src/views/admin/account/cost/myMoney/index.vue @@ -4,28 +4,25 @@ - -
-
可用余额
- 查看消费明细 -
- -
¥ {{ formatAmount(balance) }}
+ + +
¥ {{ formatAmount(userInfo.balance || 0) }}
充值
-
提现
+
提现
- +
- {{ formatComputingPoints(computingPoints) }} - + {{ '¥' + formatAmount(userInfo.computingPowerPoint || 0) }} +
去兑换 @@ -37,7 +34,7 @@
- {{ availableCoupons }} + {{ userInfo.voucherNum }}
@@ -51,44 +48,27 @@
-

账单明细

-
- 日期范围: - -
+

消费明细

- - +