Commit d5700872 by Denglingling

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

parent 9c50fcdc
......@@ -6,15 +6,20 @@ import {
Modal,
ScrollView,
TouchableOpacity,
SafeAreaView
SafeAreaView,
Image
} from 'react-native';
import {
Width,
pxHeight,
third_text_color,
first_text_color,
safe_view
safe_view,
pxSize,
icon_style
} from '../../base/BaseStyle';
import ZoomPictureModel from '../common/ZoomPictureModel';
import { connect } from 'react-redux';
/** 选择器弹窗 */
class DialogModel extends Component {
......@@ -22,7 +27,9 @@ class DialogModel extends Component {
super(props);
this.state = {
isVisible: false,
entityList: this.props.entityList
entityList: this.props.entityList,
isShowImage: false,
zoomImages: []
}
}
......@@ -46,25 +53,58 @@ class DialogModel extends Component {
this.props.closeModal(false);
}
handleChooseItem(item) {
let { itemTitle } = this.props
if (this.state.isVisible) {
this.props.callback(item, itemTitle);
this.closeModal();
}
}
// 展示/隐藏 放大图片
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}
key={index}
onPress={this.choose.bind(this, item, index)}
style={styles.list_item_box}>
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>
);
}
choose(item, index) {
let { itemTitle } = this.props
if (this.state.isVisible) {
this.props.callback(item, itemTitle);
this.closeModal();
{
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() {
......@@ -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() {
return (
<View style={styles.dia_container}>
......@@ -97,12 +161,16 @@ class DialogModel extends Component {
// onRequestClose={() => this.closeModal()} // onRequestClose 只支持安卓
>
<SafeAreaView style={safe_view}>
<TouchableOpacity style={styles.container} activeOpacity={1}
onPress={() => this.closeModal()}>
<TouchableOpacity
style={styles.container} activeOpacity={1}
onPress={() => this.closeModal()}
>
{this.renderZoomPicture()}
{this.renderDialog()}
</TouchableOpacity>
</SafeAreaView>
</Modal>
</View>
);
}
......@@ -147,7 +215,6 @@ const styles = StyleSheet.create({
paddingLeft: 20,
paddingRight: 20,
alignItems: 'center',
},
list_item_text: {
fontSize: 16,
......@@ -162,6 +229,42 @@ const styles = StyleSheet.create({
paddingTop: 46
},
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,
},
})
export default DialogModel;
\ No newline at end of file
const mapStateToProps = (state) => {
return {
global_domain_config: state.login.global_domain_config
}
}
export default connect(mapStateToProps, null)(DialogModel);
\ No newline at end of file
......@@ -652,6 +652,7 @@ class EquipConsuPage extends Component {
obj.name = tempName
obj.value = item.template_number
obj.desc = item.template_desc
obj.template_pic = item.template_pic
resultArr.push(obj)
})
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