|
|
'use strict';
|
|
|
|
|
|
import React, {Component} from 'react';
|
|
|
import ReactNative, {Platform, StyleSheet, View} from 'react-native'
|
|
|
import ReactNative, {Platform, StyleSheet, View,Dimensions,} from 'react-native'
|
|
|
|
|
|
import {bindActionCreators} from 'redux';
|
|
|
import {connect} from 'react-redux';
|
...
|
...
|
@@ -10,6 +10,7 @@ import * as groupPurchaseDetailActions from '../reducers/groupPurchaseDetail/gro |
|
|
import GroupPurchaseDetail from '../components/GroupPurchaseDetail'
|
|
|
import ShareViewModal from '../components/ShareViewModal'
|
|
|
import SnapshootShare from '../components/SnapshootShare'
|
|
|
import {getSlicedUrl} from '../../classify/utils/Utils';
|
|
|
|
|
|
const actions = [
|
|
|
groupPurchaseDetailActions,
|
...
|
...
|
@@ -67,11 +68,6 @@ class GroupPurchaseDetailContainer extends Component { |
|
|
this.props.actions.updateTime(leftTime);
|
|
|
}
|
|
|
didTouchButton(resource){
|
|
|
|
|
|
this.props.actions.showShareView(true);
|
|
|
|
|
|
|
|
|
return;
|
|
|
let pageGo = resource.pageGo ? resource.pageGo : 0;
|
|
|
let { activityId } = this.props.groupPurchaseDetail;
|
|
|
if(pageGo == 1) {
|
...
|
...
|
@@ -80,7 +76,7 @@ return; |
|
|
}else if (pageGo == 3) {
|
|
|
this.props.actions.showShareView(true);
|
|
|
}else if (pageGo == 4 || pageGo == 5 || pageGo == 7 || pageGo == 6) {
|
|
|
let url = 'http://m.yohobuy.com?openby:yohobuy={"action":"go.activitytemplate","params":{"actionType":"2", "activityId":"${activityId}"}}';
|
|
|
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.activitytemplate","params":{"type":"2", "activityId":"${activityId}"}}`;
|
|
|
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -90,7 +86,7 @@ return; |
|
|
index,
|
|
|
imageUrl: url,
|
|
|
}
|
|
|
console.log(param);
|
|
|
|
|
|
ReactNative.NativeModules.YH_CommonHelper.shareImageToWXMini(param);
|
|
|
this.props.actions.showSnapshootShare(false);
|
|
|
}
|
...
|
...
|
@@ -102,7 +98,6 @@ return; |
|
|
}
|
|
|
|
|
|
goComment() {
|
|
|
console.log('goComment');
|
|
|
let url = 'https://m.yohobuy.com/activity/feature/1555.html?nodownload=1&title=友货规则';
|
|
|
ReactNative.NativeModules.YH_CommonHelper.goLinkUrl(url);
|
|
|
}
|
...
|
...
|
@@ -112,12 +107,30 @@ return; |
|
|
}
|
|
|
|
|
|
shareMiniApp(){
|
|
|
let {
|
|
|
activityId,
|
|
|
groupNo,
|
|
|
groupDetail,
|
|
|
} = this.props.groupPurchaseDetail;
|
|
|
let productDetail = groupDetail ? groupDetail.toJS():null;
|
|
|
if(!productDetail){
|
|
|
return;
|
|
|
}
|
|
|
let membershipItems = productDetail.membershipItems;
|
|
|
let resource = membershipItems ? membershipItems[0]: null;
|
|
|
|
|
|
if (!resource) {
|
|
|
return;
|
|
|
}
|
|
|
let productIcon = 'https://cdn.yoho.cn/20180207/group/22.png';//resource.productIcon ? getSlicedUrl(resource.productIcon,50*DEVICE_WIDTH_RATIO, 40*DEVICE_WIDTH_RATIO, 2) : '';
|
|
|
let miniProgramPath = '/pages/groupPurchase/groupPurchaseResult?activity_id=' + activityId + '&group_no=' + groupNo;
|
|
|
|
|
|
this.props.actions.showShareView(false);
|
|
|
let param = {
|
|
|
title: 'aaaa',
|
|
|
image: 'http://img10.static.yhbimg.com/goodsimg/2015/12/31/06/0176f1c21e535e26e249f142779e884f47.jpg',
|
|
|
title: 'Hey homie!快来跟我一起下单',
|
|
|
image: productIcon,
|
|
|
shareUrl: '',
|
|
|
miniProgramPath: '/pages/index/index',
|
|
|
miniProgramPath,
|
|
|
}
|
|
|
ReactNative.NativeModules.YH_CommonHelper.shareWXMiniProgram(param);
|
|
|
}
|
...
|
...
|
@@ -146,11 +159,14 @@ return; |
|
|
} = this.props.app;
|
|
|
|
|
|
let param = {
|
|
|
activityId,
|
|
|
activity_id: activityId,
|
|
|
group_no: groupNo,
|
|
|
}
|
|
|
|
|
|
let qrCode = host + '/wechat/miniapp/img-check.jpg?param=' + encodeURIComponent(JSON.stringify(param)) + '&name=' + groupNo + '&miniQrType=4';
|
|
|
let qrCode = host + '/wechat/miniapp/img-check.jpg?param=' + encodeURIComponent(JSON.stringify(param)) + '&miniQrType=4';
|
|
|
console.log(qrCode);
|
|
|
console.log('qrCode');
|
|
|
|
|
|
return (
|
|
|
<View style={styles.container}>
|
|
|
<ShareViewModal show={showShareView} showShareView={this.showShareView} shareMiniApp={this.shareMiniApp} showSnapshootShare={this.showSnapshootShare}/>
|
...
|
...
|
@@ -175,6 +191,8 @@ return; |
|
|
}
|
|
|
}
|
|
|
|
|
|
let {width, height} = Dimensions.get('window');
|
|
|
const DEVICE_WIDTH_RATIO = width / 375;
|
|
|
let styles = StyleSheet.create({
|
|
|
container: {
|
|
|
flex: 1,
|
...
|
...
|
|