diff --git a/App.vue b/App.vue
index 9ee83ae..d89da34 100644
--- a/App.vue
+++ b/App.vue
@@ -11,10 +11,7 @@
// 注意:语言初始化已移至 main.js,确保每次 reLaunch 都能正确加载新语言
},
onShow: async function() {
- console.log('========================================')
- console.log('=== App onShow 被调用 ===')
- console.log('时间戳:', new Date().toLocaleTimeString())
-
+
// 检查启动路径,如果设置了启动路径则跳转
try {
const launchPath = uni.getStorageSync('launchPath')
@@ -81,8 +78,6 @@
} catch (e) {
console.error('App onShow - 语言检查失败:', e)
}
-
- console.log('========================================')
},
onHide: function() {
console.log('App Hide')
diff --git a/config/http.js b/config/http.js
index 851d261..5148627 100644
--- a/config/http.js
+++ b/config/http.js
@@ -30,14 +30,16 @@ const request = (option) => {
mask: true
})
}
-
+
uni.request({
url: URL + option.url,
method: option.method,
data: option.data,
header: {
- "Content-Type": option.headers && option.headers["Content-Type"] ? option.headers["Content-Type"] : (option.method && option.method.toUpperCase() === 'POST' ? 'application/json' : 'application/x-www-form-urlencoded'),
- ...option.headers,
+ "Content-Type": option.headers && option.headers["Content-Type"] ? option.headers[
+ "Content-Type"] : (option.method && option.method.toUpperCase() === 'POST' ?
+ 'application/json' : 'application/x-www-form-urlencoded'),
+ ...option.headers,
'appid': platformAppid,
'Authorization': "Bearer " + uni.getStorageSync('token'),
'Clientid': uni.getStorageSync('client_id'),
@@ -45,21 +47,23 @@ const request = (option) => {
},
success(res) {
-
+
// 检查响应状态码
if (res.statusCode !== 200) {
console.error(`HTTP状态码错误: ${res.statusCode}`, res.data)
-
+
// 为了适应某些服务器的异常响应,我们仍然返回数据
if (res.data) {
resolve(res.data)
return
}
-
- reject({msg: `请求失败,状态码:${res.statusCode}`})
+
+ reject({
+ msg: `请求失败,状态码:${res.statusCode}`
+ })
return
}
-
+
// 未登录或 token 失效处理(支持多种后端返回)
if (res.statusCode === 401 || res.data?.code === 401 || res.data?.code === 40101) {
try {
@@ -68,22 +72,32 @@ const request = (option) => {
// 计算重定向地址
const pages = getCurrentPages()
const current = pages && pages.length ? pages[pages.length - 1] : null
- const route = current && current.route ? ('/' + current.route) : '/pages/index/index'
- const query = current && current.options ? Object.keys(current.options).map(k => `${k}=${encodeURIComponent(current.options[k])}`).join('&') : ''
+ const route = current && current.route ? ('/' + current.route) :
+ '/pages/index/index'
+ const query = current && current.options ? Object.keys(current.options).map(
+ k => `${k}=${encodeURIComponent(current.options[k])}`).join('&') :
+ ''
const redirect = encodeURIComponent(query ? `${route}?${query}` : route)
+ // console.log(redirect, "===========");
// 跳转到登录页
- uni.reLaunch({ url: `/subPackages/user/login/index?redirect=${redirect}` })
- } catch (e) {}
+ uni.reLaunch({
+ url: "/subPackages/user/login/index"
+ })
+ } catch (e) {
+ uni.reLaunch({
+ url: "/subPackages/user/login/index"
+ })
+ }
}
// 检查业务状态码
if (res.data && res.data.code !== 200) {
console.warn(`业务状态码错误: ${res.data.code}`, res.data)
-
+
// 判断是否需要忽略数据为空的错误
- if (option.ignoreEmptyError &&
- (res.data.code === 500 && res.data.msg &&
- (res.data.msg.includes('未找到') || res.data.msg.includes('不存在')))) {
+ if (option.ignoreEmptyError &&
+ (res.data.code === 500 && res.data.msg &&
+ (res.data.msg.includes('未找到') || res.data.msg.includes('不存在')))) {
// 对于指定需要忽略的错误,返回一个标准的"成功但数据为空"的响应
resolve({
code: 200,
@@ -92,12 +106,12 @@ const request = (option) => {
})
return
}
-
+
// 仍然返回数据,由业务逻辑处理
resolve(res.data)
return
}
-
+
resolve(res.data)
},
fail(err) {
diff --git a/main.js b/main.js
index 24c2432..be2748e 100644
--- a/main.js
+++ b/main.js
@@ -71,11 +71,7 @@ function getI18nInstance() {
// 每次都重新读取当前语言
const currentLang = getSavedLanguage()
- console.log('=== getI18nInstance 被调用 ===')
- console.log('缓存中的语言:', currentLang)
- console.log('当前 i18n 实例存在?', !!i18nInstance)
- console.log('当前 i18n.global.locale:', i18nInstance?.global?.locale)
-
+
// 检查是否需要更新语言
if (i18nInstance && i18nInstance.global.locale !== currentLang) {
console.log('=== 检测到语言变化,强制更新 ===')
@@ -84,19 +80,12 @@ function getI18nInstance() {
// 直接更新 locale(这应该会触发所有组件重新渲染)
i18nInstance.global.locale = currentLang
-
- console.log('i18n.global.locale 已更新为:', i18nInstance.global.locale)
- console.log('测试翻译 (common.loading):', i18nInstance.global.t('common.loading'))
- console.log('测试翻译 (home.title):', i18nInstance.global.t('home.title'))
- console.log('===================================')
-
+
return i18nInstance
}
// 首次创建实例
if (!i18nInstance) {
- console.log('=== 首次创建 i18n 实例 ===')
-
i18nInstance = createI18n({
legacy: true, // 使用 Legacy API 模式,支持全局 $t
locale: currentLang,
@@ -110,21 +99,13 @@ function getI18nInstance() {
silentFallbackWarn: true
})
- console.log('i18n 实例已创建,语言:', currentLang)
- console.log('测试翻译 (common.loading):', i18nInstance.global.t('common.loading'))
- console.log('测试翻译 (home.title):', i18nInstance.global.t('home.title'))
- console.log('============================')
}
return i18nInstance
}
export function createApp() {
- console.log('========================================')
- console.log('=== createApp 被调用 ===')
- console.log('时间戳:', new Date().toLocaleTimeString())
- console.log('========================================')
-
+
const app = createSSRApp(App)
// 使用 uView
@@ -153,13 +134,6 @@ export function createApp() {
}
}
- console.log('=== Vue 3 应用创建完成 ===')
- console.log('最终 locale:', i18n.global.locale)
- console.log('app.config.globalProperties.$t 存在?', !!app.config.globalProperties.$t)
- console.log('app.config.globalProperties.$i18n 存在?', !!app.config.globalProperties.$i18n)
- console.log('测试 $t 调用:', i18n.global.t('common.loading'))
- console.log('===========================')
-
return {
app
}
diff --git a/manifest.json b/manifest.json
index 41c0899..8f6086c 100644
--- a/manifest.json
+++ b/manifest.json
@@ -93,9 +93,10 @@
}
},
"router" : {
- "mode" : "hash",
- "base" : "./"
- }
+ "mode" : "history",
+ "base" : "/"
+ },
+ "title" : "FDZPower"
},
"uniStatistics" : {
"enable" : false
diff --git a/pages.json b/pages.json
index add2dee..b460bcb 100644
--- a/pages.json
+++ b/pages.json
@@ -61,6 +61,12 @@
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
+ },
+ {
+ "path": "toProgram",
+ "style": {
+ "navigationStyle": "custom"
+ }
}
],
"subPackages": [
diff --git a/pages/device/detail.vue b/pages/device/detail.vue
index 2705670..b571fc9 100644
--- a/pages/device/detail.vue
+++ b/pages/device/detail.vue
@@ -181,7 +181,6 @@
// 生命周期 onLoad 钩子
onLoad(async (options) => {
- console.log('options', options)
// 普通链接二维码进入时,参数通常在 options.q(且为编码后的完整 URL)
if (!options.deviceNo && options.q) {
@@ -232,11 +231,6 @@
isAlipayMiniProgram.value = false
isH5.value = true
// #endif
- console.log('当前运行环境:', {
- isWechatMiniProgram: isWechatMiniProgram.value,
- isAlipayMiniProgram: isAlipayMiniProgram.value,
- isH5: isH5.value
- })
await checkUserPhone()
await fetchDeviceInfo()
})
@@ -366,7 +360,7 @@
const fetchDeviceInfo = async () => {
try {
loading.value = true
- console.log(deviceId.value);
+ // console.log(deviceId.value);
const res = await getDeviceInfo(deviceId.value)
if (res.code == 200) {
deviceInfo.value = res.data.device || {}
@@ -404,9 +398,10 @@
}
}
}else{
- uni.reLaunch({
- url:'/pages/index/index'
- })
+
+ // uni.reLaunch({
+ // url:'/pages/index/index'
+ // })
}
}catch(error){
console.error('获取设备信息失败:', error)
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 727abd1..9ef4e73 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -21,18 +21,18 @@
-
-
@@ -125,13 +125,8 @@
-