From b20db35afcb8f0ca707a6a7b0511f08f6c43cb55 Mon Sep 17 00:00:00 2001 From: lzx_win <2602107437@qq.com> Date: Mon, 22 Sep 2025 17:08:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98=E5=B9=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0API=E5=9F=BA=E7=A1=80URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除用户信息的默认值,改为使用可选链和空值合并处理 - 添加v-if条件渲染防止未定义属性导致的错误 - 将API基础URL从本地开发环境切换到生产环境 --- src/api/index.js | 6 +++--- src/views/book/index.vue | 28 ++++++++++++++++++---------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 5e65c51..adcd7db 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,9 +1,9 @@ import axios from 'axios'; const api = axios.create({ - baseURL: 'http://127.0.0.1:8002/novel-admin', - // baseURL: 'https://prod-api.budingxiaoshuo.com/novel-admin', - // baseURL: import.meta.env.VITE_API_BASE_URL || 'http://127.0.0.1', + // baseURL: 'http://127.0.0.1:8002/novel-admin', + baseURL: 'https://prod-api.budingxiaoshuo.com/novel-admin', + // baseURL: import.meta.env.VITE_API_BASE_URL || 'http://127.0.0.1', timeout: 50000, headers: { 'Content-Type' : 'application/x-www-form-urlencoded' diff --git a/src/views/book/index.vue b/src/views/book/index.vue index 93970c2..ef56a73 100644 --- a/src/views/book/index.vue +++ b/src/views/book/index.vue @@ -32,15 +32,15 @@ 我的等级