add settings store with FIRE parameters; fix home page

- store/settings.ts: target 71万, withdraw rate 3.5%, monthly invest 1500, etc. (persist)
- progress.vue: read target from settings store instead of hardcoded value
- index/index.vue: remove type:home conflict so checkin page is the entry

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ila
2026-06-08 11:01:16 +08:00
co-authored by Claude Sonnet 4.6
parent a8fa0c0753
commit 5fffb3112a
3 changed files with 25 additions and 5 deletions
-2
View File
@@ -3,8 +3,6 @@ defineOptions({
name: 'Home',
})
definePage({
// 使用 type: "home" 属性设置首页,其他页面不需要设置,默认为page
type: 'home',
style: {
// 'custom' 表示开启自定义导航栏,默认 'default'
'navigationStyle': 'custom',
+4 -3
View File
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import { useProgressStore } from '@/store/progress'
import { useSettingsStore } from '@/store/settings'
defineOptions({ name: 'Progress' })
definePage({
@@ -7,10 +8,10 @@ definePage({
})
const store = useProgressStore()
const TARGET = 710000
const settings = useSettingsStore()
const percent = computed(() => Math.min(100, Math.round((store.netAssets / TARGET) * 100)))
const remaining = computed(() => Math.max(0, TARGET - store.netAssets))
const percent = computed(() => Math.min(100, Math.round((store.netAssets / settings.target) * 100)))
const remaining = computed(() => Math.max(0, settings.target - store.netAssets))
const showForm = ref(false)
const inputVal = ref('')
+21
View File
@@ -0,0 +1,21 @@
import { defineStore } from 'pinia'
export const useSettingsStore = defineStore('settings', () => {
const target = ref(710000) // 目標本金(元)
const withdrawRate = ref(0.035) // 安全提取率 3.5%
const monthlyInvest = ref(1500) // 每月定投(元)
const partTimeIncome = ref(40000) // 兼職年收入(元)
const annualExpense = ref(65000) // 年開支(元)
const initialCapital = ref(70000) // 起始本金(元)
return {
target,
withdrawRate,
monthlyInvest,
partTimeIncome,
annualExpense,
initialCapital,
}
}, {
persist: true,
})