Authored by 李犇

个人中心学生认证是否展示通过开关控制——review by 盖剑秋

... ... @@ -27,6 +27,7 @@ import {
import {
getMineUserInfoSuccess,
getMemberBillTaskRedDotSuccess,
setIsNeedShowXsrz,
} from './reducers/mine/mineActions';
function getInitialState() {
... ... @@ -47,12 +48,15 @@ export default function native(platform) {
let channel = this.props.channel;
let profilesInfo = this.props.profilesInfo;
let memberBillNew = this.props.memberBillNew;
let isOpenXsrz = this.props.isOpenXsrz;
if (profilesInfo) {
profilesInfo = JSON.parse(profilesInfo);
}
channel && store.dispatch(setChannel(channel));
profilesInfo && store.dispatch(getMineUserInfoSuccess(profilesInfo));
memberBillNew && store.dispatch(getMemberBillTaskRedDotSuccess(memberBillNew));
store.dispatch(setIsNeedShowXsrz(isOpenXsrz));
return (
<Provider store={store}>
<MineContainer />
... ...
... ... @@ -52,6 +52,7 @@ export default class MineList extends React.Component {
_renderHeader() {
return (
<MineListHeader
isNeedShowXsrz={this.props.isNeedShowXsrz}
profile={this.props.profile}
mineInfoNum={this.props.mineInfoNum}
redPackageNum={this.props.redPackageNum}
... ...
... ... @@ -135,6 +135,7 @@ export default class MineListHeader extends React.Component {
let fontFamilyStyle = {};
let localUid = '0';
let {
isNeedShowXsrz,
profile,
mineInfoNum,
redPackageNum,
... ... @@ -271,13 +272,15 @@ export default class MineListHeader extends React.Component {
}
{
(profile.uid != '0' && profile.vip_info.is_student == 1) ? null :
<TouchableOpacity style={{position:'absolute',right:0,top:bgPaddingTop}} onPress={() => this.props.onPressItem('mineStudentHome','')}>
<Image
style={{width: 80,height: 27,marginBottom:15}}
resizeMode={'stretch'} source={require('../../image/renzheng_bg.png')}>
<Text style={styles.renzheng_text} numberOfLines={1}>学生认证</Text>
</Image>
</TouchableOpacity>
(isNeedShowXsrz) ?
<TouchableOpacity style={{position:'absolute',right:0,top:bgPaddingTop}} onPress={() => this.props.onPressItem('mineStudentHome','')}>
<Image
style={{width: 80,height: 27,marginBottom:15}}
resizeMode={'stretch'} source={require('../../image/renzheng_bg.png')}>
<Text style={styles.renzheng_text} numberOfLines={1}>学生认证</Text>
</Image>
</TouchableOpacity> : null
}
<View style={styles.fav_container}>
... ...
... ... @@ -3,6 +3,7 @@ import keyMirror from 'key-mirror';
export default keyMirror({
SET_PLATFORM:null,
SET_CHANNEL:null,
SET_IS_NEED_SHOW_XSRZ:null,
MINECENTER_PRODUCT_REQUEST:null,
MINECENTER_PRODUCT_SUCCESS:null,
... ...
... ... @@ -284,6 +284,7 @@ class MineContainer extends Component {
render() {
let {
isFetching,
isNeedShowXsrz,
isLogin,
open,
profile,
... ... @@ -301,6 +302,7 @@ class MineContainer extends Component {
return (
<MineList
isFetching={isFetching}
isNeedShowXsrz={isNeedShowXsrz}
isLogin={isLogin}
productListForMineCenter={open.productListForMineCenter}
mineCenterInfo={open.mineCenterInfo}
... ...
... ... @@ -8,6 +8,7 @@ import MineService from '../../services/MineService';
const {
SET_PLATFORM,
SET_IS_NEED_SHOW_XSRZ,
MINECENTER_PRODUCT_REQUEST,
MINECENTER_PRODUCT_SUCCESS,
... ... @@ -71,6 +72,13 @@ const {
} = require('../../constants/actionTypes').default;
export function setIsNeedShowXsrz(json) {
return {
type: SET_IS_NEED_SHOW_XSRZ,
payload: json,
}
}
export function productListForMineCenterRequest() {
return {
type: MINECENTER_PRODUCT_REQUEST,
... ...
... ... @@ -4,6 +4,7 @@ import {Record, List, Map} from 'immutable';
let InitialState = Record({
isFetching: false,
isNeedShowXsrz:true,
open: new (Record({
productListForMineCenter: new (Record({
list: List(),
... ...
... ... @@ -5,6 +5,7 @@ import Immutable, {Map} from 'immutable';
const {
SET_PLATFORM,
SET_IS_NEED_SHOW_XSRZ,
MINECENTER_PRODUCT_REQUEST,
MINECENTER_PRODUCT_SUCCESS,
... ... @@ -74,6 +75,11 @@ export default function appReducer(state = initialState, action) {
if (!(state instanceof InitialState)) return initialState.merge(state);
switch (action.type) {
case SET_IS_NEED_SHOW_XSRZ:{
let isNeedShowXsrz = action.payload;
return state.set('isNeedShowXsrz', isNeedShowXsrz);
}
case MINECENTER_PRODUCT_SUCCESS: {
let {
product_list,
... ...