feat: update VSCode settings for ESLint and Prettier integration
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 20s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s

chore: refactor ESLint configuration for improved linting rules and performance

fix: handle push event data parsing in service worker

style: adjust tabbar item properties for better readability in App.vue

refactor: remove unused functions and improve code clarity in TransactionDetail.vue

fix: ensure consistent event handling in CalendarView.vue

style: clean up component structure and formatting in various Vue files

chore: update launch script for better command execution

feat: add ESLint configuration file for consistent code style across the project

fix: resolve issues with button click events in multiple components
This commit is contained in:
孙诚
2026-01-07 14:33:30 +08:00
parent efdfe88155
commit b2339c1c5e
32 changed files with 380 additions and 241 deletions

View File

@@ -2,7 +2,7 @@
<van-config-provider :theme="theme" class="app-provider">
<div class="app-root">
<RouterView />
<van-tabbar v-model="active" v-show="showTabbar">
<van-tabbar v-show="showTabbar" v-model="active">
<van-tabbar-item name="ccalendar" icon="notes" to="/calendar">
日历
</van-tabbar-item>
@@ -13,8 +13,8 @@
name="balance"
icon="balance-list"
:to="messageStore.unreadCount > 0 ? '/balance?tab=message' : '/balance'"
@click="handleTabClick('/balance')"
:badge="messageStore.unreadCount || null"
:badge="messageStore.unreadCount || null"
@click="handleTabClick('/balance')"
>
账单
</van-tabbar-item>
@@ -151,48 +151,6 @@ const handleAddTransactionSuccess = () => {
window.dispatchEvent(event)
}
// 辅助函数:将 Base64 字符串转换为 Uint8Array
const urlBase64ToUint8Array = (base64String) => {
const padding = '='.repeat((4 - base64String.length % 4) % 4);
const base64 = (base64String + padding).replace(/-/g, '+').replace(/_/g, '/');
const rawData = window.atob(base64);
const outputArray = new Uint8Array(rawData.length);
for (let i = 0; i < rawData.length; ++i) {
outputArray[i] = rawData.charCodeAt(i);
}
return outputArray;
}
const subscribeToPush = async () => {
if (!('serviceWorker' in navigator)) return;
// 1. 获取 VAPID 公钥
const response = await fetch('/api/notification/vapid-public-key');
const { publicKey } = await response.json();
// 2. 等待 Service Worker 准备就绪
const registration = await navigator.serviceWorker.ready;
// 3. 请求订阅
const subscription = await registration.pushManager.subscribe({
userVisibleOnly: true,
applicationServerKey: urlBase64ToUint8Array(publicKey)
});
// 4. 将订阅信息发送给后端
// 注意:后端 PushSubscriptionEntity 字段首字母大写,这里需要转换或让后端兼容
const subJson = subscription.toJSON();
await fetch('/api/notification/subscribe', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
endpoint: subJson.endpoint,
p256dh: subJson.keys.p256dh,
auth: subJson.keys.auth
})
});
}
</script>
<style scoped>