bugfix: 设置页邮箱&资源下载

This commit is contained in:
2026-05-28 14:20:23 +08:00
parent f203d6146c
commit 9948b18c26
3 changed files with 28 additions and 8 deletions

View File

@@ -341,7 +341,7 @@ export function useSettingsForm({ t, locale }: UseSettingsFormOptions) {
username: draftData.value.username.trim(), username: draftData.value.username.trim(),
email: securityDraft.value.newEmail.trim(), email: securityDraft.value.newEmail.trim(),
roles: draftData.value.roles as string[], roles: draftData.value.roles as string[],
language: backendLanguage, // 发送后端格式:'en' 或 'zh-CN' language: backendLanguage,
region: draftData.value.region, region: draftData.value.region,
newPassword: '', newPassword: '',
oldPassword: '', oldPassword: '',
@@ -373,7 +373,7 @@ export function useSettingsForm({ t, locale }: UseSettingsFormOptions) {
firstName: nextData.firstName, firstName: nextData.firstName,
lastName: nextData.lastName, lastName: nextData.lastName,
username: nextData.username, username: nextData.username,
email: nextData.email, email: nextData.email || draftData.value.email,
roles: nextData.roles as RoleValue[], roles: nextData.roles as RoleValue[],
language: frontendLanguage, language: frontendLanguage,
region: nextData.region as any region: nextData.region as any

View File

@@ -32,7 +32,7 @@
class="assets-toolbar__download flex flex-center" class="assets-toolbar__download flex flex-center"
:class="{ disabled: selectedCount < 1 }" :class="{ disabled: selectedCount < 1 }"
v-loading="downloadingSelected" v-loading="downloadingSelected"
@click="handleDownloadSelected" @click="handleDownloadSelected(null)"
> >
<SvgIcon name="downloadBtn" color="#fff" /> <SvgIcon name="downloadBtn" color="#fff" />
<span>{{ t('Wardrobe.assets.downloadSelected') }}</span> <span>{{ t('Wardrobe.assets.downloadSelected') }}</span>
@@ -67,7 +67,7 @@
download download
:url="item.thumbnailUrl" :url="item.thumbnailUrl"
:name="item.listingName" :name="item.listingName"
@download.stop="handleDownloadSelected(item)" @download="handleDownloadSelected(item)"
:showPrice="false" :showPrice="false"
></CommodityItem> ></CommodityItem>
</div> </div>
@@ -323,7 +323,7 @@
} }
const downloadingSelected = ref(false) const downloadingSelected = ref(false)
const handleDownloadSelected = (assets) => { const handleDownloadSelected = (assets = null) => {
const items = assets ? [assets] : dataList.value.filter((item) => item.checked) const items = assets ? [assets] : dataList.value.filter((item) => item.checked)
downloadingSelected.value = true downloadingSelected.value = true
@@ -350,7 +350,8 @@
}) })
.catch((error) => { .catch((error) => {
console.error('Download failed:', error) console.error('Download failed:', error)
}).finally(() => { })
.finally(() => {
downloadingSelected.value = false downloadingSelected.value = false
}) })
} }

View File

@@ -97,7 +97,7 @@
import { computed, onMounted, ref, shallowRef } from 'vue' import { computed, onMounted, ref, shallowRef } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { fetchMyOrders ,fetchDownloadItemsByGet} from '@/api/user' import { fetchMyOrders, fetchDownloadItemsByGet } from '@/api/user'
import ScItem from '@/views/shoppingCart/sc-item.vue' import ScItem from '@/views/shoppingCart/sc-item.vue'
import Empty from './Empty.vue' import Empty from './Empty.vue'
@@ -257,7 +257,26 @@
} }
const handleDownload = (order) => { const handleDownload = (order) => {
console.log(order) const ids = order.items.map((item) => item.id)
fetchDownloadItemsByGet({ ids }).then((res) => {
console.log(res)
const disposition = res.headers['content-disposition']
const fileName = disposition?.split('filename=')[1]?.replace(/"/g, '') || 'download.zip'
const blob = res.data
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
const timestamp = new Date().getTime()
link.download = fileName || `wardrobe_download_${timestamp}.zip`
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(url)
})
} }
const handleRouteBrand = (order: OrderRecord) => { const handleRouteBrand = (order: OrderRecord) => {