Authored by 于良

Merge branch '5.4.1' of http://git.yoho.cn/mobile/YH_RNComponent into 5.4.1

Showing 100 changed files with 1572 additions and 0 deletions

Too many changes to show.

To preserve performance only 100 of 100+ files are displayed.

... ... @@ -11,6 +11,7 @@ import Seckill from './seckill/Seckill';
import Guang from './guang/Guang';
import Message from './message/Message';
import NewArrival from './newArrival/NewArrival';
import Mine from './mine/Mine';
// import Search from './search/Search';
import RedPersonBrand from './redPersonBrand/RedPersonBrand';
... ... @@ -33,6 +34,7 @@ export default function native(platform) {
Home(platform);
Outlet(platform);
BLK(platform)
Mine(platform);
if (Platform.OS === 'ios') {
Community(platform);
... ...
'use strict';
import React from 'react';
import ReactNative, {
AppRegistry,
Platform,
StyleSheet,
Dimensions,
TouchableOpacity,
} from 'react-native';
import {
Provider,
connect
} from 'react-redux';
import configureStore from './store/configureStore';
import {Record, List, Map} from 'immutable';
import appInitialState from './reducers/app/appInitialState';
import mineInitialState from './reducers/mine/mineInitialState';
import MineContainer from './containers/MineContainer';
import {
setPlatform,
setChannel,
} from './reducers/app/appActions';
function getInitialState() {
const _initState = {
app: (new appInitialState()),
mine: (new mineInitialState()),
};
return _initState;
}
export default function native(platform) {
let YH_Mine = React.createClass({
render() {
const store = configureStore(getInitialState());
store.dispatch(setPlatform(platform));
let channel = this.props.channel;
channel && store.dispatch(setChannel(channel));
console.log(channel);
return (
<Provider store={store}>
<MineContainer />
</Provider>
);
}
});
AppRegistry.registerComponent('YH_Mine', () => YH_Mine);
}
let styles = StyleSheet.create({
});
\ No newline at end of file
... ...
'use strict';
import React from 'react';
import ReactNative from 'react-native';
import Swiper from 'react-native-swiper';
import YH_Image from '../../../common/components/YH_Image';
import Immutable, {Map} from 'immutable';
const {
View,
Text,
Image,
TouchableOpacity,
StyleSheet,
Dimensions,
} = ReactNative;
export default class Announcement extends React.Component {
constructor(props) {
super (props);
}
shouldComponentUpdate(nextProps){
if (Immutable.is(nextProps.headerImage, this.props.headerImage)
&& Immutable.is(nextProps.data, this.props.data)
&& nextProps.duration == this.props.duration) {
return false;
} else {
return true;
}
}
render() {
let {headerImage, data, duration} = this.props;
duration = parseInt(duration);
duration = duration ? duration : 3;
let url = YH_Image.getSlicedUrl(headerImage, headImageWidth, headImageHeight, 2);
data = data.toArray();
return (
<View style={styles.container}>
{headerImage ? <YH_Image style={styles.header} url={url} /> : null}
{headerImage ? <View style={styles.vLine} /> : null}
<Image style={styles.icon} resizeMode={'contain'} source={require('../../image/announcement_speaker_icon.png') } />
<Swiper
style={styles.banner}
horizontal={false}
showsButtons={false}
loop={true}
autoplay={true}
autoplayTimeout={duration}
showsPagination={false}
dot={this.dot}
activeDot={this.activeDot}
height={containerHeight}
scrollEnabled={false}
>
{data.map((item, i) => {
return (
<TouchableOpacity
key={i}
activeOpacity={1}
onPress={() => {
this.props.onPressAnnounceItem && this.props.onPressAnnounceItem(item.get('url'), i);
}}
style={{height: containerHeight, justifyContent: 'center', }}
>
<Text style={styles.text} numberOfLines={1}>{item.get('title')}</Text>
</TouchableOpacity>
);
})}
</Swiper>
</View>
);
}
}
let {width, height} = Dimensions.get('window');
const DEVICE_WIDTH_RATIO = width / 320;
let containerHeight = Math.ceil(35 * DEVICE_WIDTH_RATIO);
let headImageMarginLeft = 15;
let headImageWidth = Math.ceil(63 * DEVICE_WIDTH_RATIO);
let headImageHeight = Math.ceil(13 * DEVICE_WIDTH_RATIO);
let lineViewMarginLeft = 15;
let lineViewMarginRight = 10;
let iconImageMarginRight = 7;
let textFieldMarginRight = 15;
let textFontSize = 12;
// iPhone 6P
if (height == 736) {
headImageMarginLeft = 22.5;
lineViewMarginLeft = 22.5;
lineViewMarginRight = 15;
iconImageMarginRight = 10;
textFieldMarginRight = 22.5;
textFontSize = 13;
}
let textFieldWidth = width - headImageWidth - headImageMarginLeft
- lineViewMarginLeft - 12 - lineViewMarginRight - iconImageMarginRight - 5;
let styles = StyleSheet.create({
container: {
flexDirection: 'row',
alignItems: 'center',
backgroundColor: 'white',
height: containerHeight,
},
header: {
width: headImageWidth,
height: headImageHeight,
marginLeft: headImageMarginLeft,
},
vLine: {
width: 1,
height: 20,
marginLeft: lineViewMarginLeft,
backgroundColor: '#e5e5e5',
},
icon: {
width: 18,
height: 18,
marginLeft:20,
marginRight: iconImageMarginRight,
},
banner: {
},
text: {
fontFamily: 'STHeitiSC-Medium',
fontSize: textFontSize,
color: '#444444',
width: textFieldWidth,
},
});
... ...
'use strict';
import React from 'react';
import ReactNative, {
View,
Text,
Image,
ListView,
StyleSheet,
Dimensions,
TouchableOpacity,
Platform,
PixelRatio,
} from 'react-native';
import Immutable, {Map} from 'immutable';
import ProductListCell from '../../../common/components/ListCell/ProductListCell';
import MineListHeader from './MineListHeader';
export default class MineList extends React.Component {
constructor(props) {
super(props);
this._renderRow = this._renderRow.bind(this);
this._renderHeader = this._renderHeader.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
});
}
_renderRow(rowData, sectionID, rowID, highlightRow) {
let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft};
return (
<ProductListCell
style={[styles.listContainer, customStyle]}
key={'row' + rowID}
rowID={rowID}
data={rowData}
onPressProduct={this.props.onPressProductListProduct}
/>
);
}
_renderHeader() {
return (
<MineListHeader
profile={this.props.profile}
mineInfoNum={this.props.mineInfoNum}
redPackageNum={this.props.redPackageNum}
onPressItem={this.props.onPressItem}
activityListInfo={this.props.activityListInfo}
memberBill={this.props.memberBill}
showRedPacket={this.props.showRedPacket}
certificationInfo={this.props.certificationInfo}
announcement={this.props.announcement}
globalOrderData={this.props.globalOrderData}
/>
);
}
render() {
let {
isFetching,
productListForInstallment,
installmentInfo,
profile,
mineInfoNum,
redPackageNum,
activityListInfo,
memberBill,
showRedPacket,
certificationInfo,
announcement,
globalOrderData
} = this.props;
let dataSource = null;
dataSource = productListForInstallment.list.toArray();
return (
<View style={styles.container}>
<ListView
contentContainerStyle={styles.contentContainer}
enableEmptySections={true}
dataSource={this.dataSource.cloneWithRows(dataSource)}
renderRow={this._renderRow}
renderHeader={this._renderHeader}
/>
<View style={styles.top_bar}>
<TouchableOpacity onPress={() => this.props.onPressItem('mineSetting','')}>
<Image style={{
marginLeft: 15,
width: 26,
height: 26,
}} source={require('../../image/mine_setting_icon_n.png')}/>
</TouchableOpacity>
<Text style={{
flex: 1,
marginRight: 25,
height: 20,
justifyContent: 'center',
alignItems: 'center',
textAlignVertical:'center',
textAlign:'center',
color: 'white',
fontSize:17,
}}>
我的
</Text>
<TouchableOpacity onPress={() => this.props.onPressItem('mineMessageHome','')}>
<Image style={{
marginRight: 15,
width: 27,
height: 27,
resizeMode:'contain',
}} source={require('../../image/home_message_center.png')}>
</Image>
</TouchableOpacity>
<Text style={{
position:'absolute',
right:3,
top:0,
alignItems: 'center',
justifyContent: 'center',
color: 'white',
fontSize:10,
textAlign: 'center',
textAlignVertical: 'center',
backgroundColor:'red',
paddingLeft:4,
paddingRight:4,
borderRadius: 10,
marginTop:2,
borderWidth: 0,
}}>
99
</Text>
</View>
</View>
);
}
};
let {width, height} = Dimensions.get('window');
let rowWidth = Math.ceil(137.5 * width / 320);
let rowHeight = Math.ceil(254 * width / 320);
let rowMarginTop = Math.ceil(10 * width / 320);
let rowMarginHorizontal = (width - rowWidth * 2) / 3;
let styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
},
contentContainer: {
flexDirection: 'row',
flexWrap: 'wrap',
},
listContainer: {
width: width / 2,
},
top_bar: {
position: 'absolute',
flexDirection: 'row',
alignItems: 'center',
height: 44,
left: 0,
top: 0,
width: width,
},
dot: {
position: 'absolute',
right: 0,
top: 0,
height: 9,
width: 9,
}
});
\ No newline at end of file
... ...
'use strict';
import React from 'react';
import ReactNative, {
View,
Text,
Image,
StyleSheet,
Dimensions,
PixelRatio,
TouchableOpacity,
Platform,
} from 'react-native';
import Immutable, {Map} from 'immutable';
import Announcement from './Announcement';
import YH_Image from '../../../common/components/YH_Image';
export default class MineListHeader extends React.Component {
constructor(props) {
super(props);
this._renderNumberPoint = this._renderNumberPoint.bind(this);
this._renderVip = this._renderVip.bind(this);
/*this.state = {
offsetHigh: 0,
};*/
}
/*componentWillReceiveProps(nextProps){
//计算高度
let oHigh=0;
if(nextProps.certificationInfo&&nextProps.certificationInfo.isBindedOrRelated==='N'){
oHigh=oHigh+subRowHeight;
}
if(nextProps.announcement&&nextProps.announcement.open==='Y'){
oHigh=oHigh+subRowHeight;
}
if((nextProps.certificationInfo.isBindedOrRelated==='N')||(nextProps.announcement&&nextProps.announcement.open==='Y')){
oHigh=oHigh+10;
}
if(nextProps.globalOrderData&&nextProps.globalOrderData.hasOrder==='Y'){
oHigh=oHigh+rowheight;
}
if(nextProps.memberBill&&nextProps.memberBill.bill.open==='Y'){
oHigh=oHigh+rowheight;
}
if(nextProps.activityListInfo&&nextProps.activityListInfo.list&&nextProps.activityListInfo.list.toArray().length>0){
console.log('=====');
oHigh=oHigh+rowheight*nextProps.activityListInfo.list.length;
}
this.setState({
offsetHigh: oHigh,
});
}*/
_renderNumberPoint(num) {
let offset = 0;
if (isNaN(num)) {
//兼容非数字
} else if (num <= 0) {
//0不显示
return null;
} else if (num < 10) {
offset = 15;
} else if (num < 100) {
offset = 15;
} else if (num < 1000) {
offset = 10;
} else if (num < 10000) {
offset = 5;
} else {
offset = 1;
num = '9999+';
}
return (
<Text style={{
position:'absolute',
right:offset,
top:0,
alignItems: 'center',
justifyContent: 'center',
color: 'white',
fontSize:10,
textAlign: 'center',
textAlignVertical: 'center',
backgroundColor:'black',
paddingLeft:num<10?4:1,
paddingRight:num<10?4:1,
borderRadius: 10,
borderWidth: (Platform.OS==='ios' ? 3 : 5) / PixelRatio.get(),
}}>{num}</Text>
);
}
_renderVip() {
let num = this.props.profile.vip_info.cur_level;
if (num <= 0) {
return null;
}
let vipPic = [
require('../../image/mine_vip_1.png'),
require('../../image/mine_vip_2.png'),
require('../../image/mine_vip_3.png'),
]
if (num > 3) {
num = 3;
}
return (<Image style={styles.user_level} resizeMode={'stretch'} source={vipPic[num-1]}/>);
}
render() {
let fontFamilyStyle = {};
let {
profile,
mineInfoNum,
redPackageNum,
activityListInfo, memberBill, showRedPacket, certificationInfo, announcement, globalOrderData
} = this.props;
if (Platform.OS === 'ios') {
let systemVersion = DeviceInfo.getSystemVersion();
systemVersion = parseFloat(systemVersion);
if (systemVersion >= 9.0) {
fontFamilyStyle = {fontFamily: 'PingFang SC'};
}
}
let oHigh = 0;
if (this.props.certificationInfo && this.props.certificationInfo.isBindedOrRelated === 'N') {
oHigh = oHigh + subRowHeight;
}
if (this.props.announcement && this.props.announcement.open === 'Y') {
oHigh = oHigh + subRowHeight;
}
if ((this.props.certificationInfo.isBindedOrRelated === 'N') || (this.props.announcement && this.props.announcement.open === 'Y')) {
oHigh = oHigh + 10;
}
if (this.props.globalOrderData && this.props.globalOrderData.hasOrder === 'Y') {
oHigh = oHigh + rowheight;
}
if (this.props.memberBill && this.props.memberBill.bill.open === 'Y') {
oHigh = oHigh + rowheight;
}
if (this.props.activityListInfo && this.props.activityListInfo.list && this.props.activityListInfo.list.size > 0) {
console.log('=====');
console.log(this.props.activityListInfo.list.size);
oHigh = oHigh + rowheight * this.props.activityListInfo.list.size;
}
console.log("liben000000");
console.log(topHeight);
console.log(oHigh);
oHigh = topHeight + oHigh;
console.log(oHigh);
return (
<View style={[styles.container,{height:oHigh}]}>
<Image source={require('../../image/mine_banner_boy.jpg')}
style={{width: width, height: 175,paddingTop:45, }}
resizeMode={'stretch'}>
{
profile.uid != '0' ?
<TouchableOpacity onPress={() => this.props.onPressItem('mineInfo','')}>
<View style={styles.icon_container}>
<View style={{
flexDirection:'row',
flex:1,
alignItems:'center',
}}>
<Image style={styles.user_img}
source={{uri: YH_Image.getSlicedUrl(profile.head_ico, 90, 90, 2)}}
resizeMode={'cover'}/>
<View style={{
flexDirection:'column',
flex:1,
marginLeft:8,
}}>
<Text style={{
alignItems: 'center',
justifyContent: 'center',
color: 'white',
}} numberOfLines={1}>
{profile.profile_name}
</Text>
<View style={{
flexDirection:'row',
marginTop:3,
}}>
{this._renderVip()}
{
profile.vip_info.is_student == 0 ? null :
<Image style={{
width: 30,
height: 20,
marginLeft:4,
}} resizeMode={'stretch'}
source={require('../../image/mine_vip_stu.png')}/>
}
</View>
</View>
</View>
<View style={{
flexDirection:'column',
width: 120,
alignItems:'flex-end',
marginTop:1,
}}>
<TouchableOpacity
onPress={() => this.props.onPressItem('mineCertification','')}>
<Image style={styles.renzheng} resizeMode={'stretch'}
source={require('../../image/renzheng_bg.png')}>
<Text style={styles.renzheng_text} numberOfLines={1}>
学生认证
</Text>
</Image>
</TouchableOpacity>
<View style={{
flexDirection:'row',
marginTop:15,
}}>
<Text style={{
alignItems: 'center',
justifyContent: 'center',
color: 'white',
fontSize:14,
marginRight:4,
}} numberOfLines={1}>
设置收货地址
</Text>
<Image style={styles.arrow}
source={require('../../image/category_arrow.png')}/>
</View>
</View>
</View>
</TouchableOpacity> :
<View style={{
flexDirection:'column',
width: width,
height: 80,
alignItems: 'center',
justifyContent: 'center',
}}>
<TouchableOpacity onPress={() => this.props.onPressItem('mineLogin','')}>
<Text style={styles.login_text} numberOfLines={1}>
登陆/注册
</Text>
</TouchableOpacity>
</View>
}
<View style={styles.fav_container}>
<TouchableOpacity onPress={() => this.props.onPressItem('mineFavProduct','')}>
<View style={styles.topnum_content}>
{
(profile.uid != '0' && mineInfoNum.product_favorite_total > 0) ?
<Text
style={styles.top_number_text}>{mineInfoNum.product_favorite_total < 100 ? mineInfoNum.product_favorite_total : '99+'}</Text> : null
}
<Text style={styles.top_text}>收藏的商品</Text>
</View>
</TouchableOpacity>
<View style={{
width: 0.5,
height: 30,
marginTop:6,
marginBottom:6,
backgroundColor: '#e5e5e5',
}}/>
<TouchableOpacity onPress={() => this.props.onPressItem('mineFavBrand','')}>
<View style={styles.topnum_content}>
{
(profile.uid != '0' && mineInfoNum.brand_favorite_total > 0) ?
<Text
style={styles.top_number_text}>{mineInfoNum.brand_favorite_total < 100 ? mineInfoNum.brand_favorite_total : '99+'}</Text> : null
}
<Text style={styles.top_text}>收藏的品牌</Text>
</View>
</TouchableOpacity>
<View style={{
width: 0.5,
height: 30,
marginTop:6,
marginBottom:6,
backgroundColor: '#e5e5e5',
}}/>
<TouchableOpacity onPress={() => this.props.onPressItem('mineBrowseHis','')}>
<View style={styles.topnum_content}>
{
(profile.uid != '0' && mineInfoNum.product_browse > 0) ?
<Text
style={styles.top_number_text}>{mineInfoNum.product_browse < 100 ? mineInfoNum.product_browse : '99+'}</Text> : null
}
<Text style={styles.top_text}>浏览记录</Text>
</View>
</TouchableOpacity>
</View>
</Image>
{certificationInfo && certificationInfo.isBindedOrRelated === 'N' ?
<TouchableOpacity onPress={() => this.props.onPressItem('mineSetPhone','')}>
<View style={styles.sub_row}>
<Image style={styles.row_icon} resizeMode={'contain'}
source={require('../../image/bindTipsIcon.png')}/>
<Text style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
fontSize:12,
marginLeft:4,
}} numberOfLines={1}>
账号安全等级较低,建议您绑定手机号
</Text>
<Text style={{
color:'red',
fontSize:12,
marginRight:2,
}} numberOfLines={1}>
去绑定
</Text>
<Image style={styles.arrow} source={require('../../image/persona_icon_go.png')}/>
</View>
<View style={{
width: width,
height: 0.5,
backgroundColor: '#e5e5e5',
}}/>
</TouchableOpacity> : null
}
{(announcement && announcement.open === 'Y') ?
<Announcement
data={announcement.list}
onPressAnnounceItem={(url, i) => this.props.onPressItem('mineAnnounce',url)}/> : null
}
{((certificationInfo.isBindedOrRelated === 'N') || (announcement && announcement.open === 'Y')) ?
<View style={{
width: width,
height: 10,
backgroundColor: '#e5e5e5',
}}/> : null
}
<TouchableOpacity onPress={() => this.props.onPressItem('mineOrder','')}>
<View style={styles.row}>
<Text style={styles.icon_text} numberOfLines={1}>
我的订单
</Text>
<Text style={{
marginRight: 2,
fontSize:14,
color:'#b0b0b0',
}} numberOfLines={1}>
查看全部订单
</Text>
<Image style={styles.arrow} source={require('../../image/category_arrow.png')}/>
</View>
</TouchableOpacity>
<View style={{
width: width,
height: 0.5,
backgroundColor: '#e5e5e5',
}}/>
<View style={styles.order_container}>
<TouchableOpacity onPress={() => this.props.onPressItem('dfkOrder','')}>
<View style={styles.order_content}>
<Image style={styles.icon_image} source={require('../../image/dd_icon_dfk.png')}/>
<Text style={styles.order_text}>待付款</Text>
{
(profile.uid != '0' && mineInfoNum.wait_pay_num > 0) ?
<Image style={{
position:'absolute',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
height: 14,
right:13,
top:2,
width:14,
}} source={require('../../image/mine_message_new_icon.png')}>
<Text style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
color: 'white',
fontSize:12,
textAlign: 'center',
textAlignVertical: 'center',
}}>{mineInfoNum.wait_pay_num}</Text>
</Image> : null}
</View>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.onPressItem('dfhOrder','')}>
<View style={styles.order_content}>
<Image style={styles.icon_image} source={require('../../image/dd_icon_dfh.png')}/>
<Text style={styles.order_text}>待发货</Text>
{
(profile.uid != '0' && mineInfoNum.send_cargo_num > 0) ?
<Image style={{
position:'absolute',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
height: 14,
right:13,
top:2,
width:14,
}} source={require('../../image/mine_message_new_icon.png')}>
<Text style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
color: 'white',
fontSize:12,
textAlign: 'center',
textAlignVertical: 'center',
}}>{mineInfoNum.send_cargo_num}</Text>
</Image> : null}
</View>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.onPressItem('dshOrder','')}>
<View style={styles.order_content}>
<Image style={styles.icon_image} source={require('../../image/dd_icon_dsh.png')}/>
<Text style={styles.order_text}>待收货</Text>
{
(profile.uid != '0' && mineInfoNum.wait_cargo_num > 0) ?
<Image style={{
position:'absolute',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
height: 14,
right:13,
top:2,
width:14,
}} source={require('../../image/mine_message_new_icon.png')}>
<Text style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
color: 'white',
fontSize:12,
textAlign: 'center',
textAlignVertical: 'center',
}}>{mineInfoNum.wait_cargo_num}</Text>
</Image> : null}
</View>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.onPressItem('dsdOrder','')}>
<View style={styles.order_content}>
<Image style={styles.icon_image} source={require('../../image/wddd_icon_dpj.png')}/>
<Text style={styles.order_text}>待晒单</Text>
{
(profile.uid != '0' && mineInfoNum.toShareOrderNum > 0) ?
<Image style={{
position:'absolute',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
height: 14,
right:13,
top:2,
width:14,
}} source={require('../../image/mine_message_new_icon.png')}>
<Text style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
color: 'white',
fontSize:12,
textAlign: 'center',
textAlignVertical: 'center',
}}>{mineInfoNum.toShareOrderNum}</Text>
</Image> : null}
</View>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.onPressItem('thhOrder','')}>
<View style={styles.order_content}>
<Image style={styles.icon_image} source={require('../../image/dd_icon_thh.png')}/>
<Text style={styles.order_text}>退/换货</Text>
{
(profile.uid != '0' && mineInfoNum.refund_exchange_num > 0) ?
<Image style={{
position:'absolute',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
height: 14,
right:13,
top:2,
width:14,
}} source={require('../../image/mine_message_new_icon.png')}>
<Text style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
color: 'white',
fontSize:12,
textAlign: 'center',
textAlignVertical: 'center',
}}>{mineInfoNum.refund_exchange_num}</Text>
</Image> : null}
</View>
</TouchableOpacity>
</View>
<View style={{
width: width,
height: 10,
backgroundColor: '#e5e5e5',
}}/>
{(globalOrderData && globalOrderData.hasOrder === 'Y') ?
<TouchableOpacity onPress={() => this.props.onPressItem('mineGlobalOrder','')}>
<View style={styles.row}>
<Image style={styles.row_icon}
source={require('../../image/mine_globalpurchase_icon.png')}/>
<Text style={styles.icon_text} numberOfLines={1}>
境外发货订单
</Text>
<Image style={styles.arrow} source={require('../../image/category_arrow.png')}/>
</View>
<View style={{
width: width,
height: 10,
backgroundColor: '#e5e5e5',
}}/>
</TouchableOpacity> : null
}
<View style={styles.row}>
<Text style={styles.icon_text} numberOfLines={1}>
我的资产
</Text>
<Text style={{
marginRight: 25,
height: 15,
width: 70,
fontSize:18,
}}>
</Text>
</View>
<View style={{
width: width,
height: 0.5,
backgroundColor: '#e5e5e5',
}}/>
<View style={styles.order_container}>
<TouchableOpacity onPress={() => this.props.onPressItem('mineCoupon','')}>
<View style={styles.asset_content}>
<Image style={styles.icon_image} source={require('../../image/yh_mine_coupon_icon.png')}/>
<Text style={styles.order_text}>优惠券</Text>
{
(profile.uid != '0' && mineInfoNum) ? this._renderNumberPoint(mineInfoNum.coupon_num) : null
}
</View>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.onPressItem('mineYohoCoin','')}>
<View style={styles.asset_content}>
<Image style={styles.icon_image} source={require('../../image/yh_mine_yoho_coin.png')}/>
<Text style={styles.order_text}>有货币</Text>
{
(profile.uid != '0' && mineInfoNum) ? this._renderNumberPoint(mineInfoNum.yoho_coin_num) : null
}
</View>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.onPressItem('mineLimitCode','')}>
<View style={styles.asset_content}>
<Image style={styles.icon_image}
source={require('../../image/yh_mine_limitcode_icon.png')}/>
<Text style={styles.order_text}>限购码</Text>
{
(profile.uid != '0' && mineInfoNum) ? this._renderNumberPoint(mineInfoNum.limitCodeNum) : null
}
</View>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.onPressItem('mineInstallment','')}>
<View style={styles.asset_content}>
<Image style={styles.icon_image} source={require('../../image/yh_mine_fenqi_icon.png')}/>
<Text style={styles.order_text}>有货分期</Text>
{
(profile.uid != '0') ? this._renderNumberPoint(0) : this._renderNumberPoint('去开通')
}
</View>
</TouchableOpacity>
{showRedPacket && showRedPacket.open === 'Y' ?
<TouchableOpacity onPress={() => this.props.onPressItem('mineRedPackage','')}>
<View style={styles.asset_content}>
<Image style={styles.icon_image}
source={require('../../image/yh_mine_redbag_icon.png')}/>
<Text style={styles.order_text}>红包</Text>
{
(profile.uid != '0' && redPackageNum) ? this._renderNumberPoint(redPackageNum.redpacket_num) : null
}
</View>
</TouchableOpacity> : null
}
</View>
<View style={{
width: width,
height: 10,
backgroundColor: '#e5e5e5',
}}/>
<TouchableOpacity onPress={() => this.props.onPressItem('mineGuang','')}>
<View style={styles.row}>
<Image style={styles.row_icon} source={require('../../image/mine_collectionTiezi_icon.png')}/>
<Text style={styles.icon_text} numberOfLines={1}>
我的逛
</Text>
<Image style={styles.arrow} source={require('../../image/category_arrow.png')}/>
</View>
</TouchableOpacity>
<View style={{
width: width-50,
height: 0.5,
marginLeft:50,
backgroundColor: '#e5e5e5',
}}/>
<TouchableOpacity onPress={() => this.props.onPressItem('mineShareOrder','')}>
<View style={styles.row}>
<Image style={styles.row_icon} source={require('../../image/shaidan.png')}/>
<Text style={styles.icon_text} numberOfLines={1}>
我的晒单
</Text>
<Image style={styles.arrow} source={require('../../image/category_arrow.png')}/>
</View>
</TouchableOpacity>
{(memberBill && memberBill.bill && memberBill.bill.open === 'Y') ?
<TouchableOpacity onPress={() => this.props.onPressItem('mineMemberInfo','')}>
<View style={{
width: width-50,
height: 0.5,
marginLeft:50,
backgroundColor: '#e5e5e5',
}}/>
<View style={styles.row}>
<Image style={styles.row_icon} resizeMode={'contain'}
source={require('../../image/mine_bill_icon.png')}/>
<Text style={styles.icon_text} numberOfLines={1}>
会员账单信息
</Text>
<Image style={styles.dot} source={require('../../image/mine_message_new_icon.png')}/>
<Image style={styles.arrow} source={require('../../image/category_arrow.png')}/>
</View>
</TouchableOpacity> : null
}
<View style={{
width: width,
height: 10,
backgroundColor: '#e5e5e5',
paddingLeft:30,
}}/>
{activityListInfo.list.map((item, i) => {
return (
<TouchableOpacity key={i} onPress={() => this.props.onPressItem('mineActivity',item.get('url'))}>
<View style={styles.row}>
<Image style={styles.row_icon} source={require('../../image/mine_activity_icon.png')}/>
<Text style={styles.icon_text} numberOfLines={1}>
{item.get('act_name')}
</Text>
<Image style={styles.dot} source={require('../../image/mine_message_new_icon.png')}/>
<Image style={styles.arrow} source={require('../../image/category_arrow.png')}/>
</View>
<View style={{
width: width-50,
height: 0.5,
marginLeft:50,
backgroundColor: '#e5e5e5',
}}/>
</TouchableOpacity>
);
})}
{(activityListInfo && (activityListInfo.list.size > 0)) ? <View style={{
width: width,
height: 10,
backgroundColor: '#e5e5e5',
}}/> : null
}
<TouchableOpacity onPress={() => this.props.onPressItem('mineFeedback','')}>
<View style={styles.row}>
<Image style={styles.row_icon} resizeMode={'contain'}
source={require('../../image/mine_servicefeedback_icon.png')}/>
<Text style={styles.icon_text} numberOfLines={1}>
服务与反馈
</Text>
<Image style={styles.arrow} source={require('../../image/category_arrow.png')}/>
</View>
</TouchableOpacity>
<View style={{
width: width,
height: 10,
backgroundColor: '#e5e5e5',
}}/>
<Text style={[styles.icon_text, {marginTop:15}]} numberOfLines={1}>
为您优选新品
</Text>
</View>
);
}
};
let {width, height} = Dimensions.get('window');
const DEVICE_WIDTH_RATIO = width / 320;
let subRowHeight = Math.ceil(35 * DEVICE_WIDTH_RATIO);//账号安全 通知层的高度
let rowheight = 45;//wo的订单类似的高度,我的逛也用这个高度
let orderContainerHeight = 55;
let topHeight = 175 + rowheight + orderContainerHeight + 10 + rowheight + orderContainerHeight + 1 + 10 + rowheight * 3 + 1 + 20 + 60 + 10;
let styles = StyleSheet.create({
container: {
width: width,
height: topHeight,
backgroundColor: 'white',
alignItems: 'center',
},
icon_container: {
flexDirection: 'row',
width: width,
height: 80,
},
order_container: {
flexDirection: 'row',
justifyContent: 'space-around',
width: width,
height: orderContainerHeight,
marginTop: 8,
},
fav_container: {
flexDirection: 'row',
justifyContent: 'space-around',
width: width,
height: 50,
paddingTop: 3,
backgroundColor: 'black',
},
mine_row_container: {
flexDirection: 'row',
width: width,
height: 50,
},
order_content: {
flex: 1,
flexDirection: 'column',
width: (width - 10) / 5,
alignItems: 'center',
paddingTop: 4,
paddingBottom: 4,
},
asset_content: {
flexDirection: 'column',
flex: 1,
alignItems: 'center',
width: 70,
paddingTop: 4,
paddingBottom: 4,
},
topnum_content: {
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
width: (width - 10) / 4,
height: 45,
},
icon_image: {
width: 30,
height: 30,
},
row_icon: {
width: 20,
height: 20,
marginRight: 10,
},
icon_right_arrow: {
width: 10,
height: 10,
alignItems: 'center',
justifyContent: 'center',
},
icon_text: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
marginLeft: 4,
fontSize: 15,
},
order_text: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
marginLeft: 4,
fontSize: 11,
},
top_number_text: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
color: 'white',
fontSize: 14,
textAlignVertical: 'center',
textAlign: 'center',
},
top_text: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
color: 'white',
fontSize: 13,
textAlignVertical: 'center',
textAlign: 'center',
},
open_text: {
marginTop: 30,
marginBottom: 30,
width: width - 80,
height: 60,
alignItems: 'center',
textAlignVertical: 'center',
backgroundColor: 'black',
textAlign: 'center',
color: "white",
borderRadius: 5,
},
product_text_container: {
width: width,
height: 41,
backgroundColor: 'white',
alignItems: 'center',
},
product_text: {
alignItems: 'center',
justifyContent: 'center',
height: 40,
width: width,
textAlign: 'center',
textAlignVertical: 'center',
backgroundColor: 'white',
},
product_thumbnail: {
position: 'absolute',
width: 40,
height: 38,
top: 1,
bottom: 1,
marginLeft: width - 40,
backgroundColor: 'transparent',
justifyContent: 'center',
}, arrow: {
marginRight: 15,
width: 9,
height: 15,
},
row: {
flexDirection: 'row',
alignItems: 'center',
height: rowheight,
width: width,
paddingLeft: 15,
backgroundColor: 'white',
},
sub_row: {
flexDirection: 'row',
alignItems: 'center',
height: subRowHeight,
width: width,
paddingLeft: 15,
backgroundColor: 'white',
},
user_img: {
marginLeft: 15,
width: 60,
height: 60,
paddingLeft: 4,
paddingRight: 4,
borderRadius: 30,
borderWidth: (Platform.OS === 'ios' ? 1.0 : 1.5) / PixelRatio.get(),
},
user_level: {
width: 45,
height: 20,
}, renzheng: {
width: 80,
height: 27,
},
renzheng_text: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
color: 'white',
fontSize: 13,
textAlignVertical: 'center',
textAlign: 'center',
},
login_text: {
alignItems: 'center',
justifyContent: 'center',
height: 45,
width: 120,
textAlign: 'center',
textAlignVertical: 'center',
color: 'white',
fontSize: 15,
borderRadius: 3,
borderWidth: (Platform.OS === 'ios' ? 3 : 5) / PixelRatio.get(),
borderColor: 'white',
},
dot: {
height: 9,
width: 9,
marginRight: 6,
}
});
\ No newline at end of file
... ...
import keyMirror from 'key-mirror';
export default keyMirror({
SET_PLATFORM:null,
SET_CHANNEL:null,
INSTALLMENT_PRODUCT_REQUEST:null,
INSTALLMENT_PRODUCT_SUCCESS:null,
INSTALLMENT_PRODUCT_FAILURE:null,
GET_MINEUSERINFO_REQUEST:null,
GET_MINEUSERINFO_SUCCESS:null,
GET_MINEUSERINFO_FAILURE:null,
GET_MINEUSERINFONUM_REQUEST:null,
GET_MINEUSERINFONUM_SUCCESS:null,
GET_MINEUSERINFONUM_FAILURE:null,
GET_MINEUNREADMSG_REQUEST:null,
GET_MINEUNREADMSG_SUCCESS:null,
GET_MINEUNREADMSG_FAILURE:null,
GET_MINEFAVPRONUM_REQUEST:null,
GET_MINEFAVPRONUM_SUCCESS:null,
GET_MINEFAVPRONUM_FAILURE:null,
GET_MINEREDPACKAGENUM_REQUEST:null,
GET_MINEREDPACKAGENUM_SUCCESS:null,
GET_MINEREDPACKAGENUM_FAILURE:null,
GET_MINEINSTALEMTINFO_REQUEST:null,
GET_MINEINSTALEMTINFO_SUCCESS:null,
GET_MINEINSTALEMTINFO_FAILURE:null,
GET_MINEACTIVITY_REQUEST:null,
GET_MINEACTIVITY_SUCCESS:null,
GET_MINEACTIVITY_FAILURE:null,
GET_MEMBERBILLTASK_REQUEST:null,
GET_MEMBERBILLTASK_SUCCESS:null,
GET_MEMBERBILLTASK_FAILURE:null,
GET_ENVELOPESITEM_REQUEST:null,
GET_ENVELOPESITEM_SUCCESS:null,
GET_ENVELOPESITEM_FAILURE:null,
GET_CERTIFICATIONDATA_REQUEST:null,
GET_CERTIFICATIONDATA_SUCCESS:null,
GET_CERTIFICATIONDATA_FAILURE:null,
GET_ANNOUNCEMENT_REQUEST:null,
GET_ANNOUNCEMENT_SUCCESS:null,
GET_ANNOUNCEMENT_FAILURE:null,
GET_GLOBALORDERSTATE_REQUEST:null,
GET_GLOBALORDERSTATE_SUCCESS:null,
GET_GLOBALORDERSTATE_FAILURE:null,
});
... ...
'use strict'
import React, {Component} from 'react';
import ReactNative,{
StyleSheet,
Dimensions,
Platform,
View,
NativeModules,
InteractionManager,
NativeAppEventEmitter,
} from 'react-native'
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {Map} from 'immutable';
import * as mineActions from '../reducers/mine/mineActions';
import MineList from '../components/mine/MineList';
const actions = [
mineActions,
];
function mapStateToProps(state) {
return {
...state
};
}
function mapDispatchToProps(dispatch) {
const creators = Map()
.merge(...actions)
.filter(value => typeof value === 'function')
.toObject();
return {
actions: bindActionCreators(creators, dispatch),
dispatch
};
}
class MineContainer extends Component {
constructor(props) {
super(props);
this._onPressItem = this._onPressItem.bind(this);
this._onPressProductListProduct = this._onPressProductListProduct.bind(this);
}
componentDidMount() {
this.props.actions.productListForInstallment();
this.props.actions.getMineUserInfo();
this.props.actions.getMineUserInfoNum();
this.props.actions.getMineUnreadMsg();
this.props.actions.getMineFavProNum();
this.props.actions.getMineRedPackageNum();
this.props.actions.getMineInstalemtInfo();
this.props.actions.getMineActivity();
this.props.actions.getMemberBillTask();
this.props.actions.getEnvelopesItem();
this.props.actions.getCertificationData();
this.props.actions.getAnnouncement();
this.props.actions.getGlobalOrderState();
}
_onPressItem(viewId, data){
let url = "";
switch (viewId) {
case 'mineSetting':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.setting","params":{}}`;
break;
case 'mineMessageHome':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.messagehome","params":{}}`;
break;
case 'mineInfo':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.mineinfo","params":{}}`;
break;
case 'mineCertification':
//学生认证
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.studenthome","params":{}}`;
break;
case 'mineLogin':
ReactNative.NativeModules.YH_CommonHelper.login();
//登陆
break;
case 'mineFavProduct':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.fav","params":{}}`;
break;
case 'mineFavBrand':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.fav","params":{"favType":"1"}}`;
break;
case 'mineBrowseHis':
//浏览记录
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.browserhistory","params":{}}`;
break;
case 'mineSetPhone':
//设置安全性
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.associatephone","params":{}}`;
break;
case 'mineAnnounce':
//通知
url = data;
break;
case 'mineOrder':
//我的订单
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.order","params":{"index":"0"}}`;
break;
case 'dfkOrder':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.order","params":{"index":"0"}}`;
break;
case 'dfhOrder':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.order","params":{"index":"1"}}`;
break;
case 'dshOrder':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.order","params":{"index":"2"}}`;
break;
case 'dsdOrder':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.showgoods","params":{}}`;
break;
case 'thhOrder':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.orderService","params":{}}`;
break;
case 'mineCoupon':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.coupon","params":{}}`;
break;
case 'mineYohoCoin':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.yohocoin","params":{}}`;
break;
case 'mineLimitCode':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minerestrictioncode","params":{}}`;
break;
case 'mineInstallment':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.myInstalment","params":{}}`;
break;
case 'mineRedPackage':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.mineredenvelop","params":{}}`;
break;
case 'mineGuang':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.mineguang","params":{}}`;
break;
case 'mineShareOrder':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.shareorder","params":{}}`;
break;
case 'mineMemberInfo':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.memberbill","params":{}}`;
break;
case 'mineActivity':
url = data;
break;
case 'mineFeedback':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.sfhome","params":{}}`;
break;
case 'mineGlobalOrder':
url=`http://m.yohobuy.com?openby:yohobuy={"action":"go.globalorderlist","params":{}}`;
default:
break;
}
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
}
_onPressProductListProduct(product, rowId=0) {
let productSkn = product && product.get('product_skn', 0);
if (!productSkn) {
return;
}
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${productSkn}"}}`;
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
}
render() {
let {isFetching,open,profile,mineInfoNum,redPackageNum,activityListInfo,memberBill,showRedPacket,certificationInfo,announcement,globalOrderData} = this.props.mine;
console.log("open");
console.log(activityListInfo);
return (
<MineList
isFetching={open.isFetching}
productListForInstallment={open.productListForInstallment}
installmentInfo={open.installmentInfo}
profile={profile}
mineInfoNum={mineInfoNum}
redPackageNum={redPackageNum}
activityListInfo={activityListInfo}
memberBill={memberBill}
showRedPacket={showRedPacket}
certificationInfo={certificationInfo}
announcement={announcement}
globalOrderData={globalOrderData}
onPressItem = {this._onPressItem}
onPressProductListProduct = {this._onPressProductListProduct}
/>
);
}
}
let styles = StyleSheet.create({
container: {
flex: 1,
},
});
export default connect(mapStateToProps, mapDispatchToProps)(MineContainer);
... ...