2015-07-11 16:40:59 +08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
//import React from 'react';
|
|
|
|
import Notification from 'rc-notification';
|
|
|
|
|
2015-07-11 18:00:58 +08:00
|
|
|
var defaultDuration = 2.5;
|
2015-07-11 16:40:59 +08:00
|
|
|
|
|
|
|
var getMessageInstance = function(){
|
2015-07-11 18:00:58 +08:00
|
|
|
return Notification.newInstance({
|
2015-07-11 16:40:59 +08:00
|
|
|
prefixCls: 'ant-message',
|
|
|
|
transitionName: 'move-up',
|
|
|
|
style: {
|
|
|
|
top: '16px'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2015-07-11 18:00:58 +08:00
|
|
|
export default {
|
2015-07-11 11:27:10 +08:00
|
|
|
info: function(m, t) {
|
2015-07-11 18:00:58 +08:00
|
|
|
var message = getMessageInstance();
|
|
|
|
t = t || defaultDuration;
|
2015-07-11 16:40:59 +08:00
|
|
|
message.notice({
|
|
|
|
key: 'simpleMessage',
|
2015-07-11 11:27:10 +08:00
|
|
|
duration: t,
|
2015-07-11 16:40:59 +08:00
|
|
|
style: {
|
|
|
|
left: '50%'
|
|
|
|
},
|
2015-07-11 11:27:10 +08:00
|
|
|
content: <div className='ant-message-custom-content'>
|
|
|
|
<i className='anticon anticon-info-circle ant-message-info'></i>
|
|
|
|
<span>{m}</span>
|
|
|
|
</div>
|
2015-07-11 16:40:59 +08:00
|
|
|
});
|
|
|
|
},
|
2015-07-11 11:27:10 +08:00
|
|
|
success: function(m, t) {
|
2015-07-11 18:00:58 +08:00
|
|
|
var message = getMessageInstance();
|
|
|
|
t = t || defaultDuration;
|
2015-07-11 16:40:59 +08:00
|
|
|
message.notice({
|
|
|
|
key: 'simpleMessage1',
|
|
|
|
transitionName: 'move-up',
|
2015-07-11 11:27:10 +08:00
|
|
|
duration: t,
|
2015-07-11 16:40:59 +08:00
|
|
|
style: {
|
|
|
|
left: '50%'
|
|
|
|
},
|
2015-07-11 11:27:10 +08:00
|
|
|
content: <div className='ant-message-custom-content'>
|
|
|
|
<i className='anticon anticon-check-circle ant-message-success'></i>
|
|
|
|
<span>{m}</span>
|
|
|
|
</div>
|
2015-07-11 16:40:59 +08:00
|
|
|
});
|
|
|
|
},
|
2015-07-11 11:27:10 +08:00
|
|
|
error: function(m, t) {
|
2015-07-11 18:00:58 +08:00
|
|
|
var message = getMessageInstance();
|
|
|
|
t = t || defaultDuration;
|
2015-07-11 16:40:59 +08:00
|
|
|
message.notice({
|
|
|
|
key: 'simpleMessage2',
|
|
|
|
transitionName: 'move-up',
|
2015-07-11 11:27:10 +08:00
|
|
|
duration: t,
|
2015-07-11 16:40:59 +08:00
|
|
|
style: {
|
|
|
|
left: '50%'
|
|
|
|
},
|
2015-07-11 11:27:10 +08:00
|
|
|
content: <div className='ant-message-custom-content'>
|
|
|
|
<i className='anticon anticon-exclamation-circle ant-message-error'></i>
|
|
|
|
<span>{m}</span>
|
|
|
|
</div>
|
2015-07-11 16:40:59 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|