Showing
3 changed files
with
4 additions
and
176 deletions
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 | -}); |
@@ -59,8 +59,8 @@ export default class GroupPurchaseDetail extends Component { | @@ -59,8 +59,8 @@ export default class GroupPurchaseDetail extends Component { | ||
59 | let src = YH_Image.getSlicedUrl(item.src, imageWidth, imageHeight, 2); | 59 | let src = YH_Image.getSlicedUrl(item.src, imageWidth, imageHeight, 2); |
60 | 60 | ||
61 | return( | 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}}> | 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={() => { | 64 | <TouchableOpacity activeOpacity={1} onPress={() => { |
65 | this.props.didTouchBanner && this.props.didTouchBanner(item.url); | 65 | this.props.didTouchBanner && this.props.didTouchBanner(item.url); |
66 | }}> | 66 | }}> |
@@ -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 DetailShareViewModal from '../components/DetailShareViewModal' | 12 | +import ShareViewModal from '../components/ShareViewModal' |
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 | ||
@@ -49,7 +49,6 @@ class GroupPurchaseDetailContainer extends Component { | @@ -49,7 +49,6 @@ class GroupPurchaseDetailContainer extends Component { | ||
49 | this.didTouchButton = this.didTouchButton.bind(this); | 49 | this.didTouchButton = this.didTouchButton.bind(this); |
50 | this.showShareView = this.showShareView.bind(this); | 50 | this.showShareView = this.showShareView.bind(this); |
51 | this.shareMiniApp = this.shareMiniApp.bind(this); | 51 | this.shareMiniApp = this.shareMiniApp.bind(this); |
52 | - this.shareWXTimeLine = this.shareWXTimeLine.bind(this); | ||
53 | this.showSnapshootShare = this.showSnapshootShare.bind(this); | 52 | this.showSnapshootShare = this.showSnapshootShare.bind(this); |
54 | this.shareSnapshootAction = this.shareSnapshootAction.bind(this); | 53 | this.shareSnapshootAction = this.shareSnapshootAction.bind(this); |
55 | 54 | ||
@@ -185,44 +184,6 @@ class GroupPurchaseDetailContainer extends Component { | @@ -185,44 +184,6 @@ class GroupPurchaseDetailContainer extends Component { | ||
185 | ReactNative.NativeModules.YH_CommonHelper.shareWXMiniProgram(param); | 184 | ReactNative.NativeModules.YH_CommonHelper.shareWXMiniProgram(param); |
186 | } | 185 | } |
187 | 186 | ||
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 | - | ||
226 | showSnapshootShare(show){ | 187 | showSnapshootShare(show){ |
227 | this.props.actions.showShareView(false); | 188 | this.props.actions.showShareView(false); |
228 | this.props.actions.showSnapshootShare(show); | 189 | this.props.actions.showSnapshootShare(show); |
@@ -257,7 +218,7 @@ class GroupPurchaseDetailContainer extends Component { | @@ -257,7 +218,7 @@ class GroupPurchaseDetailContainer extends Component { | ||
257 | 218 | ||
258 | return ( | 219 | return ( |
259 | <View style={styles.container}> | 220 | <View style={styles.container}> |
260 | - <DetailShareViewModal show={showShareView} unionType={unionType} showShareView={this.showShareView} shareMiniApp={this.shareMiniApp} shareWXTimeLine={this.shareWXTimeLine}/> | 221 | + <ShareViewModal show={showShareView} unionType={unionType} showShareView={this.showShareView} shareMiniApp={this.shareMiniApp} showSnapshootShare={this.showSnapshootShare}/> |
261 | <SnapshootShare | 222 | <SnapshootShare |
262 | show={showSnapshootShare} | 223 | show={showSnapshootShare} |
263 | unionType={unionType} | 224 | unionType={unionType} |
-
Please register or login to post a comment