修改禅道已知bug

This commit is contained in:
qq787203167
2022-03-10 09:43:20 +08:00
parent 95af2a543e
commit 39cec7480e
+66 -44
View File
@@ -1,77 +1,99 @@
<template> <template>
<div> <div>
<a-upload name="file" :showUploadList="false" <a-upload name="file" :showUploadList="false"
class="upload-text" class="upload-text"
:multiple="false" :headers="tokenHeader" :multiple="false" :headers="tokenHeader"
:action="importUrl" :action="importUrl"
@change="handleImportZip" @change="handleImportZip"
accept=".zip"> accept=".zip">
<a-icon type="import" :rotate="270"/> <a-icon type="import" :rotate="270"/>
{{$t('import')}} {{$t('import')}}
</a-upload> </a-upload>
</div> </div>
</template> </template>
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN } from "@/store/mutation-types" import { ACCESS_TOKEN } from '@/store/mutation-types'
import eventBUs from '../../common/event' import eventBUs from '../../common/event'
export default { export default {
name: 'index', name: 'index',
props:{ props: {
url: { url: {
type: Object, type: Object,
default: {} default: {}
}, }
}, },
data(){ data() {
return{ return {
tokenHeader: {'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)}, tokenHeader: { 'X-Access-Token': Vue.ls.get(ACCESS_TOKEN) },
importUrl:window._CONFIG['domianURL']+this.url.importZipUrl, importUrl: window._CONFIG['domianURL'] + this.url.importZipUrl
} }
}, },
mounted() { mounted() {
}, },
methods:{ methods: {
handleImportZip(info){ handleImportZip(info) {
this.spinning = true this.spinning = true
if (info.file.status !== 'uploading') { if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList); console.log(info.file, info.fileList)
} }
if (info.file.status === 'done') { if (info.file.status === 'done') {
if (info.file.response.success) { if (info.file.response.success) {
// this.$message.success(`${info.file.name} 文件上传成功`);
if (info.file.response.code === 201) { if (info.file.response.code === 201) {
let { message, result: { msg,error, fileUrl, fileName } } = info.file.response let { message } = info.file.response
let href = window._CONFIG['domianURL'] + fileUrl let { name } = info.file
let content = [] let content = []
for (let i = 0; i < error.length; i++) { if (message) {
content.push(<div>{error[i]}</div>) message = message.split('</br>')
message.forEach(res => {
if (res) {
content.push( < div > { res } < /div>)
}
})
} }
this.$warning({ this.$warning({
title: message, title: name,
content: ( content: (
<div> < div >
<span>{msg}</span><br/> { content }
{content} < /div>
</div>
) )
}) })
} else { } else {
eventBUs.$emit('searchReset')
this.$message.success(info.file.response.message || `${info.file.name} 文件导入成功`) this.$message.success(info.file.response.message || `${info.file.name} 文件导入成功`)
} }
eventBUs.$emit('searchReset')
this.spinning = false this.spinning = false
} else { } else {
this.$message.error(`${info.file.name} ${info.file.response.message}`); let { message } = info.file.response
let { name } = info.file
let content = []
if (message) {
message = message.split('</br>')
message.forEach(res => {
if (res) {
content.push( < div > { res } < /div>)
}
})
}
this.$warning({
title: name,
content: (
< div >
{ content }
< /div>
)
})
this.spinning = false this.spinning = false
} }
} else if (info.file.status === 'error') { } else if (info.file.status === 'error') {
if (info.file.response.status === 500) { if (info.file.response.status === 500) {
let data = info.file.response let data = info.file.response
const token = Vue.ls.get(ACCESS_TOKEN) const token = Vue.ls.get(ACCESS_TOKEN)
if (token && data.message.includes("Token失效")) { if (token && data.message.includes('Token失效')) {
Modal.error({ Modal.error({
title: '登录已过期', title: '登录已过期',
content: '很抱歉,登录已过期,请重新登录', content: '很抱歉,登录已过期,请重新登录',
@@ -80,26 +102,26 @@
onOk: () => { onOk: () => {
store.dispatch('Logout').then(() => { store.dispatch('Logout').then(() => {
Vue.ls.remove(ACCESS_TOKEN) Vue.ls.remove(ACCESS_TOKEN)
window.location.reload(); window.location.reload()
}) })
} }
}) })
} }
this.spinning = false this.spinning = false
} else { } else {
this.$message.error(`文件导入失败: ${info.file.msg} `); this.$message.error(`文件导入失败: ${info.file.msg} `)
this.spinning = false this.spinning = false
} }
} }
}, }
}, }
} }
</script> </script>
<style> <style>
.upload-text .ant-upload{ .upload-text .ant-upload {
font-size: 14px!important; font-size: 14px !important;
font-weight: 400!important; font-weight: 400 !important;
color: #040B29!important; color: #040B29 !important;
} }
</style> </style>