Authored by 孙凯

add guangDetail 图片 链接 review by hongmo

@@ -81,7 +81,7 @@ export default class Detail extends Component { @@ -81,7 +81,7 @@ export default class Detail extends Component {
81 ); 81 );
82 }else if (template_name == 'single_image') { 82 }else if (template_name == 'single_image') {
83 return ( 83 return (
84 - <SingleImage resource={rowData}/> 84 + <SingleImage resource={rowData} onPressLink={this.props.onPressLink}/>
85 ); 85 );
86 }else if (template_name == 'small_pic') { 86 }else if (template_name == 'small_pic') {
87 return ( 87 return (
@@ -102,7 +102,7 @@ export default class DetailText extends React.Component { @@ -102,7 +102,7 @@ export default class DetailText extends React.Component {
102 text = '<html><style type="text/css">img {max-width: 100%;}</style><body>' + text + '</body></html>' 102 text = '<html><style type="text/css">img {max-width: 100%;}</style><body>' + text + '</body></html>'
103 103
104 let hasLink = false; 104 let hasLink = false;
105 - if (text.indexOf('<a href=') >= 0) { 105 + if (text.indexOf('href=') >= 0) {
106 hasLink = true; 106 hasLink = true;
107 } 107 }
108 108
@@ -52,23 +52,43 @@ export default class SingleImage extends React.Component { @@ -52,23 +52,43 @@ export default class SingleImage extends React.Component {
52 let {resource} = this.props; 52 let {resource} = this.props;
53 let template_name = resource.get('data'); 53 let template_name = resource.get('data');
54 let src = template_name.get('src'); 54 let src = template_name.get('src');
  55 + let linkUrl = template_name.get('url');
55 let imageHeight = template_name.get('height'); 56 let imageHeight = template_name.get('height');
56 let imageWidth = template_name.get('width'); 57 let imageWidth = template_name.get('width');
57 58
58 if (imageHeight && imageWidth) { 59 if (imageHeight && imageWidth) {
59 return ( 60 return (
60 - <Image  
61 - source={{uri: src}}  
62 - style={{width: screenWidth,height: (imageHeight/imageWidth)*screenWidth}}  
63 - />  
64 - ); 61 + <View style={{width: screenWidth,height: (imageHeight/imageWidth)*screenWidth}}>
  62 + {linkUrl?<TouchableOpacity activeOpacity={0.5} onPress={() => {
  63 + this.props.onPressLink && this.props.onPressLink(linkUrl);
  64 + }}>
  65 + <Image
  66 + source={{uri: src}}
  67 + style={{width: screenWidth,height: (imageHeight/imageWidth)*screenWidth}}
  68 + />
  69 + </TouchableOpacity>:<Image
  70 + source={{uri: src}}
  71 + style={{width: screenWidth,height: (imageHeight/imageWidth)*screenWidth}}
  72 + />}
  73 + </View>
  74 + );
65 }else { 75 }else {
66 return ( 76 return (
67 - <Image  
68 - ref={(ref)=>this.imageView=ref}  
69 - source={{uri: src}}  
70 - style={{width: screenWidth,height: (this.state.height/this.state.width)*screenWidth}}  
71 - /> 77 + <View style={{width: screenWidth,height: (this.state.height/this.state.width)*screenWidth}}>
  78 + {linkUrl?<TouchableOpacity activeOpacity={0.5} onPress={() => {
  79 + this.props.onPressLink && this.props.onPressLink(linkUrl);
  80 + }}>
  81 + <Image
  82 + ref={(ref)=>this.imageView=ref}
  83 + source={{uri: src}}
  84 + style={{width: screenWidth,height: (this.state.height/this.state.width)*screenWidth}}
  85 + />
  86 + </TouchableOpacity>:<Image
  87 + ref={(ref)=>this.imageView=ref}
  88 + source={{uri: src}}
  89 + style={{width: screenWidth,height: (this.state.height/this.state.width)*screenWidth}}
  90 + />}
  91 + </View>
72 ); 92 );
73 } 93 }
74 } 94 }