百度查了也没明白怎么去掉
<ul class="fileList">
<li v-for="(file, fileIndex) in infoData.files" :key="fileIndex" :class="{ iszip: /\.(zip|rar|7z)$/.test(file.name) }" @click="downLoad(file)">
<a class="down-load-link">{{ file.name }}</a>
<a class="down-load-size">{{ file.ext.size | fileSize }}</a>
</li>
</ul>
async downLoad(item) {
console.log(item)
const path = await this.download(item)
window.location.href = path
},
async download(item) {
console.log('downLoad--------------------------')
console.log(item)
// 检查是否已有 Oss Client
let client = checkOssClient()
if (client === null) {
try {
if (identity !== 'teacher') {
const res = await stuOSSToken({ token: hasToken })
if (res.respCode === '0000') {
const credentials = res.respResult.Credentials
client = initOssClient(credentials)
}
} else {
const res = await teaOSSToken({ token: hasToken })
if (res.respCode === '0000') {
const credentials = res.respResult.Credentials
client = initOssClient(credentials)
}
}
} catch (error) {
this.$message.error(`${error}`)
return
}
}
const url = item.url
console.log(url)
const response = {
'content-disposition': `attachment; filename=${encodeURIComponent(item.name)}`
}
let link
try {
const res = await client.signatureUrl(url, { response })
link = res
} catch (error) {
this.$message.error(`${error}`)
}
return link
},