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 @@
-
-
-
-
-
-
-
- {{ stats.pending }}
- {{ t('index.pending') }}
-
-
- {{ stats.ordered }}
- {{ t('index.ordered') }}
-
-
- {{ stats.arrived }}
- {{ t('index.arrived') }}
-
-
- {{ stats.received }}
- {{ t('index.received') }}
-
-
-
-
-
- {{ t('index.quickActions') }}
-
-
- 📋
- {{ t('index.allOrders') }}
- →
-
-
- ➕
- {{ t('index.addOrder') }}
- →
-
-
- 📅
- {{ t('index.schedule') }}
- →
-
-
-
-
-
-
-
- 🌐
-
- {{ t('index.language') }}
- {{ locale === 'zh' ? '中文' : 'English' }}
-
- →
-
-
-
-
-
-
-
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 @@
-
+
-
+
中文
- |
+ |
EN
-
-
- OPS
- {{ t('login.title') }}
+
+
+ OPS
+ {{ t('login.title') }}
-
-
- {{ t('login.username') }}
+
+
+ {{ t('login.username') }}
-
- {{ t('login.password') }}
+
+ {{ t('login.password') }}
-
+
{{ showPassword ? '👁️' : '👁️🗨️' }}
-
+
-
-
- {{ errorMsg }}
+
+ {{ errorMsg }}
-
-
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 @@
-
+
-
+
中文
- |
+ |
EN
-
- ← {{ t('common.back') }}
+
+ ← {{ t('common.back') }}
-
- {{ t('register.title') }}
+
+
+ {{ t('register.title') }}
-
- {{ t('register.username') }}
+
+ {{ t('register.username') }}
-
- {{ t('register.email') }}
+
+ {{ t('register.email') }}
-
- {{ t('register.password') }}
+
+ {{ t('register.password') }}
-
- {{ t('register.confirmPassword') }}
+
+ {{ t('register.confirmPassword') }}
-
- {{ showPassword ? '👁️ ' : '👁️🗨️ ' }}{{ showPassword ? t('register.showPassword') : t('register.hidePassword') }}
+
+ {{ showPassword ? '👁️ ' : '👁️🗨️ ' }}{{ showPassword ? t('register.showPassword') : t('register.hidePassword') }}
-
- {{ errorMsg }}
+
+ {{ errorMsg }}
@@ -94,7 +100,7 @@ import { setLocale, getCurrentLocale } from '../../locales/index.js'
const { t, locale } = useI18n()
-// 响应式数据
+const statusBarHeight = ref(20)
const form = reactive({
username: '',
email: '',
@@ -106,18 +112,15 @@ const showPassword = ref(false)
const loading = ref(false)
const errorMsg = ref('')
-// 切换语言
const switchLang = (lang) => {
setLocale(lang)
locale.value = lang
}
-// 返回上一页
const goBack = () => {
uni.navigateBack()
}
-// 表单验证
const validate = () => {
if (!form.username.trim()) {
errorMsg.value = t('register.usernameRequired')
@@ -127,7 +130,6 @@ const validate = () => {
errorMsg.value = t('register.emailRequired')
return false
}
- // 简单邮箱验证
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
if (!emailRegex.test(form.email)) {
errorMsg.value = t('register.emailInvalid')
@@ -149,7 +151,6 @@ const validate = () => {
return true
}
-// 注册处理
const handleRegister = () => {
if (!validate()) return
@@ -197,8 +198,10 @@ const handleRegister = () => {
})
}
-// 生命周期
onMounted(() => {
+ const systemInfo = uni.getSystemInfoSync()
+ statusBarHeight.value = systemInfo.statusBarHeight || 20
+
locale.value = getCurrentLocale()
uni.$on('localeChanged', (lang) => {
@@ -211,133 +214,8 @@ onUnmounted(() => {
})
-
diff --git a/frontend/ops_uniapp/pages/settings/apiConfig.vue b/frontend/ops_uniapp/pages/settings/apiConfig.vue
index 1db8b9d..464dc1f 100644
--- a/frontend/ops_uniapp/pages/settings/apiConfig.vue
+++ b/frontend/ops_uniapp/pages/settings/apiConfig.vue
@@ -1,34 +1,37 @@
-
+
-