feat: 品牌文案配置化 + 全页面下拉刷新

- 新增 configStore 管理品牌文案(appName, appSlogan, appDescription)
- 关于弹窗、分享标题使用 configStore 读取品牌名
- 所有数据页面添加下拉刷新功能
- 所有数据页面 onShow 时自动刷新数据
This commit is contained in:
2026-06-08 10:59:09 +08:00
parent 62ca400b64
commit 6af876a8f4
12 changed files with 161 additions and 24 deletions

View File

@@ -0,0 +1,31 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { getConfig } from '@/api/config'
/** 系统配置 store全局缓存品牌文案等配置 */
export const useConfigStore = defineStore('config', () => {
const config = ref<Record<string, string>>({})
const loaded = ref(false)
/** 品牌名称 */
const appName = ref('小菜记账')
/** 品牌标语 */
const appSlogan = ref('温暖 x 轻松的个人记账小程序')
/** 品牌描述 */
const appDescription = ref('让记账从负担变成享受')
async function fetchConfig() {
try {
const data = await getConfig()
config.value = data
if (data.app_name) appName.value = data.app_name
if (data.app_slogan) appSlogan.value = data.app_slogan
if (data.app_description) appDescription.value = data.app_description
loaded.value = true
} catch {
// 配置加载失败时使用默认值
}
}
return { config, loaded, appName, appSlogan, appDescription, fetchConfig }
})