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