Merge branch 'main' of git.waypeak.work:martial/martial-mini

This commit is contained in:
2025-12-26 14:05:28 +08:00
3 changed files with 34 additions and 33 deletions

View File

@@ -12,13 +12,13 @@ const development = {
// 测试环境配置
const test = {
baseURL: 'http://test-api.yourdomain.com',
baseURL: 'https://martial-api.aitisai.com',
timeout: 30000
}
// 生产环境配置
const production = {
baseURL: 'https://api.yourdomain.com',
baseURL: 'https://martial-api.aitisai.com',
timeout: 30000
}

View File

@@ -195,6 +195,28 @@ export default {
* 下载文件
*/
downloadFile(file) {
// 获取文件后缀
const fileExt = file.fileType || this.getFileType(file.fileName) || 'pdf'
// #ifdef H5
// H5环境直接使用a标签下载确保文件名带后缀
const link = document.createElement('a')
link.href = file.fileUrl
link.download = file.fileName // 设置下载文件名(带后缀)
link.target = '_blank'
link.style.display = 'none'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
uni.showToast({
title: '开始下载',
icon: 'success'
})
return
// #endif
// #ifndef H5
// 非H5环境
uni.showLoading({
title: '准备下载'
})
@@ -210,7 +232,7 @@ export default {
// 打开文档
uni.openDocument({
filePath: filePath,
fileType: file.fileType,
fileType: fileExt,
success: () => {
uni.hideLoading()
uni.showToast({
@@ -238,6 +260,7 @@ export default {
})
}
})
// #endif
},
/**