Authored by 张文文

拼团详情页分享&添加banner位

  1 +'use strict';
  2 +
  3 +import React from 'react';
  4 +import ReactNative from 'react-native';
  5 +
  6 +const {
  7 + AppRegistry,
  8 + StyleSheet,
  9 + Image,
  10 + View,
  11 + Dimensions,
  12 + TouchableOpacity,
  13 + Modal,
  14 + Text,
  15 + TouchableWithoutFeedback,
  16 +} = ReactNative;
  17 +
  18 +
  19 +export default class DetailShareViewModal extends React.Component {
  20 + constructor(props) {
  21 + super(props);
  22 + }
  23 +
  24 + render() {
  25 + let { unionType } = this.props;
  26 + return (
  27 + <Modal
  28 + visible={this.props.show}
  29 + animationType={'none'}
  30 + transparent={true}
  31 + onRequestClose={() => {
  32 + }}>
  33 + <View style={styles.modalContainer}>
  34 + <TouchableWithoutFeedback onPress={() => {
  35 + this.props.showShareView && this.props.showShareView(false);
  36 + }}>
  37 + <View style={styles.topView}/>
  38 + </TouchableWithoutFeedback>
  39 + <View style={styles.shareView}>
  40 + <View style={styles.buttons}>
  41 + <TouchableOpacity activeOpacity={0.5} style={styles.button1} onPress={() => {
  42 + this.props.shareMiniApp && this.props.shareMiniApp();
  43 + }}>
  44 + <Image source={unionType ? require('../images/unionShare_wx_icon.png') : require('../images/weixin.png')} style={styles.icon} />
  45 + <Text style={styles.text}>微信好友</Text>
  46 + </TouchableOpacity>
  47 + <TouchableOpacity activeOpacity={0.5} style={styles.button2} onPress={() => {
  48 + this.props.shareWXTimeLine && this.props.shareWXTimeLine();
  49 + }}>
  50 + <Image source={unionType ? require('../images/unionShare_timeline_icon.png') : require('../images/pengyou.png')} style={styles.icon} />
  51 + <Text style={styles.text}>微信朋友圈</Text>
  52 + </TouchableOpacity>
  53 + </View>
  54 + <View style={styles.line}/>
  55 + <TouchableOpacity activeOpacity={0.5} style={styles.cancel} onPress={() => {
  56 + this.props.showShareView && this.props.showShareView(false);
  57 + }}>
  58 + <Text style={styles.canceltext}>取消</Text>
  59 + </TouchableOpacity>
  60 + </View>
  61 + </View>
  62 +
  63 + </Modal>
  64 + );
  65 + }
  66 +};
  67 +
  68 +let {width, height} = Dimensions.get('window');
  69 +const DEVICE_WIDTH_RATIO = width / 375;
  70 +
  71 +let styles = StyleSheet.create({
  72 + modalContainer: {
  73 + flex: 1,
  74 + width: width,
  75 + height: height,
  76 + backgroundColor: 'rgba(0, 0, 0, 0.6)',
  77 + },
  78 + topView: {
  79 + flex: 1,
  80 + },
  81 + shareView: {
  82 + width,
  83 + height: 171*DEVICE_WIDTH_RATIO,
  84 + backgroundColor: 'white',
  85 + alignItems: 'center',
  86 + },
  87 + image :{
  88 + width: 305*DEVICE_WIDTH_RATIO,
  89 + height: 88*DEVICE_WIDTH_RATIO,
  90 + marginTop: 25*DEVICE_WIDTH_RATIO,
  91 + },
  92 + buttons: {
  93 + width,
  94 + height: 115*DEVICE_WIDTH_RATIO,
  95 + alignItems: 'center',
  96 + flexDirection: 'row',
  97 + },
  98 + button1: {
  99 + marginLeft: (width - 180*DEVICE_WIDTH_RATIO)/3,
  100 + alignItems: 'center',
  101 + },
  102 +
  103 + button2: {
  104 + marginLeft: (width - 180*DEVICE_WIDTH_RATIO)/3,
  105 + alignItems: 'center',
  106 + },
  107 + icon: {
  108 + width: 45*DEVICE_WIDTH_RATIO,
  109 + height: 45*DEVICE_WIDTH_RATIO,
  110 + },
  111 + text: {
  112 + marginTop: 8*DEVICE_WIDTH_RATIO,
  113 + fontSize: 12,
  114 + color: '#444444',
  115 + width: 90*DEVICE_WIDTH_RATIO,
  116 + textAlign: 'center',
  117 + },
  118 + line: {
  119 + width: width - 52,
  120 + height: 1,
  121 + backgroundColor: '#CCCCCC',
  122 + },
  123 + cancel: {
  124 + width,
  125 + height: 54*DEVICE_WIDTH_RATIO,
  126 + justifyContent: 'center',
  127 + alignItems: 'center',
  128 + },
  129 + canceltext: {
  130 + fontSize: 17,
  131 + color: '#444444',
  132 + },
  133 +});
