Authored by 孙凯

add share review by daiqiang

'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,
... ...
... ... @@ -67,7 +67,12 @@ export function fetchResourceInfo() {
return (dispatch, getState) => {
let {app} = getState();
dispatch(resourceInfoRequest());
return new GroupPurchaseService(app.host).fetchResourceInfo()
let content_code = 'f99fa98a01fdadb09012bbd2b4a28e91';
if(app.host == 'http://api.yoho.cn'){
content_code = 'ab4ca2161bada40fe7335dce51b8e196';
}
return new GroupPurchaseService(app.host).fetchResourceInfo(content_code)
.then(json => {
dispatch(resourceInfoSuccess(json));
})
... ...
... ... @@ -36,7 +36,7 @@ export default class groupPurchaseService {
url: '',
body: {
method: 'app.activity.groupDetail',
groupNo: '20354618709',//'19649975637', //'19809359189',
groupNo,//: '20354618709',//'19649975637', //'19809359189',
uid,
}
})
... ... @@ -48,13 +48,11 @@ export default class groupPurchaseService {
});
}
async fetchResourceInfo() {
//content_code 测试环境:f99fa98a01fdadb09012bbd2b4a28e91
// 正式环境:ab4ca2161bada40fe7335dce51b8e196
async fetchResourceInfo(content_code) {
return await this.api.get({
url: '/operations/api/v5/resource/get',
body: {
content_code: 'f99fa98a01fdadb09012bbd2b4a28e91',
content_code,
fromPage: ''
}
})
... ...