@beisen-platform/export-form
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -20,3 +20,3 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
import { fetchWithCors, context as runtimeContext, urlHelper } from '@beisen-platform/platform-runtime-helpers'; | ||
import Tip from '@beisen-platform/platform-tip'; | ||
import Tip, { ajaxErrorDecoder } from '@beisen-platform/platform-tip'; | ||
import Loading from '@beisen-platform/loading'; | ||
@@ -282,32 +282,18 @@ | ||
}).then(function (resp) { | ||
if (parseInt(resp.code) !== 200) { | ||
_this2.setState({ | ||
showLoading: false, | ||
showTip: true, | ||
tipInfo: { | ||
infoType: 'error', | ||
title: resp.message | ||
} | ||
}); | ||
} else { | ||
_this2.setState({ | ||
showLoading: false, | ||
showTip: true, | ||
tipInfo: { | ||
infoType: 'success', | ||
title: resp.message, | ||
content: resp.moreMessage ? resp.moreMessage : [] | ||
} | ||
}); | ||
} | ||
var tipInfo = ajaxErrorDecoder(resp); | ||
_this2.setState({ | ||
showLoading: false, | ||
showTip: true, | ||
tipInfo: tipInfo | ||
}); | ||
_this2.afterSave(resp); | ||
}, function (error) { | ||
var tipInfo = ajaxErrorDecoder(error.json); | ||
_this2.setState({ | ||
showLoading: false, | ||
showTip: true, | ||
tipInfo: { | ||
infoType: 'error', | ||
title: error.json.message | ||
} | ||
tipInfo: tipInfo | ||
}); | ||
@@ -326,4 +312,13 @@ }); | ||
value: function renderTip() { | ||
if (this.state.showTip) { | ||
return React.createElement(Tip, this.state.tipInfo); | ||
var _this3 = this; | ||
if (this.state.showTip && this.state.tipInfo) { | ||
return React.createElement(Tip, _extends({}, this.state.tipInfo, { | ||
hide: function hide() { | ||
_this3.setState({ | ||
showTip: false, | ||
tipInfo: null | ||
}); | ||
} | ||
})); | ||
} | ||
@@ -330,0 +325,0 @@ } |
{ | ||
"name": "@beisen-platform/export-form", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -5,3 +5,3 @@ import React,{ Component } from 'react'; | ||
import { fetchWithCors, context as runtimeContext, urlHelper } from '@beisen-platform/platform-runtime-helpers'; | ||
import Tip from '@beisen-platform/platform-tip'; | ||
import Tip, {ajaxErrorDecoder} from '@beisen-platform/platform-tip'; | ||
import Loading from '@beisen-platform/loading'; | ||
@@ -118,3 +118,3 @@ require('./index.scss'); | ||
if(!data.queryUrl.extendFormPage) { | ||
delete data.queryUrl.shadow_context; | ||
@@ -219,10 +219,8 @@ _temp = this._distinctAddtional(_temp,data.queryUrl); | ||
fetchWithCors(formSaveUrl + '&exportFileType=' + this.state.value,{ method: 'POST', params: popOptions.searchData }).then(resp => { | ||
if(parseInt(resp.code) !== 200) { | ||
this.setState({showLoading: false,showTip: true, tipInfo: { infoType: 'error',title: resp.message }}); | ||
}else { | ||
this.setState({showLoading: false,showTip: true, tipInfo: { infoType: 'success',title: resp.message,content: resp.moreMessage ? resp.moreMessage : []}}); | ||
} | ||
const tipInfo = ajaxErrorDecoder(resp); | ||
this.setState({showLoading: false,showTip: true, tipInfo: tipInfo}); | ||
this.afterSave(resp); | ||
},error => { | ||
this.setState({ showLoading: false,showTip: true, tipInfo: { infoType: 'error',title: error.json.message } }); | ||
const tipInfo = ajaxErrorDecoder(error.json); | ||
this.setState({ showLoading: false,showTip: true, tipInfo: tipInfo }); | ||
}); | ||
@@ -237,7 +235,8 @@ } | ||
renderTip() { | ||
if(this.state.showTip) { | ||
return <Tip {...this.state.tipInfo} />; | ||
if(this.state.showTip && this.state.tipInfo) { | ||
return <Tip {...this.state.tipInfo } hide={()=>{this.setState({ | ||
showTip: false, tipInfo: null })}} />; | ||
} | ||
} | ||
renderLoading() { | ||
@@ -244,0 +243,0 @@ if(this.state.showLoading) { |
26918
637