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

198
.eslintrc.js Normal file
View File

@@ -0,0 +1,198 @@
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
env: {
browser: true,
node: true,
es6: true,
},
extends: ['plugin:vue/recommended', 'eslint:recommended'],
// add your custom rules here
//it is base on https://github.com/vuejs/eslint-config-vue
rules: {
"vue/max-attributes-per-line": [2, {
"singleline": 10,
// "multiline": {
// "max": 1,
// "allowFirstLine": false
// }
}],
"vue/singleline-html-element-content-newline": "off",
"vue/multiline-html-element-content-newline":"off",
"vue/name-property-casing": ["error", "PascalCase"],
"vue/no-v-html": "off",
'accessor-pairs': 2,
'arrow-spacing': [2, {
'before': true,
'after': true
}],
'block-spacing': [2, 'always'],
'brace-style': [2, '1tbs', {
'allowSingleLine': true
}],
'camelcase': [0, {
'properties': 'always'
}],
'comma-dangle': [2, 'never'],
'comma-spacing': [2, {
'before': false,
'after': true
}],
'comma-style': [2, 'last'],
'constructor-super': 2,
'curly': [2, 'multi-line'],
'dot-location': [2, 'property'],
'eol-last': 2,
'eqeqeq': ["error", "always", {"null": "ignore"}],
'generator-star-spacing': [2, {
'before': true,
'after': true
}],
'handle-callback-err': [2, '^(err|error)$'],
'indent': [2, 2, {
'SwitchCase': 1
}],
'jsx-quotes': [2, 'prefer-single'],
'key-spacing': [2, {
'beforeColon': false,
'afterColon': true
}],
'keyword-spacing': [2, {
'before': true,
'after': true
}],
'new-cap': [2, {
'newIsCap': true,
'capIsNew': false
}],
'new-parens': 2,
'no-array-constructor': 2,
'no-caller': 2,
'no-console': 'off',
'no-class-assign': 2,
'no-cond-assign': 2,
'no-const-assign': 2,
'no-control-regex': 0,
'no-delete-var': 2,
'no-dupe-args': 2,
'no-dupe-class-members': 2,
'no-dupe-keys': 2,
'no-duplicate-case': 2,
'no-empty-character-class': 2,
'no-empty-pattern': 2,
'no-eval': 2,
'no-ex-assign': 2,
'no-extend-native': 2,
'no-extra-bind': 2,
'no-extra-boolean-cast': 2,
'no-extra-parens': [2, 'functions'],
'no-fallthrough': 2,
'no-floating-decimal': 2,
'no-func-assign': 2,
'no-implied-eval': 2,
'no-inner-declarations': [2, 'functions'],
'no-invalid-regexp': 2,
'no-irregular-whitespace': 2,
'no-iterator': 2,
'no-label-var': 2,
'no-labels': [2, {
'allowLoop': false,
'allowSwitch': false
}],
'no-lone-blocks': 2,
'no-mixed-spaces-and-tabs': 2,
'no-multi-spaces': 2,
'no-multi-str': 2,
'no-multiple-empty-lines': [2, {
'max': 1
}],
'no-native-reassign': 2,
'no-negated-in-lhs': 2,
'no-new-object': 2,
'no-new-require': 2,
'no-new-symbol': 2,
'no-new-wrappers': 2,
'no-obj-calls': 2,
'no-octal': 2,
'no-octal-escape': 2,
'no-path-concat': 2,
'no-proto': 2,
'no-redeclare': 2,
'no-regex-spaces': 2,
'no-return-assign': [2, 'except-parens'],
'no-self-assign': 2,
'no-self-compare': 2,
'no-sequences': 2,
'no-shadow-restricted-names': 2,
'no-spaced-func': 2,
'no-sparse-arrays': 2,
'no-this-before-super': 2,
'no-throw-literal': 2,
'no-trailing-spaces': 2,
'no-undef': 2,
'no-undef-init': 2,
'no-unexpected-multiline': 2,
'no-unmodified-loop-condition': 2,
'no-unneeded-ternary': [2, {
'defaultAssignment': false
}],
'no-unreachable': 2,
'no-unsafe-finally': 2,
'no-unused-vars': [2, {
'vars': 'all',
'args': 'none'
}],
'no-useless-call': 2,
'no-useless-computed-key': 2,
'no-useless-constructor': 2,
'no-useless-escape': 0,
'no-whitespace-before-property': 2,
'no-with': 2,
'one-var': [2, {
'initialized': 'never'
}],
'operator-linebreak': [2, 'after', {
'overrides': {
'?': 'before',
':': 'before'
}
}],
'padded-blocks': [2, 'never'],
'quotes': [2, 'single', {
'avoidEscape': true,
'allowTemplateLiterals': true
}],
'semi': [2, 'never'],
'semi-spacing': [2, {
'before': false,
'after': true
}],
'space-before-blocks': [2, 'always'],
'space-before-function-paren': [2, 'never'],
'space-in-parens': [2, 'never'],
'space-infix-ops': 2,
'space-unary-ops': [2, {
'words': true,
'nonwords': false
}],
'spaced-comment': [2, 'always', {
'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
}],
'template-curly-spacing': [2, 'never'],
'use-isnan': 2,
'valid-typeof': 2,
'wrap-iife': [2, 'any'],
'yield-star-spacing': [2, 'both'],
'yoda': [2, 'never'],
'prefer-const': 2,
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'object-curly-spacing': [2, 'always', {
objectsInObjects: false
}],
'array-bracket-spacing': [2, 'never']
}
}

