Commit d5700872 by Denglingling

新增手术模板,可展示模板图片功能;

parent 9c50fcdc
...@@ -6,15 +6,20 @@ import { ...@@ -6,15 +6,20 @@ import {
Modal, Modal,
ScrollView, ScrollView,
TouchableOpacity, TouchableOpacity,
SafeAreaView SafeAreaView,
Image
} from 'react-native'; } from 'react-native';
import { import {
Width, Width,
pxHeight, pxHeight,
third_text_color, third_text_color,
first_text_color, first_text_color,
safe_view safe_view,
pxSize,
icon_style
} from '../../base/BaseStyle'; } from '../../base/BaseStyle';
import ZoomPictureModel from '../common/ZoomPictureModel';
import { connect } from 'react-redux';
/** 选择器弹窗 */ /** 选择器弹窗 */
class DialogModel extends Component { class DialogModel extends Component {
...@@ -22,7 +27,9 @@ class DialogModel extends Component { ...@@ -22,7 +27,9 @@ class DialogModel extends Component {
super(props); super(props);
this.state = { this.state = {
isVisible: false, isVisible: false,
entityList: this.props.entityList entityList: this.props.entityList,
isShowImage: false,
zoomImages: []
} }
} }
...@@ -45,21 +52,8 @@ class DialogModel extends Component { ...@@ -45,21 +52,8 @@ class DialogModel extends Component {
}); });
this.props.closeModal(false); this.props.closeModal(false);
} }
renderItem(item, index) {
let { itemValue } = this.props
return (
<TouchableOpacity
activeOpacity={.8}
key={index}
onPress={this.choose.bind(this, item, index)}
style={styles.list_item_box}>
<Text numberOfLines={1} style={[styles.list_item_text, itemValue == item.value ? styles.curr_item : '']}>{item.name}</Text>
</TouchableOpacity>
);
}
choose(item, index) { handleChooseItem(item) {
let { itemTitle } = this.props let { itemTitle } = this.props
if (this.state.isVisible) { if (this.state.isVisible) {
this.props.callback(item, itemTitle); this.props.callback(item, itemTitle);
...@@ -67,6 +61,52 @@ class DialogModel extends Component { ...@@ -67,6 +61,52 @@ class DialogModel extends Component {
} }
} }
// 展示/隐藏 放大图片
handleZoomPicture(flag, uri) {
this.setState({
isShowImage: flag,
zoomImages: [{ url: uri }]
})
}
renderItem(item, index) {
let { itemValue } = this.props
let isExitPicUrl = item.template_pic
if(isExitPicUrl) {
let { global_domain_config } = this.props
isExitPicUrl = `${global_domain_config}/jeecg-boot/sys/common/view/${item.template_pic}`
}
return (
<View
key={index}
style={!isExitPicUrl ? styles.list_item_box : styles.list_item_pic_box}
>
<TouchableOpacity
activeOpacity={.8}
style={styles.list_txt_box}
onPress={this.handleChooseItem.bind(this, item, index)}
>
<Text numberOfLines={1} style={[styles.list_item_text, itemValue == item.value ? styles.curr_item : '']}>{item.name}</Text>
</TouchableOpacity>
{
isExitPicUrl ?
<View style={[styles.list_img_box, itemValue == item.value ? styles.list_act_box : '']}>
<TouchableOpacity
activeOpacity={.8}
style={styles.list_item_img}
onPress={() => this.handleZoomPicture(true, isExitPicUrl)}
>
<Image
defaultSource={require('../../images/not_img.png')}
source={{uri: isExitPicUrl}}
style={icon_style} />
</TouchableOpacity>
</View> : null
}
</View>
);
}
renderDialog() { renderDialog() {
let { entityList } = this.state let { entityList } = this.state
return ( return (
...@@ -87,6 +127,30 @@ class DialogModel extends Component { ...@@ -87,6 +127,30 @@ class DialogModel extends Component {
) )
} }
// 加载放大图片弹窗
renderZoomPicture() {
// // 测试
// let { isShowImage } = this.state
// let zoomImages = [{
// url: 'https://obs.uat.sfrx.guke.tech/upload/dingding/image/QDw05sTo.jpg',
// },{
// url: 'https://obs.uat.sfrx.guke.tech/upload/dingding/image/QDw05sTo.jpg',
// },{
// url: 'https://obs.uat.sfrx.guke.tech/jeecg-boot/sys/common/view/upload/dingding/image/8V4599aH.jpg'
// }]
// 正式
let { isShowImage, zoomImages } = this.state
return (
<ZoomPictureModel
isShowImage={isShowImage}
currShowImgIndex={0}
zoomImages={zoomImages}
callBack={(flag) => this.handleZoomPicture(flag)}
></ZoomPictureModel>
)
}
render() { render() {
return ( return (
<View style={styles.dia_container}> <View style={styles.dia_container}>
...@@ -97,12 +161,16 @@ class DialogModel extends Component { ...@@ -97,12 +161,16 @@ class DialogModel extends Component {
// onRequestClose={() => this.closeModal()} // onRequestClose 只支持安卓 // onRequestClose={() => this.closeModal()} // onRequestClose 只支持安卓
> >
<SafeAreaView style={safe_view}> <SafeAreaView style={safe_view}>
<TouchableOpacity style={styles.container} activeOpacity={1} <TouchableOpacity
onPress={() => this.closeModal()}> style={styles.container} activeOpacity={1}
onPress={() => this.closeModal()}
>
{this.renderZoomPicture()}
{this.renderDialog()} {this.renderDialog()}
</TouchableOpacity> </TouchableOpacity>
</SafeAreaView> </SafeAreaView>
</Modal> </Modal>
</View> </View>
); );
} }
...@@ -147,7 +215,6 @@ const styles = StyleSheet.create({ ...@@ -147,7 +215,6 @@ const styles = StyleSheet.create({
paddingLeft: 20, paddingLeft: 20,
paddingRight: 20, paddingRight: 20,
alignItems: 'center', alignItems: 'center',
}, },
list_item_text: { list_item_text: {
fontSize: 16, fontSize: 16,
...@@ -162,6 +229,42 @@ const styles = StyleSheet.create({ ...@@ -162,6 +229,42 @@ const styles = StyleSheet.create({
paddingTop: 46 paddingTop: 46
}, },
item_scroll: {}, item_scroll: {},
list_item_pic_box: {
display: 'flex',
flexDirection: 'row',
width: Width(),
height: 44,
paddingLeft: 26,
paddingRight: 26,
alignItems: 'center',
justifyContent: 'space-around'
},
list_item_img: {
width: pxSize(36),
height: 'auto'
},
list_txt_box: {
flex: 1
},
list_img_box: {
width: pxSize(60),
height: pxSize(39),
borderWidth: 1,
borderColor: '#DDDDDD',
borderRadius: 4,
padding: 1,
alignItems: 'center',
justifyContent: 'center'
},
list_act_box: {
borderColor: first_text_color,
},
}) })
const mapStateToProps = (state) => {
return {
global_domain_config: state.login.global_domain_config
}
}
export default DialogModel; export default connect(mapStateToProps, null)(DialogModel);
\ No newline at end of file \ No newline at end of file
...@@ -652,6 +652,7 @@ class EquipConsuPage extends Component { ...@@ -652,6 +652,7 @@ class EquipConsuPage extends Component {
obj.name = tempName obj.name = tempName
obj.value = item.template_number obj.value = item.template_number
obj.desc = item.template_desc obj.desc = item.template_desc
obj.template_pic = item.template_pic
resultArr.push(obj) resultArr.push(obj)
}) })
tempOption = [...resultArr] tempOption = [...resultArr]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment