feat: 修复 H5 底部导航覆盖 + 更新项目进度文档
## H5 底部导航修复 (Bug #10) - 精简 App.vue,移除重复 tabbar,仅保留全局样式 - uni-page 设置 height: calc(100% - 50px) + overflow-y: auto - 内容区域精确停在底部导航上方,独立滚动不再叠加 - 恢复 custom-tab-bar 组件 ## 项目进度文档 - PROGRESS.md 更新至 10 个 Bug 修复 - 新增 H5 底部导航修复记录 - 新增历史变更条目
This commit is contained in:
+43
-10
@@ -1,4 +1,5 @@
|
||||
import { ref } from 'vue'
|
||||
import { pushApi } from './api.js'
|
||||
|
||||
let pushClientId = ''
|
||||
let isInitialized = ref(false)
|
||||
@@ -24,9 +25,14 @@ export const pushService = {
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifndef APP-PLUS
|
||||
console.log('非App环境下跳过推送初始化')
|
||||
resolve(false)
|
||||
// #ifdef MP-WEIXIN
|
||||
this.registerWechatDevice()
|
||||
resolve(true)
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
this.registerWebDevice()
|
||||
resolve(true)
|
||||
// #endif
|
||||
})
|
||||
},
|
||||
@@ -50,16 +56,14 @@ export const pushService = {
|
||||
/**
|
||||
* 注册设备到服务器
|
||||
*/
|
||||
async registerDevice(clientId) {
|
||||
async registerDevice(clientId) {
|
||||
if (!clientId) return
|
||||
|
||||
try {
|
||||
const { request } = require('./api.js')
|
||||
await request('/push/register', 'POST', {
|
||||
client_id: clientId,
|
||||
platform: uni.getSystemInfoSync().platform,
|
||||
device_info: uni.getSystemInfoSync(),
|
||||
})
|
||||
const platform = uni.getSystemInfoSync().platform || 'web'
|
||||
const deviceInfo = uni.getSystemInfoSync()
|
||||
|
||||
await pushApi.register(clientId, platform, '', deviceInfo)
|
||||
console.log('Device registered successfully')
|
||||
} catch (err) {
|
||||
console.error('Register device failed:', err)
|
||||
@@ -143,6 +147,35 @@ export const pushService = {
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 微信小程序设备注册
|
||||
*/
|
||||
registerWechatDevice() {
|
||||
// #ifdef MP-WEIXIN
|
||||
try {
|
||||
const systemInfo = uni.getSystemInfoSync()
|
||||
const clientId = `${systemInfo.platform}_${Date.now()}`
|
||||
this.registerDevice(clientId)
|
||||
} catch (err) {
|
||||
console.error('Wechat device register failed:', err)
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
|
||||
/**
|
||||
* H5 设备注册
|
||||
*/
|
||||
registerWebDevice() {
|
||||
// #ifdef H5
|
||||
try {
|
||||
const clientId = `web_${Date.now()}`
|
||||
this.registerDevice(clientId)
|
||||
} catch (err) {
|
||||
console.error('Web device register failed:', err)
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
|
||||
/**
|
||||
* 清除所有推送消息
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user