diff --git a/main.js b/main.js index 020f8d3..77a48d3 100644 --- a/main.js +++ b/main.js @@ -21,15 +21,11 @@ import { } from './store' export function createApp() { const app = createSSRApp(App) - - // 将store挂载到全局 - app.config.globalProperties.$store = store - // 从缓存读取系统信息(已在App.vue中获取) const systemInfo = uni.getStorageSync('systemInfo') || {} app.config.globalProperties.$system = systemInfo.platform == 'ios' ? 'iOS' : 'Android' app.config.globalProperties.$systemInfo = systemInfo - uni.setStorageSync('version', '1.1.0') + uni.setStorageSync('version', '1.0.0') app.use(globalMethods); return { app diff --git a/manifest.json b/manifest.json index 4c1ee3f..26e6884 100644 --- a/manifest.json +++ b/manifest.json @@ -1,94 +1,95 @@ { - "name" : "alipay-emulator", - "appid" : "__UNI__D535736", - "description" : "", - "versionName" : "1.0.0", - "versionCode" : "100", - "transformPx" : false, - /* 5+App特有相关 */ - "app-plus" : { - "usingComponents" : true, - "nvueStyleCompiler" : "uni-app", - "compilerVersion" : 3, - "splashscreen" : { - "alwaysShowBeforeRender" : true, - "waiting" : true, - "autoclose" : true, - "delay" : 0 - }, - "optimization" : { - "subPackages" : true - }, - "runmode" : "liberate", // 开启分包优化后,必须配置资源释放模式 + "name": "alipay-emulator", + "appid": "__UNI__D535736", + "description": "", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + /* 5+App特有相关 */ + "app-plus": { + "darkmode": false, + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "compilerVersion": 3, + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "optimization": { + "subPackages": true + }, + "runmode": "liberate", // 开启分包优化后,必须配置资源释放模式 - /* 模块配置 */ - "modules" : { - "Camera" : {}, - "Payment" : {} - }, - /* 应用发布信息 */ - "distribute" : { - /* android打包配置 */ - "android" : { - "permissions" : [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ] - }, - /* ios打包配置 */ - "ios" : { - "dSYMs" : false - }, - /* SDK配置 */ - "sdkConfigs" : { - "payment" : { - "weixin" : { - "__platform__" : [ "ios", "android" ], - "appid" : "123456", - "UniversalLinks" : "123456" - }, - "alipay" : { - "__platform__" : [ "ios", "android" ] - } - } - } - }, - "nvueLaunchMode" : "" - }, - /* 快应用特有相关 */ - "quickapp" : {}, - /* 小程序特有相关 */ - "mp-weixin" : { - "appid" : "", - "setting" : { - "urlCheck" : false - }, - "usingComponents" : true - }, - "mp-alipay" : { - "usingComponents" : true - }, - "mp-baidu" : { - "usingComponents" : true - }, - "mp-toutiao" : { - "usingComponents" : true - }, - "uniStatistics" : { - "enable" : false - }, - "vueVersion" : "3" -} + /* 模块配置 */ + "modules": { + "Camera": {}, + "Payment": {} + }, + /* 应用发布信息 */ + "distribute": { + /* android打包配置 */ + "android": { + "permissions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + /* ios打包配置 */ + "ios": { + "dSYMs": false + }, + /* SDK配置 */ + "sdkConfigs": { + "payment": { + "weixin": { + "__platform__": ["ios", "android"], + "appid": "123456", + "UniversalLinks": "123456" + }, + "alipay": { + "__platform__": ["ios", "android"] + } + } + } + }, + "nvueLaunchMode": "" + }, + /* 快应用特有相关 */ + "quickapp": {}, + /* 小程序特有相关 */ + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + }, + "usingComponents": true + }, + "mp-alipay": { + "usingComponents": true + }, + "mp-baidu": { + "usingComponents": true + }, + "mp-toutiao": { + "usingComponents": true + }, + "uniStatistics": { + "enable": false + }, + "vueVersion": "3" +} \ No newline at end of file diff --git a/pages/balance/index.vue b/pages/balance/index.vue index 70d9391..db2eebf 100644 --- a/pages/balance/index.vue +++ b/pages/balance/index.vue @@ -197,20 +197,23 @@ onLoad(async () => { // 初始获取状态栏高度和屏幕高度 updateStatusBarHeight() data.windowHeight = await deviceUtil.getWindowHeight() + +}) + +onShow(() => { + // #ifdef APP-PLUS + util.setAndroidSystemBarColor('#F0F3F8') + plus.navigator.setStatusBarStyle("light"); + // #endif + + // 获取快速入口配置 + data.menuList = fastEntranceData() + // 从缓存读取余额 const cachedBalance = storage.get('balance') if (cachedBalance !== null) { data.balance = cachedBalance } -}) - -onShow(() => { - // #ifdef APP-PLUS - util.setAndroidSystemBarColor('#F0F3F8', "#ffffff") - // #endif - - // 获取快速入口配置 - data.menuList = fastEntranceData() getRecentBills() }) @@ -228,6 +231,7 @@ const fastEntranceData = () => { // 获取账单最新的三条余额相关的数据 const getRecentBills = () => { const allBillList = getBillList() + // 按时间降序排序 const sortedList = [...allBillList].sort((a, b) => { const timeA = a.itemInfoList.find(info => info.key == 'createTime')?.value || 0 @@ -235,9 +239,12 @@ const getRecentBills = () => { return new Date(timeB) - new Date(timeA) }) + console.log('sortedList', sortedList) + // 获取前3条 const recentBills = sortedList.filter(item => item.payMethod == '余额').slice(0, 3) + console.log('recentBills', recentBills) // 转换数据 data.changeDetailList = recentBills.map(item => { const createTime = item.itemInfoList.find(info => info.key == 'createTime')?.value || new Date() @@ -717,7 +724,7 @@ const onMenuScroll = (e) => { .title-right>.text { font-size: 14px; - color: var(--text-color); + color: #979797; } .right-icon { diff --git a/pages/bill/add-bill/add-bill.vue b/pages/bill/add-bill/add-bill.vue index 00b5d1e..488f388 100644 --- a/pages/bill/add-bill/add-bill.vue +++ b/pages/bill/add-bill/add-bill.vue @@ -473,6 +473,9 @@ let { billData, datePickerData, selectItemInfo } = toRefs(data) onShow(() => { // #ifdef APP-PLUS util.setAndroidSystemBarColor('#F5F5F5') + setTimeout(() => { + plus.navigator.setStatusBarStyle("dark"); + }, 500); // #endif }) @@ -791,6 +794,9 @@ const onRightClick = async () => { billData.value.payMethod = "余额" } addBill(billData.value) + const allBillList = getBillList() + + console.log("getBillDataList------", allBillList) } uni.showToast({ diff --git a/pages/bill/bill-detail/bill-detail.vue b/pages/bill/bill-detail/bill-detail.vue index 98a7311..43d8573 100644 --- a/pages/bill/bill-detail/bill-detail.vue +++ b/pages/bill/bill-detail/bill-detail.vue @@ -319,6 +319,9 @@ onShow(() => { getBillData(data.billId) // #ifdef APP-PLUS util.setAndroidSystemBarColor('#F5F5F5') + setTimeout(() => { + plus.navigator.setStatusBarStyle("dark"); + }, 500); // #endif }) diff --git a/pages/bill/bill-list/bill-list.vue b/pages/bill/bill-list/bill-list.vue index 9d53d91..4924d65 100644 --- a/pages/bill/bill-list/bill-list.vue +++ b/pages/bill/bill-list/bill-list.vue @@ -12,7 +12,7 @@ \ No newline at end of file diff --git a/store/index.js b/store/index.js index 8c4f704..6f47cb7 100644 --- a/store/index.js +++ b/store/index.js @@ -39,6 +39,9 @@ export const store = reactive({ }); + + + // 定义操作方法 export const useStore = () => { // 用户相关操作 @@ -83,10 +86,6 @@ export const useStore = () => { return store.billList } - // 手动保存账单列表(替代自动监听) - const saveBillList = debounce(() => { - storage.set('bill_list', store.billList) - }, 500) // 优化后的监听:使用防抖减少存储频率 const debouncedSaveSettings = debounce((newValue) => { @@ -105,7 +104,12 @@ export const useStore = () => { { deep: true } ); - // 移除billList的自动监听,改为手动调用saveBillList + // 监听billList改变自动保存 + watch( + () => store.billList, + (newValue) => storage.set('bill_list', newValue), + { deep: true } + ); // 获取系统信息(从缓存读取) const getSystemInfo = () => { @@ -124,7 +128,6 @@ export const useStore = () => { updateBill, deleteBill, getBillList, - saveBillList, getSystemInfo }; }; diff --git a/utils/common.js b/utils/common.js index bce9bec..36f1340 100644 --- a/utils/common.js +++ b/utils/common.js @@ -387,7 +387,6 @@ export const util = { let window = plus.android.invoke(activity, "getWindow"); plus.android.invoke(window, "setNavigationBarColor", colorInt); uni.setNavigationBarColor({ - frontColor: frontColor, animation: { // 动画效果 duration: 100, timingFunc: 'easeIn' @@ -395,7 +394,6 @@ export const util = { }) setTimeout(function () { uni.setNavigationBarColor({ - frontColor: frontColor, animation: { // 动画效果 duration: 100, timingFunc: 'easeIn' @@ -407,7 +405,6 @@ export const util = { } catch (err) { console.log("状态栏修改失败", err); uni.setNavigationBarColor({ - frontColor: frontColor, animation: { // 动画效果 duration: 100, timingFunc: 'easeIn'