From cd93d6d06d39f7ebf332ab34bb4058ca865c52de Mon Sep 17 00:00:00 2001 From: "34701892@qq.com" <34701892@qq.com> Date: Mon, 22 Dec 2025 11:04:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0API=E5=9F=BA=E7=A1=80U?= =?UTF-8?q?RL=E5=B9=B6=E6=B7=BB=E5=8A=A0=E5=88=86=E4=BA=AB=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改vite配置添加base路径 更新开发环境和生产环境的API基础URL 在新闻详情页添加分享时间验证逻辑,超过24小时则刷新页面 --- .env.development | 4 ++-- src/config/index.ts | 4 ++-- src/pages/detail/indexNewsInfo.vue | 11 +++++++++++ vite.config.ts | 7 ++++--- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.env.development b/.env.development index c0a4311..c0ec8aa 100644 --- a/.env.development +++ b/.env.development @@ -5,7 +5,7 @@ ENV = development # VITE_API_URL = http://123.60.153.169:8040/apih5 # VITE_API_URL = https://4155gf93ll13.vicp.fun/apih5 # VITE_API_URL = http://123.60.79.143:8041/apih5 -VITE_API_URL = http://192.168.3.38:8040/apih5 -# VITE_API_URL = https://cankao.cs.com.cn/apih5 +# VITE_API_URL = http://192.168.3.38:8040/apih5 +VITE_API_URL = https://cankao.cs.com.cn/apih5 VITE_API_DATAV_URL = https://cankao.cs.com.cn/zzck_datav \ No newline at end of file diff --git a/src/config/index.ts b/src/config/index.ts index 81f1ed6..9abcbdb 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,7 +1,7 @@ // const baseUrl = "http://192.168.31.25:8060/api"; // export const baseUrl = "http://127.0.0.1:8040/apih5"; -export const baseUrl = "http://123.60.153.169:8042/apih5"; -// export const baseUrl = "https://cankao.cs.com.cn/mini"; +// export const baseUrl = "http://123.60.153.169:8042/apih5"; +export const baseUrl = "https://cankao.cs.com.cn/mini"; export const baseUrlDataV = "https://cankao.cs.com.cn/zzck_datav"; // export const baseUrlDataV = "http://123.60.153.169:9995/zzck_datav"; diff --git a/src/pages/detail/indexNewsInfo.vue b/src/pages/detail/indexNewsInfo.vue index fdf5890..be573cf 100644 --- a/src/pages/detail/indexNewsInfo.vue +++ b/src/pages/detail/indexNewsInfo.vue @@ -125,6 +125,17 @@ onLoad(async (option: any) => { wxShare(); } } + + // 打开页面时链接中带有time字段,表示上次分享的时间 + let shareTime = option?.time || 0; + // 现在的时间对比上次的分享时间,如果超过24小时,则刷新推荐栏目 + if (Date.now() - shareTime > 24 * 60 * 60 * 1000) { + uni.removeStorageSync("token"); + // 刷新本页面 + uni.reLaunch({ + url: curPages[curPages.length - 1].route, + }); + } }); const newList = async (columnId: number) => { diff --git a/vite.config.ts b/vite.config.ts index ea51c4c..be1b4a0 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,15 +4,16 @@ import { resolve } from "path"; // https://vitejs.dev/config/ export default defineConfig({ + base: "/jnh/", plugins: [uni()], css: { preprocessorOptions: { scss: { additionalData: ` @import "@/assets/style/variable.scss"; - ` - } - } + `, + }, + }, }, server: {