大量的代码格式化
Some checks failed
Docker Build & Deploy / Build Docker Image (push) Failing after 1m10s
Docker Build & Deploy / Deploy to Production (push) Has been skipped
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
Some checks failed
Docker Build & Deploy / Build Docker Image (push) Failing after 1m10s
Docker Build & Deploy / Deploy to Production (push) Has been skipped
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
@@ -1,59 +1,137 @@
|
||||
<template>
|
||||
<div class="page-container-flex">
|
||||
<van-nav-bar title="设置" placeholder/>
|
||||
<van-nav-bar
|
||||
title="设置"
|
||||
placeholder
|
||||
/>
|
||||
<div class="scroll-content">
|
||||
<div class="detail-header" style="padding-bottom: 5px;">
|
||||
<div
|
||||
class="detail-header"
|
||||
style="padding-bottom: 5px"
|
||||
>
|
||||
<p>账单</p>
|
||||
</div>
|
||||
<van-cell-group inset>
|
||||
<van-cell title="从支付宝导入" is-link @click="handleImportClick('Alipay')" />
|
||||
<van-cell title="从微信导入" is-link @click="handleImportClick('WeChat')" />
|
||||
<van-cell title="周期记录" is-link @click="handlePeriodicRecord" />
|
||||
<van-cell
|
||||
title="从支付宝导入"
|
||||
is-link
|
||||
@click="handleImportClick('Alipay')"
|
||||
/>
|
||||
<van-cell
|
||||
title="从微信导入"
|
||||
is-link
|
||||
@click="handleImportClick('WeChat')"
|
||||
/>
|
||||
<van-cell
|
||||
title="周期记录"
|
||||
is-link
|
||||
@click="handlePeriodicRecord"
|
||||
/>
|
||||
</van-cell-group>
|
||||
|
||||
<!-- 隐藏的文件选择器 -->
|
||||
<input ref="fileInputRef" type="file" accept=".csv,.xlsx,.xls" style="display: none" @change="handleFileChange" />
|
||||
<input
|
||||
ref="fileInputRef"
|
||||
type="file"
|
||||
accept=".csv,.xlsx,.xls"
|
||||
style="display: none"
|
||||
@change="handleFileChange"
|
||||
>
|
||||
|
||||
<div class="detail-header" style="padding-bottom: 5px;">
|
||||
<div
|
||||
class="detail-header"
|
||||
style="padding-bottom: 5px"
|
||||
>
|
||||
<p>分类</p>
|
||||
</div>
|
||||
<van-cell-group inset>
|
||||
<van-cell title="待确认分类" is-link @click="handleUnconfirmedClassification" />
|
||||
<van-cell title="编辑分类" is-link @click="handleEditClassification" />
|
||||
<van-cell title="批量分类" is-link @click="handleBatchClassification" />
|
||||
<van-cell title="智能分类" is-link @click="handleSmartClassification" />
|
||||
<van-cell
|
||||
title="待确认分类"
|
||||
is-link
|
||||
@click="handleUnconfirmedClassification"
|
||||
/>
|
||||
<van-cell
|
||||
title="编辑分类"
|
||||
is-link
|
||||
@click="handleEditClassification"
|
||||
/>
|
||||
<van-cell
|
||||
title="批量分类"
|
||||
is-link
|
||||
@click="handleBatchClassification"
|
||||
/>
|
||||
<van-cell
|
||||
title="智能分类"
|
||||
is-link
|
||||
@click="handleSmartClassification"
|
||||
/>
|
||||
<!-- <van-cell title="自然语言分类" is-link @click="handleNaturalLanguageClassification" /> -->
|
||||
</van-cell-group>
|
||||
|
||||
<div class="detail-header" style="padding-bottom: 5px;">
|
||||
<div
|
||||
class="detail-header"
|
||||
style="padding-bottom: 5px"
|
||||
>
|
||||
<p>通知</p>
|
||||
</div>
|
||||
<van-cell-group inset>
|
||||
<van-cell title="开启消息通知">
|
||||
<template #right-icon>
|
||||
<van-switch v-model="notificationEnabled" size="24" :loading="notificationLoading" @change="handleNotificationToggle" />
|
||||
<van-switch
|
||||
v-model="notificationEnabled"
|
||||
size="24"
|
||||
:loading="notificationLoading"
|
||||
@change="handleNotificationToggle"
|
||||
/>
|
||||
</template>
|
||||
</van-cell>
|
||||
<van-cell v-if="notificationEnabled" title="测试通知" is-link @click="handleTestNotification" />
|
||||
<van-cell
|
||||
v-if="notificationEnabled"
|
||||
title="测试通知"
|
||||
is-link
|
||||
@click="handleTestNotification"
|
||||
/>
|
||||
</van-cell-group>
|
||||
|
||||
<div class="detail-header" style="padding-bottom: 5px;">
|
||||
<div
|
||||
class="detail-header"
|
||||
style="padding-bottom: 5px"
|
||||
>
|
||||
<p>开发者</p>
|
||||
</div>
|
||||
<van-cell-group inset>
|
||||
<van-cell title="查看日志" is-link @click="handleLogView" />
|
||||
<van-cell title="清除缓存" is-link @click="handleReloadFromNetwork" />
|
||||
<van-cell title="定时任务" is-link @click="handleScheduledTasks" />
|
||||
<van-cell
|
||||
title="查看日志"
|
||||
is-link
|
||||
@click="handleLogView"
|
||||
/>
|
||||
<van-cell
|
||||
title="清除缓存"
|
||||
is-link
|
||||
@click="handleReloadFromNetwork"
|
||||
/>
|
||||
<van-cell
|
||||
title="定时任务"
|
||||
is-link
|
||||
@click="handleScheduledTasks"
|
||||
/>
|
||||
</van-cell-group>
|
||||
|
||||
<div class="detail-header" style="padding-bottom: 5px;">
|
||||
<div
|
||||
class="detail-header"
|
||||
style="padding-bottom: 5px"
|
||||
>
|
||||
<p>账户</p>
|
||||
</div>
|
||||
<van-cell-group inset>
|
||||
<van-cell title="退出登录" is-link @click="handleLogout" />
|
||||
<van-cell
|
||||
title="退出登录"
|
||||
is-link
|
||||
@click="handleLogout"
|
||||
/>
|
||||
</van-cell-group>
|
||||
<!-- 底部安全距离 -->
|
||||
<div style="height: calc(80px + env(safe-area-inset-bottom, 0px))"></div>
|
||||
<div style="height: calc(80px + env(safe-area-inset-bottom, 0px))" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -82,15 +160,15 @@ onMounted(async () => {
|
||||
}
|
||||
})
|
||||
|
||||
function 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);
|
||||
function 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);
|
||||
outputArray[i] = rawData.charCodeAt(i)
|
||||
}
|
||||
return outputArray;
|
||||
return outputArray
|
||||
}
|
||||
|
||||
const handleNotificationToggle = async (checked) => {
|
||||
@@ -113,12 +191,12 @@ const handleNotificationToggle = async (checked) => {
|
||||
return
|
||||
}
|
||||
|
||||
let { success, data, message } = await getVapidPublicKey()
|
||||
const { success, data, message } = await getVapidPublicKey()
|
||||
|
||||
if (!success) {
|
||||
throw new Error(message || '获取 VAPID 公钥失败')
|
||||
}
|
||||
|
||||
|
||||
const convertedVapidKey = urlBase64ToUint8Array(data)
|
||||
|
||||
const subscription = await registration.pushManager.subscribe({
|
||||
@@ -132,7 +210,7 @@ const handleNotificationToggle = async (checked) => {
|
||||
p256DH: subJson.keys.p256dh,
|
||||
auth: subJson.keys.auth
|
||||
})
|
||||
|
||||
|
||||
showSuccessToast('开启成功')
|
||||
} else {
|
||||
// 关闭通知
|
||||
@@ -184,7 +262,11 @@ const handleFileChange = async (event) => {
|
||||
}
|
||||
|
||||
// 验证文件类型
|
||||
const validTypes = ['text/csv', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']
|
||||
const validTypes = [
|
||||
'text/csv',
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
]
|
||||
if (!validTypes.includes(file.type)) {
|
||||
showToast('请选择 CSV 或 Excel 文件')
|
||||
return
|
||||
@@ -218,8 +300,7 @@ const handleFileChange = async (event) => {
|
||||
} catch (error) {
|
||||
console.error('上传失败:', error)
|
||||
showToast('上传失败: ' + (error.message || '未知错误'))
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
closeToast()
|
||||
// 清空文件输入,允许重复选择同一文件
|
||||
event.target.value = ''
|
||||
@@ -249,9 +330,9 @@ const handleLogout = async () => {
|
||||
try {
|
||||
await showConfirmDialog({
|
||||
title: '提示',
|
||||
message: '确定要退出登录吗?',
|
||||
message: '确定要退出登录吗?'
|
||||
})
|
||||
|
||||
|
||||
authStore.logout()
|
||||
showSuccessToast('已退出登录')
|
||||
router.push({ name: 'login' })
|
||||
@@ -276,7 +357,7 @@ const handleReloadFromNetwork = async () => {
|
||||
try {
|
||||
await showConfirmDialog({
|
||||
title: '提示',
|
||||
message: '确定要刷新网络吗?此操作不可撤销。',
|
||||
message: '确定要刷新网络吗?此操作不可撤销。'
|
||||
})
|
||||
|
||||
// PWA程序强制页面更新到最新版本
|
||||
@@ -300,7 +381,6 @@ const handleReloadFromNetwork = async () => {
|
||||
const handleScheduledTasks = () => {
|
||||
router.push({ name: 'scheduled-tasks' })
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -331,4 +411,4 @@ const handleScheduledTasks = () => {
|
||||
:deep(.van-nav-bar) {
|
||||
background: transparent !important;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user