feat:更新版本记录

This commit is contained in:
2026-06-23 13:29:38 +08:00
parent 90fc557ac8
commit ab8e8371cf
4 changed files with 52 additions and 8 deletions
+17 -4
View File
@@ -62,7 +62,7 @@
const shouldUseUpdateOverlay = (title) => { const shouldUseUpdateOverlay = (title) => {
const text = String(title || ''); const text = String(title || '');
if (!text) return false; if (!text) return false;
if (/下载|安装|更新/.test(text) && (/%/.test(text) || /下载中|安装中/.test(text))) { if (/下载|安装|更新/.test(text) && (/%/.test(text) || /下载中|安装中|正在下载|正在安装|正在更新/.test(text))) {
return true; return true;
} }
return false; return false;
@@ -86,18 +86,31 @@
return true; return true;
}; };
if (!uni.__updateToastPatched && typeof uni.showToast === 'function') {
const originalShowToast = uni.showToast;
uni.showToast = (options = {}) => {
const title =
typeof options === 'string' ? options : (options?.title ?? '');
if ((uni.__hotUpdateInFlight || uni.__hotUpdatePendingProgress || uni.__updateProgressShown) && shouldUseUpdateOverlay(title)) {
return;
}
return originalShowToast.call(uni, options);
};
uni.__updateToastPatched = true;
}
uni.showLoading = (options = {}) => { uni.showLoading = (options = {}) => {
const title = options?.title ?? ''; const title = options?.title ?? '';
if (shouldUseUpdateOverlay(title) && canEmit()) { if (shouldUseUpdateOverlay(title) && (uni.__hotUpdateInFlight || uni.__hotUpdatePendingProgress || canEmit())) {
const parsed = parseTitleToProgress(title); const parsed = parseTitleToProgress(title);
if (!uni.__updateProgressShown) { if (!uni.__updateProgressShown && canEmit()) {
uni.__updateProgressShown = true; uni.__updateProgressShown = true;
emitProgress({ emitProgress({
type: 'show', type: 'show',
text: parsed.text || '下载中...' text: parsed.text || '下载中...'
}); });
} }
if (parsed.percent !== null) { if (parsed.percent !== null && canEmit()) {
emitProgress({ emitProgress({
type: 'set', type: 'set',
percent: parsed.percent, percent: parsed.percent,
+11
View File
@@ -21,3 +21,14 @@
### 修改 ### 修改
- 我的页面蓝色背景不展示问题 - 我的页面蓝色背景不展示问题
- ai店铺页面nav下展示白色border问题 - ai店铺页面nav下展示白色border问题
## [1.4.8] - 2026-06-16
### 新增
- 变现添加输入手机号
- 添加登录记录
- 添加头像修改入口
## [1.4.9] - 2026-06-22
### 新增
- 添加跳转江文数商链接
- 提现未实名跳转实名认证
+2 -2
View File
@@ -2,8 +2,8 @@
"name" : "优购商城", "name" : "优购商城",
"appid" : "__UNI__8B19741", "appid" : "__UNI__8B19741",
"description" : "", "description" : "",
"versionName" : "1.4.8", "versionName" : "1.4.9",
"versionCode" : 148, "versionCode" : 149,
"transformPx" : false, "transformPx" : false,
"app-plus" : { "app-plus" : {
"privacy" : { "privacy" : {
+21 -1
View File
@@ -180,6 +180,21 @@ export const downloadFileWithProgress = (url, { progress, stageText = '下载中
reject(new Error('empty url')) reject(new Error('empty url'))
return return
} }
const markHotUpdateInFlight = (delta) => {
try {
const current = Number(uni.__hotUpdateInFlightCount || 0)
const next = Math.max(0, current + Number(delta || 0))
uni.__hotUpdateInFlightCount = next
uni.__hotUpdateInFlight = next > 0
} catch (e) {}
}
let cleaned = false
const cleanup = () => {
if (cleaned) return
cleaned = true
markHotUpdateInFlight(-1)
}
markHotUpdateInFlight(1)
const setter = createProgressSetter(progress) const setter = createProgressSetter(progress)
setter.reset() setter.reset()
if (progress?.show) progress.show(stageText) if (progress?.show) progress.show(stageText)
@@ -189,13 +204,18 @@ export const downloadFileWithProgress = (url, { progress, stageText = '下载中
url, url,
success: (res) => { success: (res) => {
if (!res || res.statusCode !== 200) { if (!res || res.statusCode !== 200) {
cleanup()
reject(new Error('download failed')) reject(new Error('download failed'))
return return
} }
setter.set(100, stageText) setter.set(100, stageText)
cleanup()
resolve(res.tempFilePath) resolve(res.tempFilePath)
}, },
fail: () => reject(new Error('download failed')), fail: () => {
cleanup()
reject(new Error('download failed'))
},
}) })
if (task && typeof task.onProgressUpdate === 'function') { if (task && typeof task.onProgressUpdate === 'function') {