review 奥莱UI 添加toast review by zhanglixia
Showing
9 changed files
with
72 additions
and
10 deletions
@@ -137,6 +137,7 @@ export default class ActivityCell extends React.Component { | @@ -137,6 +137,7 @@ export default class ActivityCell extends React.Component { | ||
137 | let id = data.id; | 137 | let id = data.id; |
138 | let price = promotionName&&promotionName.length>2?promotionName.substring(0,promotionName.length-2):'' | 138 | let price = promotionName&&promotionName.length>2?promotionName.substring(0,promotionName.length-2):'' |
139 | let priceString = promotionName&&promotionName.length>2?promotionName.substring(promotionName.length-2,promotionName.length):'' | 139 | let priceString = promotionName&&promotionName.length>2?promotionName.substring(promotionName.length-2,promotionName.length):'' |
140 | + let startLeftTime = data.startLeftTime; | ||
140 | 141 | ||
141 | return ( | 142 | return ( |
142 | <View style={styles.container}> | 143 | <View style={styles.container}> |
@@ -144,8 +145,16 @@ export default class ActivityCell extends React.Component { | @@ -144,8 +145,16 @@ export default class ActivityCell extends React.Component { | ||
144 | activeOpacity={1} | 145 | activeOpacity={1} |
145 | style={{width: backgroundWidth, height: backgroundHeight}} | 146 | style={{width: backgroundWidth, height: backgroundHeight}} |
146 | onPress={() => { | 147 | onPress={() => { |
147 | - let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.outletactivity","params":{"activity_id":"${id}"}}`; | ||
148 | - this.props.onPressProduct && this.props.onPressProduct(url); | 148 | + if (startLeftTime <= 0) { |
149 | + if (this.state.showString == '活动已结束') { | ||
150 | + this.props.showToast && this.props.showToast('活动已结束,敬请期待。'); | ||
151 | + }else { | ||
152 | + let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.outletactivity","params":{"activity_id":"${id}"}}`; | ||
153 | + this.props.onPressProduct && this.props.onPressProduct(url); | ||
154 | + } | ||
155 | + }else { | ||
156 | + this.props.showToast && this.props.showToast('活动还未开始,敬请期待'); | ||
157 | + } | ||
149 | }} | 158 | }} |
150 | > | 159 | > |
151 | <YH_Image | 160 | <YH_Image |
@@ -24,6 +24,8 @@ export default class Outlet extends Component { | @@ -24,6 +24,8 @@ export default class Outlet extends Component { | ||
24 | 24 | ||
25 | let { | 25 | let { |
26 | categoryList, | 26 | categoryList, |
27 | + isShowToast, | ||
28 | + toastMessage, | ||
27 | } = this.props; | 29 | } = this.props; |
28 | 30 | ||
29 | if (!categoryList) { | 31 | if (!categoryList) { |
@@ -44,6 +46,8 @@ export default class Outlet extends Component { | @@ -44,6 +46,8 @@ export default class Outlet extends Component { | ||
44 | tabLabel={name} | 46 | tabLabel={name} |
45 | key={'OutletPageListView' + i} | 47 | key={'OutletPageListView' + i} |
46 | resource = {item} | 48 | resource = {item} |
49 | + toastMessage = {toastMessage} | ||
50 | + isShowToast = {isShowToast} | ||
47 | getOutletHomeResource = {this.props.getOutletHomeResource} | 51 | getOutletHomeResource = {this.props.getOutletHomeResource} |
48 | getOutletActivityList = {this.props.getOutletActivityList} | 52 | getOutletActivityList = {this.props.getOutletActivityList} |
49 | onPressProduct = {this.props.onPressProduct} | 53 | onPressProduct = {this.props.onPressProduct} |
@@ -51,6 +55,8 @@ export default class Outlet extends Component { | @@ -51,6 +55,8 @@ export default class Outlet extends Component { | ||
51 | setActivityFliter = {this.props.setActivityFliter} | 55 | setActivityFliter = {this.props.setActivityFliter} |
52 | onPressFilter = {this.props.onPressFilter} | 56 | onPressFilter = {this.props.onPressFilter} |
53 | onEndReached = {this.props.onEndReached} | 57 | onEndReached = {this.props.onEndReached} |
58 | + showToast = {this.props.showToast} | ||
59 | + hideToastMessage = {this.props.hideToastMessage} | ||
54 | /> | 60 | /> |
55 | ); | 61 | ); |
56 | })} | 62 | })} |
@@ -21,6 +21,7 @@ import ProductFliter from './ProductFliter'; | @@ -21,6 +21,7 @@ import ProductFliter from './ProductFliter'; | ||
21 | import BrandProductListCell from '../../../common/components/ListCell/ProductListCell'; | 21 | import BrandProductListCell from '../../../common/components/ListCell/ProductListCell'; |
22 | import ActivityCell from './ActivityCell'; | 22 | import ActivityCell from './ActivityCell'; |
23 | import NoActivityView from './NoActivityView'; | 23 | import NoActivityView from './NoActivityView'; |
24 | +import Prompt from '../../../coupon/components/coupon/Prompt'; | ||
24 | 25 | ||
25 | export default class OutletPageListView extends Component { | 26 | export default class OutletPageListView extends Component { |
26 | constructor(props) { | 27 | constructor(props) { |
@@ -100,7 +101,6 @@ export default class OutletPageListView extends Component { | @@ -100,7 +101,6 @@ export default class OutletPageListView extends Component { | ||
100 | } | 101 | } |
101 | 102 | ||
102 | renderRow(rowData, sectionID, rowID, highlightRow) { | 103 | renderRow(rowData, sectionID, rowID, highlightRow) { |
103 | - // console.log(rowData.toJS()); | ||
104 | if (sectionID == 'outletHomeReource') { | 104 | if (sectionID == 'outletHomeReource') { |
105 | if (rowData.get('template_name') == 'NL2R') { | 105 | if (rowData.get('template_name') == 'NL2R') { |
106 | return(<OutletThreeImage resource={rowData} onPressProduct={this.props.onPressProduct}/>); | 106 | return(<OutletThreeImage resource={rowData} onPressProduct={this.props.onPressProduct}/>); |
@@ -108,7 +108,7 @@ export default class OutletPageListView extends Component { | @@ -108,7 +108,7 @@ export default class OutletPageListView extends Component { | ||
108 | return(<OutletSwiper resource={rowData} onPressProduct={this.props.onPressProduct}/>); | 108 | return(<OutletSwiper resource={rowData} onPressProduct={this.props.onPressProduct}/>); |
109 | }else if (rowData.get('template_name') == 'single_image') { | 109 | }else if (rowData.get('template_name') == 'single_image') { |
110 | return(<OutletSingleImage resource={rowData} onPressProduct={this.props.onPressProduct}/>); | 110 | return(<OutletSingleImage resource={rowData} onPressProduct={this.props.onPressProduct}/>); |
111 | - }else if (rowData.get('template_name') == 'double_image') { | 111 | + }else if (rowData.get('template_name') == 'small_pic') { |
112 | return(<OutletDoubleImage resource={rowData} onPressProduct={this.props.onPressProduct}/>); | 112 | return(<OutletDoubleImage resource={rowData} onPressProduct={this.props.onPressProduct}/>); |
113 | }else if (rowData.get('template_name') == 'recommend_content_five') { | 113 | }else if (rowData.get('template_name') == 'recommend_content_five') { |
114 | return(<OutletRecommendFive resource={rowData} onPressProduct={this.props.onPressProduct}/>); | 114 | return(<OutletRecommendFive resource={rowData} onPressProduct={this.props.onPressProduct}/>); |
@@ -118,7 +118,7 @@ export default class OutletPageListView extends Component { | @@ -118,7 +118,7 @@ export default class OutletPageListView extends Component { | ||
118 | // return(<TripleImage resource={rowData} onPressProduct={this.props.onPressProduct}/>); | 118 | // return(<TripleImage resource={rowData} onPressProduct={this.props.onPressProduct}/>); |
119 | } | 119 | } |
120 | }else if (sectionID == 'activityList') { | 120 | }else if (sectionID == 'activityList') { |
121 | - return(<ActivityCell resource={rowData} key = {rowID + 'activityList'} onPressProduct={this.props.onPressProduct}/>); | 121 | + return(<ActivityCell resource={rowData} key = {rowID + 'activityList'} showToast={this.props.showToast} onPressProduct={this.props.onPressProduct}/>); |
122 | }else if (sectionID == 'activityMore') { | 122 | }else if (sectionID == 'activityMore') { |
123 | if (rowData == 'more') { | 123 | if (rowData == 'more') { |
124 | let sourceIcon = require('../../../brandStore/image/filter/brandstore_filter_arrow_down_normal.png'); | 124 | let sourceIcon = require('../../../brandStore/image/filter/brandstore_filter_arrow_down_normal.png'); |
@@ -152,11 +152,16 @@ export default class OutletPageListView extends Component { | @@ -152,11 +152,16 @@ export default class OutletPageListView extends Component { | ||
152 | let { | 152 | let { |
153 | resource, | 153 | resource, |
154 | tabLabel, | 154 | tabLabel, |
155 | + toastMessage, | ||
156 | + isShowToast, | ||
155 | } = this.props; | 157 | } = this.props; |
156 | 158 | ||
157 | if (!resource) { | 159 | if (!resource) { |
158 | return null; | 160 | return null; |
159 | } | 161 | } |
162 | + | ||
163 | + let needShowToast = isShowToast; | ||
164 | + let showToastMessage = toastMessage; | ||
160 | let title = tabLabel; | 165 | let title = tabLabel; |
161 | let isFetching_homeResource = resource.get('isFetching')?resource.get('isFetching'):false; | 166 | let isFetching_homeResource = resource.get('isFetching')?resource.get('isFetching'):false; |
162 | let honeResource = resource.get('honeResource'); | 167 | let honeResource = resource.get('honeResource'); |
@@ -219,6 +224,11 @@ export default class OutletPageListView extends Component { | @@ -219,6 +224,11 @@ export default class OutletPageListView extends Component { | ||
219 | } | 224 | } |
220 | }} | 225 | }} |
221 | /> | 226 | /> |
227 | + {needShowToast ? <Prompt | ||
228 | + text={showToastMessage} | ||
229 | + duration={3000} | ||
230 | + onPromptHidden={this.props.hideToastMessage} | ||
231 | + /> : null} | ||
222 | </View> | 232 | </View> |
223 | ); | 233 | ); |
224 | } | 234 | } |
@@ -7,10 +7,10 @@ export default keyMirror({ | @@ -7,10 +7,10 @@ export default keyMirror({ | ||
7 | SET_CHANNEL: null, | 7 | SET_CHANNEL: null, |
8 | SET_SERVICE_HOST: null, | 8 | SET_SERVICE_HOST: null, |
9 | SET_CATEGORYID: null, | 9 | SET_CATEGORYID: null, |
10 | - | 10 | + HIDE_TOAST: null, |
11 | SET_ACTIVITY_FLITER: null, | 11 | SET_ACTIVITY_FLITER: null, |
12 | SET_FLITER: null, | 12 | SET_FLITER: null, |
13 | - | 13 | + SHOW_TOAST: null, |
14 | GET_CATEGORY_REQUEST: null, | 14 | GET_CATEGORY_REQUEST: null, |
15 | GET_CATEGORY_SUCCESS: null, | 15 | GET_CATEGORY_SUCCESS: null, |
16 | GET_CATEGORY_FAILURE: null, | 16 | GET_CATEGORY_FAILURE: null, |
@@ -47,6 +47,8 @@ class OutletContainer extends Component { | @@ -47,6 +47,8 @@ class OutletContainer extends Component { | ||
47 | this._getOutletActivityList = this._getOutletActivityList.bind(this); | 47 | this._getOutletActivityList = this._getOutletActivityList.bind(this); |
48 | this._onEndReached = this._onEndReached.bind(this); | 48 | this._onEndReached = this._onEndReached.bind(this); |
49 | this._setActivityFliter = this._setActivityFliter.bind(this); | 49 | this._setActivityFliter = this._setActivityFliter.bind(this); |
50 | + this._showToast = this._showToast.bind(this); | ||
51 | + this._hideToastMessage = this._hideToastMessage.bind(this); | ||
50 | } | 52 | } |
51 | 53 | ||
52 | componentDidMount() { | 54 | componentDidMount() { |
@@ -89,6 +91,13 @@ class OutletContainer extends Component { | @@ -89,6 +91,13 @@ class OutletContainer extends Component { | ||
89 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | 91 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); |
90 | } | 92 | } |
91 | 93 | ||
94 | + _showToast(value){ | ||
95 | + this.props.actions.showToastMessage(value); | ||
96 | + } | ||
97 | + | ||
98 | + _hideToastMessage(){ | ||
99 | + this.props.actions.hideToastMessage(); | ||
100 | + } | ||
92 | 101 | ||
93 | _onPressFilter(content_code,value,categoryNavigationItem){ | 102 | _onPressFilter(content_code,value,categoryNavigationItem){ |
94 | this.props.actions.onPressFilter(content_code,value); | 103 | this.props.actions.onPressFilter(content_code,value); |
@@ -102,11 +111,15 @@ class OutletContainer extends Component { | @@ -102,11 +111,15 @@ class OutletContainer extends Component { | ||
102 | 111 | ||
103 | let { | 112 | let { |
104 | categoryList, | 113 | categoryList, |
114 | + isShowToast, | ||
115 | + toastMessage, | ||
105 | } = this.props.outlet; | 116 | } = this.props.outlet; |
106 | 117 | ||
107 | return ( | 118 | return ( |
108 | <Outlet | 119 | <Outlet |
109 | categoryList = {categoryList} | 120 | categoryList = {categoryList} |
121 | + isShowToast = {isShowToast} | ||
122 | + toastMessage = {toastMessage} | ||
110 | getOutletHomeResource = {this._getOutletHomeResource} | 123 | getOutletHomeResource = {this._getOutletHomeResource} |
111 | setActivityFliter = {this._setActivityFliter} | 124 | setActivityFliter = {this._setActivityFliter} |
112 | getOutletActivityList = {this._getOutletActivityList} | 125 | getOutletActivityList = {this._getOutletActivityList} |
@@ -114,6 +127,8 @@ class OutletContainer extends Component { | @@ -114,6 +127,8 @@ class OutletContainer extends Component { | ||
114 | onPressProductListProduct = {this._onPressProductListProduct} | 127 | onPressProductListProduct = {this._onPressProductListProduct} |
115 | onPressFilter = {this._onPressFilter} | 128 | onPressFilter = {this._onPressFilter} |
116 | onEndReached = {this._onEndReached} | 129 | onEndReached = {this._onEndReached} |
130 | + showToast = {this._showToast} | ||
131 | + hideToastMessage = {this._hideToastMessage} | ||
117 | /> | 132 | /> |
118 | ); | 133 | ); |
119 | } | 134 | } |
@@ -11,7 +11,8 @@ const { | @@ -11,7 +11,8 @@ const { | ||
11 | SET_ACTIVITY_FLITER, | 11 | SET_ACTIVITY_FLITER, |
12 | 12 | ||
13 | SET_FLITER, | 13 | SET_FLITER, |
14 | - | 14 | + SHOW_TOAST, |
15 | + HIDE_TOAST, | ||
15 | GET_CATEGORY_REQUEST, | 16 | GET_CATEGORY_REQUEST, |
16 | GET_CATEGORY_SUCCESS, | 17 | GET_CATEGORY_SUCCESS, |
17 | GET_CATEGORY_FAILURE, | 18 | GET_CATEGORY_FAILURE, |
@@ -261,3 +262,17 @@ export function onPressFilter(content_code,value) { | @@ -261,3 +262,17 @@ export function onPressFilter(content_code,value) { | ||
261 | payload: {'value':value,'content_code':content_code} | 262 | payload: {'value':value,'content_code':content_code} |
262 | }; | 263 | }; |
263 | } | 264 | } |
265 | + | ||
266 | + | ||
267 | +export function showToastMessage(value) { | ||
268 | + return { | ||
269 | + type: SHOW_TOAST, | ||
270 | + payload: value | ||
271 | + }; | ||
272 | +} | ||
273 | + | ||
274 | +export function hideToastMessage() { | ||
275 | + return { | ||
276 | + type: HIDE_TOAST, | ||
277 | + }; | ||
278 | +} |
@@ -6,7 +6,8 @@ import Immutable, {Map} from 'immutable'; | @@ -6,7 +6,8 @@ import Immutable, {Map} from 'immutable'; | ||
6 | const { | 6 | const { |
7 | SET_ACTIVITY_FLITER, | 7 | SET_ACTIVITY_FLITER, |
8 | SET_FLITER, | 8 | SET_FLITER, |
9 | - | 9 | + SHOW_TOAST, |
10 | + HIDE_TOAST, | ||
10 | GET_CATEGORY_REQUEST, | 11 | GET_CATEGORY_REQUEST, |
11 | GET_CATEGORY_SUCCESS, | 12 | GET_CATEGORY_SUCCESS, |
12 | GET_CATEGORY_FAILURE, | 13 | GET_CATEGORY_FAILURE, |
@@ -219,6 +220,10 @@ export default function outletReducer(state=initialState, action) { | @@ -219,6 +220,10 @@ export default function outletReducer(state=initialState, action) { | ||
219 | }) | 220 | }) |
220 | return state.setIn(['categoryList', 'list'], Immutable.fromJS(categoryList.list)) | 221 | return state.setIn(['categoryList', 'list'], Immutable.fromJS(categoryList.list)) |
221 | } | 222 | } |
223 | + case SHOW_TOAST: | ||
224 | + return state.set('isShowToast', true).set('toastMessage', action.payload) | ||
225 | + case HIDE_TOAST: | ||
226 | + return state.set('isShowToast', false).set('toastMessage', '') | ||
222 | } | 227 | } |
223 | 228 | ||
224 | return state; | 229 | return state; |
@@ -213,7 +213,7 @@ let styles = StyleSheet.create({ | @@ -213,7 +213,7 @@ let styles = StyleSheet.create({ | ||
213 | height: imageHeigth, | 213 | height: imageHeigth, |
214 | position: 'absolute', | 214 | position: 'absolute', |
215 | marginTop: -imageHeigth, | 215 | marginTop: -imageHeigth, |
216 | - backgroundColor: 'rgba(0,0,0,.2)' | 216 | + backgroundColor: 'rgba(0,0,0,.15)' |
217 | }, | 217 | }, |
218 | header: { | 218 | header: { |
219 | justifyContent: 'flex-end', | 219 | justifyContent: 'flex-end', |
-
Please register or login to post a comment