2
.gitignore vendored
View File

@@ -402,3 +402,5 @@ FodyWeavers.xsd
.idea/
Web/dist
# ESLint
.eslintcache

13
.vscode/settings.json vendored
View File

@@ -1,3 +1,14 @@
{
"vue3snippets.enable-compile-vue-file-on-did-save-code": false
"vue3snippets.enable-compile-vue-file-on-did-save-code": false,
"eslint.workingDirectories": [
"./Web"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"eslint.validate": [
"javascript",
"javascriptreact",
"vue"
]
}

File diff suppressed because one or more lines are too long

2
Web/.gitignore vendored
View File

@@ -400,3 +400,5 @@ FodyWeavers.xsd
.idea/
# ESLint
.eslintcache

View File

@@ -6,8 +6,31 @@
"package.json": "package-lock.json, pnpm*, .yarnrc*, yarn*, .eslint*, eslint*, .oxlint*, oxlint*, .prettier*, prettier*, .editorconfig"
},
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
"source.fixAll": "explicit",
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.validate": [
"javascript",
"javascriptreact",
"vue"
],
"eslint.format.enable": false,
"prettier.documentSelectors": [
"**/*.vue",
"**/*.js",
"**/*.jsx",
"**/*.css",
"**/*.html"
]
}

View File

