This commit is contained in:
owenchen committed 2026-10-22 14:26:28 +08:00
1 parent 1c91f62ff6
commit 6710b429b0
3 files changed
+63 -5

No files matched your search

@@ -17,7 +17,7 @@ import { StorageUsageData } from "@/data/auto/storageUsageData";
import { useLocale } from "uview-pro";
import { computed, onMounted, ref } from "vue";
import { brandGlyph } from "@/common/brand";
import { buildChunkFileName, uploadFile } from "@/common/http.interceptor";
import { buildChunkFileName, requestBuffer, uploadFile } from "@/common/http.interceptor";
import { userTypeGlyph, userTypePillBg } from "@/common/userTypeIcons";
import { useIdCardVerify, useThemeGradient, useThemeTokens } from "@/composables";
import { useArticles } from "@/composables/useArticles";
@@ -40,6 +40,7 @@ import dmsFileService from "@/service/master/dmsFileService";
import { useLoginProfileStore } from "@/stores";
import { pageUrl } from "@/router/routes";
import { chooseFiles } from "@/utils/chooseFiles";
import { saveFileBytes } from "@/utils/dmsBytes";
import { absoluteFileUrl, backupFileUrl } from "@/utils/fileUrl";
/** ready:组件挂载完成通知(时序口径见文件底部 onMounted 注释) */
@@ -128,12 +129,42 @@ const storageBarWidth = computed(() => {
const userTypeIcon = computed(() => userTypeGlyph(currentType.value));
const userTypeBg = computed(() => userTypePillBg(currentType.value));
/** 网盘存储卡图标:内联云形 SVG(同 treeGlyph 套路),绿描边置于柔光圆内(存储卡为浅色渐变描边底) */
const cloudGlyph = `data:image/svg+xml,${encodeURIComponent([
const cloudSvg = [
"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='#2f9e6b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'>",
"<path d='M6.8 18.5a4.3 4.3 0 0 1-.5-8.56 5.6 5.6 0 0 1 10.75-1.06A3.9 3.9 0 0 1 17.4 18.5z'/>",
"<path d='M9.5 14.2l1.9 1.9 3.6-3.9'/>",
"</svg>",
].join(""))}`;
].join("");
const cloudGlyph = `data:image/svg+xml,${encodeURIComponent(cloudSvg)}`;
/** 仅 H5 的「下载 App」图标:内联下箭头 SVG(绿描边,放在「网盘存储空间」标题旁),点击从 /FileServer 下载 youjiala.apk */
const downloadSvg = [
"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='#2f9e6b' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'>",
"<path d='M12 3.5v11'/>",
"<path d='M7.5 10.5l4.5 4.5 4.5-4.5'/>",
"<path d='M5 20.5h14'/>",
"</svg>",
].join("");
const downloadGlyph = `data:image/svg+xml,${encodeURIComponent(downloadSvg)}`;
// #ifdef H5
/** H5 下载 App 安装包:复用网盘 file 页同一条下载链——requestBuffer 按当前线路取字节
* (后端报错回的是 JSON,按 content-type 转成错误提示,不会跳错误页),saveFileBytes 走 blob <a download> 落盘 */
async function onDownloadApp(): Promise<void> {
uni.showLoading({ title: t("storage.downloadingApp"), mask: true });
try {
const bytes = await requestBuffer({ url: "/FileServer/youjiala.apk", method: "GET" });
await saveFileBytes({ bytes, name: "youjiala.apk" });
uni.showToast({ title: t("storage.downloadStarted"), icon: "none" });
}
catch {
// requestBuffer 内部已 notifyError 弹示失败原因,这里只收尾
}
finally {
uni.hideLoading();
}
}
// #endif
/** 未认证底部弹层:单击「未认证」徽标从底部弹出身份证认证,复用 useIdCardVerify(与身份验证页同一套流程) */
const idPopup = ref(false);
@@ -1625,6 +1656,11 @@ defineExpose({
<image class="home-card__sicon-img" :src="cloudGlyph" mode="aspectFit" />
</view>
<text class="home-card__stitle">{{ t("storage.title") }}</text>
<!-- #ifdef H5 -->
<view class="home-card__dlapp" @tap="onDownloadApp">
<image class="home-card__dlapp-icon" :src="downloadGlyph" mode="aspectFit" />
</view>
<!-- #endif -->
</view>
<text class="home-card__spct" :class="{ 'home-card__spct--over': storageOver }">{{ storagePercentText
}}</text>
@@ -2932,6 +2968,22 @@ defineExpose({
pointer-events: none;
}
/* 仅 H5 下载 App 图标:放在「网盘存储空间」标题旁,绿描边 + 柔光圆底(与 sicon 同色系,白卡可见) */
.home-card__dlapp {
display: flex;
align-items: center;
justify-content: center;
width: 44rpx;
height: 44rpx;
border-radius: 50%;
background: var(--fg-soft, #e6f6ec);
}
.home-card__dlapp-icon {
width: 28rpx;
height: 28rpx;
}
.home-card__avatar {
position: relative;
z-index: 1;
+4 -1
View File
@@ -10,7 +10,10 @@
"typeVip": "VIP",
"typeSvip": "SVIP",
"avatarUploadedTip": "Avatar updated",
"avatarUploadFailed": "Avatar upload failed"
"avatarUploadFailed": "Avatar upload failed",
"downloadApp": "Download App",
"downloadingApp": "Downloading…",
"downloadStarted": "Downloading youjiala.apk…"
},
"article": {
"title": "Family Culture",
+4 -1
View File
@@ -10,7 +10,10 @@
"typeVip": "VIP",
"typeSvip": "SVIP",
"avatarUploadedTip": "头像已更新",
"avatarUploadFailed": "头像上传失败"
"avatarUploadFailed": "头像上传失败",
"downloadApp": "下载 App",
"downloadingApp": "正在下载…",
"downloadStarted": "开始下载 youjiala.apk…"
},
"article": {
"title": "有家文化传承",