PersonalHomePage.js
43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
import React, {Component} from 'react';
import {
FlatList,
Image,
NativeModules,
StyleSheet,
Text,
TouchableOpacity,
View,
DeviceEventEmitter,
CameraRoll, Alert, Modal
} from 'react-native';
import ItemImageText from '../component/ItemImageText';
import QuestionHomeListItem from '../questions/QuestionHomeListItem';
import {height, width, zoomH, zoomW} from '../../utils/getSize';
import ScrollableTabView, {DefaultTabBar} from "react-native-scrollable-tab-view";
import AppService from "../../service/AppService";
import {getHomeColor, NoDoublePress, xnToast} from "../../utils/utils";
import ItemGoodsView from "../component/ItemGoodsView";
import ViewShot from "react-native-view-shot"
// import ForumHeader from "../../widget/ForumHeader";
const defaultIcon = require('../../img/defaultIcon.png');
const emptyView = require('../../img/empty.png');
const defaultSingPicUrl = 'https://cdn.xiniunet.com/img/fangliao/default_cover.jpg';// 默认的签到图片
export default class PersonalHomePage extends Component {
static navigationOptions = ({navigation, screenProps}) => ({
headerTitle: navigation.state.params.userName,
headerLeft: (
<View style={{flex: 1}}>
<TouchableOpacity style={{width: 40, height: 40, justifyContent: 'center', alignItems: 'center'}}
onPress={() => navigation.goBack()}>
<Image style={{width: 18, height: 18}} source={require('../../img/loadBack.png')}/>
</TouchableOpacity>
</View>
),
headerRight: (
<View></View>
),
// headerStyle: {
// backgroundColor: '#fff',
// elevation: 0,
// borderStyle: 'solid',
// borderColor: '#ddd',
// borderBottomWidth: 0.5,
// }
});
constructor(props) {
super(props);
this.state = {
defWebViewHeight:0,
userId: this.props.navigation.state.params.userId,
userName: this.props.navigation.state.params.userName||'',
userInfo: {},
textImageList: [],
questionAnswerList: [],
videoList: [],
goodList: [],
loadMore: false,
loading: false,
refreshing:false,
tabNumber: 0,
isImageAll: false,
isQuestionAll: false,
isVideoAll: false,
attentionId:null,
imid: '',
threadType:0,
goodsList :[],
isGoodsAll:false,
modalVisible:false,
codeUrl:'',
signUrl:'',
signText:'',
queryId:'',// 二维码参数
associateId:''//登录用户的粉丝Id
}
}
componentWillMount() {
const _this = this;
// 获取网络状态
if (global.isConnected) {
//获取个人信息
this.getUserInfo();
//获取帖子信息
this.getFirstThreadList(0, 0, true);
} else {
xnToast('请检查网络')
}
this.refresh = DeviceEventEmitter.addListener("refreshList", () => {
this.setState({
textImageList: [],
textImageTotalCount: 0
});
_this.getFirstThreadList(0, 0, true);
_this.getUserInfo();
});
this.refreshComm = DeviceEventEmitter.addListener("refreshCommList", () => {
this.setState({
questionAnswerList: []
});
_this.getFirstThreadList(3, 0, true);
_this.getUserInfo();
});
this.refreshVideo = DeviceEventEmitter.addListener(
"refreshVideoList",
() => {
this.setState({
videoList: [],
videoListtalCount: 0
});
_this.getFirstThreadList(2, 0, true);
_this.getUserInfo();
}
);
if (global.tenantId == '852769418315444224' || global.tenantId == '1038991752041734144') {
AppService.getSignInfo({}).then((data) => {
if (data.message) {
xnToast(error.message);
// reject(error.message);
return;
}
if (!!data.errors === true && !!data.errors.length > 0) {
// reject(data.errors);
return;
} else {
let sginInfo = JSON.parse(data.signRule.image)
_this.setState({
signUrl: sginInfo[0].filePath,
signText: data.signRule.signRuleText,
}, () => {
// resolve(true);
_this.promise2();
});
}
}).catch((error) => {
// xnToast(error.message);
// reject(error.message);
});
// });
}
}
promise2 = () => {
const _this = this;
// return new Promise((resolve, reject) => {
AppService.getAssociateMemberBySource({sourceType:"WX_OPEN",unionId:global.unionId,tenantId:global.config.tenantId,name:global.userName,avatarUrl:!!!global.userAvatar?'':global.userAvatar}).then((data) => {
if (data.message) {
xnToast(data.message);
// reject(error.message);
return;
}
if (!!data.errors === true && !!data.errors.length > 0) {
xnToast(data.errors[0].message);
// reject(data.errors[0].message);
return;
} else {
_this.setState({
associateId:data.associateMember.id,
},()=>{
// resolve(res);
_this.promise3();
});
}
}).catch((error) => {
// xnToast(error.message);
// reject(error.message);
});
// });
};
promise3 = () => {
const _this = this;
// return new Promise((resolve, reject) => {
AppService.saveAppScenceParm({'json':JSON.stringify({userId:this.state.userId,rasId:this.state.associateId})}).then((data) => {
if (data.message) {
xnToast(data.message);
// reject(data.message);
return;
}
if (!!data.errors === true && !!data.errors.length > 0) {
xnToast(data.errors[0].message);
// reject(data.errors[0].message);
return;
} else {
_this.setState({
queryId:data.id,
},()=>{
// resolve(res);
_this.promise4();
});
}
}).catch((error) => {
// xnToast(error.message);
// reject(error.message);
});
// });
};
promise4 = () => {
const _this = this;
// return new Promise((resolve, reject) => {
AppService.createAppScene({tenantId: global.tenantId,appId:global.weChatBySmallProgramAppId,scene:'queryId='+this.state.queryId,page:'pages/community/member-detail/member-detail'}).then((data) => {
if (data.message) {
xnToast(data.message);
// reject(data.message);
return;
}
if (!!data.errors === true && !!data.errors.length > 0) {
xnToast(data.errors[0].message);
// reject(data.errors[0].message);
} else {
_this.setState({
codeUrl:data.imgUrl,
},()=>{
// resolve(res);
})
}
}).catch((error) => {
// xnToast(error.message);
// reject(error.message);
});
// });
};
// 跳转关注
goAttention = () => {
this.props.navigation.navigate('PersonalAttention',{id: 1,name: 'Attention',userId:this.state.userId})
}
goFans = () => {
this.props.navigation.navigate('PersonalAttention',{id: 2,name: 'Attention',userId:this.state.userId})
}
// 获取个人信息
getUserInfo = () => {
if (global.isConnected) {
// alert("查询")
const params = {
forumId: global.forumId,
id:this.state.userId
};
AppService.getUserInfo(params).then((data) => {
// this.setState({
// loading: false
// });
if (data.message) {
xnToast(data.message);
return;
}
if (!!data.errors === true && !!data.errors.length > 0) {
xnToast(data.errors[0].message);
} else {
if (!!data.userExtend) {
this.setState({
userInfo: data.userExtend,
attentionId:data.userExtend.attention == null ? 0:data.userExtend.attention.id,
imid: data.userExtend.imid,
userName:data.userExtend.name,
});
this.props.navigation.setParams({
userName: data.userExtend.name,
});
}
}
})
} else {
xnToast('请检查网络');
}
};
// 关注
attention = () => {
if (global.isConnected) {
let params = {
forumId:global.forumId,
targetType:1,
targetUserId:this.state.userId,
targetUserName:this.state.userInfo.name,
targetUserHeadFileUrl:this.state.userInfo.avatar,
attentionUserId:global.userId,
attentionUserName:global.userName,
isActive:true
};
AppService.attention(params).then((data) => {
this.setState({
loading: false
});
if (data.message) {
xnToast(data.message);
return;
}
if (!!data.errors === true && !!data.errors.length > 0) {
xnToast(data.errors[0].message);
} else {
xnToast("已关注");
this.getUserInfo();
DeviceEventEmitter.emit('refreshHomeHistory');
DeviceEventEmitter.emit('refreshCollectList');
DeviceEventEmitter.emit('refreshAttention');
DeviceEventEmitter.emit('refreshHomeList');
DeviceEventEmitter.emit("refreshAllList");
DeviceEventEmitter.emit('reGetThreadDetailInfo');
}
})
} else {
this.setState({
loading: false
});
xnToast('请检查网络');
}
};
//取消关注
cancelAttention = (id)=> {
let params = {
id: id
};
if (global.isConnected) {
AppService.cancleAttention(params).then((data) => {
this.setState({
loading: false
});
if (data.message) {
xnToast(data.message);
return;
}
if (!!data.errors === true && !!data.errors.length > 0) {
xnToast(data.errors[0].message);
} else {
xnToast('取消关注');
this.getUserInfo();
DeviceEventEmitter.emit('refreshHomeHistory');
DeviceEventEmitter.emit('refreshCollectList');
DeviceEventEmitter.emit('refreshAttention');
DeviceEventEmitter.emit('refreshHomeList');
DeviceEventEmitter.emit("refreshAllList");
DeviceEventEmitter.emit('reGetThreadDetailInfo');
}
})
} else {
this.setState({
loading: false
});
xnToast('请检查网络');
}
};
//获取商品数据
getGoodsList = (length) => {
let params = {
pageNumber:length/pageSize+1,
pageSize:pageSize,
operatingUnitId: 801756150419828736,
systemType:'B2C',
deviceType:'MOBILE',
supplierId: 0,
tenantId: global.tenantId
}
AppService.findCommodityExtend(params).then(data => {
});
}
// 获取第一页数据
getFirstThreadList = (threadType,length,isRefresh) => {
if (isRefresh) {
if(threadType==0){
this.setState(
{
textImageList: [],
}
);
}else if(threadType==3){
this.setState(
{
questionAnswerList: [],
}
);
}else if(threadType==2){
this.setState(
{
videoList: [],
}
);
}else {
this.setState(
{
textImageList: [],
}
);
}
}
const _this = this;
AppService.queryList({
forumId: global.forumId,
threadUserId: this.state.userId,
pageNumber: length / 10 + 1,
searchType:"HAS_PUBLISH",
sourceFrom:'APP',
pageSize: 10,
isActive: true,
threadType: threadType
}).then((data) => {
if (data.message) {
xnToast(data.message);
return;
}
if (data.errors == null || data.errors.length > 0) {
xnToast(data.errors[0].message);
} else {
if(threadType == 0){
this.setState({
textImageList: _this.state.textImageList.concat(data.result),
textImageTotalCount:data.totalCount,
}, () => {
if (_this.state.textImageList.length == Number(data.totalCount)) {
_this.setState({
isImageAll: true
});
}
});
}else if(threadType == 2){
this.setState({
videoList: _this.state.videoList.concat(data.result),
videoListtalCount:data.totalCount,
}, ()=> {
if (_this.state.videoList.length == Number(data.totalCount)) {
_this.setState({
isVideoAll: true
});
}
});
}else if(threadType == 3){
this.setState({
questionAnswerList: _this.state.questionAnswerList.concat(data.result)
}, ()=> {
if (_this.state.questionAnswerList.length == Number(data.totalCount)) {
_this.setState({
isQuestionAll: true
});
}
});
}else {
this.setState({
textImageList: _this.state.textImageList.concat(data.result),
textImageTotalCount:data.totalCount,
}, () => {
if (_this.state.textImageList.length == Number(data.totalCount)) {
_this.setState({
isImageAll: true
});
}
});
}
console.log(data)
}
})
};
// 加载更多
loadMore = (threadType) => {
let length = 0;
if(threadType == 0){
length = this.state.textImageList.length;
if(this.state.isImageAll){
return;
}
}else if(threadType == 2){
length = this.state.videoList.length;
if(this.state.isVideoAll){
return;
}
}else if(threadType == 3){
length = this.state.questionAnswerList.length;
if(this.state.isQuestionAll){
return;
}
}else {
length = this.state.textImageList.length;
if(this.state.isImageAll){
return;
}
}
this.getFirstThreadList(threadType, length,false);
};
keyExtractor = (item, index) => index;
//图文列表
renderImageTextItem({item, index}) {
return (<ItemImageText itemList = {item} nav = {this.props.navigation}/>
)
}
//问答列表
renderQuestionItem({item, index}) {
return (
<QuestionHomeListItem item={item} nav = {this.props.navigation}/>
)
}
//视频列表
renderVideoItem({item, index}) {
return (
<ItemImageText itemList = {item} nav = {this.props.navigation} isVideo={true}/>
)
}
//商品列表
renderGoodsItem({ item, index }) {
return <ItemGoodsView itemList={item} nav={this.props.navigation} />;
}
// 私信
privateLetter=() => {
if(this.state.imid == null || this.state.imid == undefined){
xnToast("该用户暂时无法聊天");
}else {
NativeModules.system.startP2PSessionFromRN(this.state.imid)
}
};
// 分割线
_separator = () => {
return <View style={{ height: 6 / zoomH, backgroundColor: "#F3F5F6" }} />;
};
// 列表底部
_footer = () => <View style={styles.footerWrap}>
<Text style={{fontSize: 12, color: '#A4A9B0'}}>到底啦</Text>
</View>
render() {
let _this = this;
let identifyTypeNames = this.state.userInfo.identifyTypeNames?(this.state.userInfo.identifyTypeNames!=''?
this.state.userInfo.identifyTypeNames.replace(/\,/g,' '):global.defaultInentifyTypeName):
global.defaultInentifyTypeName;
return (
<View style={styles.background}>
{/*<ForumHeader title={this.props.navigation.state.params.userName} pop navigation={this.props.navigation}/>*/}
<View style={styles.mineInfo}>
<View style={styles.mineInfoLeft}>
<View style={styles.headImage}>
{!!this.state.userInfo.avatar && <Image source={{uri:this.state.userInfo.avatar+'?x-oss-process=image/resize,w_400'}} style={styles.headImage} resizeMode="cover" />}
{!this.state.userInfo.avatar && <Image source={defaultIcon} style={styles.headImage} resizeMode="cover" />}
</View>
</View>
<View style={styles.mineInfoRight}>
<View style={styles.upText}>
<View>
{ !!this.state.userInfo.threadNum ?
<View><Text style={styles.upTextCount}>{this.state.userInfo.threadNum}</Text></View>:
<View><Text style={styles.upTextCount}>0</Text></View>
}
<View><Text style={styles.upTextFont}>发布</Text></View>
</View>
<TouchableOpacity onPress={() => this.goAttention()}>
<View><Text style={styles.upTextCount}>{this.state.userInfo.attentionNum}</Text></View>
<View><Text style={styles.upTextFont}>关注</Text></View>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.goFans()}>
<View><Text
style={styles.upTextCount}>{this.state.userInfo.beAttentionNum}</Text></View>
<View><Text style={styles.upTextFont}>粉丝</Text></View>
</TouchableOpacity>
<View style={{marginRight: 29/zoomW}}>
<View><Text style={styles.upTextCount}>{this.state.userInfo.likeNum}</Text></View>
<View><Text style={styles.upTextFont}>获赞</Text></View>
</View>
</View>
{this.state.userInfo.id != global.userId && <View style={styles.bottomText}>
{/*<TouchableOpacity style={styles.privateLetter} onPress={() => {*/}
{/* this.privateLetter()*/}
{/*}}>*/}
{/* <Text style={{textAlign: 'center', fontSize: 14, color: '#000000',}} >私信</Text>*/}
{/*</TouchableOpacity>*/}
{this.state.userInfo.hasBeenAttended &&<TouchableOpacity style={styles.attentionAlready} onPress={() => {this.cancelAttention(this.state.attentionId)}}>
<Text style={{textAlign: 'center', fontSize: 14, color: '#000000'}}>已关注</Text>
</TouchableOpacity>}
{!this.state.userInfo.hasBeenAttended &&<TouchableOpacity onPress={() => {this.attention()}} style={[styles.attentionNo,{backgroundColor: global.homeColor}]}>
<Text style={{textAlign: 'center', fontSize: 14, color: '#ffffff'}}>关注</Text>
</TouchableOpacity>}
</View>}
{(global.tenantId == '852769418315444224' || global.tenantId == '1038991752041734144')&&<TouchableOpacity style={{width:'100%',height:30/zoomW,alignItems:'flex-end'}} onPress={()=>{this.setState({
modalVisible:true
})}}>
<Image source={require('../../img/quickmark_press.png')} style={{marginRight:20/zoomW,width:30/zoomW,height:30/zoomW}}/>
</TouchableOpacity>}
</View>
</View>
<View style={styles.abstract}>
<View style={{flexDirection: 'row'}}>
<Text style={{fontSize: 14, color: '#000', opacity: 0.65}}>认证: </Text>
{ !!this.state.userInfo.isAuthented && <Text
style={{fontSize: 14, color: '#000'}}>{identifyTypeNames}</Text>}
{ !this.state.userInfo.isAuthented && <Text
style={{fontSize: 14, color: '#000'}}>未认证</Text>}
</View>
<View style={{marginTop: 8/zoomH, flexDirection: 'row',width:"80%"}}>
<Text style={{fontSize: 14, color: '#000', opacity: 0.65}}>简介: </Text>
{ !!this.state.userInfo.description &&<Text numberOfLines={10}
style={{fontSize: 14, color: '#000'}}>{this.state.userInfo.description}</Text>}
{ !this.state.userInfo.description &&<Text
style={{fontSize: 14, color: '#DDD'}}>还没有简介哦</Text>}
</View>
</View>
<View style={{ height: 8 / zoomH, backgroundColor: '#F3F5F6', marginTop: 20 / zoomH }} />
<ScrollableTabView
renderTabBar={() => <DefaultTabBar style={styles.tabStyle}/>}
tabBarActiveTextColor={global.homeColor}
tabBarUnderlineStyle={[styles.lineStyle,{backgroundColor:global.homeColor,}]}
tabBarInactiveTextColor='#000000'
tabBarBackgroundColor='#fff'
locked={false}
onScroll={(obj) => {
}}
onChangeTab={(obj) => {
let threadType = 0;
let needReSearch = true;
if(obj.i == 0){
threadType = 0
if(this.state.textImageList!=null &&this.state.textImageList.length>0 ){
needReSearch = false;
}
}else if(obj.i ==1){
threadType = 3
if(this.state.questionAnswerList!=null &&this.state.questionAnswerList.length>0 ){
needReSearch = false;
}
}else if(obj.i == 2){
threadType = 2
if(this.state.videoList!=null &&this.state.videoList.length>0 ){
needReSearch = false;
}
}
if(needReSearch){
this.getFirstThreadList(threadType,0,true);
}
}}
>
<View tabLabel='图文'>
{this.state.textImageList && this.state.textImageList.length >0 &&<FlatList
data={this.state.textImageList}
ItemSeparatorComponent={this._separator}
renderItem={this.renderImageTextItem.bind(this)}
onRefresh={() => this.getFirstThreadList(0,0,true)}
onEndReached={() => this.loadMore(0)}
ListFooterComponent={(this.state.textImageList.length > 0 && this.state.isImageAll) ? this._footer : null}
refreshing={this.state.refreshing}
keyExtractor={this.keyExtractor}
/>}
{(!this.state.textImageList ||this.state.textImageList.length == 0) &&
<View style = {[styles.defaultStyle]}>
<Image style = {{height:100/zoomH}}source={emptyView} resizeMode= 'contain'></Image>
<Text style = {{marginTop:10,color:'rgba(0,0,0,0.45)'}}>暂无图文帖子</Text>
</View>}
</View>
<View tabLabel='问答'>
{this.state.questionAnswerList && this.state.questionAnswerList.length >0 &&<FlatList
data={this.state.questionAnswerList}
ItemSeparatorComponent={this._separator}
renderItem={this.renderQuestionItem.bind(this)}
onRefresh={() => this.getFirstThreadList(3,0,true)}
onEndReached={() => this.loadMore(3)}
ListFooterComponent={(this.state.questionAnswerList.length > 0 && this.state.isQuestionAll) ? this._footer : null}
refreshing={this.state.refreshing}
keyExtractor={this.keyExtractor}
/>}
{(!this.state.questionAnswerList ||this.state.questionAnswerList.length == 0) &&
<View style = {[styles.defaultStyle]}>
<Image style = {{height:100/zoomH}}source={emptyView} resizeMode= 'contain'></Image>
<Text style = {{marginTop:10,color:'rgba(0,0,0,0.45)'}}>暂无问答帖子</Text>
</View>}
</View>
<View tabLabel='视频'>
{this.state.videoList && this.state.videoList.length >0 &&<FlatList
data={this.state.videoList}
ItemSeparatorComponent={this._separator}
renderItem={this.renderVideoItem.bind(this)}
onRefresh={() => this.getFirstThreadList(2,0,true)}
onEndReached={() => this.loadMore(2)}
ListFooterComponent={(this.state.videoList.length > 0 && this.state.isVideoAll) ? this._footer : null}
refreshing={this.state.refreshing}
keyExtractor={this.keyExtractor}
/>}
{(!this.state.videoList || this.state.videoList.length == 0) &&
<View style = {[styles.defaultStyle]}>
<Image style = {{height:100/zoomH}}source={emptyView} resizeMode= 'contain'></Image>
<Text style = {{marginTop:10,color:'rgba(0,0,0,0.45)'}}>暂无视频帖子</Text>
</View>
}
</View>
{/*<View tabLabel="商品">*/}
{/*{this.state.goodsList && this.state.goodsList.length >0 &&<FlatList*/}
{/*data={this.state.goodsList}*/}
{/*ItemSeparatorComponent={this._separator}*/}
{/*renderItem={this.renderGoodsItem.bind(this)}*/}
{/*onEndReachedThreshold={0.01}*/}
{/*onRefresh={() => {*/}
{/*_this.setState({*/}
{/*goodList:[]*/}
{/*},function () {*/}
{/*this.getGoodsList(0)*/}
{/*})*/}
{/*}}*/}
{/*onEndReached={() => {*/}
{/*if(_this.state.isGoodsAll){*/}
{/*return;*/}
{/*}*/}
{/*_this.getGoodsList(this.state.goodList.length);*/}
{/*}}*/}
{/*ListFooterComponent={*/}
{/*this.state.goodsList.length > 0 && this.state.isGoodsAll*/}
{/*? this._footer*/}
{/*: null*/}
{/*}*/}
{/*refreshing={this.state.refreshing}*/}
{/*keyExtractor={this.keyExtractor}*/}
{/*/>}*/}
{/*{(!this.state.goodsList || this.state.goodsList.length == 0) &&*/}
{/*<View style = {[styles.defaultStyle]}>*/}
{/*<Image style = {{height:100/zoomH}}source={emptyView} resizeMode= 'contain'></Image>*/}
{/*<Text style = {{marginTop:10,color:'rgba(0,0,0,0.45)'}}>暂无商品</Text>*/}
{/*</View>*/}
{/*}*/}
{/*</View>*/}
</ScrollableTabView>
<Modal
animationType="slide"
transparent={true}
visible={this.state.modalVisible}
onRequestClose={() => {
}}>
<View style={styles.modalBg} >
<View style={{width:width,height:height*0.9,marginTop:44/zoomH}}>
<ViewShot ref='viewShot' options={{ format: "jpg", quality: 0.5 }} style={{flex:1}}>
<Image source={!!!this.state.signUrl?require('../../img/default_cover.jpg'):{uri:this.state.signUrl}} style={{width:width,height:width}} />
<View style={{flex:1,backgroundColor:'#fff',flexDirection:'row',padding:15}}>
<View style={{flex:2,justifyContent:'space-around'}}>
<Text>{this.state.signText}</Text>
<View style={{flexDirection:'row',marginTop:15}}>
<Image source={!!!this.state.userInfo.avatar?defaultIcon:{uri:this.state.userInfo.avatar+'?x-oss-process=image/resize,w_400'}} style={{width:60/zoomW,height:60/zoomW,borderRadius:30/zoomW}}/>
<View style={{marginLeft:10,flex:1}}>
<Text style={{fontSize:20}}>{this.state.userInfo.name}</Text>
<Text style={{color:'#d1d2d3'}}>我在芳聊,等您来</Text>
</View>
</View>
</View>
<View style={{flex:1,justifyContent:'space-around',alignItems:'center'}}>
<Image source={{uri:this.state.codeUrl}} style={{width:100/zoomW,height:100/zoomW,marginBottom: 5}}/>
<Text style={{flex:1}}>长按识别二维码</Text>
</View>
</View>
</ViewShot>
{/*按钮区*/}
<View style={{width:width,height:height*0.1,backgroundColor:'#fff',flexDirection:'row',justifyContent:'space-around',alignItems:'center'}}>
<TouchableOpacity style={{width:70,height:height*0.1,alignItems:'center',justifyContent:'space-around'}} onPress={()=>{
NoDoublePress.onPress(()=>{
// TODO:因直接使用签到图片,发朋友就不需要截图了,可以提高速度
// this.refs.viewShot.capture().then(uri => {
// console.log("do something with ", uri);
//
// let fileName = uri.substring(uri.lastIndexOf('/') + 1);
// let _this = this;
// AppService.getAccess({name: fileName}).then((data) => {
//
// if (data.message) {
//
// return;
// }
// if (data.errors.length > 0) {
//
// } else {
// NativeModules.system.simpleUpload(data.accessKeyId, data.accessKeySecret, data.securityToken,
// data.info.endpoint, data.info.bucket, fileName, uri).then((res) => {
let path = '/pages/community/member-detail/member-detail?id='+this.state.userId;//小程序的地址
// path
var temp = '';
var webUrl = 'https://sns.xiniunet.com/wechatpage/dist/index.html#/center';
webUrl = webUrl + '?path='+path;
var wxOriginalID = '';
if(global.appTarget == 'fangPartner'){
// 芳聊小程序的原始ID
wxOriginalID = 'gh_38cacc3e0a30';
}
// 这是测试App 300029承租人下的芳聊社区,用于debug芳聊测试环境的小程序
if(global.appTarget == 'xntalkTest' || global.appTarget == 'fang'){
wxOriginalID = 'gh_e1c3c68d4919';
//wxOriginalID = 'wx878f29f4478f429d';
}
// 小程序卡片的图片固定是300X300的正方形
var temp = !!!this.state.signUrl?defaultSingPicUrl:this.state.signUrl;
// url = defaultSingPicUrl;
var url = temp+'?x-oss-process=image/resize,m_fill,h_600,w_600/format,jpg';
NativeModules.system.wchatShare(path,webUrl,this.state.userName,'' ,url,wxOriginalID);
// }).catch((error) => {
//
// xnToast(error)
// })
// }
// }).catch((error) => {
//
// xnToast(error)
// })
//
// })
})
}}>
<Image style={{width:52/zoomW,height:52/zoomW}} source={require('../../img/sharewechat.png')}/>
<Text style={{color:'#000'}}>发朋友</Text>
</TouchableOpacity>
<TouchableOpacity style={{width:70,height:height*0.1,alignItems:'center',justifyContent:'space-around'}} onPress={
()=>{
NoDoublePress.onPress(()=>{
this.refs.viewShot.capture().then(uri => {
console.log("do something with ", uri);
var promise = CameraRoll.saveToCameraRoll(uri)
promise.then(function(result) {
// xnToast('保存成功,请至相册查看');
Alert.alert('保存成功,请至相册查看')
}).catch(function(error) {
// xnToast('保存失败');
Alert.alert('保存失败')
})
})
})
}
}>
<Image style={{width:52/zoomW,height:52/zoomW}} source={require('../../img/save.png')}/>
<Text style={{color:'#000'}}>保存</Text>
</TouchableOpacity>
<TouchableOpacity style={{width:70,height:height*0.1,alignItems:'center',justifyContent:'space-around'}} onPress={()=>{
NoDoublePress.onPress(()=>{
this.setState({modalVisible:false})
})
}}>
<Image style={{width:52/zoomW,height:52/zoomW}} source={require('../../img/cancel.png')}/>
<Text style={{color:'#000'}}>取消</Text>
</TouchableOpacity>
</View>
</View>
</View>
</Modal>
</View>
)
}
}
const styles = StyleSheet.create({
background: {
flex: 1,
backgroundColor: '#ffffff',
display: 'flex',
},
mineInfo: {
display: 'flex',
flexDirection: 'row',
marginTop: 20/zoomH,
},
mineInfoLeft: {
marginLeft: 15/zoomW,
},
headImage: {
width:(80/zoomW),
height:(80/zoomW),
marginRight:(15/zoomW),
borderRadius:40/zoomW
},
mineInfoRight: {
marginLeft: 20/zoomW,
flex: 1
},
upText: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between'
},
upTextCount: {
textAlign: 'center',
color: '#000000',
fontSize: 18
},
upTextFont: {
fontSize: 12,
color: '#8C8C8C',
},
bottomText: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
marginTop: 14/zoomH,
},
privateLetter: {
height: 28/zoomH,
width: '42%',
borderColor: '#DDDDDD',
borderWidth: 0.5,
borderStyle: 'solid',
borderRadius: 4,
justifyContent: 'center',
},
attentionNo: {
width: '42%',
marginRight: 29/zoomW,
height: 28/zoomH,
borderColor: '#DDDDDD',
borderWidth: 0.5,
borderStyle: 'solid',
borderRadius: 4,
justifyContent: 'center',
},
attentionAlready: {
backgroundColor: '#ffffff',
width: '42%',
marginRight: 29/zoomW,
height: 28/zoomH,
borderColor: '#DDDDDD',
borderWidth: 0.5,
borderStyle: 'solid',
borderRadius: 4,
justifyContent: 'center',
},
abstract: {
marginTop: 10/zoomH,
marginLeft: 20/zoomW,
},
tabStyle: {
height: 36/zoomH,
marginTop: 8/zoomH,
// marginBottom: 17/zoomH,
// width: '80%',
},
lineStyle: {
width:36/zoomW,
height: 3/zoomH,
marginLeft: 46/zoomW,
},
headIcon: {
display: 'flex',
flexDirection: 'row',
marginLeft: 15/zoomW
},
goodsContainer: {
display: 'flex',
flexDirection: 'row',
marginTop: 18,
justifyContent: 'space-between',
},
goodsDesc: {
width: 190/zoomW,
height: 140/zoomH,
marginLeft: 12/zoomW
},
itemLine: {
height: 8/zoomH,
backgroundColor: 'rgba(0,0,0,0.1)',
},
footerWrap: {
borderStyle:'solid',
borderColor: '#DDDDDD',
borderTopWidth: 0.5,
width: '100%',
height: 52.5/zoomH,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
},
line: {
width: 200 / zoomW,
height: 1/zoomH,
backgroundColor: '#D0D0D0',
},
defaultStyle: {
width:'100%',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
marginTop:100/zoomH
},
modalBg: {
width: width,
height: height,
backgroundColor: 'rgba(0,0,0,1)',
display: 'flex',
alignItems: 'center'
},
empty:{
}
});