UNPKG

yylib-quick-mobile

Version:

yylib-quick-mobile

98 lines (96 loc) 2.93 kB
import React from 'react'; import {Modal} from 'antd-mobile'; import './yyfile.less'; import ping from '../../common/img/ping.png'; import zhuan from '../../common/img/zhuan.png'; import returnImg from '../../common/img/return.png'; import YYReply from './YYReply'; import {ADDR} from '../../common/RestUrl'; class YYFile extends React.Component{ state={ showReply:false, close:false } replyContent(){ this.setState({showReply:true}) } shareUrl(){ let {selectRow}=this.props; let shareUrl=ADDR+'/icop-file/onlinePreview?url='+ADDR+'/'+selectRow.filePath; let params = { type: "3", text: selectRow.fileName, url: shareUrl, title: selectRow.fileName }; window.YYPlugin&&window.YYPlugin.call("CommonPlugin", 'share', params) } onClose(){ this.setState({showReply:false}) } closeFile(){ this.setState({close:true},()=>{ setTimeout(()=>{ this.props.closeFile&&this.props.closeFile(); },300) }) } componentDidMount() { let {selectRow} = this.props; var params = { sourceBillType:selectRow.billType, sourceBillId:selectRow.id, pageSize:10, pageNumber:0 } this.setState({params:params}); this.props.getCommentList(params); } reached() { let {selectRow,last} = this.props; let {params} = this.state; if (!last) { this.props.reached(Object.assign(params,{pageNumber:params.pageNumber+1})); } } onRefresh() { let {selectRow} = this.props; var params = { sourceBillType:selectRow.billType, sourceBillId:selectRow.id, pageSize:10, pageNumber:0 } this.setState({params:params}); this.props.getCommentList(params); } render(){ let {selectRow,total}=this.props; let {showReply,close}=this.state; let shareUrl=ADDR+'/icop-file/onlinePreview?url='+ADDR+'/'+selectRow.filePath; let className=close?'yyfile slide-down':'yyfile slide-up' return (<div ref={(o)=>this.YYFileDom=o} className={className}> <div className='return' onClick={this.closeFile.bind(this)}><img src={returnImg} /></div> <iframe className='sharefile' src={shareUrl}></iframe> <div className="operate"> <div onClick={this.replyContent.bind(this)} className='ping'><img src={ping} /><div className='num'>{total?total:0}</div></div> <div onClick={this.shareUrl.bind(this)} className='zhuan'><img src={zhuan} /></div> </div> <Modal popup visible={showReply} onClose={this.onClose.bind(this)} animationType="slide-up" > <YYReply selectRow={selectRow} send={this.props.send} liked={this.props.liked} data={this.props.commentList} appendData={this.props.appendData} reached={this.reached.bind(this)} refresh={this.onRefresh.bind(this)}/> </Modal> </div>) } } export default YYFile;