CommentMore.js 28.5 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
import React, {Component} from 'react';
import {Animated, DeviceEventEmitter, NativeModules,Image,Modal, StatusBar, StyleSheet, Text, TouchableOpacity, View, Platform,ScrollView} from 'react-native';
import {height, width, zoomH} from '../../utils/getSize';
import {xnToast,getHomeColor} from "../../utils/utils";
import AppService from "../../service/AppService";

const  wchatMoment = require('../../img/wchatMoment.png');
const  wchat = require('../../img/wchat.png');

/**
 * 详情-更多
 * 调用者需要传递的数据源格式:
 *  data:{
 *
 *  }
 */
export default class CommentMore extends Component {
    // 构造
    constructor(props) {
        super(props);
        // 初始状态
        this.state = {
            showSetting:false,
            bottom: new Animated.Value(-(320 / zoomH)),
            queryId:'',// 二维码参数
            associateId:'',//登录用户的粉丝Id
            wechatCircleShareReady: false,// 微信分享到朋友圈准备工作是否完成(获取粉丝id+保存sence参数)
        };
        // 开关,用于放开/关闭"分享到个人"与"分享到群组",目前不再卡控,默认开放
        this.canShareInApp = false;
        // if(global.appTarget == 'xntalkInhouse' || global.appTarget == 'xntalkTest'){
        //     this.canShareInApp = true;
        // }
    }
    /*模态框取消操作*/
    closeModal() {
        this.setState({
            showSetting: false,
            bottom: new Animated.Value(-(320 / zoomH))
        },function(){
            StatusBar.setBackgroundColor(global.homeColor);});

    }

    //打开更多弹窗
    openModal = () =>{
        this.setState({
            showSetting: true
        },function () {
            StatusBar.setBackgroundColor("rgba(0,0,0,0.50)");

        });
        Animated.timing(
            this.state.bottom,
            {toValue: (0 / zoomH)}
        ).start();
    };

    //收藏
    collectClick(isCollect){
        if (!global.isConnected){
            xnToast('暂无网络连接,请稍后重试!');
            return;
        }
        let  data = this.props.detailInfo;
        //收藏
        if (isCollect){
            let params = {
                forumId:data.forumId,//社区id
                boardId:data.boardId,//板块id
                threadId:data.id,//帖子id
                collectUserId:global.userId,//收藏用户id
                collectUserName:global.userName,//收藏用户名字
            };
            console.log(params);

            AppService.collect(params).then((data) => {
                console.log(data);
                if (data.message) {
                    xnToast(data.message);
                    return;
                }
                if (data.errors.length > 0) {
                    xnToast(data.errors[0].message);
                } else {
                    StatusBar.setBackgroundColor(global.homeColor);
                    xnToast('已收藏');
                    DeviceEventEmitter.emit('reGetThreadDetailInfo');
                    DeviceEventEmitter.emit('refreshAttention');
                }
            }).catch((error) => {
                xnToast(error)
            })
        }else {
            //取消收藏
            let params = {
                id:data.collect.id,//社区id
            };
            console.log(params);

            AppService.cancleCollect(params).then((data) => {
                console.log(data);
                if (data.message) {
                    xnToast(data.message);
                    return;
                }
                if (data.errors.length > 0) {
                    xnToast(data.errors[0].message);
                } else {
                    xnToast('已取消收藏');
                    StatusBar.setBackgroundColor(global.homeColor);
                    DeviceEventEmitter.emit('reGetThreadDetailInfo');
                    // 取消收藏通知主页更新
                    DeviceEventEmitter.emit('refreshAttention');
                }
            }).catch((error) => {
                xnToast(error)
            })
        }


    };

    //删除
    deleteClick(){
        if (!global.isConnected){
            xnToast('暂无网络连接,请稍后重试!');
            // this.setState({
            //     loading:false,
            // });
            return;
        }

        let  data = this.props.detailInfo;
        let isCollected = !!data.collect && data.collect.isActive? true:false;
        let params = {
            id:data.id,
            sourceFrom:this.props.sourceFrom || 'APP'
        };

        console.log(params);

        AppService.deleteThreadById(params).then((data) => {

            console.log(data);
            if (data.message) {
                xnToast(data.message);
                return;
            }
            if (data.errors.length > 0) {
                xnToast(data.errors[0].message);
            } else {
                xnToast('删除成功');
                //如果之前这个帖子被收藏过,更新用户信息页面刷新收藏数
                if (isCollected){
                    DeviceEventEmitter.emit('refreshCollectList');
                }
                DeviceEventEmitter.emit('refreshHomeHistory');
                DeviceEventEmitter.emit('refreshHomeList');
                DeviceEventEmitter.emit('refreshList');
                DeviceEventEmitter.emit('refreshVideoList');
                this.props.deleteClick();
                StatusBar.setBackgroundColor(global.homeColor);
            }
        }).catch((error) => {
            xnToast(error)
        })
    };


