修改已知bug1

This commit is contained in:
qq787203167
2022-06-02 11:48:36 +08:00
parent f0ebbf2948
commit 9421f0a0b6
+41 -6
View File
@@ -1,6 +1,25 @@
import Vue from 'vue' import Vue from 'vue'
import { axios } from '@/utils/request' import { axios } from '@/utils/request'
import JLoadingOne from '../components/jero/JLoadingOne'
const showDrawer = {}
const DrawerConstructor = Vue.extend(JLoadingOne)
let currentMsg
const initInstance = () => {
currentMsg = new DrawerConstructor({})
document.body.appendChild(currentMsg.$mount().$el)
}
let index = {
showDrawer(options) {
if (!currentMsg) {
initInstance()
}
if (typeof options === 'object') {
Object.assign(currentMsg, options)
}
}
}
const api = { const api = {
user: '/mock/api/user', user: '/mock/api/user',
role: '/mock/api/role', role: '/mock/api/role',
@@ -121,6 +140,18 @@ export function downFile(url,parameter){
* @returns {*} * @returns {*}
*/ */
export function downloadFile(url, fileName, parameter, callback) { export function downloadFile(url, fileName, parameter, callback) {
let langCn = localStorage.language
// 默认中文
let isTrue
if (langCn == 'en-us') {
isTrue = true
} else if (langCn == 'zh-cn') {
isTrue = false
}
index.showDrawer({
loading: true,
isTrue: isTrue
})
return downFile(url, parameter).then((data) => { return downFile(url, parameter).then((data) => {
if (!data || data.size === 0) { if (!data || data.size === 0) {
Vue.prototype['$message'].warning('文件下载失败') Vue.prototype['$message'].warning('文件下载失败')
@@ -139,6 +170,10 @@ export function downloadFile(url, fileName, parameter,callback) {
document.body.removeChild(link) //下载完成移除元素 document.body.removeChild(link) //下载完成移除元素
window.URL.revokeObjectURL(url) //释放掉blob对象 window.URL.revokeObjectURL(url) //释放掉blob对象
} }
index.showDrawer({
loading: false,
isTrue: isTrue
})
callback && callback() callback && callback()
}) })
} }
@@ -155,8 +190,8 @@ export function uploadAction(url,parameter){
data: parameter, data: parameter,
method: 'post', method: 'post',
headers: { headers: {
'Content-Type': 'multipart/form-data', // 文件上传 'Content-Type': 'multipart/form-data' // 文件上传
}, }
}) })
} }
@@ -170,13 +205,13 @@ export function getFileAccessHttpUrl(avatar,subStr) {
if (!subStr) subStr = 'http' if (!subStr) subStr = 'http'
try { try {
if (avatar && avatar.startsWith(subStr)) { if (avatar && avatar.startsWith(subStr)) {
return avatar; return avatar
} else { } else {
if(avatar && avatar.length>0 && avatar.indexOf('[')==-1){ if (avatar && avatar.length > 0 && avatar.indexOf('[') == -1) {
return window._CONFIG['staticDomainURL'] + "/" + avatar; return window._CONFIG['staticDomainURL'] + '/' + avatar
} }
} }
} catch (err) { } catch (err) {
return; return
} }
} }