diff --git a/.env b/.env
index f47558f..81a8be5 100644
--- a/.env
+++ b/.env
@@ -1,6 +1,6 @@
# API 基础地址,不设置时默认 https://api.xtrader.vip
# 连接测试服务器 192.168.3.21:8888 时复制本文件为 .env 或 .env.local 并取消下一行注释:
-# VITE_API_BASE_URL=http://192.168.3.14:8888
+VITE_API_BASE_URL=/api
# VITE_USE_MOCK_DATA=false # 全部关闭 mock
# SSH 部署(npm run deploy),可选覆盖
diff --git a/.env.production b/.env.production
index cb04907..1c06d6b 100644
--- a/.env.production
+++ b/.env.production
@@ -1,2 +1,2 @@
# 生产环境 API 地址(npm run build / npm run deploy 时自动使用)
-VITE_API_BASE_URL=https://api.xtrader.vip
+VITE_API_BASE_URL=/api
diff --git a/index.html b/index.html
index 64a5f64..012708b 100644
--- a/index.html
+++ b/index.html
@@ -4,7 +4,7 @@
-
TestMarket
+ Alpha Market
diff --git a/scripts/deploy.mjs b/scripts/deploy.mjs
index 99484eb..812b79d 100644
--- a/scripts/deploy.mjs
+++ b/scripts/deploy.mjs
@@ -2,7 +2,7 @@
/**
* 将项目打包并部署到远程服务器
* 使用方式:npm run deploy
- * 通过 SSH rsync 部署到 root@38.246.250.238:/opt/1panel/www/sites/pm.xtrader.vip/index
+ * 通过 SSH rsync 部署到 root@38.246.250.238:/opt/1panel/www/sites/pm.aaa.com/index
*
* 环境变量(可选):DEPLOY_HOST、DEPLOY_USER、DEPLOY_PATH
* 依赖:rsync(系统自带)、ssh 免密或密钥
@@ -18,13 +18,13 @@ const distDir = join(projectRoot, 'dist')
const config = {
host: process.env.DEPLOY_HOST || '38.246.250.238',
user: process.env.DEPLOY_USER || 'root',
- path: process.env.DEPLOY_PATH || '/opt/1panel/www/sites/pm.xtrader.vip/index',
+ path: process.env.DEPLOY_PATH || '/opt/1panel/www/sites/pm.aaa.vip/index',
}
const target = `${config.user}@${config.host}:${config.path}`
function build() {
- const apiUrl = process.env.VITE_API_BASE_URL || 'https://api.xtrader.vip'
+ const apiUrl = process.env.VITE_API_BASE_URL || 'https://api.aaa.vip'
console.log(`📦 正在打包项目(.env.production API: ${apiUrl})...`)
execSync('npm run build', {
cwd: projectRoot,
diff --git a/src/App.vue b/src/App.vue
index ac2ecdd..50e1d4d 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -87,7 +87,7 @@ watch(
>
mdi-arrow-left
- TestMarket
+ Alpha Market
(res: Response): Promise {
return res.json() as Promise
}
-/** 请求基础 URL,默认 https://api.xtrader.vip,可通过环境变量 VITE_API_BASE_URL 覆盖 */
+/** 请求基础 URL,默认 https://api.aaa.com,可通过环境变量 VITE_API_BASE_URL 覆盖 */
export const BASE_URL =
(import.meta as { env?: { VITE_API_BASE_URL?: string } }).env?.VITE_API_BASE_URL ??
- 'https://api.xtrader.vip'
+ 'https://api.aaa.com'
const FALLBACK_BASE =
- typeof window !== 'undefined' ? window.location.origin : 'https://api.xtrader.vip'
+ typeof window !== 'undefined' ? window.location.origin : 'https://api.aaa.com'
+
+/** 生成完整 URL,支持相对路径的 BASE_URL */
+function buildFullUrl(path: string): URL {
+ let base = BASE_URL || FALLBACK_BASE
+ if (!/^https?:\/\//i.test(base)) {
+ const origin = typeof window !== 'undefined' ? window.location.origin : 'http://localhost'
+ base = `${origin}${base.startsWith('/') ? '' : '/'}${base}`
+ }
+ const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base
+ const cleanPath = path.startsWith('/') ? path : `/${path}`
+ return new URL(`${cleanBase}${cleanPath}`)
+}
/** 生成 WebSocket URL,与 REST API 同源 */
function getWsUrl(path: string): string {
- const base = BASE_URL || FALLBACK_BASE
- const url = new URL(base)
+ const url = buildFullUrl(path)
const protocol = url.protocol === 'https:' ? 'wss:' : 'ws:'
- return `${protocol}//${url.host}${path.startsWith('/') ? path : `/${path}`}`
+ return `${protocol}//${url.host}${url.pathname}${url.search}`
}
/** CLOB WebSocket URL */
@@ -91,7 +102,7 @@ export async function get(
params?: Record,
config?: RequestConfig,
): Promise {
- const url = new URL(path, BASE_URL || window.location.origin)
+ const url = buildFullUrl(path)
if (params) {
Object.entries(params).forEach(([key, value]) => {
if (value === undefined) return
@@ -119,7 +130,7 @@ export async function post(
body?: unknown,
config?: RequestConfig,
): Promise {
- const url = new URL(path, BASE_URL || window.location.origin)
+ const url = buildFullUrl(path)
const headers: Record = {
'Content-Type': 'application/json',
'Accept-Language': i18n.global.locale.value as string,
@@ -141,7 +152,7 @@ export async function uploadFile(
file: File,
config?: RequestConfig,
): Promise {
- const url = new URL(path, BASE_URL || window.location.origin)
+ const url = buildFullUrl(path)
const form = new FormData()
form.append('file', file)
const headers: Record = {
@@ -165,7 +176,7 @@ export async function put(
body?: unknown,
config?: RequestConfig,
): Promise {
- const url = new URL(path, BASE_URL || window.location.origin)
+ const url = buildFullUrl(path)
const headers: Record = {
'Content-Type': 'application/json',
'Accept-Language': i18n.global.locale.value as string,
@@ -187,7 +198,7 @@ export async function httpDelete(
body?: unknown,
config?: RequestConfig,
): Promise {
- const url = new URL(path, BASE_URL || window.location.origin)
+ const url = buildFullUrl(path)
const headers: Record = {
'Content-Type': 'application/json',
'Accept-Language': i18n.global.locale.value as string,
diff --git a/src/locales/en.json b/src/locales/en.json
index 7e57796..fd1d751 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -149,7 +149,7 @@
"walletNotInstalled": "Ethereum wallet is not installed. Please install MetaMask, TokenPocket or another Ethereum wallet to continue.",
"invalidAddress": "Invalid wallet address format. Please check your wallet connection.",
"connectFailed": "Failed to connect with wallet. Please check your wallet and try again.",
- "siweStatement": "Sign in to TestMarket"
+ "siweStatement": "Sign in to Alpha Market"
},
"apiKey": {
"title": "API Key Management",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index 299aaab..89cf05b 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -149,7 +149,7 @@
"walletNotInstalled": "イーサリアムウォレットがインストールされていません。MetaMask、TokenPocket などのウォレットをインストールしてください。",
"invalidAddress": "ウォレットアドレスの形式が無効です。接続を確認してください。",
"connectFailed": "ウォレットの接続に失敗しました。ウォレットを確認して再試行してください。",
- "siweStatement": "TestMarket にサインイン"
+ "siweStatement": "Alpha Market にサインイン"
},
"apiKey": {
"title": "API Key 管理",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index a0a4baf..b91c9bb 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -149,7 +149,7 @@
"walletNotInstalled": "이더리움 지갑이 설치되어 있지 않습니다. MetaMask, TokenPocket 등 지갑을 설치해 주세요.",
"invalidAddress": "지갑 주소 형식이 올바르지 않습니다. 지갑 연결을 확인해 주세요.",
"connectFailed": "지갑 연결에 실패했습니다. 지갑을 확인하고 다시 시도해 주세요.",
- "siweStatement": "TestMarket 로그인"
+ "siweStatement": "Alpha Market 로그인"
},
"apiKey": {
"title": "API Key 관리",
diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json
index ea14ff7..eb76bf5 100644
--- a/src/locales/zh-CN.json
+++ b/src/locales/zh-CN.json
@@ -149,7 +149,7 @@
"walletNotInstalled": "未检测到以太坊钱包。请安装 MetaMask、TokenPocket 或其他以太坊钱包后重试。",
"invalidAddress": "钱包地址格式无效,请检查钱包连接。",
"connectFailed": "连接钱包失败,请检查钱包后重试。",
- "siweStatement": "登录 TestMarket"
+ "siweStatement": "登录 Alpha Market"
},
"apiKey": {
"title": "API Key 管理",
diff --git a/src/locales/zh-TW.json b/src/locales/zh-TW.json
index 55d4ef7..cbc469b 100644
--- a/src/locales/zh-TW.json
+++ b/src/locales/zh-TW.json
@@ -149,7 +149,7 @@
"walletNotInstalled": "未偵測到以太坊錢包。請安裝 MetaMask、TokenPocket 或其他以太坊錢包後重試。",
"invalidAddress": "錢包地址格式無效,請檢查錢包連接。",
"connectFailed": "連接錢包失敗,請檢查錢包後重試。",
- "siweStatement": "登入 TestMarket"
+ "siweStatement": "登入 Alpha Market"
},
"apiKey": {
"title": "API Key 管理",
diff --git a/src/views/Login.vue b/src/views/Login.vue
index db01324..3f69c47 100644
--- a/src/views/Login.vue
+++ b/src/views/Login.vue
@@ -85,7 +85,7 @@ const connectWithWallet = async () => {
scheme,
domain,
address: signer.address,
- statement: 'Sign in to TestMarket',
+ statement: 'Sign in to Alpha Market',
uri: origin,
version: '1',
chainId: chainId,
diff --git a/src/views/Profile.vue b/src/views/Profile.vue
index e9b67d9..a96b794 100644
--- a/src/views/Profile.vue
+++ b/src/views/Profile.vue
@@ -30,13 +30,13 @@
{{ t('profile.edit') }}
-