...
|
...
|
@@ -84,7 +84,7 @@ function processProfile(profile){ |
|
|
case 'portrait':
|
|
|
cellItem.url = profile.head_ico;
|
|
|
break;
|
|
|
case 'nickname':
|
|
|
case 'nick_name':
|
|
|
cellItem.content = profile.nickname;
|
|
|
break;
|
|
|
case 'gender':{
|
...
|
...
|
@@ -95,7 +95,7 @@ function processProfile(profile){ |
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 'birthDay':
|
|
|
case 'birthday':
|
|
|
cellItem.content = profile.birthday;
|
|
|
break;
|
|
|
case 'VIPLevel':{
|
...
|
...
|
@@ -117,3 +117,143 @@ function processProfile(profile){ |
|
|
dispatch(updatePageCellList(pageCellList));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function modifyUserBaseInfo(cellList) {
|
|
|
return (dispatch, getState) => {
|
|
|
let {app, personalInfo} = getState();
|
|
|
let {pageCellList} = personalInfo;
|
|
|
if (!cellList) {
|
|
|
cellList = pageCellList.toJS();
|
|
|
}
|
|
|
let params = {};
|
|
|
cellList.map((cellItem, i) => {
|
|
|
if (cellItem.id == 'gender') {
|
|
|
let gender = 0;
|
|
|
if (cellItem.content == 'BOY') {
|
|
|
gender = 1;
|
|
|
} else if (cellItem.content == 'GIRL') {
|
|
|
gender = 2;
|
|
|
}
|
|
|
params.gender = gender;
|
|
|
}else {
|
|
|
if (cellItem.baseUpload) {
|
|
|
params[cellItem.id] = cellItem.content;
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
return new PersonalInfoService(app.host).modifyUserBaseInfo(params)
|
|
|
.then(json => {
|
|
|
|
|
|
console.log('-----更新信息');
|
|
|
console.log(json);
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.log('-----更新信息');
|
|
|
console.log(error);
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function onPressInfoCell(cellInfo) {
|
|
|
return (dispatch, getState) => {
|
|
|
let {app, personalInfo} = getState();
|
|
|
let {pageCellList} = personalInfo;
|
|
|
pageCellList = pageCellList.toJS();
|
|
|
switch (cellInfo.get('id')) {
|
|
|
case 'portrait':{
|
|
|
ReactNative.NativeModules.YH_PersonalInfoHelper.selectAvatarAction()
|
|
|
.then(data => {
|
|
|
if (data && data != '') {
|
|
|
pageCellList[0].url = data;
|
|
|
}
|
|
|
dispatch(updatePageCellList(pageCellList));
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.log('-----imageUrl error');
|
|
|
console.log(error);
|
|
|
});
|
|
|
}
|
|
|
break;
|
|
|
case 'nick_name': {
|
|
|
ReactNative.NativeModules.YH_PersonalInfoHelper.gotoEditNickName(cellInfo.get('content'))
|
|
|
.then(data => {
|
|
|
pageCellList[cellInfo.get('index')].content = data;
|
|
|
dispatch(updatePageCellList(pageCellList));
|
|
|
dispatch(modifyUserBaseInfo(pageCellList));
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.log('-----nickname error');
|
|
|
console.log(error);
|
|
|
});
|
|
|
}
|
|
|
break;
|
|
|
case 'gender':{
|
|
|
ReactNative.NativeModules.YH_PersonalInfoHelper.selectGenderAction()
|
|
|
.then(data => {
|
|
|
console.log('-----gender');
|
|
|
console.log(data);
|
|
|
pageCellList[cellInfo.get('index')].content = data;
|
|
|
dispatch(updatePageCellList(pageCellList));
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.log('-----nickname error');
|
|
|
console.log(error);
|
|
|
});
|
|
|
}
|
|
|
break;
|
|
|
case 'birthday':{
|
|
|
ReactNative.NativeModules.YH_PersonalInfoHelper.selectBirthdayAction()
|
|
|
.then(data => {
|
|
|
console.log('-----gender');
|
|
|
console.log(data);
|
|
|
pageCellList[cellInfo.get('index')].content = data;
|
|
|
dispatch(updatePageCellList(pageCellList));
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.log('-----nickname error');
|
|
|
console.log(error);
|
|
|
});
|
|
|
}
|
|
|
break;
|
|
|
case 'VIPLevel':{
|
|
|
ReactNative.NativeModules.YH_PersonalInfoHelper.gotoVIPLevelVC();
|
|
|
}
|
|
|
break;
|
|
|
case 'mineQRCode':{
|
|
|
ReactNative.NativeModules.YH_PersonalInfoHelper.gotoMineQRCode();
|
|
|
}
|
|
|
break;
|
|
|
case 'height':
|
|
|
case 'weight':{
|
|
|
ReactNative.NativeModules.YH_PersonalInfoHelper.selectHeightWeightAction()
|
|
|
.then(data => {
|
|
|
console.log('-----height & weight');
|
|
|
console.log(data);
|
|
|
if (cellInfo.get('id') == 'height') {
|
|
|
pageCellList[cellInfo.get('index')].content = data.height;
|
|
|
pageCellList[cellInfo.get('index') + 1].content = data.weight;
|
|
|
} else if (cellInfo.get('id') == 'weight') {
|
|
|
pageCellList[cellInfo.get('index')].content = data.weight;
|
|
|
pageCellList[cellInfo.get('index') - 1].content = data.height;
|
|
|
}
|
|
|
dispatch(updatePageCellList(pageCellList));
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.log('-----nickname error');
|
|
|
console.log(error);
|
|
|
});
|
|
|
}
|
|
|
break;
|
|
|
case 'addressManage':{
|
|
|
ReactNative.NativeModules.YH_PersonalInfoHelper.gotoManagerAddressVC();
|
|
|
}
|
|
|
break;
|
|
|
case 'accountBind':{
|
|
|
ReactNative.NativeModules.YH_PersonalInfoHelper.gotoAccountBindVC();
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
|
|
|
}
|
|
|
}
|
|
|
} |
...
|
...
|
|