@@ -1,26 +1,52 @@
import { defineConfig, globalIgnores } from 'eslint/config'
import globals from 'globals'
import js from '@eslint/js'
import globals from 'globals'
import pluginVue from 'eslint-plugin-vue'
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
export default defineConfig([
export default [
{
name: 'app/files-to-lint',
files: ['**/*.{js,mjs,jsx,vue}'],
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**', '**/node_modules/**', '.nuxt/**'],
},
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
{
files: ['**/*.{js,mjs,jsx}'],
languageOptions: {
globals: {
...globals.browser,
},
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
rules: {
...js.configs.recommended.rules,
'indent': ['error', 2],
'quotes': ['error', 'single', { avoidEscape: true }],
'semi': ['error', 'never'],
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'comma-dangle': ['error', 'never'],
'no-trailing-spaces': 'error',
'no-multiple-empty-lines': ['error', { max: 1 }],
'space-before-function-paren': ['error', 'always'],
},
},
...pluginVue.configs['flat/recommended'],
{
files: ['**/*.vue'],
rules: {
'vue/multi-word-component-names': 'off',
'vue/no-v-html': 'warn',
'indent': 'off',
},
},
js.configs.recommended,
...pluginVue.configs['flat/essential'],
skipFormatting,
])
{
files: ['**/service-worker.js', '**/src/registerServiceWorker.js'],
languageOptions: {
globals: {
...globals.serviceworker,
...globals.browser,
},
},
},
]

View File

@@ -119,7 +119,7 @@ self.addEventListener('push', (event) => {
try {
const json = event.data.json();
data = { ...data, ...json };
} catch (e) {
} catch {
data.body = event.data.text();
}
}

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"
@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>

View File

@@ -53,13 +53,14 @@ request.interceptors.response.use(
case 400:
message = data?.message || '请求参数错误'
break
case 401:
case 401: {
message = '未授权,请重新登录'
// 清除登录状态并跳转到登录页
const authStore = useAuthStore()
authStore.logout()
router.push({ name: 'login', query: { redirect: router.currentRoute.value.fullPath } })
break
}
case 403:
message = '拒绝访问'
break

View File

@@ -1,6 +1,6 @@
<template>
<div>
<div class="input-section" v-if="!parseResult" style="margin: 12px 12px 0 16px;">
<div v-if="!parseResult" class="input-section" style="margin: 12px 12px 0 16px;">
<van-field
v-model="text"
type="textarea"
@@ -14,9 +14,9 @@
type="primary"
round
block
@click="handleParse"
:loading="parsing"
:disabled="!text.trim()"
@click="handleParse"
>
智能解析
</van-button>
@@ -35,8 +35,8 @@
plain
round
block
@click="parseResult = null"
class="mt-2"
@click="parseResult = null"
>
重新输入
</van-button>

View File

@@ -1,4 +1,5 @@
<template>
<!-- eslint-disable vue/no-v-html -->
<template>
<van-popup
v-model:show="visible"
position="bottom"
@@ -45,24 +46,24 @@ import { computed, useSlots } from 'vue'
const props = defineProps({
modelValue: {
type: Boolean,
required: true
required: true,
},
title: {
type: String,
default: ''
default: '',
},
subtitle: {
type: String,
default: ''
default: '',
},
height: {
type: String,
default: '80%'
default: '80%',
},
closeable: {
type: Boolean,
default: true
}
default: true,
},
})
const emit = defineEmits(['update:modelValue'])
@@ -72,7 +73,7 @@ const slots = useSlots()
// 双向绑定
const visible = computed({
get: () => props.modelValue,
set: (value) => emit('update:modelValue', value)
set: (value) => emit('update:modelValue', value),
})
// 判断是否有操作按钮
@@ -121,10 +122,9 @@ const hasActions = computed(() => !!slots['header-actions'])
text-align: center;
color: var(--van-text-color, #323233);
/*超出长度*/
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.header-stats {

View File

@@ -40,7 +40,7 @@
{{ group.sampleClassify }}
</van-tag>
<span class="count-text">{{ group.count }} </span>
<span class="amount-text" v-if="group.totalAmount">
<span v-if="group.totalAmount" class="amount-text">
¥{{ Math.abs(group.totalAmount).toFixed(2) }}
</span>
</div>

View File

@@ -5,8 +5,8 @@
size="small"
:loading="loading || saving"
:disabled="loading || saving"
@click="handleClick"
class="smart-classify-btn"
@click="handleClick"
>
<template v-if="!loading && !saving">
<van-icon :name="buttonIcon" />

View File

@@ -292,16 +292,6 @@ const clearClassify = () => {
showToast('已清空分类')
}
// 获取交易类型名称
const getTypeName = (type) => {
const typeMap = {
0: '支出',
1: '收入',
2: '不计入收支'
}
return typeMap[type] || '未知'
}
// 格式化日期
const formatDate = (dateString) => {
if (!dateString) return ''

View File

@@ -15,8 +15,8 @@
<van-checkbox
v-if="showCheckbox"
:model-value="isSelected(transaction.id)"
@update:model-value="toggleSelection(transaction)"
class="checkbox-col"
@update:model-value="toggleSelection(transaction)"
/>
<div
class="transaction-card"
@@ -66,10 +66,10 @@
<div :class="['amount', getAmountClass(transaction.type)]">
{{ formatAmount(transaction.amount, transaction.type) }}
</div>
<div class="balance" v-if="transaction.balance && transaction.balance > 0">
<div v-if="transaction.balance && transaction.balance > 0" class="balance">
余额: {{ formatMoney(transaction.balance) }}
</div>
<div class="balance" v-if="transaction.refundAmount && transaction.refundAmount > 0">
<div v-if="transaction.refundAmount && transaction.refundAmount > 0" class="balance">
退款: {{ formatMoney(transaction.refundAmount) }}
</div>
</div>
@@ -77,7 +77,7 @@
</div>
</div>
</div>
<template #right v-if="showDelete">
<template v-if="showDelete" #right>
<van-button
square
type="danger"
@@ -161,6 +161,7 @@ const handleDeleteClick = async (transaction) => {
window.dispatchEvent(new CustomEvent('transaction-deleted', { detail: transaction.id }))
} catch (e) {
// ignore in non-browser environment
console.log('非浏览器环境,跳过派发 transaction-deleted 事件', e)
}
} else {
showToast(response.message || '删除失败')

View File

@@ -1,5 +1,6 @@
<template>
<div class="page-container-flex">
<!-- eslint-disable vue/no-v-html -->
<template>
<div class="page-container-flex">
<!-- 顶部导航栏 -->
<van-nav-bar
title="智能分析"
@@ -11,8 +12,8 @@
<van-icon
name="question-o"
size="20"
@click="onClickPrompt"
style="cursor: pointer; padding-right: 12px;"
@click="onClickPrompt"
/>
</template>
</van-nav-bar>
@@ -39,8 +40,8 @@
type="primary"
plain
size="medium"
@click="selectQuestion(q)"
class="quick-tag"
@click="selectQuestion(q)"
>
{{ q }}
</van-tag>
@@ -52,26 +53,26 @@
round
:loading="analyzing"
loading-text="分析中..."
@click="startAnalysis"
:disabled="!userInput.trim()"
@click="startAnalysis"
>
开始分析
</van-button>
</div>
<!-- 结果区域 -->
<div class="result-section" v-if="showResult">
<div v-if="showResult" class="result-section">
<div class="result-header">
<h3>分析结果</h3>
<van-icon
v-if="!analyzing"
name="delete-o"
size="18"
@click="clearResult"
v-if="!analyzing"
/>
</div>
<div class="result-content" ref="resultContainer">
<div ref="resultContainer" class="result-content">
<div v-html="resultHtml"></div>
<van-loading v-if="analyzing" class="result-loading">
AI正在分析中...
@@ -202,7 +203,7 @@ const startAnalysis = async () => {
resultHtml.value = ''
try {
var baseUrl = import.meta.env.VITE_API_BASE_URL || ''
const baseUrl = import.meta.env.VITE_API_BASE_URL || ''
const response = await fetch(`${baseUrl}/TransactionRecord/AnalyzeBill`, {
method: 'POST',
headers: {

View File

@@ -45,7 +45,7 @@
<van-tag v-else type="success" size="small" plain>进行中</van-tag>
</div>
<div class="header-actions">
<van-button icon="replay" size="mini" plain @click="handleSync(budget)" :loading="budget.syncing" />
<van-button icon="replay" size="mini" plain :loading="budget.syncing" @click="handleSync(budget)" />
<van-button :icon="budget.isStopped ? 'play' : 'pause'" size="mini" plain @click="handleToggleStop(budget)" />
</div>
</div>
@@ -139,7 +139,7 @@
<van-tag v-else type="success" size="small" plain>进行中</van-tag>
</div>
<div class="header-actions">
<van-button icon="replay" size="mini" plain round @click="handleSync(budget)" :loading="budget.syncing" />
<van-button icon="replay" size="mini" plain round :loading="budget.syncing" @click="handleSync(budget)" />
<van-button :icon="budget.isStopped ? 'play' : 'pause'" size="mini" plain round @click="handleToggleStop(budget)" />
</div>
</div>
@@ -233,7 +233,7 @@
<van-tag v-else type="success" size="small" plain>积累中</van-tag>
</div>
<div class="header-actions">
<van-button icon="replay" size="mini" plain round @click="handleSync(budget)" :loading="budget.syncing" />
<van-button icon="replay" size="mini" plain round :loading="budget.syncing" @click="handleSync(budget)" />
<van-button :icon="budget.isStopped ? 'play' : 'pause'" size="mini" plain round @click="handleToggleStop(budget)" />
</div>
</div>

View File

@@ -260,7 +260,7 @@ const now = new Date();
fetchDailyStatistics(now.getFullYear(), now.getMonth() + 1);
// 全局删除事件监听,确保日历页面数据一致
const onGlobalTransactionDeleted = (e) => {
const onGlobalTransactionDeleted = () => {
if (selectedDate.value) {
fetchDateTransactions(selectedDate.value)
}
@@ -275,7 +275,7 @@ onBeforeUnmount(() => {
})
// 当有交易被新增/修改/批量更新时刷新
const onGlobalTransactionsChanged = (e) => {
const onGlobalTransactionsChanged = () => {
if (selectedDate.value) {
fetchDateTransactions(selectedDate.value)
}

View File

@@ -4,8 +4,8 @@
title="批量分类"
left-text="返回"
left-arrow
@click-left="handleBack"
placeholder
@click-left="handleBack"
/>
<div class="scroll-content">
@@ -65,7 +65,7 @@ const loadUnclassifiedCount = async () => {
}
// 处理数据加载完成
const handleDataLoaded = ({ groups, total, finished: isFinished }) => {
const handleDataLoaded = ({ groups, finished: isFinished }) => {
hasData.value = groups.length > 0
finished.value = isFinished
}

View File

@@ -4,8 +4,8 @@
:title="navTitle"
left-text="返回"
left-arrow
@click-left="handleBack"
placeholder
@click-left="handleBack"
/>
<div class="scroll-content">
@@ -29,8 +29,8 @@
<van-tag
type="primary"
closeable
@close="handleBackToRoot"
style="margin-left: 16px;"
@close="handleBackToRoot"
>
{{ currentTypeName }}
</van-tag>

View File

@@ -102,9 +102,9 @@
:finished="true"
:show-checkbox="true"
:selected-ids="selectedIds"
:show-delete="false"
@update:selected-ids="updateSelectedIds"
@click="handleRecordClick"
:show-delete="false"
/>
</div>
</div>

View File

@@ -33,8 +33,8 @@
:loading="classifying"
:disabled="selectedCount === 0"
round
@click="startClassify"
class="action-btn"
@click="startClassify"
>
{{ classifying ? '分类中...' : `开始分类 (${selectedCount}组)` }}
</van-button>
@@ -43,8 +43,8 @@
type="success"
:disabled="!hasChanges || classifying"
round
@click="saveClassifications"
class="action-btn"
@click="saveClassifications"
>
保存分类
</van-button>
@@ -91,7 +91,7 @@ const loadUnclassifiedCount = async () => {
}
// 处理数据加载完成
const handleDataLoaded = ({ groups, total }) => {
const handleDataLoaded = ({ total }) => {
totalGroups.value = total
// 默认全选所有分组
if (groupListRef.value) {

View File

@@ -1,4 +1,5 @@
<template>
<!-- eslint-disable vue/no-v-html -->
<template>
<div class="page-container-flex">
<!-- 下拉刷新区域 -->
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
@@ -27,7 +28,7 @@
<template #value>
<div class="email-info">
<div class="email-date">{{ formatDate(email.receivedDate) }}</div>
<div class="bill-count" v-if="email.transactionCount > 0">
<div v-if="email.transactionCount > 0" class="bill-count">
<span style="font-size: 12px;">已解析{{ email.transactionCount }}条账单</span>
</div>
@@ -79,19 +80,19 @@
<van-cell title="接收时间" :value="formatDate(currentEmail.ReceivedDate || currentEmail.receivedDate)" />
<van-cell title="记录时间" :value="formatDate(currentEmail.CreateTime || currentEmail.createTime)" />
<van-cell
v-if="(currentEmail.TransactionCount || currentEmail.transactionCount || 0) > 0"
title="已解析账单数"
:value="`${currentEmail.TransactionCount || currentEmail.transactionCount || 0}条`"
is-link
@click="viewTransactions"
v-if="(currentEmail.TransactionCount || currentEmail.transactionCount || 0) > 0"
/>
</van-cell-group>
<div class="email-content">
<h4 style="margin-left: 10px;">邮件内容</h4>
<div
v-if="currentEmail.htmlBody"
v-html="currentEmail.htmlBody"
class="content-body html-content"
v-html="currentEmail.htmlBody"
></div>
<div
v-else-if="currentEmail.body"
@@ -453,6 +454,8 @@ const formatDate = (dateString) => {
})
}
onMounted(() => {
loadData(true)
})

View File

@@ -4,8 +4,8 @@
title="查看日志"
left-text="返回"
left-arrow
@click-left="handleBack"
placeholder
@click-left="handleBack"
/>
<div class="scroll-content">
@@ -38,8 +38,8 @@
v-model:loading="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
class="log-list"
@load="onLoad"
>
<div
v-for="(log, index) in logList"

View File

@@ -21,8 +21,8 @@
block
round
:loading="loading"
@click="handleLogin"
class="login-button"
@click="handleLogin"
>
登录
</van-button>

View File

@@ -1,4 +1,5 @@
<template>
<!-- eslint-disable vue/no-v-html -->
<template>
<div class="page-container-flex">
<van-nav-bar v-if="!isComponent" title="消息中心">
<template #right>
@@ -49,7 +50,11 @@
height="50%"
:closeable="true"
>
<div v-if="currentMessage.messageType === 2" class="detail-content" v-html="currentMessage.content">
<div
v-if="currentMessage.messageType === 2"
class="detail-content"
v-html="currentMessage.content"
>
</div>
<div v-else class="detail-content">
{{ currentMessage.content }}
@@ -207,12 +212,6 @@ const handleMarkAllRead = () => {
onMounted(() => {
// onLoad 会由 van-list 自动触发
});
const props = defineProps({
isComponent: {
type: Boolean,
default: false
}
});
defineExpose({
handleMarkAllRead

View File

@@ -4,8 +4,8 @@
:title="navTitle"
left-text="返回"
left-arrow
@click-left="handleBack"
placeholder
@click-left="handleBack"
/>
<!-- 下拉刷新区域 -->
@@ -20,10 +20,10 @@
v-model:loading="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
class="periodic-list"
@load="onLoad"
>
<van-cell-group inset v-for="item in periodicList" :key="item.id" class="periodic-item">
<van-cell-group v-for="item in periodicList" :key="item.id" inset class="periodic-item">
<van-swipe-cell>
<div @click="editPeriodic(item)">
<van-cell :title="item.reason || '无摘要'" :label="getPeriodicTypeText(item)">
@@ -99,8 +99,8 @@
name="periodicType"
label="周期"
placeholder="请选择周期类型"
@click="showPeriodicTypePicker = true"
:rules="[{ required: true, message: '请选择周期类型' }]"
@click="showPeriodicTypePicker = true"
/>
<!-- 每周配置 -->
@@ -112,8 +112,8 @@
name="weekdays"
label="星期"
placeholder="请选择星期几"
@click="showWeekdaysPicker = true"
:rules="[{ required: true, message: '请选择星期几' }]"
@click="showWeekdaysPicker = true"
/>
<!-- 每月配置 -->
@@ -125,8 +125,8 @@
name="monthDays"
label="日期"
placeholder="请选择每月的日期"
@click="showMonthDaysPicker = true"
:rules="[{ required: true, message: '请选择日期' }]"
@click="showMonthDaysPicker = true"
/>
<!-- 每季度配置 -->
@@ -225,7 +225,7 @@
</van-cell-group>
</van-form>
<template #footer>
<van-button round block type="primary" @click="submit" :loading="submitting">
<van-button round block type="primary" :loading="submitting" @click="submit">
{{ isEdit ? '更新' : '确认添加' }}
</van-button>
</template>
@@ -267,13 +267,11 @@
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue'
import { ref, reactive } from 'vue'
import { useRouter } from 'vue-router'
import { showToast, showConfirmDialog } from 'vant'
import {
getPeriodicList,
createPeriodic,
updatePeriodic,
deletePeriodic as deletePeriodicApi,
togglePeriodicEnabled
} from '@/api/transactionPeriodic'
@@ -643,80 +641,6 @@ const handleAddClassify = async (categoryName) => {
}
}
// 提交表单
const onSubmit = async () => {
try {
submitting.value = true
// 构建周期配置
let periodicConfig = ''
switch (form.periodicType) {
case 1: // 每周
if (!form.weekdays.length) {
showToast('请选择星期几')
return
}
periodicConfig = form.weekdays.join(',')
break
case 2: // 每月
if (!form.monthDays.length) {
showToast('请选择日期')
return
}
periodicConfig = form.monthDays.join(',')
break
case 3: // 每季度
if (!form.quarterDay) {
showToast('请输入季度开始后第几天')
return
}
periodicConfig = form.quarterDay
break
case 4: // 每年
if (!form.yearDay) {
showToast('请输入年开始后第几天')
return
}
periodicConfig = form.yearDay
break
}
const data = {
periodicType: form.periodicType,
periodicConfig: periodicConfig,
amount: parseFloat(form.amount),
type: form.type,
classify: form.classify || '',
reason: form.reason || ''
}
let response
if (isEdit.value) {
data.id = form.id
data.isEnabled = true
response = await updatePeriodic(data)
} else {
response = await createPeriodic(data)
}
if (response.success) {
showToast(isEdit.value ? '更新成功' : '添加成功')
dialogVisible.value = false
loadData(true)
} else {
showToast(response.message || (isEdit.value ? '更新失败' : '添加失败'))
}
} catch (error) {
console.error('提交出错:', error)
showToast((isEdit.value ? '更新' : '添加') + '失败')
} finally {
submitting.value = false
}
}
onMounted(() => {
// van-list 会自动触发 onLoad
})
</script>
<style scoped>

View File

@@ -30,10 +30,10 @@
<van-cell-group inset>
<van-cell title="开启消息通知">
<template #right-icon>
<van-switch v-model="notificationEnabled" @change="handleNotificationToggle" size="24" :loading="notificationLoading" />
<van-switch v-model="notificationEnabled" size="24" :loading="notificationLoading" @change="handleNotificationToggle" />
</template>
</van-cell>
<van-cell title="测试通知" is-link @click="handleTestNotification" v-if="notificationEnabled" />
<van-cell v-if="notificationEnabled" title="测试通知" is-link @click="handleTestNotification" />
</van-cell-group>
<div class="detail-header" style="padding-bottom: 5px;">

View File

@@ -23,8 +23,8 @@
icon="arrow"
plain
size="small"
@click="changeMonth(1)"
:disabled="isCurrentMonth"
@click="changeMonth(1)"
/>
</div>
@@ -69,7 +69,7 @@
</div>
<!-- 环形图区域 -->
<div class="chart-container" v-if="expenseCategoriesView.length > 0">
<div v-if="expenseCategoriesView.length > 0" class="chart-container">
<div class="ring-chart">
<svg viewBox="0 0 200 200" class="ring-svg">
<circle
@@ -95,7 +95,7 @@
</div>
<!-- 分类列表 -->
<div class="category-list" v-if="expenseCategoriesView.length > 0">
<div v-if="expenseCategoriesView.length > 0" class="category-list">
<div
v-for="(category) in expenseCategoriesView"
:key="category.classify"
@@ -125,7 +125,7 @@
</div>
<!-- 收入分类统计 -->
<div class="common-card" v-if="incomeCategoriesView.length > 0">
<div v-if="incomeCategoriesView.length > 0" class="common-card">
<div class="card-header">
<h3 class="card-title">收入分类统计</h3>
<van-tag type="success" size="medium">{{ incomeCategoriesView.length }}</van-tag>
@@ -155,7 +155,7 @@
</div>
<!-- 不计收支分类统计 -->
<div class="common-card" v-if="noneCategoriesView.length > 0">
<div v-if="noneCategoriesView.length > 0" class="common-card">
<div class="card-header">
<h3 class="card-title">不计收支分类统计</h3>
<van-tag type="info" size="medium">{{ noneCategoriesView.length }}</van-tag>
@@ -202,7 +202,7 @@
class="bar expense-bar"
:style="{ height: getBarHeight(item.expense, maxTrendValue) }"
>
<div class="bar-value" v-if="item.expense > 0">
<div v-if="item.expense > 0" class="bar-value">
{{ formatShortMoney(item.expense) }}
</div>
</div>
@@ -210,7 +210,7 @@
class="bar income-bar"
:style="{ height: getBarHeight(item.income, maxTrendValue) }"
>
<div class="bar-value" v-if="item.income > 0">
<div v-if="item.income > 0" class="bar-value">
{{ formatShortMoney(item.income) }}
</div>
</div>
@@ -285,10 +285,10 @@
>
<template #header-actions>
<SmartClassifyButton
ref="smartClassifyButtonRef"
v-if="isUnclassified"
ref="smartClassifyButtonRef"
:transactions="categoryBills"
:onBeforeClassify="beforeSmartClassify"
:on-before-classify="beforeSmartClassify"
@save="onSmartClassifySave"
@notify-doned-transaction-id="handleNotifiedTransactionId"
/>

View File

@@ -41,9 +41,9 @@
<van-search
v-model="searchKeyword"
placeholder="搜索交易摘要、来源、卡号、分类"
shape="round"
@update:model-value="onSearchChange"
@clear="onSearchClear"
shape="round"
/>
</div>
</div>

View File

@@ -1,2 +1,2 @@
start cd ./Web/; pnpm i ;pnpm dev;
start cd ./WebApi/; dotnet watch run;
start cmd /k "cd Web && pnpm i && pnpm dev"
start cmd /k "cd WebApi && dotnet watch run"