@@ -140,7 +140,7 @@ export default class GroupDetailHeader extends React.Component { @@ -140,7 +140,7 @@ export default class GroupDetailHeader extends React.Component {
140 tipTitlecolor = '#000000'; 140 tipTitlecolor = '#000000';
141 }else if (pageGo == 5) { 141 }else if (pageGo == 5) {
142 tipTitle = '你来晚了'; 142 tipTitle = '你来晚了';
143 - buttonText = '查看更多拼团活动'; 143 + buttonText = '我也要开团';
144 tipTitlecolor = '#000000'; 144 tipTitlecolor = '#000000';
145 }else if (pageGo == 6) { 145 }else if (pageGo == 6) {
146 tipTitle = '拼团失败'; 146 tipTitle = '拼团失败';
@@ -43,6 +43,34 @@ export default class GroupPurchaseDetail extends Component { @@ -43,6 +43,34 @@ export default class GroupPurchaseDetail extends Component {
43 43
44 switch(sectionID) { 44 switch(sectionID) {
45 45
  46 + case 'productResourceInfo': {
  47 +
  48 + if(!rowData || !rowData.get('data')){
  49 + return null;
  50 + }
  51 + let infoData = rowData.get('data');
  52 +
  53 + let imageWidth = infoData.get('imageWidth');
  54 + let imageHeight = infoData.get('imageHeight');
  55 +
  56 + let listInfo = infoData.get('list').toJS();
  57 + let item = listInfo[0];
  58 +
  59 + let src = YH_Image.getSlicedUrl(item.src, imageWidth, imageHeight, 2);
  60 +
  61 + return(
  62 + <View style={{width:width, height:121*DEVICE_WIDTH_RATIO+8, backgroundColor:'#f0f0f0'}}>
  63 + <View style={{width:width, height:121*DEVICE_WIDTH_RATIO}}>
  64 + <TouchableOpacity activeOpacity={1} onPress={() => {
  65 + this.props.didTouchBanner && this.props.didTouchBanner(item.url);
  66 + }}>
  67 + <YH_Image style={{width: '100%', height: '100%'}} url={src}></YH_Image>
  68 + </TouchableOpacity>
  69 + </View>
  70 + </View>
  71 + );
  72 + }
  73 +
46 case 'productListTitle': { 74 case 'productListTitle': {
47 return( 75 return(
48 <View style={styles.productListheader}> 76 <View style={styles.productListheader}>
@@ -52,6 +80,7 @@ export default class GroupPurchaseDetail extends Component { @@ -52,6 +80,7 @@ export default class GroupPurchaseDetail extends Component {
52 </View> 80 </View>
53 ); 81 );
54 } 82 }
  83 +
55 case 'productList': { 84 case 'productList': {
56 return( 85 return(
57 <GroupProductCell resource={rowData} didTouchProduct={this.props.didTouchProduct}/> 86 <GroupProductCell resource={rowData} didTouchProduct={this.props.didTouchProduct}/>
@@ -65,9 +94,11 @@ export default class GroupPurchaseDetail extends Component { @@ -65,9 +94,11 @@ export default class GroupPurchaseDetail extends Component {
65 render() { 94 render() {
66 let { 95 let {
67 productList, 96 productList,
  97 + resource,
68 } = this.props; 98 } = this.props;
69 let dataSource = { 99 let dataSource = {
70 - productListTitle: [1], 100 + productResourceInfo: resource.resourceList ? resource.resourceList.toArray() : [],
  101 + productListTitle: [2],
71 productList: productList.list ? productList.list.toArray() : [], 102 productList: productList.list ? productList.list.toArray() : [],
72 }; 103 };
73 104
1 'use strict'; 1 'use strict';
2 2
3 import React, {Component} from 'react'; 3 import React, {Component} from 'react';
4 -import ReactNative, {Platform, StyleSheet, View,Dimensions,} from 'react-native' 4 +import ReactNative, {Platform, StyleSheet, View, Dimensions, NativeAppEventEmitter} from 'react-native'
5 5
6 import {bindActionCreators} from 'redux'; 6 import {bindActionCreators} from 'redux';
7 import {connect} from 'react-redux'; 7 import {connect} from 'react-redux';
@@ -9,7 +9,7 @@ import {Map} from 'immutable'; @@ -9,7 +9,7 @@ import {Map} from 'immutable';
9 import { setUnionType } from '../reducers/app/appActions'; 9 import { setUnionType } from '../reducers/app/appActions';
10 import * as groupPurchaseDetailActions from '../reducers/groupPurchaseDetail/groupPurchaseDetailActions'; 10 import * as groupPurchaseDetailActions from '../reducers/groupPurchaseDetail/groupPurchaseDetailActions';
11 import GroupPurchaseDetail from '../components/GroupPurchaseDetail' 11 import GroupPurchaseDetail from '../components/GroupPurchaseDetail'
12 -import ShareViewModal from '../components/ShareViewModal' 12 +import DetailShareViewModal from '../components/DetailShareViewModal'
13 import SnapshootShare from '../components/SnapshootShare' 13 import SnapshootShare from '../components/SnapshootShare'
14 import {getSlicedUrl} from '../../classify/utils/Utils'; 14 import {getSlicedUrl} from '../../classify/utils/Utils';
15 15
@@ -42,24 +42,33 @@ class GroupPurchaseDetailContainer extends Component { @@ -42,24 +42,33 @@ class GroupPurchaseDetailContainer extends Component {
42 constructor(props) { 42 constructor(props) {
43 super(props); 43 super(props);
44 this._onEndReached = this._onEndReached.bind(this); 44 this._onEndReached = this._onEndReached.bind(this);
  45 + this._didTouchBanner = this._didTouchBanner.bind(this);
45 this.updateTime = this.updateTime.bind(this); 46 this.updateTime = this.updateTime.bind(this);
46 this.didTouchProduct = this.didTouchProduct.bind(this); 47 this.didTouchProduct = this.didTouchProduct.bind(this);
47 this.goComment = this.goComment.bind(this); 48 this.goComment = this.goComment.bind(this);
48 this.didTouchButton = this.didTouchButton.bind(this); 49 this.didTouchButton = this.didTouchButton.bind(this);
49 this.showShareView = this.showShareView.bind(this); 50 this.showShareView = this.showShareView.bind(this);
50 this.shareMiniApp = this.shareMiniApp.bind(this); 51 this.shareMiniApp = this.shareMiniApp.bind(this);
  52 + this.shareWXTimeLine = this.shareWXTimeLine.bind(this);
51 this.showSnapshootShare = this.showSnapshootShare.bind(this); 53 this.showSnapshootShare = this.showSnapshootShare.bind(this);
52 this.shareSnapshootAction = this.shareSnapshootAction.bind(this); 54 this.shareSnapshootAction = this.shareSnapshootAction.bind(this);
53 55
  56 + this.subscription = NativeAppEventEmitter.addListener(
  57 + 'ShareCollageDetailEvent',
  58 + () => {
  59 + this.props.actions.showShareView(true);
  60 + }
  61 + );
54 } 62 }
55 63
56 async componentDidMount() { 64 async componentDidMount() {
57 this.props.actions.getProductList(); 65 this.props.actions.getProductList();
58 this.props.actions.fetchActivityGroupDetail(); 66 this.props.actions.fetchActivityGroupDetail();
  67 + this.props.actions.fetchResourceInfo();
59 } 68 }
60 69
61 componentWillUnmount() { 70 componentWillUnmount() {
62 - 71 + this.subscription && this.subscription.remove();
63 } 72 }
64 73
65 updateTime(leftTime) { 74 updateTime(leftTime) {
@@ -74,7 +83,7 @@ class GroupPurchaseDetailContainer extends Component { @@ -74,7 +83,7 @@ class GroupPurchaseDetailContainer extends Component {
74 let { activityId, groupNo, groupDetail } = this.props.groupPurchaseDetail; 83 let { activityId, groupNo, groupDetail } = this.props.groupPurchaseDetail;
75 if(pageGo == 1) { 84 if(pageGo == 1) {
76 this.props.actions.showShareView(true); 85 this.props.actions.showShareView(true);
77 - }else if (pageGo == 2) { 86 + }else if (pageGo == 2 || pageGo == 5) {
78 let membershipItems = groupDetail.get('membershipItems'); 87 let membershipItems = groupDetail.get('membershipItems');
79 let productDetail = membershipItems.size > 0 ? membershipItems.get(0) : new Map(); 88 let productDetail = membershipItems.size > 0 ? membershipItems.get(0) : new Map();
80 let productSkn = productDetail.get('productSkn'); 89 let productSkn = productDetail.get('productSkn');
@@ -91,7 +100,7 @@ class GroupPurchaseDetailContainer extends Component { @@ -91,7 +100,7 @@ class GroupPurchaseDetailContainer extends Component {
91 ReactNative.NativeModules.YH_CommonHelper.showBuyPicker(params); 100 ReactNative.NativeModules.YH_CommonHelper.showBuyPicker(params);
92 }else if (pageGo == 3) { 101 }else if (pageGo == 3) {
93 this.props.actions.showShareView(true); 102 this.props.actions.showShareView(true);
94 - }else if (pageGo == 4 || pageGo == 5 || pageGo == 7 || pageGo == 6) { 103 + }else if (pageGo == 4 || pageGo == 7 || pageGo == 6) {
95 let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.activitytemplate","params":{"type":"2", "activityId":"${activityId}"}}`; 104 let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.activitytemplate","params":{"type":"2", "activityId":"${activityId}"}}`;
96 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); 105 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
97 } 106 }
@@ -109,6 +118,10 @@ class GroupPurchaseDetailContainer extends Component { @@ -109,6 +118,10 @@ class GroupPurchaseDetailContainer extends Component {
109 this.props.actions.showSnapshootShare(false); 118 this.props.actions.showSnapshootShare(false);
110 } 119 }
111 120
  121 + showShareView(show){
  122 + this.props.actions.showShareView(show);
  123 + }
  124 +
112 didTouchProduct(productSkn,activityId,newSrc) { 125 didTouchProduct(productSkn,activityId,newSrc) {
113 if(newSrc){ 126 if(newSrc){
114 let arr=newSrc.split("?"); 127 let arr=newSrc.split("?");
@@ -123,8 +136,15 @@ class GroupPurchaseDetailContainer extends Component { @@ -123,8 +136,15 @@ class GroupPurchaseDetailContainer extends Component {
123 ReactNative.NativeModules.YH_CommonHelper.goLinkUrl(url); 136 ReactNative.NativeModules.YH_CommonHelper.goLinkUrl(url);
124 } 137 }
125 138
126 - showShareView(show){  
127 - this.props.actions.showShareView(show); 139 + _didTouchBanner(url) {
  140 + if (!url) {
  141 + return;
  142 + }
  143 + let params = {
  144 + URL: url,
  145 + };
  146 + ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_GROUP_DEATIL_BANNER_C', params);
  147 + ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
128 } 148 }
129 149
130 async shareMiniApp(){ 150 async shareMiniApp(){
@@ -165,6 +185,44 @@ class GroupPurchaseDetailContainer extends Component { @@ -165,6 +185,44 @@ class GroupPurchaseDetailContainer extends Component {
165 ReactNative.NativeModules.YH_CommonHelper.shareWXMiniProgram(param); 185 ReactNative.NativeModules.YH_CommonHelper.shareWXMiniProgram(param);
166 } 186 }
167 187
  188 + async shareWXTimeLine(){
  189 + let {
  190 + activityId,
  191 + groupNo,
  192 + groupDetail,
  193 + } = this.props.groupPurchaseDetail;
  194 + let { unionType } = this.props.app;
  195 + let productDetail = groupDetail ? groupDetail.toJS():null;
  196 + if(!productDetail){
  197 + return;
  198 + }
  199 + let membershipItems = productDetail.membershipItems;
  200 + let resource = membershipItems ? membershipItems[0]: null;
  201 + let lackNum = productDetail ? productDetail.lackNum : 0;
  202 + if (!resource) {
  203 + return;
  204 + }
  205 + let productIcon = resource.productIcon ? getSlicedUrl(resource.productIcon,150*DEVICE_WIDTH_RATIO, 120*DEVICE_WIDTH_RATIO, 2) : '';
  206 + let miniProgramPath = '/pages/groupPurchase/groupPurchaseResult?activity_id=' + activityId + '&group_no=' + groupNo;
  207 + unionType && (miniProgramPath += '&unionType=' + unionType);
  208 + let productGroupPrice = resource.productGroupPrice;
  209 + let productName = resource.productName;
  210 + let title = '【还差' + lackNum + '人】' + productGroupPrice + '拼' + productName;
  211 + let fromPage = 'GroupPurchaseDetail';
  212 +
  213 + this.props.actions.showShareView(false);
  214 + let businessId = 'collage';
  215 + let param = {
  216 + title: title,
  217 + image: productIcon,
  218 + shareUrl: '', //缺少分享到H5的url
  219 + miniProgramPath,
  220 + fromPage,
  221 + businessId
  222 + }
  223 + ReactNative.NativeModules.YH_CommonHelper.shareWXTimeLine(param);
  224 + }
  225 +
168 showSnapshootShare(show){ 226 showSnapshootShare(show){
169 this.props.actions.showShareView(false); 227 this.props.actions.showShareView(false);
170 this.props.actions.showSnapshootShare(show); 228 this.props.actions.showSnapshootShare(show);
@@ -182,6 +240,7 @@ class GroupPurchaseDetailContainer extends Component { @@ -182,6 +240,7 @@ class GroupPurchaseDetailContainer extends Component {
182 showSnapshootShare, 240 showSnapshootShare,
183 groupDetail, 241 groupDetail,
184 productList, 242 productList,
  243 + resourceInfo
185 } = this.props.groupPurchaseDetail; 244 } = this.props.groupPurchaseDetail;
186 245
187 let { 246 let {
@@ -198,7 +257,7 @@ class GroupPurchaseDetailContainer extends Component { @@ -198,7 +257,7 @@ class GroupPurchaseDetailContainer extends Component {
198 257
199 return ( 258 return (
200 <View style={styles.container}> 259 <View style={styles.container}>
201 - <ShareViewModal show={showShareView} unionType={unionType} showShareView={this.showShareView} shareMiniApp={this.shareMiniApp} showSnapshootShare={this.showSnapshootShare}/> 260 + <DetailShareViewModal show={showShareView} unionType={unionType} showShareView={this.showShareView} shareMiniApp={this.shareMiniApp} shareWXTimeLine={this.shareWXTimeLine}/>
202 <SnapshootShare 261 <SnapshootShare
203 show={showSnapshootShare} 262 show={showSnapshootShare}
204 unionType={unionType} 263 unionType={unionType}
@@ -211,11 +270,13 @@ class GroupPurchaseDetailContainer extends Component { @@ -211,11 +270,13 @@ class GroupPurchaseDetailContainer extends Component {
211 activityId={activityId} 270 activityId={activityId}
212 productList={productList} 271 productList={productList}
213 groupDetail={groupDetail} 272 groupDetail={groupDetail}
  273 + resource={resourceInfo}
214 onEndReached={this._onEndReached} 274 onEndReached={this._onEndReached}
215 updateTime={this.updateTime} 275 updateTime={this.updateTime}
216 didTouchButton={this.didTouchButton} 276 didTouchButton={this.didTouchButton}
217 didTouchProduct={this.didTouchProduct} 277 didTouchProduct={this.didTouchProduct}
218 goComment={this.goComment} 278 goComment={this.goComment}
  279 + didTouchBanner={this._didTouchBanner}
219 /> 280 />
220 </View> 281 </View>
221 ); 282 );
@@ -11,6 +11,9 @@ const { @@ -11,6 +11,9 @@ const {
11 PRODUCT_LIST_REQUEST, 11 PRODUCT_LIST_REQUEST,
12 PRODUCT_LIST_SUCCESS, 12 PRODUCT_LIST_SUCCESS,
13 PRODUCT_LIST_FAILURE, 13 PRODUCT_LIST_FAILURE,
  14 + RESOURCEINFO_REQUEST,
  15 + RESOURCEINFO_SUCCESS,
  16 + RESOURCEINFO_FAILURE,
14 ACTIVITY_GROUP_DETAIL_REQUEST, 17 ACTIVITY_GROUP_DETAIL_REQUEST,
15 ACTIVITY_GROUP_DETAIL_SUCCESS, 18 ACTIVITY_GROUP_DETAIL_SUCCESS,
16 ACTIVITY_GROUP_DETAIL_FAILURE, 19 ACTIVITY_GROUP_DETAIL_FAILURE,
@@ -65,6 +68,26 @@ export function productListFailure(error) { @@ -65,6 +68,26 @@ export function productListFailure(error) {
65 } 68 }
66 } 69 }
67 70
  71 +export function resourceInfoRequest() {
  72 + return {
  73 + type: RESOURCEINFO_REQUEST,
  74 + };
  75 +}
  76 +
  77 +export function resourceInfoSuccess(json) {
  78 + return {
  79 + type: RESOURCEINFO_SUCCESS,
  80 + payload: json
  81 + }
  82 +}
  83 +
  84 +export function resourceInfoFailure(error) {
  85 + return {
  86 + type: RESOURCEINFO_FAILURE,
  87 + payload: error
  88 + }
  89 +}
  90 +
68 export function activityGroupDetailRequest() { 91 export function activityGroupDetailRequest() {
69 return { 92 return {
70 type: ACTIVITY_GROUP_DETAIL_REQUEST, 93 type: ACTIVITY_GROUP_DETAIL_REQUEST,
@@ -157,3 +180,18 @@ export function updateTime(leftTime) { @@ -157,3 +180,18 @@ export function updateTime(leftTime) {
157 payload: leftTime 180 payload: leftTime
158 } 181 }
159 } 182 }
  183 +
  184 +export function fetchResourceInfo() {
  185 + return (dispatch, getState) => {
  186 + let {app} = getState();
  187 + dispatch(resourceInfoRequest());
  188 + let content_code = 'cea0efae77f4e04c935beb1e87181247';
  189 + return new GroupPurchaseService(app.host).fetchDetailResourceInfo(content_code)
  190 + .then(json => {
  191 + dispatch(resourceInfoSuccess(json));
  192 + })
  193 + .catch(error => {
  194 + dispatch(resourceInfoFailure(error));
  195 + });
  196 + };
  197 +}
@@ -17,6 +17,11 @@ let InitialState = Record({ @@ -17,6 +17,11 @@ let InitialState = Record({
17 pageSize: 20,//60, 17 pageSize: 20,//60,
18 endReached: false, 18 endReached: false,
19 })), 19 })),
  20 + resourceInfo: new (Record({
  21 + isFetching: false,
  22 + error: null,
  23 + resourceList: List(),
  24 + })),
20 groupDetail: new (Record({ 25 groupDetail: new (Record({
21 isFetching: false, 26 isFetching: false,
22 error: null, 27 error: null,
@@ -9,6 +9,9 @@ const { @@ -9,6 +9,9 @@ const {
9 PRODUCT_LIST_REQUEST, 9 PRODUCT_LIST_REQUEST,
10 PRODUCT_LIST_SUCCESS, 10 PRODUCT_LIST_SUCCESS,
11 PRODUCT_LIST_FAILURE, 11 PRODUCT_LIST_FAILURE,
  12 + RESOURCEINFO_REQUEST,
  13 + RESOURCEINFO_SUCCESS,
  14 + RESOURCEINFO_FAILURE,
12 ACTIVITY_GROUP_DETAIL_REQUEST, 15 ACTIVITY_GROUP_DETAIL_REQUEST,
13 ACTIVITY_GROUP_DETAIL_SUCCESS, 16 ACTIVITY_GROUP_DETAIL_SUCCESS,
14 ACTIVITY_GROUP_DETAIL_FAILURE, 17 ACTIVITY_GROUP_DETAIL_FAILURE,
@@ -62,6 +65,21 @@ export default function couponReducer(state = initialState, action) { @@ -62,6 +65,21 @@ export default function couponReducer(state = initialState, action) {
62 return state.setIn(['productList', 'isFetching'], false) 65 return state.setIn(['productList', 'isFetching'], false)
63 .setIn(['productList', 'error'], action.payload); 66 .setIn(['productList', 'error'], action.payload);
64 } 67 }
  68 +
  69 + case RESOURCEINFO_REQUEST: {
  70 + return state.setIn(['resourceInfo', 'isFetching'], true)
  71 + .setIn(['resourceInfo', 'error'], null);
  72 + }
  73 + case RESOURCEINFO_SUCCESS: {
  74 + return state.setIn(['resourceInfo', 'isFetching'], false)
  75 + .setIn(['resourceInfo', 'resourceList'], Immutable.fromJS(action.payload))
  76 + .setIn(['resourceInfo', 'error'], null);
  77 + }
  78 + case RESOURCEINFO_FAILURE: {
  79 + return state.setIn(['resourceInfo', 'isFetching'], false)
  80 + .setIn(['resourceInfo', 'error'], action.payload);
  81 + }
  82 +
65 case ACTIVITY_GROUP_DETAIL_REQUEST: { 83 case ACTIVITY_GROUP_DETAIL_REQUEST: {
66 return state.setIn(['groupDetail', 'isFetching'], true) 84 return state.setIn(['groupDetail', 'isFetching'], true)
67 .setIn(['groupDetail', 'error'], null); 85 .setIn(['groupDetail', 'error'], null);
@@ -68,6 +68,23 @@ export default class groupPurchaseService { @@ -68,6 +68,23 @@ export default class groupPurchaseService {
68 }); 68 });
69 } 69 }
70 70
  71 + async fetchDetailResourceInfo(content_code) {
  72 + let fromPage = Platform.OS === 'android' ? 'aFP_GroupPurchaseDetail' : 'iFP_GroupPurchaseDetail';
  73 + return await this.api.get({
  74 + url: '/operations/api/v5/resource/get',
  75 + body: {
  76 + content_code,
  77 + fromPage,
  78 + }
  79 + })
  80 + .then((json) => {
  81 + return json;
  82 + })
  83 + .catch((error) => {
  84 + throw(error);
  85 + });
  86 + }
  87 +
71 async fetchShareCodeInfo(params) { 88 async fetchShareCodeInfo(params) {
72 return await this.api.get({ 89 return await this.api.get({
73 url: '/operations/api/v5/webshare/getShare', 90 url: '/operations/api/v5/webshare/getShare',