feat:更新版本记录
This commit is contained in:
@@ -62,7 +62,7 @@
|
||||
const shouldUseUpdateOverlay = (title) => {
|
||||
const text = String(title || '');
|
||||
if (!text) return false;
|
||||
if (/下载|安装|更新/.test(text) && (/%/.test(text) || /下载中|安装中/.test(text))) {
|
||||
if (/下载|安装|更新/.test(text) && (/%/.test(text) || /下载中|安装中|正在下载|正在安装|正在更新/.test(text))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -86,18 +86,31 @@
|
||||
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 = {}) => {
|
||||
const title = options?.title ?? '';
|
||||
if (shouldUseUpdateOverlay(title) && canEmit()) {
|
||||
if (shouldUseUpdateOverlay(title) && (uni.__hotUpdateInFlight || uni.__hotUpdatePendingProgress || canEmit())) {
|
||||
const parsed = parseTitleToProgress(title);
|
||||
if (!uni.__updateProgressShown) {
|
||||
if (!uni.__updateProgressShown && canEmit()) {
|
||||
uni.__updateProgressShown = true;
|
||||
emitProgress({
|
||||
type: 'show',
|
||||
text: parsed.text || '下载中...'
|
||||
});
|
||||
}
|
||||
if (parsed.percent !== null) {
|
||||
if (parsed.percent !== null && canEmit()) {
|
||||
emitProgress({
|
||||
type: 'set',
|
||||
percent: parsed.percent,
|
||||
|
||||
+12
-1
@@ -20,4 +20,15 @@
|
||||
## [1.4.1] - 2026-06-09
|
||||
### 修改
|
||||
- 我的页面蓝色背景不展示问题
|
||||
- ai店铺页面nav下展示白色border问题
|
||||
- ai店铺页面nav下展示白色border问题
|
||||
|
||||
## [1.4.8] - 2026-06-16
|
||||
### 新增
|
||||
- 变现添加输入手机号
|
||||
- 添加登录记录
|
||||
- 添加头像修改入口
|
||||
|
||||
## [1.4.9] - 2026-06-22
|
||||
### 新增
|
||||
- 添加跳转江文数商链接
|
||||
- 提现未实名跳转实名认证
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
"name" : "优购商城",
|
||||
"appid" : "__UNI__8B19741",
|
||||
"description" : "",
|
||||
"versionName" : "1.4.8",
|
||||
"versionCode" : 148,
|
||||
"versionName" : "1.4.9",
|
||||
"versionCode" : 149,
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
"privacy" : {
|
||||
|
||||
+21
-1
@@ -180,6 +180,21 @@ export const downloadFileWithProgress = (url, { progress, stageText = '下载中
|
||||
reject(new Error('empty url'))
|
||||
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)
|
||||
setter.reset()
|
||||
if (progress?.show) progress.show(stageText)
|
||||
@@ -189,13 +204,18 @@ export const downloadFileWithProgress = (url, { progress, stageText = '下载中
|
||||
url,
|
||||
success: (res) => {
|
||||
if (!res || res.statusCode !== 200) {
|
||||
cleanup()
|
||||
reject(new Error('download failed'))
|
||||
return
|
||||
}
|
||||
setter.set(100, stageText)
|
||||
cleanup()
|
||||
resolve(res.tempFilePath)
|
||||
},
|
||||
fail: () => reject(new Error('download failed')),
|
||||
fail: () => {
|
||||
cleanup()
|
||||
reject(new Error('download failed'))
|
||||
},
|
||||
})
|
||||
|
||||
if (task && typeof task.onProgressUpdate === 'function') {
|
||||
|
||||
Reference in New Issue
Block a user