Authored by 孙凯

add guangDetail 图片 链接 review by hongmo

... ... @@ -81,7 +81,7 @@ export default class Detail extends Component {
);
}else if (template_name == 'single_image') {
return (
<SingleImage resource={rowData}/>
<SingleImage resource={rowData} onPressLink={this.props.onPressLink}/>
);
}else if (template_name == 'small_pic') {
return (
... ...
... ... @@ -102,7 +102,7 @@ export default class DetailText extends React.Component {
text = '<html><style type="text/css">img {max-width: 100%;}</style><body>' + text + '</body></html>'
let hasLink = false;
if (text.indexOf('<a href=') >= 0) {
if (text.indexOf('href=') >= 0) {
hasLink = true;
}
... ...
... ... @@ -52,23 +52,43 @@ export default class SingleImage extends React.Component {
let {resource} = this.props;
let template_name = resource.get('data');
let src = template_name.get('src');
let linkUrl = template_name.get('url');
let imageHeight = template_name.get('height');
let imageWidth = template_name.get('width');
if (imageHeight && imageWidth) {
return (
<View style={{width: screenWidth,height: (imageHeight/imageWidth)*screenWidth}}>
{linkUrl?<TouchableOpacity activeOpacity={0.5} onPress={() => {
this.props.onPressLink && this.props.onPressLink(linkUrl);
}}>
<Image
source={{uri: src}}
style={{width: screenWidth,height: (imageHeight/imageWidth)*screenWidth}}
/>
</TouchableOpacity>:<Image
source={{uri: src}}
style={{width: screenWidth,height: (imageHeight/imageWidth)*screenWidth}}
/>}
</View>
);
}else {
return (
<View style={{width: screenWidth,height: (this.state.height/this.state.width)*screenWidth}}>
{linkUrl?<TouchableOpacity activeOpacity={0.5} onPress={() => {
this.props.onPressLink && this.props.onPressLink(linkUrl);
}}>
<Image
ref={(ref)=>this.imageView=ref}
source={{uri: src}}
style={{width: screenWidth,height: (this.state.height/this.state.width)*screenWidth}}
/>
</TouchableOpacity>:<Image
ref={(ref)=>this.imageView=ref}
source={{uri: src}}
style={{width: screenWidth,height: (this.state.height/this.state.width)*screenWidth}}
/>}
</View>
);
}
}
... ...