业主需求 预览修改中

This commit is contained in:
郑茂强 2019-02-14 17:35:44 +08:00
parent 04efa389b3
commit 7165180b39
7 changed files with 139 additions and 56 deletions

View File

@ -5,6 +5,7 @@ import { AtModal, AtModalHeader, AtModalContent, AtModalAction, AtIcon } from 't
import URL from '../../serviceAPI.config' import URL from '../../serviceAPI.config'
import RenderingView from './renderingView/renderingView'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent' import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import './grabOrderPage.scss' import './grabOrderPage.scss'
@ -180,49 +181,44 @@ class GrabOrderPage extends Component {
} }
deleteMyNeeds({ demandId }) { deleteMyNeeds({ demandId }) {
Taro.request({ Taro.request({
url: URL.DeleteMyNeeds, url: URL.DeleteMyNeeds,
method: 'POST', method: 'POST',
dataType: 'json', dataType: 'json',
data: { data: {
demandId: demandId demandId: demandId
}, },
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}).then(res => { }).then(res => {
if (res.data.err_msg === "success") { if (res.data.err_msg === "success") {
Taro.showToast({ Taro.showToast({
title: '删除成功', title: '删除成功',
icon: 'success', icon: 'success',
duration: 1500 duration: 1500
}) })
setTimeout(() => { setTimeout(() => {
Taro.reLaunch({ Taro.reLaunch({
url: '/pages/myNeeds/myNeeds' url: '/pages/myNeeds/myNeeds'
}) })
}, 1500); }, 1500);
} else { } else {
Taro.showToast({ Taro.showToast({
title: res.data.err_msg, title: res.data.err_msg,
icon: 'none', icon: 'none',
duration: 1500 duration: 1500
}) })
} }
}) })
} }
render() { render() {
const localStoageUserId = Taro.getStorageSync('userInfo').user_id const localStoageUserId = Taro.getStorageSync('userInfo').user_id
// 显示效果图
const renderingElementArray = this.state.renderingImage.length ? this.state.renderingImage.map((item, index) => {
return <View className='image-wrapper' key={index}>
<Image src={URL.Base + item.file_path} style='max-width:100%; max-height:100%;' />
</View>
}) : null;
// 提示框 // 提示框
const deleteModalWindowElement = <AtModal isOpened={this.state.isDeleteModal}> const deleteModalWindowElement = <AtModal isOpened={this.state.isDeleteModal}>
<AtModalHeader>提示</AtModalHeader> <AtModalHeader>提示</AtModalHeader>
@ -296,17 +292,18 @@ class GrabOrderPage extends Component {
</AtModal> </AtModal>
const imageElementArray = this.state.images.map((item, index) => { const imageElementArray = this.state.images.map((item, index) => {
return <View className='image-wrapper' key={index}> return <View className='image-wrapper' key={index}>
<Image mode='aspectFit' src={URL.Base + item.file_path} style='max-width:100%; max-height:100%;' />
<Image mode='aspectFit' src={URL.Base + item.file_path} style='max-width:100%; max-height:100%;' />
</View> </View>
}) })
return ( return (
<View className='grabOrderPage'> <View className='grabOrderPage'>
{modalMessageGrabElement} {modalMessageGrabElement}
{deleteModalWindowElement} {deleteModalWindowElement}
{this.state.isShowRendering ? <View className='rendering-container'> {this.state.isShowRendering ? <RenderingView rendering={this.state.renderingImage}></RenderingView> : null}
{renderingElementArray}
</View> : null}
{this.state.stateId === '3' && !this.state.isShowRendering ? <View className='button-box show-image-button'><View className='button' onClick={this.showImageButton.bind(this)}> {this.state.stateId === '3' && !this.state.isShowRendering ? <View className='button-box show-image-button'><View className='button' onClick={this.showImageButton.bind(this)}>
<Button className='button-orange'>查看效果图</Button> <Button className='button-orange'>查看效果图</Button>
</View></View> : null} </View></View> : null}

View File

@ -1,17 +1,7 @@
.grabOrderPage{ .grabOrderPage{
padding: 10px 20px; padding: 10px 20px;
font-size: 32rpx; font-size: 32rpx;
.rendering-container{
display: flex;
flex-wrap: wrap;
flex-direction: row;
border: 4rpx solid #ddd;
.image-wrapper{
width: 30%;
height: 200px;
margin:1.3%;
}
}
.box{ .box{
margin-top: 35px; margin-top: 35px;
} }
@ -24,6 +14,8 @@
} }
} }
.image-wrapper{ .image-wrapper{
display: flex;
justify-content:center;
border: 4rpx solid #ddd; border: 4rpx solid #ddd;
margin-top: 10px margin-top: 10px
} }

View File

@ -0,0 +1,78 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Image } from '@tarojs/components'
import { AtCurtain } from 'taro-ui'
import URL from '../../../serviceAPI.config'
import './renderingView.scss'
class RenderingView extends Component {
//效果图组件 接受rendering=[]
config = {
navigationBarTitleText: '效果图'
}
constructor(props) {
super(props)
this.state = {
image: '',
isOpened:false
}
}
onClickHandler(item) {
this.setState({
image: URL.Base + item.file_path,
isOpened:true
})
}
onCloseCurtain(){
this.setState({
isOpened:false
})
}
componentDidMount() {
}
componentWillReceiveProps(nextProps) {
}
componentWillUnmount() { }
componentDidShow() { }
componentDidHide() { }
render() {
// 显示效果图
let { rendering } = this.props
let renderingElementArray = rendering.length ? rendering.map((item, index) => {
return <View className='image-wrapper' key={index} onClick={this.onClickHandler.bind(this, item)}>
<Image src={URL.Base + item.file_path} style='max-width:100%; max-height:100%;' />
</View>
}) : null;
let curtainElement = <AtCurtain
isOpened={this.state.isOpened}
onClose={this.onCloseCurtain.bind(this)}
>
<Image
style='width:100%;height:250px'
src={this.state.image}
/>
</AtCurtain>
return (
<View className='rendering-container'>
{curtainElement}
{renderingElementArray}
</View>
)
}
}
export default RenderingView

View File

@ -0,0 +1,14 @@
.rendering-container{
display: flex;
flex-wrap: wrap;
flex-direction: row;
border: 4rpx solid #ddd;
.image-wrapper{
border: 4rpx solid #ddd;
margin-top: 10px;
box-sizing: border-box;
width: 30%;
height: 200px;
margin:1.6%;
}
}

View File

@ -309,8 +309,10 @@ class MyGoodList extends Component {
icon: 'success', icon: 'success',
duration: 1500 duration: 1500
}).then(() => { }).then(() => {
this.setState({ isCheckAll: false, currPageParam: 1 }) this.setState({ isCheckAll: false, currPageParam: 1 },()=>{
this.getMyGoodListApi({}) this.getMyGoodListApi({})
})
}) })
} else { } else {
Taro.showToast({ Taro.showToast({

View File

@ -315,7 +315,6 @@ class MyNeeds extends Component {
this.setState({ industryTypeSelected: value }) this.setState({ industryTypeSelected: value })
} }
render() { render() {
console.log('myneed')
const myNeedsListArrayElement = this.state.allNeedsList.map((item, index) => { const myNeedsListArrayElement = this.state.allNeedsList.map((item, index) => {
return <View className='needs-box' key={index}> return <View className='needs-box' key={index}>
<View className='industy-type box'> <View className='industy-type box'>

View File

@ -306,6 +306,7 @@ class MyNeedsEdit extends Component {
url: '/pages/myNeeds/myNeeds' url: '/pages/myNeeds/myNeeds'
}) })
} }
// 保存需求按钮 // 保存需求按钮
saveButtonHandler() { saveButtonHandler() {
if (this.state.title && if (this.state.title &&