From 65c398880b564058dfa2409cabc3121f8b4b663b Mon Sep 17 00:00:00 2001 From: kuaifan Date: Tue, 5 Nov 2024 10:27:57 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96app=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/App.vue | 13 +++++++++++-- resources/assets/js/functions/eeui.js | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/resources/assets/js/App.vue b/resources/assets/js/App.vue index a43bcb185..3b79c11f4 100755 --- a/resources/assets/js/App.vue +++ b/resources/assets/js/App.vue @@ -62,6 +62,7 @@ export default { routePath: null, appInter: null, countDown: Math.min(30, 60 - $A.daytz().second()), + lastCheckUpgradeYmd: $A.daytz().format('YYYY-MM-DD') } }, @@ -331,6 +332,10 @@ export default { this.autoTheme() $A.updateTimezone() $A.IDBTest() + if (this.lastCheckUpgradeYmd != $A.daytz().format('YYYY-MM-DD')) { + this.lastCheckUpgradeYmd = $A.daytz().format('YYYY-MM-DD') + $A.eeuiAppCheckUpdate(); + } } // 页面失活 window.__onPagePause = () => { @@ -434,8 +439,12 @@ export default { // 取消长按振动 $A.eeuiAppSetHapticBackEnabled(false) // 设置语言 - $A.eeuiAppSetVariate("languageWebBrowser", this.$L("浏览器打开")) - $A.eeuiAppSetVariate("languageWebRefresh", this.$L("刷新")) + $A.eeuiAppSetCachesString("languageWebBrowser", this.$L("浏览器打开")) + $A.eeuiAppSetCachesString("languageWebRefresh", this.$L("刷新")) + $A.eeuiAppSetCachesString("updateDefaultTitle", this.$L("发现新版本")) + $A.eeuiAppSetCachesString("updateDefaultContent", this.$L("暂无更新介绍!")) + $A.eeuiAppSetCachesString("updateDefaultCancelText", this.$L("以后再说")) + $A.eeuiAppSetCachesString("updateDefaultUpdateText", this.$L("立即更新")) }, otherEvents() { diff --git a/resources/assets/js/functions/eeui.js b/resources/assets/js/functions/eeui.js index 6764dce01..401b3d1d1 100755 --- a/resources/assets/js/functions/eeui.js +++ b/resources/assets/js/functions/eeui.js @@ -156,6 +156,14 @@ }) }, + // 检查更新 + eeuiAppCheckUpdate() { + if (!$A.isEEUiApp) return; + $A.eeuiModule("eeui").then(obj => { + obj.checkUpdate(); + }) + }, + // 获取主题名称 light|dark eeuiAppGetThemeName() { if (!$A.isEEUiApp) return; @@ -174,6 +182,12 @@ $A.eeuiModuleSync("eeui").setVariate(key, value); }, + // 设置缓存数据 + eeuiAppSetCachesString(key, value, expired = 0) { + if (!$A.isEEUiApp) return; + $A.eeuiModuleSync("eeui").setCachesString(key, value, expired); + }, + // 长按内容震动(仅支持android、iOS无效) eeuiAppSetHapticBackEnabled(val) { if (!$A.isEEUiApp) return;