    wchatShare(){
        var wxOriginalID = '';
        if(global.appTarget == 'fangPartner'){
            // 芳聊小程序的原始ID
            wxOriginalID = 'gh_38cacc3e0a30';
        }
        // 这是测试App 300029承租人下的芳聊社区,用于debug芳聊测试环境的小程序
        if(global.appTarget == 'xntalkTest' || global.appTarget == 'fang'){
            wxOriginalID = 'gh_e1c3c68d4919';
        }
        let data = this.props.detailInfo;
        let threadType = data.threadType;
        let path;//小程序的地址 path
        var temp = data.threadDetail.content;
        var webUrl = 'https://sns.xiniunet.com/wechatpage/dist/index.html#/center';
        if (threadType ==  0){//图文
            path = '/pages/community/img-text-detail/img-text-detail?boardId='+data.boardId+'&threadId='+data.id+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
            //path = '/pages/community/img-text-detail/img-text-detail?boardId='+1050592354601406465+'&threadId='+1074152535918514176+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
        }else if (threadType ==  1){//图集
            path = '/pages/community/atlas/atlas??boardId='+data.boardId+'&threadId='+data.id+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
            //path = '/pages/community/atlas/atlas??boardId='+1055395348350111744+'&threadId='+1077392601658822656+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
        }else if (threadType ==  2){//视频
            path = '/pages/community/video/video?boardId='+data.boardId+'&threadId='+data.id+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
            //path = '/pages/community/video/video?boardId='+1055395348350111744+'&threadId='+1082537196264755200+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
        }else if (threadType ==  3){//问答
            path = '/pages/community/question-answer/question/question?boardId='+data.boardId+'&threadId='+data.id+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
            //path = '/pages/community/question-answer/question/question?boardId='+1050592354601406465+'&threadId='+1074152535918514176+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
        }else if (threadType ==  4){//文章
            path = '/pages/community/text-detail/text-detail?boardId='+data.boardId+'&threadId='+data.id+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
            //path = '/pages/community/text-detail/text-detail?boardId='+1055395348350111744+'&threadId='+1073397006329843712+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
        }
        webUrl = webUrl + '?path='+path;
        if(temp.length > 20){
            temp = temp.substring(0,19);
        }
        let thumbUrl = "";
        let isVideo =data.threadType ==2 ;
        if (isVideo){
            if ( !! data.videoCover ){
                thumbUrl  = data.videoCover|| "";
            }
        }else {
            if ( !! data.attachmentList && data.attachmentList.length >0){
                thumbUrl  = data.attachmentList[0].filePath || "";
            }
        }

        // 默认图片
        if(thumbUrl.length == 0){
            thumbUrl = 'https://cdn.xiniunet.com/img/sns/fang/wxshare_defaultImg.jpg';
        }
        let title = data.title?data.title:temp;
        let description = data.title?temp:'';
        console.log('wchatShare--',path);
        NativeModules.system.wchatShare(path,webUrl,title,description ,thumbUrl,wxOriginalID);
    }

    // 获取粉丝id
    promise2 = () => {
        const _this = this;
        if(_this.state.associateId != ''){
            _this.promise3();
        }else{
            // return new Promise((resolve, reject) => {
            AppService.getAssociateMemberBySource({sourceType:"WX_OPEN",unionId:global.unionId,tenantId:global.tenantId,name:global.userName,avatarUrl:!!!global.userAvatar?'':global.userAvatar}).then((data) => {
                if (data.message) {
                    xnToast(data.message);
                    // reject(error.message);
                    _this.promise3();
                    return;
                }
                if (!!data.errors === true && !!data.errors.length > 0) {
                    xnToast(data.errors[0].message);
                    // reject(data.errors[0].message);
                    _this.promise3();
                    return;
                } else {
                    _this.setState({
                        associateId:data.associateMember.id,
                    },()=>{
                        // resolve(res);
                        _this.promise3();
                    });
                }
            }).catch((error) => {
                // xnToast(error.message);
                // reject(error.message);
                _this.promise3();
            });
            // });
        }
    };

