diff --git a/frontend/ops_uniapp/.workbuddy/expert-history.json b/frontend/ops_uniapp/.workbuddy/expert-history.json index 94599c8..85bcbba 100644 --- a/frontend/ops_uniapp/.workbuddy/expert-history.json +++ b/frontend/ops_uniapp/.workbuddy/expert-history.json @@ -13,5 +13,5 @@ } ] }, - "lastUpdated": 1776168445262 + "lastUpdated": 1776172462417 } \ No newline at end of file diff --git a/frontend/ops_uniapp/App.vue b/frontend/ops_uniapp/App.vue index e7339c3..a617340 100644 --- a/frontend/ops_uniapp/App.vue +++ b/frontend/ops_uniapp/App.vue @@ -4,14 +4,21 @@ export default { console.log('App Launch') // 初始化全局 API 地址 - const DEFAULT_API_URL = 'http://192.168.13.105/api/' - const apiUrl = uni.getStorageSync('apiUrl') || DEFAULT_API_URL + const apiUrl = uni.getStorageSync('apiUrl') if (!getApp().globalData) { getApp().globalData = {} } - getApp().globalData.BASE_URL = apiUrl - this.checkLoginStatus() + // H5 端使用相对路径走代理,其他端使用完整 URL + // #ifdef H5 + getApp().globalData.BASE_URL = '/api/' + // #endif + // #ifndef H5 + getApp().globalData.BASE_URL = apiUrl + // #endif + + // 暂时禁用自动跳转登录 + // this.checkLoginStatus() }, onShow: function() { console.log('App Show') @@ -21,10 +28,8 @@ export default { }, methods: { checkLoginStatus() { - // 检查登录状态 const sessionCookie = uni.getStorageSync('sessionCookie') if (!sessionCookie) { - // 未登录,跳转到登录页 uni.reLaunch({ url: '/pages/login/login' }) @@ -35,9 +40,129 @@ export default { diff --git a/frontend/ops_uniapp/locales/en.js b/frontend/ops_uniapp/locales/en.js index b30284c..ce7d82b 100644 --- a/frontend/ops_uniapp/locales/en.js +++ b/frontend/ops_uniapp/locales/en.js @@ -20,6 +20,8 @@ export default { ordered: 'Ordered', arrived: 'Arrived', received: 'Received', + pleaseLogin: 'Please login first', + login: 'Login', }, // 登录页 login: { diff --git a/frontend/ops_uniapp/locales/zh.js b/frontend/ops_uniapp/locales/zh.js index 3a7bd3d..2234012 100644 --- a/frontend/ops_uniapp/locales/zh.js +++ b/frontend/ops_uniapp/locales/zh.js @@ -20,6 +20,8 @@ export default { ordered: '已下单', arrived: '已到达', received: '已收件', + pleaseLogin: '请先登录', + login: '登 录', }, // 登录页 login: { diff --git a/frontend/ops_uniapp/manifest.json b/frontend/ops_uniapp/manifest.json index 83f1292..2eb784d 100644 --- a/frontend/ops_uniapp/manifest.json +++ b/frontend/ops_uniapp/manifest.json @@ -5,6 +5,23 @@ "versionName" : "1.0.0", "versionCode" : "100", "transformPx" : false, + /* H5特有相关 */ + "h5": { + "devServer": { + "https": false, + "port": 5173, + "proxy": { + "/api": { + "target": "http://192.168.13.105", + "changeOrigin": true, + "secure": false + } + } + }, + "router": { + "mode": "hash" + } + }, /* 5+App特有相关 */ "app-plus" : { "usingComponents" : true, @@ -113,4 +130,5 @@ }, "vueVersion" : "3", "locale" : "auto" + } diff --git a/frontend/ops_uniapp/pages/index/index.vue b/frontend/ops_uniapp/pages/index/index.vue index 83c0bf4..c0c7cb3 100644 --- a/frontend/ops_uniapp/pages/index/index.vue +++ b/frontend/ops_uniapp/pages/index/index.vue @@ -1,82 +1,123 @@ - diff --git a/frontend/ops_uniapp/pages/login/login.vue b/frontend/ops_uniapp/pages/login/login.vue index ca33ce7..9531854 100644 --- a/frontend/ops_uniapp/pages/login/login.vue +++ b/frontend/ops_uniapp/pages/login/login.vue @@ -1,67 +1,70 @@ - diff --git a/frontend/ops_uniapp/pages/register/register.vue b/frontend/ops_uniapp/pages/register/register.vue index ffdf962..a3355f0 100644 --- a/frontend/ops_uniapp/pages/register/register.vue +++ b/frontend/ops_uniapp/pages/register/register.vue @@ -1,78 +1,84 @@