From b7b8cab0a55ea0d0baa58cf579a6c071f12523f5 Mon Sep 17 00:00:00 2001 From: wangxiaowei <1121133807@qq.com> Date: Tue, 19 Aug 2025 17:21:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- env/.env | 6 ++--- src/api/types/login.ts | 50 +++++++++++++++++++++--------------------- src/http/alova.ts | 26 +++++++++++----------- src/pages.json | 8 +++++++ src/utils/index.ts | 12 +++++----- 5 files changed, 55 insertions(+), 47 deletions(-) diff --git a/env/.env b/env/.env index 399f808..7741db6 100644 --- a/env/.env +++ b/env/.env @@ -10,13 +10,13 @@ VITE_APP_PUBLIC_BASE=/ # 登录页面 VITE_LOGIN_URL = '/pages/login/index' # 第一个请求地址 -VITE_SERVER_BASEURL = 'https://ukw0y1.laf.run' +VITE_SERVER_BASEURL = 'https://mnp.zhuzhuda.cn' -VITE_UPLOAD_BASEURL = 'https://ukw0y1.laf.run/upload' +VITE_UPLOAD_BASEURL = 'https://mnp.zhuzhuda.cn/upload' # h5是否需要配置代理 VITE_APP_PROXY=false VITE_APP_PROXY_PREFIX = '/api' # 第二个请求地址 (目前alova中可以使用) -VITE_API_SECONDARY_URL = 'https://ukw0y1.laf.run' \ No newline at end of file +VITE_API_SECONDARY_URL = 'https://mnp.zhuzhuda.cn' \ No newline at end of file diff --git a/src/api/types/login.ts b/src/api/types/login.ts index d0638cf..560018f 100644 --- a/src/api/types/login.ts +++ b/src/api/types/login.ts @@ -2,56 +2,56 @@ * 用户信息 */ export interface IUserInfoVo { - id: number - username: string - avatar: string - token: string + id: number + username: string + avatar: string + token: string } /** * 登录返回的信息 */ export interface IUserLogin { - id: string - username: string - token: string + id: string + username: string + token: string } /** * 获取验证码 */ export interface ICaptcha { - captchaEnabled: boolean - uuid: string - image: string + captchaEnabled: boolean + uuid: string + image: string } /** * 上传成功的信息 */ export interface IUploadSuccessInfo { - fileId: number - originalName: string - fileName: string - storagePath: string - fileHash: string - fileType: string - fileBusinessType: string - fileSize: number + fileId: number + originalName: string + fileName: string + storagePath: string + fileHash: string + fileType: string + fileBusinessType: string + fileSize: number } /** * 更新用户信息 */ export interface IUpdateInfo { - id: number - name: string - sex: string + id: number + name: string + sex: string } /** * 更新用户信息 */ export interface IUpdatePassword { - id: number - oldPassword: string - newPassword: string - confirmPassword: string + id: number + oldPassword: string + newPassword: string + confirmPassword: string } diff --git a/src/http/alova.ts b/src/http/alova.ts index 360ba19..d64402b 100644 --- a/src/http/alova.ts +++ b/src/http/alova.ts @@ -41,7 +41,7 @@ const { onAuthRequired, onResponseRefreshToken } = createServerTokenAuthenticati * alova 请求实例 */ const alovaInstance = createAlova({ - baseURL: import.meta.env.VITE_APP_PROXY_PREFIX, + baseURL: import.meta.env.VITE_SERVER_BASEURL, ...AdapterUniapp(), timeout: 5000, statesHook: VueHook, @@ -88,21 +88,21 @@ const alovaInstance = createAlova({ } // 处理 HTTP 状态码错误 - if (statusCode !== 200) { - const errorMessage = ShowMessage(statusCode) || `HTTP请求错误[${statusCode}]` - console.error('errorMessage===>', errorMessage) - toast.error(errorMessage) - throw new Error(`${errorMessage}:${errMsg}`) - } + // if (statusCode !== 200) { + // const errorMessage = ShowMessage(statusCode) || `HTTP请求错误[${statusCode}]` + // console.error('errorMessage===>', errorMessage) + // toast.error(errorMessage) + // throw new Error(`${errorMessage}:${errMsg}`) + // } // 处理业务逻辑错误 const { code, message, data } = rawData as IResponse - if (code !== ResultEnum.Success) { - if (config.meta?.toast !== false) { - toast.warning(message) - } - throw new Error(`请求错误[${code}]:${message}`) - } + // if (code !== ResultEnum.Success) { + // if (config.meta?.toast !== false) { + // toast.warning(message) + // } + // throw new Error(`请求错误[${code}]:${message}`) + // } // 处理成功响应,返回业务数据 return data }), diff --git a/src/pages.json b/src/pages.json index 29a5ac4..03a3352 100644 --- a/src/pages.json +++ b/src/pages.json @@ -133,6 +133,14 @@ "style": { "navigationStyle": "custom" } + }, + { + "path": "store-recharge/store-recharge", + "type": "page", + "layout": "tabbar", + "style": { + "navigationStyle": "custom" + } } ] } diff --git a/src/utils/index.ts b/src/utils/index.ts index 5712ca1..540ffd0 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -130,9 +130,9 @@ export function getEnvBaseUrl() { let baseUrl = import.meta.env.VITE_SERVER_BASEURL // # 有些同学可能需要在微信小程序里面根据 develop、trial、release 分别设置上传地址,参考代码如下。 - const VITE_SERVER_BASEURL__WEIXIN_DEVELOP = 'https://ukw0y1.laf.run' - const VITE_SERVER_BASEURL__WEIXIN_TRIAL = 'https://ukw0y1.laf.run' - const VITE_SERVER_BASEURL__WEIXIN_RELEASE = 'https://ukw0y1.laf.run' + const VITE_SERVER_BASEURL__WEIXIN_DEVELOP = '' + const VITE_SERVER_BASEURL__WEIXIN_TRIAL = '' + const VITE_SERVER_BASEURL__WEIXIN_RELEASE = '' // 微信小程序端环境区分 if (isMpWeixin) { @@ -163,9 +163,9 @@ export function getEnvBaseUploadUrl() { // 请求基准地址 let baseUploadUrl = import.meta.env.VITE_UPLOAD_BASEURL - const VITE_UPLOAD_BASEURL__WEIXIN_DEVELOP = 'https://ukw0y1.laf.run/upload' - const VITE_UPLOAD_BASEURL__WEIXIN_TRIAL = 'https://ukw0y1.laf.run/upload' - const VITE_UPLOAD_BASEURL__WEIXIN_RELEASE = 'https://ukw0y1.laf.run/upload' + const VITE_UPLOAD_BASEURL__WEIXIN_DEVELOP = '' + const VITE_UPLOAD_BASEURL__WEIXIN_TRIAL = '' + const VITE_UPLOAD_BASEURL__WEIXIN_RELEASE = '' // 微信小程序端环境区分 if (isMpWeixin) {