ow
This commit is contained in:
1 parent
6710b429b0
commit
15d8eb3f4e
6 files changed
+39
-1
No files matched your search
@@ -42,6 +42,7 @@ import { pageUrl } from "@/router/routes";
|
||||
import { chooseFiles } from "@/utils/chooseFiles";
|
||||
import { saveFileBytes } from "@/utils/dmsBytes";
|
||||
import { absoluteFileUrl, backupFileUrl } from "@/utils/fileUrl";
|
||||
import { isWeixinBrowser } from "@/utils/weixin";
|
||||
|
||||
/** ready:组件挂载完成通知(时序口径见文件底部 onMounted 注释) */
|
||||
const emit = defineEmits<{ (e: "ready"): void }>();
|
||||
@@ -151,6 +152,16 @@ const downloadGlyph = `data:image/svg+xml,${encodeURIComponent(downloadSvg)}`;
|
||||
/** H5 下载 App 安装包:复用网盘 file 页同一条下载链——requestBuffer 按当前线路取字节
|
||||
* (后端报错回的是 JSON,按 content-type 转成错误提示,不会跳错误页),saveFileBytes 走 blob <a download> 落盘 */
|
||||
async function onDownloadApp(): Promise<void> {
|
||||
// 微信内置浏览器屏蔽 <a download> 且 apk 在微信下载封禁名单里(点击静默无反应),
|
||||
// 只能引导用户到系统浏览器下载
|
||||
if (isWeixinBrowser()) {
|
||||
uni.showModal({
|
||||
title: t("storage.downloadApp"),
|
||||
content: t("storage.openInBrowserTip"),
|
||||
showCancel: false,
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.showLoading({ title: t("storage.downloadingApp"), mask: true });
|
||||
try {
|
||||
const bytes = await requestBuffer({ url: "/FileServer/youjiala.apk", method: "GET" });
|
||||
|
||||
Reference in new issue
Block a user