Authored by chenl

调整了年度特惠state结构和电子杂志的图片样式。review by 张亚宁。

... ... @@ -32,6 +32,8 @@ import {
setHost,
setServiceHost,
setPrivilegeId,
setUserLevel,
setChannel,
} from './reducers/app/appActions';
... ... @@ -70,7 +72,6 @@ export default function native(platform) {
}
else
return <View/>
},
render() {
... ... @@ -79,6 +80,9 @@ export default function native(platform) {
store.dispatch(setHost(this.props.host));
store.dispatch(setServiceHost(this.props.serviceHost));
store.dispatch(setPrivilegeId(this.props.privilegeId));
store.dispatch(setUserLevel(this.props.userLevel));
store.dispatch(setChannel(this.props.channel));
return (
<Provider store={store}>
... ...
... ... @@ -57,8 +57,8 @@ export default class FastExpress extends Component {
<Text style={styles.fastContentText}>{levelName}</Text>
<View style={styles.fastContentImageContainer}>
{
(isFastImage == 1) ? <Image source={require('../../images/fast.png')} style={styles.fastContentImage} />
: <Image source={require('../../images/nofast.png')} style={styles.fastContentImage} />
(isFastImage == 1) ? <Image source={require('../../images/yes.png')} style={styles.fastContentImage} />
: <Image source={require('../../images/no.png')} style={styles.fastContentImage} />
}
</View>
</View>
... ... @@ -199,8 +199,8 @@ let styles = StyleSheet.create({
},
fastContentImage:{
width: 30,
height: 30,
width: 15,
height: 15,
},
headerDescription1:{
... ...
... ... @@ -61,12 +61,15 @@ export default class Magazine extends Component {
return (
<ScrollView style={styles.container}>
<View>
<View style={styles.magazineContainer}>
<View style={styles.magazineBackground}>
<Text style={styles.magazineDesc}>{content}</Text>
</View>
<Text style={styles.about}>ABOUT</Text>
<Image style={styles.about} source={require('../../images/about.png')} />
<ListView
style={styles.magazineList}
... ... @@ -74,16 +77,18 @@ export default class Magazine extends Component {
horizontal={true}
renderRow={this.renderRow}
/>
</View>
<Text style={styles.yohoNowText1}>{"点击或扫描二维码YOHO!NOW APP"}</Text>
<Text style={styles.yohoNowText}>{"点击或扫描二维码YOHO!NOW APP"}</Text>
<Text style={styles.yohoNowText}>{"进入杂志频道免费下载"}</Text>
<TouchableOpacity style={styles.yohoNowImageContainer} activeOpacity={1} onPress={() => {
this.props.onPressYohoNow && this.props.onPressYohoNow();}}>
<Image style={styles.yohoNowImage} source={require('../../images/yohonow.png')} />
</TouchableOpacity>
</View>
</ScrollView>
);
}
... ... @@ -95,12 +100,18 @@ const DEVICE_WIDTH_RATIO = width / 320;
let styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
backgroundColor: '#f0f0f0',
},
magazineContainer: {
width: width,
height: 410,
},
magazineBackground: {
width: width - 60,
height: 350,
height: 340,
backgroundColor: 'white',
marginTop: 40,
marginLeft: 30,
... ... @@ -110,17 +121,15 @@ let styles = StyleSheet.create({
about:{
position: 'absolute',
top: 10,
top: 30,
left: 50,
fontSize: 35,
color: 'rgb(212,169,68)',
fontWeight: 'bold',
width: 93,
height: 23,
},
magazineDesc:{
fontSize: 15,
color: 'rgb(33,33,33)',
fontWeight: 'bold',
fontSize: 14,
color: '#000000',
marginTop: 20,
marginLeft: 12,
marginRight: 12,
... ... @@ -140,21 +149,23 @@ let styles = StyleSheet.create({
marginRight: 3,
},
yohoNowText1:{
position: 'absolute',
top: 380,
width: width - 20,
yohoNowText:{
width: width,
textAlign: 'center',
fontWeight: 'bold',
},
yohoNowImageContainer:{
position: 'absolute',
top: 400,
height: 125,
width: width,
marginTop: 10,
marginBottom: 20,
alignItems: 'center',
justifyContent: 'center',
},
yohoNowImage:{
width: 125,
height: 125,
width: 123,
height: 123,
},
});
... ...
... ... @@ -97,7 +97,7 @@ let productHeight = Platform.OS === 'ios'? (rowHeight + rowMarginTop + rowMargin
let styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#f0f0f0',
backgroundColor: 'white',
},
contentContainer: {
... ...
... ... @@ -6,6 +6,8 @@ export default keyMirror({
SET_HOST: null,
SET_SERVICE_HOST: null,
SET_PRIVILEGE_ID: null,
SET_USER_LEVEL: null,
SET_CHANNEL: null,
SET_SIMILAR_PRODUCT_INDEX: null,
... ...
... ... @@ -93,13 +93,13 @@ class YearActivityContainer extends Component {
render() {
let {isFetching, yearProduct} = this.props.yearActivity;
let {isFetching, similarIndex, list} = this.props.yearActivity;
return (
<YearActivity
isFetching={isFetching}
data={yearProduct.list}
similarIndex={yearProduct.similarIndex}
data={list}
similarIndex={similarIndex}
style={styles.container}
onEndReached={this.onEndReached}
onPressProductListProduct={this.onPressProductListProduct}
... ...
... ... @@ -7,6 +7,8 @@ const {
SET_HOST,
SET_SERVICE_HOST,
SET_PRIVILEGE_ID,
SET_USER_LEVEL,
SET_CHANNEL,
} = require('../../constants/actionTypes').default;
export function setPlatform(platform) {
... ... @@ -36,3 +38,17 @@ export function setPrivilegeId(id) {
payload: id
};
}
export function setUserLevel(level) {
return {
type: SET_USER_LEVEL,
payload: level
};
}
export function setChannel(channel) {
return {
type: SET_CHANNEL,
payload: channel
};
}
\ No newline at end of file
... ...
... ... @@ -7,7 +7,8 @@ let InitialState = Record({
host: 'http://api.yoho.cn',
serviceHost: 'http://service.yoho.cn',
privilegeId: 0,
userLevel: 3,
userLevel: "0",
channel: "1",
});
... ...
... ... @@ -7,6 +7,8 @@ const {
SET_HOST,
SET_SERVICE_HOST,
SET_PRIVILEGE_ID,
SET_USER_LEVEL,
SET_CHANNEL,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
... ... @@ -23,6 +25,10 @@ export default function appReducer(state = initialState, action) {
return state.set('serviceHost', action.payload);
case SET_PRIVILEGE_ID:
return state.set('privilegeId', action.payload);
case SET_USER_LEVEL:
return state.set('userLevel', action.payload);
case SET_CHANNEL:
return state.set('channel', action.payload);
}
return state;
... ...
... ... @@ -31,12 +31,12 @@ export function getYearActivityProductList() {
return (dispatch, getState) => {
let {app, yearActivity} = getState();
if (yearActivity.get('isFetching') || yearActivity.yearProduct.get('endReached')) {
if (yearActivity.get('isFetching') || yearActivity.get('endReached')) {
return;
}
let userLevel = yearActivity.userLevel;
let page = yearActivity.yearProduct.get('currentPage') + 1;
let userLevel = app.userLevel;
let page = yearActivity.get('currentPage') + 1;
dispatch(getYearProductRequest());
... ... @@ -45,7 +45,7 @@ export function getYearActivityProductList() {
let payload = parseUtils.parsePageInfoList(json);
if (payload.currentPage > 1) {
let oldList = yearActivity.yearProduct.get('list').toJS();
let oldList = yearActivity.get('list').toJS();
let newList = [...oldList, ...payload.list];
payload.list = newList;
}
... ...
... ... @@ -4,8 +4,6 @@ import {Record, List, Map} from 'immutable';
let InitialState = Record({
isFetching: false,
userLevel: 3,
yearProduct: new (Record({
list: List(),
currentPage: 0,
endReached: false,
... ... @@ -13,9 +11,6 @@ let InitialState = Record({
total: 0,
pageSize: 50,
pageCount: 0,
})),
});
export default InitialState;
... ...
... ... @@ -23,7 +23,7 @@ export default function yearActivityReducer(state=initialState, action) {
return state.set('type', action.payload);
}
case SET_SIMILAR_PRODUCT_INDEX: {
return state.setIn(['yearProduct', 'similarIndex'], action.payload.rowID);
return state.set('similarIndex', action.payload.rowID);
}
case GET_YEARACTIVITY_PRODUCT_REQUEST: {
return state.set('isFetching', true);
... ... @@ -32,11 +32,11 @@ export default function yearActivityReducer(state=initialState, action) {
let json = action.payload;
return state.set('isFetching', false)
.setIn(['yearProduct', 'list'], Immutable.fromJS(json.list))
.setIn(['yearProduct', 'currentPage'], json.currentPage)
.setIn(['yearProduct', 'pageCount'], json.pageCount)
.setIn(['yearProduct', 'total'], json.total)
.setIn(['yearProduct', 'endReached'], json.endReached);
.set('list', Immutable.fromJS(json.list))
.set('currentPage', json.currentPage)
.set('pageCount', json.pageCount)
.set('total', json.total)
.set('endReached', json.endReached);
}
case GET_YEARACTIVITY_PRODUCT_FAILURE: {
return state.set('isFetching', false);
... ...
... ... @@ -12,12 +12,13 @@ export default class yearActivityService {
this.api = new Request(baseURL);
}
async getYearProductList(userLevel, page){
async getYearProductList(channel, limit, page){
return await this.api.get({
url: '',
body: {
method: 'app.product.vip',
user_vip_level: userLevel,
method: 'app.search.sales',
select_gender: channel,
limit,
page,
}
})
... ...