Authored by 陈林

Merge branch 'group_v1130' into 'V1130_Date'

Group v1130



See merge request !22
@@ -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:70*DEVICE_WIDTH_RATIO+8, backgroundColor:'#f0f0f0'}}>
  63 + <View style={{width:width, height:70*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';
@@ -42,6 +42,7 @@ class GroupPurchaseDetailContainer extends Component { @@ -42,6 +42,7 @@ 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);
@@ -51,15 +52,22 @@ class GroupPurchaseDetailContainer extends Component { @@ -51,15 +52,22 @@ class GroupPurchaseDetailContainer extends Component {
51 this.showSnapshootShare = this.showSnapshootShare.bind(this); 52 this.showSnapshootShare = this.showSnapshootShare.bind(this);
52 this.shareSnapshootAction = this.shareSnapshootAction.bind(this); 53 this.shareSnapshootAction = this.shareSnapshootAction.bind(this);
53 54
  55 + this.subscription = NativeAppEventEmitter.addListener(
  56 + 'ShareCollageDetailEvent',
  57 + () => {
  58 + this.props.actions.showShareView(true);
  59 + }
  60 + );
54 } 61 }
55 62
56 async componentDidMount() { 63 async componentDidMount() {
57 this.props.actions.getProductList(); 64 this.props.actions.getProductList();
58 this.props.actions.fetchActivityGroupDetail(); 65 this.props.actions.fetchActivityGroupDetail();
  66 + this.props.actions.fetchResourceInfo();
59 } 67 }
60 68
61 componentWillUnmount() { 69 componentWillUnmount() {
62 - 70 + this.subscription && this.subscription.remove();
63 } 71 }
64 72
65 updateTime(leftTime) { 73 updateTime(leftTime) {
@@ -74,7 +82,7 @@ class GroupPurchaseDetailContainer extends Component { @@ -74,7 +82,7 @@ class GroupPurchaseDetailContainer extends Component {
74 let { activityId, groupNo, groupDetail } = this.props.groupPurchaseDetail; 82 let { activityId, groupNo, groupDetail } = this.props.groupPurchaseDetail;
75 if(pageGo == 1) { 83 if(pageGo == 1) {
76 this.props.actions.showShareView(true); 84 this.props.actions.showShareView(true);
77 - }else if (pageGo == 2) { 85 + }else if (pageGo == 2 || pageGo == 5) {
78 let membershipItems = groupDetail.get('membershipItems'); 86 let membershipItems = groupDetail.get('membershipItems');
79 let productDetail = membershipItems.size > 0 ? membershipItems.get(0) : new Map(); 87 let productDetail = membershipItems.size > 0 ? membershipItems.get(0) : new Map();
80 let productSkn = productDetail.get('productSkn'); 88 let productSkn = productDetail.get('productSkn');
@@ -91,7 +99,7 @@ class GroupPurchaseDetailContainer extends Component { @@ -91,7 +99,7 @@ class GroupPurchaseDetailContainer extends Component {
91 ReactNative.NativeModules.YH_CommonHelper.showBuyPicker(params); 99 ReactNative.NativeModules.YH_CommonHelper.showBuyPicker(params);
92 }else if (pageGo == 3) { 100 }else if (pageGo == 3) {
93 this.props.actions.showShareView(true); 101 this.props.actions.showShareView(true);
94 - }else if (pageGo == 4 || pageGo == 5 || pageGo == 7 || pageGo == 6) { 102 + }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}"}}`; 103 let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.activitytemplate","params":{"type":"2", "activityId":"${activityId}"}}`;
96 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); 104 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
97 } 105 }
@@ -109,6 +117,10 @@ class GroupPurchaseDetailContainer extends Component { @@ -109,6 +117,10 @@ class GroupPurchaseDetailContainer extends Component {
109 this.props.actions.showSnapshootShare(false); 117 this.props.actions.showSnapshootShare(false);
110 } 118 }
111 119
  120 + showShareView(show){
  121 + this.props.actions.showShareView(show);
  122 + }
  123 +
112 didTouchProduct(productSkn,activityId,newSrc) { 124 didTouchProduct(productSkn,activityId,newSrc) {
113 if(newSrc){ 125 if(newSrc){
114 let arr=newSrc.split("?"); 126 let arr=newSrc.split("?");
@@ -123,8 +135,15 @@ class GroupPurchaseDetailContainer extends Component { @@ -123,8 +135,15 @@ class GroupPurchaseDetailContainer extends Component {
123 ReactNative.NativeModules.YH_CommonHelper.goLinkUrl(url); 135 ReactNative.NativeModules.YH_CommonHelper.goLinkUrl(url);
124 } 136 }
125 137
126 - showShareView(show){  
127 - this.props.actions.showShareView(show); 138 + _didTouchBanner(url) {
  139 + if (!url) {
  140 + return;
  141 + }
  142 + let params = {
  143 + URL: url,
  144 + };
  145 + ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_GROUP_DEATIL_BANNER_C', params);
  146 + ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
128 } 147 }
129 148
130 async shareMiniApp(){ 149 async shareMiniApp(){
@@ -182,6 +201,7 @@ class GroupPurchaseDetailContainer extends Component { @@ -182,6 +201,7 @@ class GroupPurchaseDetailContainer extends Component {
182 showSnapshootShare, 201 showSnapshootShare,
183 groupDetail, 202 groupDetail,
184 productList, 203 productList,
  204 + resourceInfo
185 } = this.props.groupPurchaseDetail; 205 } = this.props.groupPurchaseDetail;
186 206
187 let { 207 let {
@@ -211,11 +231,13 @@ class GroupPurchaseDetailContainer extends Component { @@ -211,11 +231,13 @@ class GroupPurchaseDetailContainer extends Component {
211 activityId={activityId} 231 activityId={activityId}
212 productList={productList} 232 productList={productList}
213 groupDetail={groupDetail} 233 groupDetail={groupDetail}
  234 + resource={resourceInfo}
214 onEndReached={this._onEndReached} 235 onEndReached={this._onEndReached}
215 updateTime={this.updateTime} 236 updateTime={this.updateTime}
216 didTouchButton={this.didTouchButton} 237 didTouchButton={this.didTouchButton}
217 didTouchProduct={this.didTouchProduct} 238 didTouchProduct={this.didTouchProduct}
218 goComment={this.goComment} 239 goComment={this.goComment}
  240 + didTouchBanner={this._didTouchBanner}
219 /> 241 />
220 </View> 242 </View>
221 ); 243 );
@@ -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',