Authored by 于良

Merge branch 'local' into develop

... ... @@ -81,11 +81,6 @@ export default class LikeMessage extends React.Component {
}
}
let {width, height} = Dimensions.get('window');
let navbarHeight = (Platform.OS === 'android') ? 50 : 64;
let styles = StyleSheet.create({
container: {
flex: 1,
... ...
... ... @@ -132,7 +132,7 @@ export default class MessageCenter extends React.Component {
render() {
let {sysMsg, likeMsg, list, endReached, isRefreshing, isLoadingMore, isFetching,} = this.props;
let {sysMsg, likeMsg, list, endReached, isRefreshing, isLoadingMore, isFetching, isListFetching} = this.props;
let dataSource = {
sysMsg: sysMsg.toArray(),
likeMsg: likeMsg.toArray(),
... ... @@ -172,7 +172,7 @@ export default class MessageCenter extends React.Component {
} else {
return <LoadMoreIndicator
isVisible={isLoadingMore}
animating={isFetching}
animating={isListFetching}
/>
}
}}
... ... @@ -184,16 +184,10 @@ export default class MessageCenter extends React.Component {
}
let {width, height} = Dimensions.get('window');
let navbarHeight = (Platform.OS === 'android') ? 50 : 64;
let styles = StyleSheet.create({
container: {
flex: 1,
top: navbarHeight,
// height: height-navbarHeight,
backgroundColor: 'white',
marginBottom:navbarHeight,
},
separator: {
height: 0.5,
... ...
... ... @@ -44,7 +44,6 @@ export default class MsgCenterNormalCell extends React.Component {
render() {
let data = this.props.data.toJS();
console.log(data);
let {user, title, timeago, post, subTitle, isRead} = data;
let postId = post.id;
return (
... ...
... ... @@ -121,13 +121,9 @@ export default class SystemMessage extends React.Component {
}
let {width, height} = Dimensions.get('window');
let navbarHeight = (Platform.OS === 'android') ? 50 : 64;
let styles = StyleSheet.create({
container: {
top: navbarHeight,
height: height-navbarHeight,
flex: 1,
backgroundColor: 'white',
},
... ...
... ... @@ -420,9 +420,7 @@ export default class User extends React.Component {
let styles = StyleSheet.create({
container: {
top: 0,
flex: 1,
height: height,
backgroundColor: 'transparent',
},
... ...
... ... @@ -105,9 +105,9 @@ class MessageCenterContainer extends React.Component {
render() {
let {centerMsg} = this.props.message;
let {ptr, isFetching, sysMsg, likeMsg, list, endReached} = centerMsg;
let {ptr, isFetching, sysMsg, likeMsg, isListFetching, list, endReached} = centerMsg;
let isRefreshing = ptr;
let isLoadingMore = !ptr && isFetching;
let isLoadingMore = !ptr && isListFetching;
return (
<View style={styles.container}>
... ... @@ -128,6 +128,7 @@ class MessageCenterContainer extends React.Component {
onPressSystemCell={this._onPressSystemCell}
onPressLikeCell={this._onPressLikeCell}
onEndReached={this._onEndReached}
isListFetching={isListFetching}
/>
</View>
);
... ... @@ -140,9 +141,9 @@ let navbarHeight = (Platform.OS === 'android') ? 50 : 64;
let styles = StyleSheet.create({
container: {
// top: 0,
height: height,
backgroundColor: 'transparent'
top: navbarHeight,
marginBottom: navbarHeight,
flex: 1,
},
});
... ...
... ... @@ -119,9 +119,9 @@ let navbarHeight = (Platform.OS === 'android') ? 50 : 64;
let styles = StyleSheet.create({
container: {
// top: 0,
height: height,
backgroundColor: 'transparent'
top: navbarHeight,
marginBottom: navbarHeight,
flex: 1,
},
});
... ...
... ... @@ -299,9 +299,9 @@ let navbarHeight = (Platform.OS === 'android') ? 50 : 64;
let styles = StyleSheet.create({
container: {
// top: 0,
height: height,
backgroundColor: 'transparent'
top: 0,
marginBottom: 0,
flex: 1,
},
});
... ...
... ... @@ -184,7 +184,7 @@ export function replyMessage(ptr = false) {
return (dispatch, getState) => {
let {user, message} = getState();
if (!ptr) {
if (message.centerMsg.ptr || message.centerMsg.isFetching || message.centerMsg.endReached || message.centerMsg.error) {
if (message.centerMsg.ptr || message.centerMsg.isListFetching || message.centerMsg.endReached || message.centerMsg.listError) {
return;
}
}
... ... @@ -271,30 +271,23 @@ export function goToSystemMessage() {
function parseMessageInfo(json) {
let {praiseMsg, systemMsg} = json;
let like={} , sys={};
if (praiseMsg) {
like = {
tips: praiseMsg.title || '',
isRead: (praiseMsg.isRead === 'N')?false:true,
timeagoStr:timeago(praiseMsg.createTime),
};
}
let likeMsg = {
tips: praiseMsg && praiseMsg.title || '',
isRead: praiseMsg && (praiseMsg.isRead === 'N') ? false : true,
timeagoStr: praiseMsg && timeago(praiseMsg.createTime) || '',
};
let sysMsg = {
tips: systemMsg && systemMsg.title || '',
isRead: systemMsg && (systemMsg.isRead === 'N') ? false : true,
timeagoStr: systemMsg && timeago(systemMsg.createTime) || '',
};
if (systemMsg) {
sys = {
tips: systemMsg.title || '',
isRead: (systemMsg.isRead === 'N')?false:true,
timeagoStr:timeago(systemMsg.createTime),
};
}
let result = {
likeMsg: like,
sysMsg: sys,
likeMsg,
sysMsg,
};
return result;
}
function parseMessageList(json) {
... ...
... ... @@ -11,8 +11,6 @@ let InitialState = Record({
isFetching: false,
ptr: true,
error: null,
lastedTime: 0,
list: List(),
sysMsg: new (Record({
timeagoStr: null,
tips: null,
... ... @@ -23,6 +21,10 @@ let InitialState = Record({
tips: null,
isRead: true,
})),
isListFetching: false,
listError: null,
lastedTime: 0,
list: List(),
endReached: false,
})),
... ...
... ... @@ -106,8 +106,8 @@ export default function message(state = initialState, action) {
case MESSAGE_CENTER_REQUEST:
{
let nextState = state.setIn(['centerMsg', 'isFetching'], true)
.setIn(['centerMsg', 'error'], null);
let nextState = state.setIn(['centerMsg', 'isListFetching'], true)
.setIn(['centerMsg', 'listError'], null);
return nextState;
}
break;
... ... @@ -115,8 +115,8 @@ export default function message(state = initialState, action) {
case MESSAGE_CENTER_SUCCESS:
{
let {lastedTime, list, endReached} = action.payload;
let nextState = state.setIn(['centerMsg', 'isFetching'], false)
.setIn(['centerMsg', 'error'], null)
let nextState = state.setIn(['centerMsg', 'isListFetching'], false)
.setIn(['centerMsg', 'listError'], null)
.setIn(['centerMsg', 'lastedTime'], lastedTime)
.setIn(['centerMsg', 'endReached'], endReached)
.setIn(['centerMsg', 'list'], Immutable.fromJS(list));
... ... @@ -126,8 +126,8 @@ export default function message(state = initialState, action) {
case MESSAGE_CENTER_FAILURE:
{
return state.setIn(['centerMsg', 'isFetching'], false)
.setIn(['centerMsg', 'error'], action.payload);
return state.setIn(['centerMsg', 'isListFetching'], false)
.setIn(['centerMsg', 'listError'], action.payload);
}
break;
... ...
... ... @@ -9,7 +9,6 @@ export default class MessageService {
}
async messageInfo(uid) {
console.log('获取消息中心数据 uid = ' + uid);
return await this.api.get({
url: '',
body: {
... ... @@ -27,7 +26,6 @@ export default class MessageService {
}
async messageList(uid, type, lastedTime, limit) {
console.log('获取消息列表 type = ' + type);
return await this.api.get({
url: '',
body: {
... ...
... ... @@ -16,7 +16,12 @@ export default function timeago(timestamp) {
}
let isNDaysAgo = timeagoStr.indexOf('天');
if (isNDaysAgo !== -1) {
let isNWeeksAgo = timeagoStr.indexOf('周');
let isNMonthsAgo = timeagoStr.indexOf('月');
let isNYearsAgo = timeagoStr.indexOf('年');
let isFutrueTime = timeagoStr.indexOf('后');
if (isNDaysAgo !== -1 || isNWeeksAgo !== -1 || isNMonthsAgo !== -1 || isNYearsAgo !== -1 || isFutrueTime !== -1) {
return moment(timestamp, 'x').format('MM.DD.YYYY');
}
... ...