    // 保存参数
    promise3 = () => {
        const _this = this;
        if(_this.state.queryId != ''){
            _this.wchatCircleShare();
        }else{
            // return new Promise((resolve, reject) => {
            var wxOriginalID = '';
            if(global.appTarget == 'fangPartner'){
                // 芳聊小程序的原始ID
                wxOriginalID = 'gh_38cacc3e0a30';
            }
            // 这是测试App 300029承租人下的芳聊社区,用于debug芳聊测试环境的小程序
            if(global.appTarget == 'xntalkTest' || global.appTarget == 'fang'){
                wxOriginalID = 'gh_e1c3c68d4919';
            }
            let data = _this.props.detailInfo;
            let threadType = data.threadType;
            let userId = global.userId;
            let tenantId = global.tenantId;
            var temp = data.threadDetail.content;
            let forumId = global.forumId;
            AppService.saveAppScenceParm({'json':JSON.stringify({
                    rasId:_this.state.associateId == ''?0:_this.state.associateId,
                    boardId:data.boardId,
                    threadId:data.id,
                    tenantId:tenantId,
                    userId:userId,
                    forumId:forumId,
                    threadType:threadType,
                    wxOriginalID:wxOriginalID
                })}).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,
                        wechatCircleShareReady:true,
                    },()=>{
                        // resolve(res);
                        _this.wchatCircleShare();
                    });
                }
            }).catch((error) => {
                // xnToast(error.message);
                // reject(error.message);
            });
            // });
        }
    };

    wchatCircleShare(){
        if(this.state.queryId == ''){
            xnToast("获取分享参数失败,请稍后重试!");
        }else{
            this.closeModal();
            // 这里写死的是芳聊小程序的原始ID,可以根据当前社区的id来判断
            var wxOriginalID = '';
            if(global.appTarget == 'fangPartner'){
                wxOriginalID = 'gh_38cacc3e0a30';
            }
            // 这是测试App 300029承租人下的芳聊社区,用于debug芳聊测试环境的小程序
            if(global.appTarget == 'xntalkTest' || global.appTarget == 'fang'){
                wxOriginalID = 'gh_e1c3c68d4919';
            }
            let data = this.props.detailInfo;
            let threadType = data.threadType;
            let path;//小程序的地址 path
            var webUrl = 'https://sns.xiniunet.com/wechatpage/dist/index.html#/center'
            var temp = data.threadDetail.content;
            // 分享到微信朋友圈,pages不能以"/"开头
            if (threadType ==  0){//图文
                path = 'pages/community/img-text-detail/img-text-detail?boardId='+data.boardId+'&threadId='+data.id+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID+'&queryId='+this.state.queryId;
                //path = '/pages/community/img-text-detail/img-text-detail?boardId='+1050592354601406465+'&threadId='+1074152535918514176+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
            }else if (threadType ==  1){//图集
                path = 'pages/community/atlas/atlas??boardId='+data.boardId+'&threadId='+data.id+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID+'&queryId='+this.state.queryId;
                //path = '/pages/community/atlas/atlas??boardId='+1055395348350111744+'&threadId='+1077392601658822656+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
            }else if (threadType ==  2){//视频
                path = 'pages/community/video/video?boardId='+data.boardId+'&threadId='+data.id+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID+'&queryId='+this.state.queryId;
                //path = '/pages/community/video/video?boardId='+1055395348350111744+'&threadId='+1082537196264755200+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
            }else if (threadType ==  3){//问答
                path = 'pages/community/question-answer/question/question?boardId='+data.id+'&threadId='+data.threadId+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID+'&queryId='+this.state.queryId;
                //path = '/pages/community/question-answer/question/question?boardId='+1050592354601406465+'&threadId='+1074152535918514176+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
            }else if (threadType ==  4){//文章
                path = 'pages/community/text-detail/text-detail?boardId='+data.boardId+'&threadId='+data.id+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID+'&queryId='+this.state.queryId;
                //path = '/pages/community/text-detail/text-detail?boardId='+1055395348350111744+'&threadId='+1073397006329843712+'&tenantId='+global.tenantId+'&userId='+global.userId+'&platform='+Platform.OS+'&forumId='+global.forumId+'&threadType='+threadType+'&wxOriginalID='+wxOriginalID;
            }
            webUrl = webUrl + '?path='+path;
            console.log(webUrl);
            if ( !! data.attachmentList && data.attachmentList.length >0){
                thumbUrl  = data.attachmentList[0].filePath || "";
            }
            if(temp.length > 20){
                temp = temp.substring(0,19);
            }
            let thumbUrl = "";
            let isVideo =data.threadType ==2 ;
            if (isVideo){
                if ( !! data.videoCover ){
                    thumbUrl  = data.videoCover|| "";
                }
            }else {
                if ( !! data.attachmentList && data.attachmentList.length >0){
                    thumbUrl  = data.attachmentList[0].filePath || "";
                }
            }
            // 默认图片
            if(thumbUrl.length == 0){
                thumbUrl = 'https://cdn.xiniunet.com/img/sns/fang/wxshare_defaultImg.jpg';
            }
            let title = data.title?data.title:temp;
            let description = data.title?temp:'';
            NativeModules.system.wchatCircleShare(webUrl,title,description ,thumbUrl,wxOriginalID);
        }
    }

    //分享到个人/群组
    shareClick(isP2P){

        let data = this.props.detailInfo;

        let title=data.title?data.title:data.threadDetail.content?data.threadDetail.content:'';
        let contentImage='';
        let content='';

        // 'xntalk://rnapp.open/newForum?id=1099941246937464832&type=3&tenantId=512824102474878976&forumId=1063412116519784448&forumName=犀牛社区&boardId=1063412116553338882&threadId=1099941246937464832';

        let name = data.forumName?data.forumName:this.props.forum.name;
        let link='xntalk://rnapp.open/newForum?id='+data.id+'&type='+data.threadType+'&tenantId='+data.tenantId+'&forumId='+data.forumId+'&forumName='+name+'&boardId='+data.boardId+'&threadId='+data.threadDetail.id;


        if (data.attachmentList&&data.attachmentList.length >0) {
            let attachment = data.attachmentList[0];
            if (attachment.type === "VEDIO"){
                let attributes = JSON.parse(attachment.attributes);
                contentImage = attributes.videoCover;

            }else{
                contentImage = attachment.filePath;
            }
        }


        let shareInfo = {
            title:title,
            name:data.threadUserName,
            iconUrl:data.threadUserHeadFileUrl?data.threadUserHeadFileUrl:'',
            forumName:data.forumName?data.forumName:this.props.forum.name,
            contentImage:contentImage,
            content:content,
            tenantId:data.tenantId,
            link:link
        };

        console.log(shareInfo);
        // this.props.forum.type
        NativeModules.system.shareToChatforP2P(isP2P,shareInfo,this.props.forum.type);
    };

    render() {
        //课程不支持分享
        let data = this.props.detailInfo;
        let threadType = data.threadType;
        return (
            <Modal animationType={'none'} visible={this.state.showSetting} transparent={true}
                   onRequestClose={() => this.closeModal()}>
                <TouchableOpacity activeOpacity={1} style={styles.modalBg} onPress={() => this.closeModal()}>
                    <Animated.View style={{
                        width: '100%',
                        position: 'absolute',
                        bottom: this.state.bottom
                    }}>
                        <View style={{flex:1, backgroundColor: '#eee', borderRadius :4,paddingTop:5,paddingBottom:5,marginLeft:12,marginRight:12}}>
                            <ScrollView showsHorizontalScrollIndicator={false} horizontal={true} style={{flex:1,flexDirection: 'row'}}>
                                {/*分享到个人*/}
                                {this.canShareInApp && !this.props.fromVideoDetail &&
                                <TouchableOpacity style = {{width:width/5,alignItems:'center'}}
                                                  onPress = {()=>{
                                                      this.closeModal();
                                                      setTimeout(() => {
                                                          this.shareClick(true);
                                                      }, 200)

                                                  }} >
                                    <View style = {[styles.image,{alignItems:'center',justifyContent:'center'}]}>
                                        <Image style = {{width:32,height:32}} source={require('../../img/share_person.png')}/>
                                    </View>

                                    <Text style = {styles.textStyle}> {'分享到个人'}</Text>
                                </TouchableOpacity>}
                                {/*分享到群组*/}
                                {this.canShareInApp && !this.props.fromVideoDetail &&
                                <TouchableOpacity style = {{width:width/5,alignItems:'center'}}
                                                  onPress = {()=>{
                                                      this.closeModal();
                                                      setTimeout(() => {
                                                          this.shareClick(false);
                                                      }, 200)
                                                  }} >
                                    <View style = {[styles.image,{alignItems:'center',justifyContent:'center'}]}>
                                        <Image style = {{width:32,height:32}} source={require('../../img/share_group.png')}/>
                                    </View>

                                    <Text style = {styles.textStyle}> {'分享到群组'}</Text>
                                </TouchableOpacity>}
                                {/*分享微信*/}
                                {threadType != 5 && global.showWchatShare &&
                                <TouchableOpacity style = {{width:width/5,alignItems:'center'}}
                                                  onPress = {()=>{
                                                      this.closeModal();
                                                      this.wchatShare();
                                                  }}>
                                    <Image style = {styles.image} source={wchat} />
                                    <Text style = {styles.textStyle}> 微信</Text>
                                </TouchableOpacity>}
                                {/*分享朋友圈*/}
                                {threadType != 5 && global.showWchatShare &&
                                <TouchableOpacity style = {{width:width/5,alignItems:'center'}}
                                                  onPress = {()=>{
                                                      // this.wchatCircleShare();
                                                      this.promise2();
                                                  }}>
                                    <Image style = {styles.image} source={wchatMoment}/>
                                    <Text style = {styles.textStyle}> 朋友圈</Text>
                                </TouchableOpacity>}
                            </ScrollView>
                            <View style={{backgroundColor: '#ddd',height:1,marginBottom: 5,marginTop: 5}}></View>
                            <ScrollView showsHorizontalScrollIndicator={false} horizontal={true} style={{flex:1,flexDirection: 'row'}}>
                                {/*收藏*/}
                                {!this.props.fromVideoDetail &&
                                <TouchableOpacity style = {{width:width/5,alignItems:'center'}}
                                                  onPress = {()=>{
                                                      this.closeModal();
                                                      this.collectClick(!!this.props.detailInfo.collect && this.props.detailInfo.collect.isActive?false:true)
                                                  }} >
                                    <View style = {[styles.image,{alignItems:'center',justifyContent:'center'}]}>
                                        <Image style = {{width:32,height:32}} source={!!this.props.detailInfo.collect && this.props.detailInfo.collect.isActive?
                                            require('../../img/share_collect.png'):require('../../img/collect.png')}/>
                                    </View>

                                    <Text style = {styles.textStyle}> {!!this.props.detailInfo.collect && this.props.detailInfo.collect.isActive?'已收藏':'收藏'}</Text>
                                </TouchableOpacity>}
                                {/*删除*/}
                                {this.props.detailInfo.threadUserId == global.userId &&
                                <TouchableOpacity style = {{width:width/5,alignItems:'center'}}
                                                  onPress = {()=>{
                                                      this.closeModal();
                                                      this.deleteClick()
                                                  }}>
                                    <View style = {[styles.image,{alignItems:'center',justifyContent:'center'}]}>
                                        <Image style = {{width:32,height:32}} source={require('../../img/share_delete.png')}/>
                                    </View>

                                    <Text style = {styles.textStyle}> 删除</Text>
                                </TouchableOpacity>}
                            </ScrollView>
                        </View>
                        <View style={{flex:1, backgroundColor: '#eee',margin:12, borderRadius :4}}>
                            <TouchableOpacity activeOpacity={0.8}
                                              style={[styles.settingItem, {borderBottomWidth: 0}]}
                                              onPress={()=> {
                                                  this.closeModal()
                                              }}>
                                <Text style={{fontSize: 18, color: '#000'}}>取消</Text>
                            </TouchableOpacity>
                        </View>
                    </Animated.View>
                </TouchableOpacity>
            </Modal>
        );
    }
}

const styles = StyleSheet.create({
    modalBg: {
        width: width,
        height: height,
        backgroundColor: 'rgba(0,0,0,.5)',
        display: 'flex',
        alignItems: 'center'
    },

    image:{
        width:38,
        height:38,
        marginBottom:5
    },
    textStyle : {
        fontSize:10,
        color:'rgba(0,0,0,0.65)'
    },


    settingItem: {
        width: '100%',
        height: (50 / zoomH),
        display: 'flex',
        justifyContent: 'center',
        alignItems: 'center',


    },

});