Authored by chenl

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

@@ -32,6 +32,8 @@ import { @@ -32,6 +32,8 @@ import {
32 setHost, 32 setHost,
33 setServiceHost, 33 setServiceHost,
34 setPrivilegeId, 34 setPrivilegeId,
  35 + setUserLevel,
  36 + setChannel,
35 } from './reducers/app/appActions'; 37 } from './reducers/app/appActions';
36 38
37 39
@@ -70,7 +72,6 @@ export default function native(platform) { @@ -70,7 +72,6 @@ export default function native(platform) {
70 } 72 }
71 else 73 else
72 return <View/> 74 return <View/>
73 -  
74 }, 75 },
75 76
76 render() { 77 render() {
@@ -79,6 +80,9 @@ export default function native(platform) { @@ -79,6 +80,9 @@ export default function native(platform) {
79 store.dispatch(setHost(this.props.host)); 80 store.dispatch(setHost(this.props.host));
80 store.dispatch(setServiceHost(this.props.serviceHost)); 81 store.dispatch(setServiceHost(this.props.serviceHost));
81 store.dispatch(setPrivilegeId(this.props.privilegeId)); 82 store.dispatch(setPrivilegeId(this.props.privilegeId));
  83 + store.dispatch(setUserLevel(this.props.userLevel));
  84 + store.dispatch(setChannel(this.props.channel));
  85 +
82 86
83 return ( 87 return (
84 <Provider store={store}> 88 <Provider store={store}>
@@ -57,8 +57,8 @@ export default class FastExpress extends Component { @@ -57,8 +57,8 @@ export default class FastExpress extends Component {
57 <Text style={styles.fastContentText}>{levelName}</Text> 57 <Text style={styles.fastContentText}>{levelName}</Text>
58 <View style={styles.fastContentImageContainer}> 58 <View style={styles.fastContentImageContainer}>
59 { 59 {
60 - (isFastImage == 1) ? <Image source={require('../../images/fast.png')} style={styles.fastContentImage} />  
61 - : <Image source={require('../../images/nofast.png')} style={styles.fastContentImage} /> 60 + (isFastImage == 1) ? <Image source={require('../../images/yes.png')} style={styles.fastContentImage} />
  61 + : <Image source={require('../../images/no.png')} style={styles.fastContentImage} />
62 } 62 }
63 </View> 63 </View>
64 </View> 64 </View>
@@ -199,8 +199,8 @@ let styles = StyleSheet.create({ @@ -199,8 +199,8 @@ let styles = StyleSheet.create({
199 }, 199 },
200 200
201 fastContentImage:{ 201 fastContentImage:{
202 - width: 30,  
203 - height: 30, 202 + width: 15,
  203 + height: 15,
204 }, 204 },
205 205
206 headerDescription1:{ 206 headerDescription1:{
@@ -61,29 +61,34 @@ export default class Magazine extends Component { @@ -61,29 +61,34 @@ export default class Magazine extends Component {
61 61
62 return ( 62 return (
63 <ScrollView style={styles.container}> 63 <ScrollView style={styles.container}>
  64 + <View>
64 65
65 <View style={styles.magazineContainer}> 66 <View style={styles.magazineContainer}>
66 - <Text style={styles.magazineDesc}>{content}</Text>  
67 - </View>  
68 67
69 - <Text style={styles.about}>ABOUT</Text> 68 + <View style={styles.magazineBackground}>
  69 + <Text style={styles.magazineDesc}>{content}</Text>
  70 + </View>
  71 +
  72 + <Image style={styles.about} source={require('../../images/about.png')} />
70 73
71 - <ListView  
72 - style={styles.magazineList}  
73 - dataSource={this.dataSource.cloneWithRows(magazineData)}  
74 - horizontal={true}  
75 - renderRow={this.renderRow}  
76 - /> 74 + <ListView
  75 + style={styles.magazineList}
  76 + dataSource={this.dataSource.cloneWithRows(magazineData)}
  77 + horizontal={true}
  78 + renderRow={this.renderRow}
  79 + />
  80 + </View>
77 81
78 82
79 - <Text style={styles.yohoNowText1}>{"点击或扫描二维码YOHO!NOW APP"}</Text> 83 + <Text style={styles.yohoNowText}>{"点击或扫描二维码YOHO!NOW APP"}</Text>
  84 + <Text style={styles.yohoNowText}>{"进入杂志频道免费下载"}</Text>
80 85
81 <TouchableOpacity style={styles.yohoNowImageContainer} activeOpacity={1} onPress={() => { 86 <TouchableOpacity style={styles.yohoNowImageContainer} activeOpacity={1} onPress={() => {
82 this.props.onPressYohoNow && this.props.onPressYohoNow();}}> 87 this.props.onPressYohoNow && this.props.onPressYohoNow();}}>
83 <Image style={styles.yohoNowImage} source={require('../../images/yohonow.png')} /> 88 <Image style={styles.yohoNowImage} source={require('../../images/yohonow.png')} />
84 </TouchableOpacity> 89 </TouchableOpacity>
85 90
86 - 91 + </View>
87 </ScrollView> 92 </ScrollView>
88 ); 93 );
89 } 94 }
@@ -95,12 +100,18 @@ const DEVICE_WIDTH_RATIO = width / 320; @@ -95,12 +100,18 @@ const DEVICE_WIDTH_RATIO = width / 320;
95 let styles = StyleSheet.create({ 100 let styles = StyleSheet.create({
96 container: { 101 container: {
97 flex: 1, 102 flex: 1,
  103 + flexDirection: 'column',
98 backgroundColor: '#f0f0f0', 104 backgroundColor: '#f0f0f0',
99 }, 105 },
100 106
101 magazineContainer: { 107 magazineContainer: {
  108 + width: width,
  109 + height: 410,
  110 + },
  111 +
  112 + magazineBackground: {
102 width: width - 60, 113 width: width - 60,
103 - height: 350, 114 + height: 340,
104 backgroundColor: 'white', 115 backgroundColor: 'white',
105 marginTop: 40, 116 marginTop: 40,
106 marginLeft: 30, 117 marginLeft: 30,
@@ -110,17 +121,15 @@ let styles = StyleSheet.create({ @@ -110,17 +121,15 @@ let styles = StyleSheet.create({
110 121
111 about:{ 122 about:{
112 position: 'absolute', 123 position: 'absolute',
113 - top: 10,  
114 - left: 50,  
115 - fontSize: 35,  
116 - color: 'rgb(212,169,68)',  
117 - fontWeight: 'bold', 124 + top: 30,
  125 + left: 50,
  126 + width: 93,
  127 + height: 23,
118 }, 128 },
119 129
120 magazineDesc:{ 130 magazineDesc:{
121 - fontSize: 15,  
122 - color: 'rgb(33,33,33)',  
123 - fontWeight: 'bold', 131 + fontSize: 14,
  132 + color: '#000000',
124 marginTop: 20, 133 marginTop: 20,
125 marginLeft: 12, 134 marginLeft: 12,
126 marginRight: 12, 135 marginRight: 12,
@@ -140,21 +149,23 @@ let styles = StyleSheet.create({ @@ -140,21 +149,23 @@ let styles = StyleSheet.create({
140 marginRight: 3, 149 marginRight: 3,
141 }, 150 },
142 151
143 - yohoNowText1:{  
144 - position: 'absolute',  
145 - top: 380,  
146 - width: width - 20, 152 + yohoNowText:{
  153 + width: width,
  154 + textAlign: 'center',
  155 + fontWeight: 'bold',
147 }, 156 },
148 157
149 yohoNowImageContainer:{ 158 yohoNowImageContainer:{
150 - position: 'absolute',  
151 - top: 400,  
152 - height: 125, 159 + width: width,
  160 + marginTop: 10,
  161 + marginBottom: 20,
  162 + alignItems: 'center',
  163 + justifyContent: 'center',
153 }, 164 },
154 165
155 yohoNowImage:{ 166 yohoNowImage:{
156 - width: 125,  
157 - height: 125, 167 + width: 123,
  168 + height: 123,
158 }, 169 },
159 170
160 }); 171 });
@@ -97,7 +97,7 @@ let productHeight = Platform.OS === 'ios'? (rowHeight + rowMarginTop + rowMargin @@ -97,7 +97,7 @@ let productHeight = Platform.OS === 'ios'? (rowHeight + rowMarginTop + rowMargin
97 let styles = StyleSheet.create({ 97 let styles = StyleSheet.create({
98 container: { 98 container: {
99 flex: 1, 99 flex: 1,
100 - backgroundColor: '#f0f0f0', 100 + backgroundColor: 'white',
101 }, 101 },
102 102
103 contentContainer: { 103 contentContainer: {
@@ -6,6 +6,8 @@ export default keyMirror({ @@ -6,6 +6,8 @@ export default keyMirror({
6 SET_HOST: null, 6 SET_HOST: null,
7 SET_SERVICE_HOST: null, 7 SET_SERVICE_HOST: null,
8 SET_PRIVILEGE_ID: null, 8 SET_PRIVILEGE_ID: null,
  9 + SET_USER_LEVEL: null,
  10 + SET_CHANNEL: null,
9 11
10 SET_SIMILAR_PRODUCT_INDEX: null, 12 SET_SIMILAR_PRODUCT_INDEX: null,
11 13
@@ -93,13 +93,13 @@ class YearActivityContainer extends Component { @@ -93,13 +93,13 @@ class YearActivityContainer extends Component {
93 93
94 render() { 94 render() {
95 95
96 - let {isFetching, yearProduct} = this.props.yearActivity; 96 + let {isFetching, similarIndex, list} = this.props.yearActivity;
97 97
98 return ( 98 return (
99 <YearActivity 99 <YearActivity
100 isFetching={isFetching} 100 isFetching={isFetching}
101 - data={yearProduct.list}  
102 - similarIndex={yearProduct.similarIndex} 101 + data={list}
  102 + similarIndex={similarIndex}
103 style={styles.container} 103 style={styles.container}
104 onEndReached={this.onEndReached} 104 onEndReached={this.onEndReached}
105 onPressProductListProduct={this.onPressProductListProduct} 105 onPressProductListProduct={this.onPressProductListProduct}
@@ -7,6 +7,8 @@ const { @@ -7,6 +7,8 @@ const {
7 SET_HOST, 7 SET_HOST,
8 SET_SERVICE_HOST, 8 SET_SERVICE_HOST,
9 SET_PRIVILEGE_ID, 9 SET_PRIVILEGE_ID,
  10 + SET_USER_LEVEL,
  11 + SET_CHANNEL,
10 } = require('../../constants/actionTypes').default; 12 } = require('../../constants/actionTypes').default;
11 13
12 export function setPlatform(platform) { 14 export function setPlatform(platform) {
@@ -35,4 +37,18 @@ export function setPrivilegeId(id) { @@ -35,4 +37,18 @@ export function setPrivilegeId(id) {
35 type: SET_PRIVILEGE_ID, 37 type: SET_PRIVILEGE_ID,
36 payload: id 38 payload: id
37 }; 39 };
  40 +}
  41 +
  42 +export function setUserLevel(level) {
  43 + return {
  44 + type: SET_USER_LEVEL,
  45 + payload: level
  46 + };
  47 +}
  48 +
  49 +export function setChannel(channel) {
  50 + return {
  51 + type: SET_CHANNEL,
  52 + payload: channel
  53 + };
38 } 54 }
@@ -7,7 +7,8 @@ let InitialState = Record({ @@ -7,7 +7,8 @@ let InitialState = Record({
7 host: 'http://api.yoho.cn', 7 host: 'http://api.yoho.cn',
8 serviceHost: 'http://service.yoho.cn', 8 serviceHost: 'http://service.yoho.cn',
9 privilegeId: 0, 9 privilegeId: 0,
10 - userLevel: 3, 10 + userLevel: "0",
  11 + channel: "1",
11 12
12 }); 13 });
13 14
@@ -7,6 +7,8 @@ const { @@ -7,6 +7,8 @@ const {
7 SET_HOST, 7 SET_HOST,
8 SET_SERVICE_HOST, 8 SET_SERVICE_HOST,
9 SET_PRIVILEGE_ID, 9 SET_PRIVILEGE_ID,
  10 + SET_USER_LEVEL,
  11 + SET_CHANNEL,
10 } = require('../../constants/actionTypes').default; 12 } = require('../../constants/actionTypes').default;
11 13
12 const initialState = new InitialState; 14 const initialState = new InitialState;
@@ -23,6 +25,10 @@ export default function appReducer(state = initialState, action) { @@ -23,6 +25,10 @@ export default function appReducer(state = initialState, action) {
23 return state.set('serviceHost', action.payload); 25 return state.set('serviceHost', action.payload);
24 case SET_PRIVILEGE_ID: 26 case SET_PRIVILEGE_ID:
25 return state.set('privilegeId', action.payload); 27 return state.set('privilegeId', action.payload);
  28 + case SET_USER_LEVEL:
  29 + return state.set('userLevel', action.payload);
  30 + case SET_CHANNEL:
  31 + return state.set('channel', action.payload);
26 } 32 }
27 33
28 return state; 34 return state;
@@ -31,12 +31,12 @@ export function getYearActivityProductList() { @@ -31,12 +31,12 @@ export function getYearActivityProductList() {
31 return (dispatch, getState) => { 31 return (dispatch, getState) => {
32 let {app, yearActivity} = getState(); 32 let {app, yearActivity} = getState();
33 33
34 - if (yearActivity.get('isFetching') || yearActivity.yearProduct.get('endReached')) { 34 + if (yearActivity.get('isFetching') || yearActivity.get('endReached')) {
35 return; 35 return;
36 } 36 }
37 37
38 - let userLevel = yearActivity.userLevel;  
39 - let page = yearActivity.yearProduct.get('currentPage') + 1; 38 + let userLevel = app.userLevel;
  39 + let page = yearActivity.get('currentPage') + 1;
40 40
41 dispatch(getYearProductRequest()); 41 dispatch(getYearProductRequest());
42 42
@@ -45,7 +45,7 @@ export function getYearActivityProductList() { @@ -45,7 +45,7 @@ export function getYearActivityProductList() {
45 let payload = parseUtils.parsePageInfoList(json); 45 let payload = parseUtils.parsePageInfoList(json);
46 46
47 if (payload.currentPage > 1) { 47 if (payload.currentPage > 1) {
48 - let oldList = yearActivity.yearProduct.get('list').toJS(); 48 + let oldList = yearActivity.get('list').toJS();
49 let newList = [...oldList, ...payload.list]; 49 let newList = [...oldList, ...payload.list];
50 payload.list = newList; 50 payload.list = newList;
51 } 51 }
@@ -4,18 +4,13 @@ import {Record, List, Map} from 'immutable'; @@ -4,18 +4,13 @@ import {Record, List, Map} from 'immutable';
4 4
5 let InitialState = Record({ 5 let InitialState = Record({
6 isFetching: false, 6 isFetching: false,
7 - userLevel: 3,  
8 - yearProduct: new (Record({  
9 - list: List(),  
10 - currentPage: 0,  
11 - endReached: false,  
12 - similarIndex: -1,  
13 - total: 0,  
14 - pageSize: 50,  
15 - pageCount: 0,  
16 - })),  
17 -  
18 - 7 + list: List(),
  8 + currentPage: 0,
  9 + endReached: false,
  10 + similarIndex: -1,
  11 + total: 0,
  12 + pageSize: 50,
  13 + pageCount: 0,
19 }); 14 });
20 15
21 export default InitialState; 16 export default InitialState;
@@ -23,7 +23,7 @@ export default function yearActivityReducer(state=initialState, action) { @@ -23,7 +23,7 @@ export default function yearActivityReducer(state=initialState, action) {
23 return state.set('type', action.payload); 23 return state.set('type', action.payload);
24 } 24 }
25 case SET_SIMILAR_PRODUCT_INDEX: { 25 case SET_SIMILAR_PRODUCT_INDEX: {
26 - return state.setIn(['yearProduct', 'similarIndex'], action.payload.rowID); 26 + return state.set('similarIndex', action.payload.rowID);
27 } 27 }
28 case GET_YEARACTIVITY_PRODUCT_REQUEST: { 28 case GET_YEARACTIVITY_PRODUCT_REQUEST: {
29 return state.set('isFetching', true); 29 return state.set('isFetching', true);
@@ -32,11 +32,11 @@ export default function yearActivityReducer(state=initialState, action) { @@ -32,11 +32,11 @@ export default function yearActivityReducer(state=initialState, action) {
32 32
33 let json = action.payload; 33 let json = action.payload;
34 return state.set('isFetching', false) 34 return state.set('isFetching', false)
35 - .setIn(['yearProduct', 'list'], Immutable.fromJS(json.list))  
36 - .setIn(['yearProduct', 'currentPage'], json.currentPage)  
37 - .setIn(['yearProduct', 'pageCount'], json.pageCount)  
38 - .setIn(['yearProduct', 'total'], json.total)  
39 - .setIn(['yearProduct', 'endReached'], json.endReached); 35 + .set('list', Immutable.fromJS(json.list))
  36 + .set('currentPage', json.currentPage)
  37 + .set('pageCount', json.pageCount)
  38 + .set('total', json.total)
  39 + .set('endReached', json.endReached);
40 } 40 }
41 case GET_YEARACTIVITY_PRODUCT_FAILURE: { 41 case GET_YEARACTIVITY_PRODUCT_FAILURE: {
42 return state.set('isFetching', false); 42 return state.set('isFetching', false);
@@ -12,12 +12,13 @@ export default class yearActivityService { @@ -12,12 +12,13 @@ export default class yearActivityService {
12 this.api = new Request(baseURL); 12 this.api = new Request(baseURL);
13 } 13 }
14 14
15 - async getYearProductList(userLevel, page){ 15 + async getYearProductList(channel, limit, page){
16 return await this.api.get({ 16 return await this.api.get({
17 url: '', 17 url: '',
18 body: { 18 body: {
19 - method: 'app.product.vip',  
20 - user_vip_level: userLevel, 19 + method: 'app.search.sales',
  20 + select_gender: channel,
  21 + limit,
21 page, 22 page,
22 } 23 }
23 }) 24 })