Merge branch 'classify' into guang
Showing
14 changed files
with
329 additions
and
196 deletions
@@ -36,6 +36,7 @@ export default class BrandStore extends Component { | @@ -36,6 +36,7 @@ export default class BrandStore extends Component { | ||
36 | this.renderSectionHeader = this.renderSectionHeader.bind(this); | 36 | this.renderSectionHeader = this.renderSectionHeader.bind(this); |
37 | this.renderRow = this.renderRow.bind(this); | 37 | this.renderRow = this.renderRow.bind(this); |
38 | this._onPressProductFilter = this._onPressProductFilter.bind(this); | 38 | this._onPressProductFilter = this._onPressProductFilter.bind(this); |
39 | + this._onPressStoreFilter = this._onPressStoreFilter.bind(this); | ||
39 | 40 | ||
40 | this.dataSource = new ListView.DataSource({ | 41 | this.dataSource = new ListView.DataSource({ |
41 | rowHasChanged: (r1, r2) => !Immutable.is(r1, r2), | 42 | rowHasChanged: (r1, r2) => !Immutable.is(r1, r2), |
@@ -50,17 +51,26 @@ export default class BrandStore extends Component { | @@ -50,17 +51,26 @@ export default class BrandStore extends Component { | ||
50 | this._showToast && this._showToast(showToastMessage); | 51 | this._showToast && this._showToast(showToastMessage); |
51 | } | 52 | } |
52 | } | 53 | } |
53 | - _onPressProductFilter(value){ | ||
54 | 54 | ||
55 | + _onPressStoreFilter(value){ | ||
56 | + this.props.onPressStoreFilter && this.props.onPressStoreFilter(value); | ||
57 | + if (value != 3) { | ||
58 | + if (value == 0) { | ||
59 | + this.refs.brandStoreList && this.refs.brandStoreList.scrollTo({x: 0, y: Math.ceil((200 / 640) * width), animated: false}); | ||
60 | + }else { | ||
61 | + this.refs.brandStoreList && this.refs.brandStoreList.scrollTo({x: 0, y: storeFilter_y_Position, animated: false}); | ||
62 | + } | ||
63 | + } | ||
64 | + } | ||
65 | + | ||
66 | + _onPressProductFilter(value){ | ||
55 | if(value === 'filter'){ | 67 | if(value === 'filter'){ |
56 | this.refs.brandStoreList && this.refs.brandStoreList.scrollTo({x: 0, y: yPosition, animated: false}); | 68 | this.refs.brandStoreList && this.refs.brandStoreList.scrollTo({x: 0, y: yPosition, animated: false}); |
57 | } | 69 | } |
58 | if(value==='default'){ | 70 | if(value==='default'){ |
59 | this.refs.brandStoreList && this.refs.brandStoreList.scrollTo({x: 0, y: yPosition, animated: false}); | 71 | this.refs.brandStoreList && this.refs.brandStoreList.scrollTo({x: 0, y: yPosition, animated: false}); |
60 | - | ||
61 | } | 72 | } |
62 | this.props.onPressProductFilter && this.props.onPressProductFilter(value); | 73 | this.props.onPressProductFilter && this.props.onPressProductFilter(value); |
63 | - | ||
64 | } | 74 | } |
65 | 75 | ||
66 | _showToast(message){ | 76 | _showToast(message){ |
@@ -70,36 +80,39 @@ export default class BrandStore extends Component { | @@ -70,36 +80,39 @@ export default class BrandStore extends Component { | ||
70 | duration: 255, | 80 | duration: 255, |
71 | children: message, | 81 | children: message, |
72 | animationEnd : () => { | 82 | animationEnd : () => { |
73 | - this._toast._toastAnimationToggle = setTimeout( | ||
74 | - () => { | ||
75 | - this._toast.hide({ | ||
76 | - duration: 0, | ||
77 | - animationEnd: () => { | ||
78 | - } | ||
79 | - }) | ||
80 | - }, | ||
81 | - 1000 | ||
82 | - ); | 83 | + if(this._toast){ |
84 | + this._toast._toastAnimationToggle = setTimeout( | ||
85 | + () => { | ||
86 | + this._toast && this._toast.hide({ | ||
87 | + duration: 0, | ||
88 | + animationEnd: () => { | ||
89 | + } | ||
90 | + }) | ||
91 | + }, | ||
92 | + 1000 | ||
93 | + ); | ||
94 | + } | ||
83 | } | 95 | } |
84 | }) | 96 | }) |
85 | } | 97 | } |
86 | 98 | ||
87 | renderSectionHeader(sectionData, sectionID) { | 99 | renderSectionHeader(sectionData, sectionID) { |
88 | switch(sectionID) { | 100 | switch(sectionID) { |
89 | - case 'brandReource': { | ||
90 | - return ( | ||
91 | - <BrandStoreFilter | ||
92 | - selectID={this.props.storeFilter} | ||
93 | - onPressFilter={this.props.onPressStoreFilter} | ||
94 | - /> | ||
95 | - ); | ||
96 | - } | 101 | + case 'brandReource': |
97 | case 'storeFilter': { | 102 | case 'storeFilter': { |
103 | + | ||
98 | return ( | 104 | return ( |
99 | - <BrandStoreFilter | ||
100 | - selectID={this.props.storeFilter} | ||
101 | - onPressFilter={this.props.onPressStoreFilter} | ||
102 | - /> | 105 | + <View |
106 | + style={styles.brandFilterContainer} | ||
107 | + onLayout={(evt) => { | ||
108 | + storeFilter_y_Position = evt.nativeEvent.layout.y; | ||
109 | + }} | ||
110 | + > | ||
111 | + <BrandStoreFilter | ||
112 | + selectID={this.props.storeFilter} | ||
113 | + onPressFilter={this._onPressStoreFilter} | ||
114 | + /> | ||
115 | + </View> | ||
103 | ); | 116 | ); |
104 | } | 117 | } |
105 | case 'productList': { | 118 | case 'productList': { |
@@ -357,6 +370,7 @@ let rowHeight = Math.ceil(254 * width / 320); | @@ -357,6 +370,7 @@ let rowHeight = Math.ceil(254 * width / 320); | ||
357 | let rowMarginTop = Math.ceil(10 * width / 320); | 370 | let rowMarginTop = Math.ceil(10 * width / 320); |
358 | let rowMarginHorizontal = (width - rowWidth * 2) / 3; | 371 | let rowMarginHorizontal = (width - rowWidth * 2) / 3; |
359 | let yPosition = 0; | 372 | let yPosition = 0; |
373 | +let storeFilter_y_Position = 0; | ||
360 | 374 | ||
361 | let styles = StyleSheet.create({ | 375 | let styles = StyleSheet.create({ |
362 | container: { | 376 | container: { |
@@ -74,7 +74,7 @@ export default class CouponCell extends React.Component { | @@ -74,7 +74,7 @@ export default class CouponCell extends React.Component { | ||
74 | moneySize = {fontSize:25}; | 74 | moneySize = {fontSize:25}; |
75 | name = {marginLeft: 10,marginTop: 1,width: 80,height: 30}; | 75 | name = {marginLeft: 10,marginTop: 1,width: 80,height: 30}; |
76 | nameSize = {fontSize:9}; | 76 | nameSize = {fontSize:9}; |
77 | - statesTitleStyle = {alignItems:'center',marginTop: 5,width: cellUpOneBack,height: 30}; | 77 | + statesTitleStyle = {alignItems:'center',marginTop: 5,width: cellUpOneBack,height: 60}; |
78 | states = {marginTop: rowData.status?6:10,fontSize:9,width: 10,height: 60}; | 78 | states = {marginTop: rowData.status?6:10,fontSize:9,width: 10,height: 60}; |
79 | } | 79 | } |
80 | 80 |
@@ -25,9 +25,14 @@ export default class BrandSearch extends Component { | @@ -25,9 +25,14 @@ export default class BrandSearch extends Component { | ||
25 | } | 25 | } |
26 | 26 | ||
27 | componentDidMount() { | 27 | componentDidMount() { |
28 | - this.searchBar && this.searchBar.focus(); | 28 | + this.timer = setTimeout(() => { |
29 | + this.searchBar && this.searchBar.focus(); | ||
30 | + }, 0); | ||
29 | } | 31 | } |
30 | 32 | ||
33 | + componentWillUnmount() { | ||
34 | + this.timer && clearTimeout(this.timer); | ||
35 | + } | ||
31 | 36 | ||
32 | 37 | ||
33 | render() { | 38 | render() { |
@@ -99,12 +99,17 @@ export default class Prompt extends Component { | @@ -99,12 +99,17 @@ export default class Prompt extends Component { | ||
99 | marginBottom: 15, | 99 | marginBottom: 15, |
100 | }, | 100 | }, |
101 | }); | 101 | }); |
102 | + if (!this.props.icon) { | ||
103 | + if (!this.props.text) { | ||
104 | + return null; | ||
105 | + } | ||
106 | + } | ||
102 | 107 | ||
103 | return ( | 108 | return ( |
104 | <Animated.View style={[styles.container, {opacity: this.state.fadeAnim,}]}> | 109 | <Animated.View style={[styles.container, {opacity: this.state.fadeAnim,}]}> |
105 | <View style={customStyles.overlay}> | 110 | <View style={customStyles.overlay}> |
106 | {this.props.icon ? <Image source={this.props.icon} style={customStyles.title}/> : null} | 111 | {this.props.icon ? <Image source={this.props.icon} style={customStyles.title}/> : null} |
107 | - <Text style={customStyles.text}>{this.props.text}</Text> | 112 | + {this.props.text ? <Text style={customStyles.text}>{this.props.text}</Text> : null} |
108 | </View> | 113 | </View> |
109 | </Animated.View> | 114 | </Animated.View> |
110 | ); | 115 | ); |
@@ -12,43 +12,24 @@ import ReactNative, { | @@ -12,43 +12,24 @@ import ReactNative, { | ||
12 | Image, | 12 | Image, |
13 | Animated, | 13 | Animated, |
14 | NetInfo, | 14 | NetInfo, |
15 | + Alert, | ||
15 | } from 'react-native'; | 16 | } from 'react-native'; |
16 | 17 | ||
17 | import Camera from 'yh_rncamera'; | 18 | import Camera from 'yh_rncamera'; |
19 | +import ScanBar from './ScanBar' | ||
18 | const yh_QRCodeHelperEvt = new NativeEventEmitter(ReactNative.NativeModules.YH_QRCodeHelper) | 20 | const yh_QRCodeHelperEvt = new NativeEventEmitter(ReactNative.NativeModules.YH_QRCodeHelper) |
19 | 21 | ||
20 | let camera; | 22 | let camera; |
21 | let scanTypeValue, animationFromTopToBottom; | 23 | let scanTypeValue, animationFromTopToBottom; |
22 | -let animationStartHeight = Dimensions.get('window').height * 0.10; | ||
23 | -let animationEndHeight = Dimensions.get('window').height * 0.44; | ||
24 | -let kScreenPointScale = Dimensions.get('window').width/320.0; | ||
25 | -let kScreenPoint6Scale = Dimensions.get('window').width/375.0; | ||
26 | -let KScanRectOfInterestWidth = (175+220)*kScreenPointScale/Dimensions.get('window').height; | ||
27 | -let KScanRectOfInterestHeight = (190+220)*kScreenPointScale/ Dimensions.get('window').width; | 24 | +let animationStartHeight = height * 0.10; |
25 | +let animationEndHeight = height * 0.44; | ||
26 | +let kScreenPointScale = width/320.0; | ||
27 | +let kScreenPoint6Scale = width/375.0; | ||
28 | +let KScanRectOfInterestWidth = (175+220)*kScreenPointScale/height; | ||
29 | +let KScanRectOfInterestHeight = (190+220)*kScreenPointScale/ width; | ||
28 | 30 | ||
29 | export default class QRCode extends React.Component { | 31 | export default class QRCode extends React.Component { |
30 | 32 | ||
31 | - startAnimation() { | ||
32 | - Animated.timing(this.state.destX, { | ||
33 | - toValue: animationFromTopToBottom ? animationEndHeight : animationStartHeight, | ||
34 | - duration: 1480, | ||
35 | - }).start(() => { | ||
36 | - animationFromTopToBottom = !animationFromTopToBottom; | ||
37 | - }); | ||
38 | - }; | ||
39 | - | ||
40 | - componentDidMount() { | ||
41 | - | ||
42 | - this.timer = setInterval(() => { | ||
43 | - this.startAnimation(); | ||
44 | - }, 1500); | ||
45 | - | ||
46 | - } | ||
47 | - | ||
48 | - componentWillUnmount() { | ||
49 | - this.timer && clearInterval(this.timer); | ||
50 | - } | ||
51 | - | ||
52 | constructor(props) { | 33 | constructor(props) { |
53 | super(props); | 34 | super(props); |
54 | camera = null; | 35 | camera = null; |
@@ -61,8 +42,16 @@ export default class QRCode extends React.Component { | @@ -61,8 +42,16 @@ export default class QRCode extends React.Component { | ||
61 | 42 | ||
62 | 43 | ||
63 | render() { | 44 | render() { |
64 | - let {scanType} = this.props; | 45 | + let {scanType,dataInfo} = this.props; |
65 | scanTypeValue = scanType; | 46 | scanTypeValue = scanType; |
47 | + let {alertInfo} = dataInfo; | ||
48 | + let alertTitle = alertInfo.get('title'); | ||
49 | + let alertMessage = ''; | ||
50 | + if (alertInfo.get('message1') && alertInfo.get('message1') != '') { | ||
51 | + alertMessage += alertInfo.get('message1'); | ||
52 | + } if (alertInfo.get('message2') && alertInfo.get('message2') != '') { | ||
53 | + alertMessage += alertInfo.get('message2'); | ||
54 | + } | ||
66 | return ( | 55 | return ( |
67 | <View style={styles.container}> | 56 | <View style={styles.container}> |
68 | <Camera | 57 | <Camera |
@@ -81,20 +70,14 @@ export default class QRCode extends React.Component { | @@ -81,20 +70,14 @@ export default class QRCode extends React.Component { | ||
81 | style={styles.camera} | 70 | style={styles.camera} |
82 | captureAudio={false} | 71 | captureAudio={false} |
83 | > | 72 | > |
84 | - <Image style={styles.sacnRange} source={require('../../images/cameraQR5.png')}> | ||
85 | - | 73 | + <ScanBar |
74 | + style={styles.sacnRange} | ||
75 | + /> | ||
86 | <Image style={styles.tipInfoImage} source={require('../../images/qr_bt.png')}> | 76 | <Image style={styles.tipInfoImage} source={require('../../images/qr_bt.png')}> |
87 | <Text style={styles.tipInfo}> | 77 | <Text style={styles.tipInfo}> |
88 | 尽量让二维码充满框内 | 78 | 尽量让二维码充满框内 |
89 | </Text> | 79 | </Text> |
90 | </Image> | 80 | </Image> |
91 | - | ||
92 | - | ||
93 | - <Animated.Image style={[styles.sacnLine,{ | ||
94 | - top: this.state.destX | ||
95 | - }]} source={require('../../images/cameraQRLine.png')} /> | ||
96 | - | ||
97 | - </Image> | ||
98 | </Camera> | 81 | </Camera> |
99 | 82 | ||
100 | 83 | ||
@@ -111,6 +94,15 @@ export default class QRCode extends React.Component { | @@ -111,6 +94,15 @@ export default class QRCode extends React.Component { | ||
111 | </TouchableOpacity> | 94 | </TouchableOpacity> |
112 | 95 | ||
113 | </View> | 96 | </View> |
97 | + | ||
98 | + {alertInfo.get('show')? | ||
99 | + Alert.alert(alertTitle, alertMessage, [ | ||
100 | + {text: alertInfo.get('confirmInfo'), onPress: () => { | ||
101 | + this.props.hideAlertView && this.props.hideAlertView(); | ||
102 | + camera._addOnBarCodeReadListener(); | ||
103 | + }} | ||
104 | + ]) | ||
105 | + :null} | ||
114 | </View> | 106 | </View> |
115 | 107 | ||
116 | ); | 108 | ); |
@@ -119,32 +111,29 @@ export default class QRCode extends React.Component { | @@ -119,32 +111,29 @@ export default class QRCode extends React.Component { | ||
119 | } | 111 | } |
120 | 112 | ||
121 | 113 | ||
114 | +let {width, height} = Dimensions.get('window'); | ||
122 | 115 | ||
123 | let styles = StyleSheet.create({ | 116 | let styles = StyleSheet.create({ |
124 | container: { | 117 | container: { |
125 | flex: 1 | 118 | flex: 1 |
126 | }, | 119 | }, |
127 | sacnRange: { | 120 | sacnRange: { |
121 | + position: 'absolute', | ||
128 | backgroundColor: 'rgba(255, 255, 255, 0.00)', | 122 | backgroundColor: 'rgba(255, 255, 255, 0.00)', |
129 | - height: Dimensions.get('window').height - 44, | ||
130 | - width: Dimensions.get('window').width, | ||
131 | - }, | ||
132 | - sacnLine: { | ||
133 | - backgroundColor: 'rgba(255, 255, 255, 0.00)', | ||
134 | - height: 2, | ||
135 | - width: 210, | ||
136 | - left: (Dimensions.get('window').width - 210) / 2, | ||
137 | - top: animationStartHeight, | 123 | + height: height - 44, |
124 | + width: width, | ||
125 | + top: 0, | ||
138 | }, | 126 | }, |
139 | camera: { | 127 | camera: { |
140 | - height: Dimensions.get('window').height - 44, | 128 | + height: height - 44, |
141 | alignItems: 'center', | 129 | alignItems: 'center', |
142 | }, | 130 | }, |
143 | tipInfoImage: { | 131 | tipInfoImage: { |
144 | - top: Dimensions.get('window').height * 0.6, | ||
145 | - left: (Dimensions.get('window').width - 170) / 2, | 132 | + top: height * 0.6, |
146 | width: 170, | 133 | width: 170, |
147 | height: 20, | 134 | height: 20, |
135 | + borderRadius: 10, | ||
136 | + justifyContent: 'center', | ||
148 | }, | 137 | }, |
149 | tipInfo: { | 138 | tipInfo: { |
150 | flex: 1, | 139 | flex: 1, |
js/qrcode/components/qrcode/ScanBar.js
0 → 100644
@@ -44,6 +44,7 @@ class QRCodeContainer extends Component { | @@ -44,6 +44,7 @@ class QRCodeContainer extends Component { | ||
44 | super(props); | 44 | super(props); |
45 | 45 | ||
46 | this._onBarCodeRead = this._onBarCodeRead.bind(this); | 46 | this._onBarCodeRead = this._onBarCodeRead.bind(this); |
47 | + this._hideAlertView = this._hideAlertView.bind(this); | ||
47 | } | 48 | } |
48 | 49 | ||
49 | componentDidMount() { | 50 | componentDidMount() { |
@@ -56,20 +57,33 @@ class QRCodeContainer extends Component { | @@ -56,20 +57,33 @@ class QRCodeContainer extends Component { | ||
56 | 57 | ||
57 | _onBarCodeRead(scanString) { | 58 | _onBarCodeRead(scanString) { |
58 | if (!scanString) { | 59 | if (!scanString) { |
59 | - __DEV__ && console.log('Illegal scanString'); | 60 | + console.log('Illegal scanString'); |
60 | return; | 61 | return; |
61 | } | 62 | } |
62 | this.props.actions.processURL(scanString); | 63 | this.props.actions.processURL(scanString); |
63 | } | 64 | } |
64 | 65 | ||
66 | + _hideAlertView(){ | ||
67 | + let alertInfo = { | ||
68 | + show: false, | ||
69 | + title:'', | ||
70 | + message1: '', | ||
71 | + message2: '', | ||
72 | + confirmInfo: '', | ||
73 | + }; | ||
74 | + this.props.actions.updateAlertInfo(alertInfo); | ||
75 | + } | ||
76 | + | ||
65 | render() { | 77 | render() { |
66 | let {qrcode} = this.props; | 78 | let {qrcode} = this.props; |
67 | let {scanType} = qrcode; | 79 | let {scanType} = qrcode; |
68 | return ( | 80 | return ( |
69 | <View style={styles.container}> | 81 | <View style={styles.container}> |
70 | <QRCode | 82 | <QRCode |
83 | + dataInfo={qrcode} | ||
71 | scanType={scanType} | 84 | scanType={scanType} |
72 | onBarCodeRead={this._onBarCodeRead} | 85 | onBarCodeRead={this._onBarCodeRead} |
86 | + hideAlertView={this._hideAlertView} | ||
73 | /> | 87 | /> |
74 | </View> | 88 | </View> |
75 | ); | 89 | ); |
@@ -11,7 +11,7 @@ const { | @@ -11,7 +11,7 @@ const { | ||
11 | JUMP_WITH_URL, | 11 | JUMP_WITH_URL, |
12 | SET_SCANTYPE, | 12 | SET_SCANTYPE, |
13 | JUMP_WITH_OBJECT_NEWFLAG, | 13 | JUMP_WITH_OBJECT_NEWFLAG, |
14 | - PROCESS_SCAN_STRING, | 14 | + UPDATE_ALERT_INFO, |
15 | } = require('../../constants/actionTypes').default; | 15 | } = require('../../constants/actionTypes').default; |
16 | 16 | ||
17 | let showTip = false; | 17 | let showTip = false; |
@@ -43,64 +43,116 @@ function showAlert(title = '二维码扫描', message1, message2, confirmInfo = | @@ -43,64 +43,116 @@ function showAlert(title = '二维码扫描', message1, message2, confirmInfo = | ||
43 | function scanSkn(scanString) { | 43 | function scanSkn(scanString) { |
44 | let strs= new Array(); | 44 | let strs= new Array(); |
45 | strs = scanString.split(":"); | 45 | strs = scanString.split(":"); |
46 | + let sknAlertInfo = { | ||
47 | + show: true, | ||
48 | + title:'二维码扫描', | ||
49 | + message1: '商品skn无法识别:', | ||
50 | + message2: scanString, | ||
51 | + confirmInfo: '确定', | ||
52 | + }; | ||
46 | if (strs.length < 2) { | 53 | if (strs.length < 2) { |
47 | - showAlert('二维码扫描','商品skn无法识别:', scanString,); | ||
48 | - return false; | 54 | + return sknAlertInfo; |
49 | } | 55 | } |
50 | let sknID = strs[1]; | 56 | let sknID = strs[1]; |
51 | if (sknID === '') { | 57 | if (sknID === '') { |
52 | - showAlert('二维码扫描','商品skn无法识别:', scanString,); | ||
53 | - return; | 58 | + return sknAlertInfo; |
54 | } | 59 | } |
55 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(sknID, ScanTypeInfo.YHScanType_Skn); | 60 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(sknID, ScanTypeInfo.YHScanType_Skn); |
56 | - return true; | 61 | + return { |
62 | + show: false, | ||
63 | + title:'', | ||
64 | + message1: '', | ||
65 | + message2: '', | ||
66 | + confirmInfo: '', | ||
67 | + }; | ||
57 | } | 68 | } |
58 | 69 | ||
59 | function scanBear(scanString) { | 70 | function scanBear(scanString) { |
60 | let strs= new Array(); | 71 | let strs= new Array(); |
72 | + let bearAlertInfo = { | ||
73 | + show: true, | ||
74 | + title:'二维码扫描', | ||
75 | + message1: '小熊二维码无法识别:', | ||
76 | + message2: {scanString}, | ||
77 | + confirmInfo: '确定', | ||
78 | + }; | ||
61 | strs = scanString.split(":"); | 79 | strs = scanString.split(":"); |
62 | if (strs.length < 2) { | 80 | if (strs.length < 2) { |
63 | - showAlert('二维码扫描','小熊二维码无法识别:', scanString,); | ||
64 | - return false; | 81 | + return bearAlertInfo; |
65 | } | 82 | } |
66 | let bearID = strs[1]; | 83 | let bearID = strs[1]; |
67 | if (bearID === '') { | 84 | if (bearID === '') { |
68 | - showAlert('二维码扫描','小熊二维码无法识别:', scanString,); | ||
69 | - return false; | 85 | + return bearAlertInfo; |
70 | } | 86 | } |
71 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(bearID, ScanTypeInfo.YHScanType_Bear); | 87 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(bearID, ScanTypeInfo.YHScanType_Bear); |
72 | - return true; | 88 | + return { |
89 | + show: false, | ||
90 | + title:'', | ||
91 | + message1: '', | ||
92 | + message2: '', | ||
93 | + confirmInfo: '', | ||
94 | + }; | ||
73 | } | 95 | } |
74 | 96 | ||
75 | function scanBooth(scanString) { | 97 | function scanBooth(scanString) { |
76 | let strs= new Array(); | 98 | let strs= new Array(); |
77 | strs = scanString.split(":"); | 99 | strs = scanString.split(":"); |
100 | + let boothAlertInfo = { | ||
101 | + show: true, | ||
102 | + title:'二维码扫描', | ||
103 | + message1: '品牌店铺号无法识别:', | ||
104 | + message2: scanString, | ||
105 | + confirmInfo: '确定', | ||
106 | + }; | ||
78 | if (strs.length < 2) { | 107 | if (strs.length < 2) { |
79 | - showAlert('二维码扫描','品牌店铺号无法识别:', scanString,); | ||
80 | - return false; | 108 | + return boothAlertInfo; |
81 | } | 109 | } |
82 | let boothID = strs[1]; | 110 | let boothID = strs[1]; |
83 | if (boothID === '') { | 111 | if (boothID === '') { |
84 | - showAlert('二维码扫描','品牌店铺号无法识别:', scanString,); | ||
85 | - return false; | 112 | + return boothAlertInfo; |
86 | } | 113 | } |
87 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(boothID, ScanTypeInfo.YHScanType_Booth); | 114 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(boothID, ScanTypeInfo.YHScanType_Booth); |
88 | - return true; | 115 | + return { |
116 | + show: false, | ||
117 | + title:'', | ||
118 | + message1: '', | ||
119 | + message2: '', | ||
120 | + confirmInfo: '', | ||
121 | + }; | ||
89 | } | 122 | } |
90 | 123 | ||
91 | function scanExpress(expressString) { | 124 | function scanExpress(expressString) { |
125 | + let expressAlertInfo = { | ||
126 | + show: true, | ||
127 | + title:'二维码扫描', | ||
128 | + message1: '快递单号无法识别:', | ||
129 | + message2: expressString, | ||
130 | + confirmInfo: '确定', | ||
131 | + }; | ||
92 | if (scanString === '') { | 132 | if (scanString === '') { |
93 | - showAlert('二维码扫描','快递单号无法识别:', expressString,); | ||
94 | - return false; | 133 | + return expressAlertInfo; |
95 | } | 134 | } |
96 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(expressString, ScanTypeInfo.YHScanType_Express); | 135 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(expressString, ScanTypeInfo.YHScanType_Express); |
97 | - return true; | 136 | + return { |
137 | + show: false, | ||
138 | + title:'', | ||
139 | + message1: '', | ||
140 | + message2: '', | ||
141 | + confirmInfo: '', | ||
142 | + }; | ||
98 | } | 143 | } |
99 | 144 | ||
100 | function scanYohoBuy(scanString) { | 145 | function scanYohoBuy(scanString) { |
101 | let dataString = ''; | 146 | let dataString = ''; |
102 | let isNew = false; | 147 | let isNew = false; |
103 | let strs= new Array(); | 148 | let strs= new Array(); |
149 | + let yohoBuyAlertInfo = { | ||
150 | + show: true, | ||
151 | + title:'二维码扫描', | ||
152 | + message1: '', | ||
153 | + message2: scanString, | ||
154 | + confirmInfo: '确定', | ||
155 | + }; | ||
104 | if (scanString.indexOf('yohobuy:') !== -1) { | 156 | if (scanString.indexOf('yohobuy:') !== -1) { |
105 | strs = scanString.split("yohobuy:"); | 157 | strs = scanString.split("yohobuy:"); |
106 | if (strs.length == 1) { | 158 | if (strs.length == 1) { |
@@ -127,15 +179,26 @@ function scanYohoBuy(scanString) { | @@ -127,15 +179,26 @@ function scanYohoBuy(scanString) { | ||
127 | } | 179 | } |
128 | } | 180 | } |
129 | } | 181 | } |
130 | - var obj = JSON.parse(dataString); //由JSON字符串转换为JSON对象 | 182 | + var obj; |
183 | + try { | ||
184 | + obj = JSON.parse(dataString); //由JSON字符串转换为JSON对象 | ||
185 | + } catch(err) { | ||
186 | + return yohoBuyAlertInfo; | ||
187 | + } | ||
188 | + console.log(obj); | ||
131 | if (!obj) { | 189 | if (!obj) { |
132 | - showAlert('二维码扫描','', dataString,); | ||
133 | - return false; | 190 | + return yohoBuyAlertInfo; |
134 | } else { | 191 | } else { |
135 | //回传 | 192 | //回传 |
136 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithObjectNewFlag(obj, isNew); | 193 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithObjectNewFlag(obj, isNew); |
137 | } | 194 | } |
138 | - return true; | 195 | + return { |
196 | + show: false, | ||
197 | + title:'', | ||
198 | + message1: '', | ||
199 | + message2: '', | ||
200 | + confirmInfo: '', | ||
201 | + }; | ||
139 | } | 202 | } |
140 | 203 | ||
141 | function handleUrlForSknId(scanString) { | 204 | function handleUrlForSknId(scanString) { |
@@ -195,14 +258,26 @@ function scanAddressLink (scanString) { | @@ -195,14 +258,26 @@ function scanAddressLink (scanString) { | ||
195 | let sknId = handleUrlForSknId(scanString); | 258 | let sknId = handleUrlForSknId(scanString); |
196 | if (sknId !== '') { | 259 | if (sknId !== '') { |
197 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(sknId, ScanTypeInfo.YHScanType_Skn); | 260 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(sknId, ScanTypeInfo.YHScanType_Skn); |
198 | - return true; | 261 | + return { |
262 | + show: false, | ||
263 | + title:'', | ||
264 | + message1: '', | ||
265 | + message2: scanString, | ||
266 | + confirmInfo: '', | ||
267 | + }; | ||
199 | } | 268 | } |
200 | 269 | ||
201 | //判断yoho 品牌链接二维码 | 270 | //判断yoho 品牌链接二维码 |
202 | let brandId = handleUrlForBrandId(scanString); | 271 | let brandId = handleUrlForBrandId(scanString); |
203 | if (brandId !== '') { | 272 | if (brandId !== '') { |
204 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(brandId, ScanTypeInfo.YHScanType_Brand); | 273 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(brandId, ScanTypeInfo.YHScanType_Brand); |
205 | - return true; | 274 | + return { |
275 | + show: false, | ||
276 | + title:'', | ||
277 | + message1: '', | ||
278 | + message2: scanString, | ||
279 | + confirmInfo: '', | ||
280 | + }; | ||
206 | } | 281 | } |
207 | 282 | ||
208 | //判断PC登录二维码 | 283 | //判断PC登录二维码 |
@@ -212,18 +287,22 @@ function scanAddressLink (scanString) { | @@ -212,18 +287,22 @@ function scanAddressLink (scanString) { | ||
212 | if (!isConnected) { | 287 | if (!isConnected) { |
213 | if (!showTip) { | 288 | if (!showTip) { |
214 | showTip = true; | 289 | showTip = true; |
215 | - Alert.alert('提示', '无网络连接,刷新试试', [ | ||
216 | - {text: '取消', onPress: () => { | ||
217 | - showTip = false; | ||
218 | - }}, | ||
219 | - {text: '刷新', onPress: () => { | ||
220 | - showTip = false; | ||
221 | - }} | ||
222 | - ]); | ||
223 | - return false; | 290 | + return { |
291 | + show: true, | ||
292 | + title:'提示', | ||
293 | + message1: '无网络连接,刷新试试', | ||
294 | + message2: '', | ||
295 | + confirmInfo: '取消', | ||
296 | + };; | ||
224 | }; | 297 | }; |
225 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(pcLoginCode, ScanTypeInfo.YHScanType_PCLogin); | 298 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(pcLoginCode, ScanTypeInfo.YHScanType_PCLogin); |
226 | - return true; | 299 | + return { |
300 | + show: false, | ||
301 | + title:'', | ||
302 | + message1: '', | ||
303 | + message2: '', | ||
304 | + confirmInfo: '', | ||
305 | + }; | ||
227 | } | 306 | } |
228 | }); | 307 | }); |
229 | } | 308 | } |
@@ -231,51 +310,80 @@ function scanAddressLink (scanString) { | @@ -231,51 +310,80 @@ function scanAddressLink (scanString) { | ||
231 | //扫描信息全局变量 | 310 | //扫描信息全局变量 |
232 | let scanQRString = scanComonURL(scanString); | 311 | let scanQRString = scanComonURL(scanString); |
233 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(scanQRString, ScanTypeInfo.YHScanType_CommonUrl); | 312 | ReactNative.NativeModules.YH_QRCodeHelper.jumpWithUrl(scanQRString, ScanTypeInfo.YHScanType_CommonUrl); |
234 | - return true; | 313 | + return { |
314 | + show: false, | ||
315 | + title:'', | ||
316 | + message1: '', | ||
317 | + message2: '', | ||
318 | + confirmInfo: '', | ||
319 | + }; | ||
235 | } | 320 | } |
236 | 321 | ||
237 | 322 | ||
238 | function processScanString(url,scanType) { | 323 | function processScanString(url,scanType) { |
239 | let prefixRegex = '^skn:|^booth:|^bear:|^yohobuy:|^yohobuy=|^http://|^https://'; | 324 | let prefixRegex = '^skn:|^booth:|^bear:|^yohobuy:|^yohobuy=|^http://|^https://'; |
240 | let isHasPrefix = url.match(prefixRegex);//prefixRegex.search(url); | 325 | let isHasPrefix = url.match(prefixRegex);//prefixRegex.search(url); |
326 | + let alertInfo = { | ||
327 | + show: false, | ||
328 | + title:'', | ||
329 | + message1: '', | ||
330 | + message2: '', | ||
331 | + confirmInfo: '', | ||
332 | + }; | ||
241 | if(isHasPrefix === -1 && scanType !== 4 && !showTip){ | 333 | if(isHasPrefix === -1 && scanType !== 4 && !showTip){ |
242 | - showAlert('二维码扫描','无法识别的二维码:', url,); | ||
243 | - return false; | 334 | + alertInfo = { |
335 | + show: true, | ||
336 | + title:'二维码扫描', | ||
337 | + message1: '无法识别的二维码:', | ||
338 | + message2: url, | ||
339 | + confirmInfo: '确定', | ||
340 | + }; | ||
244 | }; | 341 | }; |
245 | 342 | ||
246 | switch (scanType) { | 343 | switch (scanType) { |
247 | case ScanTypeInfo.YHScanType_Skn://YHScanType_Skn | 344 | case ScanTypeInfo.YHScanType_Skn://YHScanType_Skn |
248 | - scanSkn(url); | 345 | + alertInfo = scanSkn(url); |
249 | break; | 346 | break; |
250 | case ScanTypeInfo.YHScanType_Bear: | 347 | case ScanTypeInfo.YHScanType_Bear: |
251 | - scanBear(url); | 348 | + alertInfo =scanBear(url); |
252 | break; | 349 | break; |
253 | case ScanTypeInfo.YHScanType_Booth: | 350 | case ScanTypeInfo.YHScanType_Booth: |
254 | - scanBooth(url); | 351 | + alertInfo = scanBooth(url); |
255 | break; | 352 | break; |
256 | case ScanTypeInfo.YHScanType_Express: | 353 | case ScanTypeInfo.YHScanType_Express: |
257 | - scanExpress(url); | 354 | + alertInfo = scanExpress(url); |
258 | break; | 355 | break; |
259 | case ScanTypeInfo.YHScanType_Default: { | 356 | case ScanTypeInfo.YHScanType_Default: { |
260 | if (url.indexOf('skn:') !== -1) { | 357 | if (url.indexOf('skn:') !== -1) { |
261 | - scanSkn(url); | 358 | + console.log('skn'); |
359 | + alertInfo = scanSkn(url); | ||
262 | } else if (url.indexOf('booth:') !== -1) { | 360 | } else if (url.indexOf('booth:') !== -1) { |
263 | - scanBooth(url); | 361 | + console.log('booth'); |
362 | + alertInfo = scanBooth(url); | ||
264 | } else if (url.indexOf('bear:') !== -1) { | 363 | } else if (url.indexOf('bear:') !== -1) { |
265 | - scanBear(url); | ||
266 | - } else if (url.indexOf('yohobuy:') !== -1 || url.indexOf('yohobuy=') !== -1) { | ||
267 | - scanYohoBuy(url); | 364 | + console.log('bear'); |
365 | + alertInfo = scanBear(url); | ||
366 | + } else if (url.indexOf('yohobuy:') !== -1 || url.indexOf('yohobuy=') !== -1 || url.indexOf('yohobuy=') !== -1) { | ||
367 | + console.log('yohobuy'); | ||
368 | + alertInfo = scanYohoBuy(url); | ||
268 | } else if (url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1) { | 369 | } else if (url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1) { |
269 | - scanAddressLink(url); | 370 | + console.log('http&s'); |
371 | + alertInfo = scanAddressLink(url); | ||
270 | } else { | 372 | } else { |
271 | - showAlert('二维码扫描','无法识别的二维码:', url,); | ||
272 | - return false; | 373 | + alertInfo = { |
374 | + show: true, | ||
375 | + title:'二维码扫描', | ||
376 | + message1: '无法识别的二维码:', | ||
377 | + message2: url, | ||
378 | + confirmInfo: '确定', | ||
379 | + }; | ||
273 | } | 380 | } |
381 | + break; | ||
274 | } | 382 | } |
275 | break; | 383 | break; |
276 | default: | 384 | default: |
277 | - | ||
278 | } | 385 | } |
386 | + return alertInfo; | ||
279 | }; | 387 | }; |
280 | 388 | ||
281 | export function setScanType(scanType) { | 389 | export function setScanType(scanType) { |
@@ -285,6 +393,13 @@ export function setScanType(scanType) { | @@ -285,6 +393,13 @@ export function setScanType(scanType) { | ||
285 | }; | 393 | }; |
286 | } | 394 | } |
287 | 395 | ||
396 | +export function updateAlertInfo(info) { | ||
397 | + return { | ||
398 | + type: UPDATE_ALERT_INFO, | ||
399 | + payload: info, | ||
400 | + }; | ||
401 | +} | ||
402 | + | ||
288 | export function processURL(scanString) { | 403 | export function processURL(scanString) { |
289 | return (dispatch, getState) => { | 404 | return (dispatch, getState) => { |
290 | 405 | ||
@@ -292,21 +407,15 @@ export function processURL(scanString) { | @@ -292,21 +407,15 @@ export function processURL(scanString) { | ||
292 | if(!scanString) { | 407 | if(!scanString) { |
293 | return; | 408 | return; |
294 | } | 409 | } |
295 | - let useableScanString = processScanString(scanString,qrcode.scanType); | ||
296 | - if (useableScanString) { | ||
297 | - return; | ||
298 | - } | ||
299 | - dispatch({ | ||
300 | - type: PROCESS_SCAN_STRING, | ||
301 | - payload: useableScanString | ||
302 | - }); | 410 | + let alertInfo = processScanString(scanString,qrcode.scanType); |
411 | + dispatch(updateAlertInfo(alertInfo)); | ||
303 | }; | 412 | }; |
304 | 413 | ||
305 | } | 414 | } |
306 | 415 | ||
307 | export function jumpWithUrl(url, JumpType) { | 416 | export function jumpWithUrl(url, JumpType) { |
308 | if (!url) { | 417 | if (!url) { |
309 | - __DEV__ && console.log('Illegal url'); | 418 | + console.log('Illegal url'); |
310 | return; | 419 | return; |
311 | } | 420 | } |
312 | 421 | ||
@@ -316,16 +425,3 @@ export function jumpWithUrl(url, JumpType) { | @@ -316,16 +425,3 @@ export function jumpWithUrl(url, JumpType) { | ||
316 | payload: url | 425 | payload: url |
317 | }; | 426 | }; |
318 | } | 427 | } |
319 | - | ||
320 | -export function jumpWithObjectNewFlag(jsonObj, isNew) { | ||
321 | - if (!url) { | ||
322 | - __DEV__ && console.log('Illegal object'); | ||
323 | - return; | ||
324 | - } | ||
325 | - | ||
326 | - ReactNative.NativeModules.YH_QRCodeHelper.jumpWithObjectNewFlag({jsonObj, isNew}); | ||
327 | - return { | ||
328 | - type: JUMP_WITH_OBJECT_NEWFLAG, | ||
329 | - payload: url | ||
330 | - }; | ||
331 | -} |
@@ -7,6 +7,13 @@ let InitialState = Record({ | @@ -7,6 +7,13 @@ let InitialState = Record({ | ||
7 | scanType: 0, | 7 | scanType: 0, |
8 | jumpScanStringFaild: 0, | 8 | jumpScanStringFaild: 0, |
9 | segment: null, | 9 | segment: null, |
10 | + alertInfo: new (Record({ | ||
11 | + show: false, | ||
12 | + title:'', | ||
13 | + message1: '', | ||
14 | + message2: '', | ||
15 | + confirmInfo: '', | ||
16 | + })), | ||
10 | }); | 17 | }); |
11 | 18 | ||
12 | export default InitialState; | 19 | export default InitialState; |
@@ -8,6 +8,7 @@ const { | @@ -8,6 +8,7 @@ const { | ||
8 | SET_SCANTYPE, | 8 | SET_SCANTYPE, |
9 | JUMP_WITH_OBJECT_NEWFLAG, | 9 | JUMP_WITH_OBJECT_NEWFLAG, |
10 | PROCESS_SCAN_STRING, | 10 | PROCESS_SCAN_STRING, |
11 | + UPDATE_ALERT_INFO, | ||
11 | } = require('../../constants/actionTypes').default; | 12 | } = require('../../constants/actionTypes').default; |
12 | 13 | ||
13 | const initialState = new InitialState; | 14 | const initialState = new InitialState; |
@@ -20,6 +21,9 @@ export default function qrcodeReducer(state=initialState, action) { | @@ -20,6 +21,9 @@ export default function qrcodeReducer(state=initialState, action) { | ||
20 | case PROCESS_SCAN_STRING: { | 21 | case PROCESS_SCAN_STRING: { |
21 | return state.set('jumpScanStringFaild',action.payload); | 22 | return state.set('jumpScanStringFaild',action.payload); |
22 | } | 23 | } |
24 | + case UPDATE_ALERT_INFO: { | ||
25 | + return state.set('alertInfo',Immutable.fromJS(action.payload)); | ||
26 | + } | ||
23 | } | 27 | } |
24 | 28 | ||
25 | return state; | 29 | return state; |
@@ -76,32 +76,38 @@ export default class ProductListView extends Component { | @@ -76,32 +76,38 @@ export default class ProductListView extends Component { | ||
76 | </View> | 76 | </View> |
77 | :<View style={[styles.secKillMarketPriceContainer, {marginTop: 2}]}> | 77 | :<View style={[styles.secKillMarketPriceContainer, {marginTop: 2}]}> |
78 | <Text style={[styles.secKillPrice,{color:'#d0021b'}]}>¥{rowData.secKillPrice}</Text> | 78 | <Text style={[styles.secKillPrice,{color:'#d0021b'}]}>¥{rowData.secKillPrice}</Text> |
79 | - <DeleteLineText style={{top:3, left:8}} text={'¥' + rowData.marketPrice+' '} /> | 79 | + <DeleteLineText style={{top:3, left:8}} lineStyle={{marginRight:8}} text={'¥' + rowData.marketPrice+' '} /> |
80 | </View> | 80 | </View> |
81 | } | 81 | } |
82 | </View> | 82 | </View> |
83 | - <TouchableOpacity onPress={() => { | ||
84 | - if (this.tipMessage == '') { | ||
85 | - if (rowData.wait) { | ||
86 | - this.props.onPressRemindBtn && this.props.onPressRemindBtn(rowData); | ||
87 | - }else { | ||
88 | - this.props.onPressProductItem && this.props.onPressProductItem(rowData); | ||
89 | - } | ||
90 | - } | ||
91 | 83 | ||
92 | - }}> | ||
93 | - { | ||
94 | - (tipState=='取消提醒')? | ||
95 | - <View style={[styles.priceClickTipViewRight,{backgroundColor: btnBgColor,borderWidth:1.0}]}> | ||
96 | - <Text style={{color:btnTextcolor}}>{tipState}</Text> | ||
97 | - </View> | ||
98 | - :<View style={[styles.priceClickTipViewRight,{backgroundColor: btnBgColor}]}> | ||
99 | - <Text style={{color:btnTextcolor}}>{tipState}</Text> | ||
100 | - </View> | ||
101 | - } | 84 | + {tipState == '已抢光' ? |
85 | + <View style={[styles.priceClickTipViewRight,{backgroundColor: btnBgColor}]}> | ||
86 | + <Text style={{color:btnTextcolor}}>{tipState}</Text> | ||
87 | + </View> | ||
88 | + : | ||
89 | + <TouchableOpacity onPress={() => { | ||
90 | + if (this.tipMessage == '') { | ||
91 | + if (rowData.wait) { | ||
92 | + this.props.onPressRemindBtn && this.props.onPressRemindBtn(rowData); | ||
93 | + }else { | ||
94 | + this.props.onPressProductItem && this.props.onPressProductItem(rowData); | ||
95 | + } | ||
96 | + } | ||
102 | 97 | ||
103 | - </TouchableOpacity> | 98 | + }}> |
99 | + { | ||
100 | + (tipState=='取消提醒')? | ||
101 | + <View style={[styles.priceClickTipViewRight,{backgroundColor: btnBgColor,borderWidth:1.0}]}> | ||
102 | + <Text style={{color:btnTextcolor}}>{tipState}</Text> | ||
103 | + </View> | ||
104 | + :<View style={[styles.priceClickTipViewRight,{backgroundColor: btnBgColor}]}> | ||
105 | + <Text style={{color:btnTextcolor}}>{tipState}</Text> | ||
106 | + </View> | ||
107 | + } | ||
104 | 108 | ||
109 | + </TouchableOpacity> | ||
110 | + } | ||
105 | </View> | 111 | </View> |
106 | </View> | 112 | </View> |
107 | </View> | 113 | </View> |
@@ -19,7 +19,7 @@ import TimerMixin from 'react-timer-mixin'; | @@ -19,7 +19,7 @@ import TimerMixin from 'react-timer-mixin'; | ||
19 | import Immutable, {Map} from 'immutable'; | 19 | import Immutable, {Map} from 'immutable'; |
20 | import ProductListView from './ProductListView'; | 20 | import ProductListView from './ProductListView'; |
21 | import TimeListView from './TimeListView'; | 21 | import TimeListView from './TimeListView'; |
22 | -import Toast from 'react-native-root-toast' | 22 | +import Prompt from '../../../coupon/components/coupon/Prompt'; |
23 | 23 | ||
24 | export default class Seckill extends Component { | 24 | export default class Seckill extends Component { |
25 | constructor(props) { | 25 | constructor(props) { |
@@ -57,9 +57,6 @@ export default class Seckill extends Component { | @@ -57,9 +57,6 @@ export default class Seckill extends Component { | ||
57 | 57 | ||
58 | componentWillReceiveProps(nextProps) { | 58 | componentWillReceiveProps(nextProps) { |
59 | this.firstLaunch = false; | 59 | this.firstLaunch = false; |
60 | - if (nextProps.tipMessage && nextProps.tipMessage !== '') { | ||
61 | - this._showToast && this._showToast(nextProps.tipMessage); | ||
62 | - } | ||
63 | } | 60 | } |
64 | 61 | ||
65 | _onPressTimeItem(activity) { | 62 | _onPressTimeItem(activity) { |
@@ -69,26 +66,6 @@ export default class Seckill extends Component { | @@ -69,26 +66,6 @@ export default class Seckill extends Component { | ||
69 | } | 66 | } |
70 | } | 67 | } |
71 | 68 | ||
72 | - _showToast = (message) => { | ||
73 | - if (this.toast) { | ||
74 | - return; | ||
75 | - } | ||
76 | - this.toast = Toast.show(message, { | ||
77 | - duration: 3000, | ||
78 | - position: height / 2 - 60, | ||
79 | - shadow: false, | ||
80 | - animation: true, | ||
81 | - hideOnPress: true, | ||
82 | - onHidden: () => { | ||
83 | - if (this.toast) { | ||
84 | - this.toast.destroy(); | ||
85 | - this.toast = null; | ||
86 | - } | ||
87 | - this.props.onClearTipMessage && this.props.onClearTipMessage(); | ||
88 | - } | ||
89 | - }); | ||
90 | - }; | ||
91 | - | ||
92 | renderSectionHeader(sectionData, sectionID) { | 69 | renderSectionHeader(sectionData, sectionID) { |
93 | if (this.queryActivityInfo && this.queryActivityInfo.secKillProductVoList && this.queryActivityInfo.secKillProductVoList.size > 0) { | 70 | if (this.queryActivityInfo && this.queryActivityInfo.secKillProductVoList && this.queryActivityInfo.secKillProductVoList.size > 0) { |
94 | return ( | 71 | return ( |
@@ -221,6 +198,15 @@ export default class Seckill extends Component { | @@ -221,6 +198,15 @@ export default class Seckill extends Component { | ||
221 | }} | 198 | }} |
222 | /> | 199 | /> |
223 | } | 200 | } |
201 | + {tipMessage != '' ? | ||
202 | + <Prompt | ||
203 | + text={tipMessage} | ||
204 | + duration={800} | ||
205 | + onPromptHidden={this.props.onClearTipMessage} | ||
206 | + /> | ||
207 | + :null | ||
208 | + } | ||
209 | + | ||
224 | </View> | 210 | </View> |
225 | ); | 211 | ); |
226 | } | 212 | } |
@@ -313,6 +313,7 @@ export function clickRemindBtn(product) { | @@ -313,6 +313,7 @@ export function clickRemindBtn(product) { | ||
313 | ReactNative.NativeModules.YH_CommonHelper.login() | 313 | ReactNative.NativeModules.YH_CommonHelper.login() |
314 | .then(uid => { | 314 | .then(uid => { |
315 | dispatch(clickActivityTimeItem(product)); | 315 | dispatch(clickActivityTimeItem(product)); |
316 | + queryRemindList(uid); | ||
316 | }) | 317 | }) |
317 | .catch(error => { | 318 | .catch(error => { |
318 | 319 | ||
@@ -363,7 +364,9 @@ export function clickRemindBtn(product) { | @@ -363,7 +364,9 @@ export function clickRemindBtn(product) { | ||
363 | dispatch(addCancelUserReminder(method, product.activityId, skn,uid, product.id, okTip, failTip)); | 364 | dispatch(addCancelUserReminder(method, product.activityId, skn,uid, product.id, okTip, failTip)); |
364 | }) | 365 | }) |
365 | .catch(error => { | 366 | .catch(error => { |
366 | - dispatch(showTipMessage(error)); | 367 | + console.log('error'); |
368 | + console.log(error); | ||
369 | + dispatch(showTipMessage('请到设置中开启日历授权')); | ||
367 | }); | 370 | }); |
368 | }; | 371 | }; |
369 | 372 |
-
Please register or login to post a comment