业主需求 预览修改中

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 RenderingView from './renderingView/renderingView'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import './grabOrderPage.scss'
@ -180,49 +181,44 @@ class GrabOrderPage extends Component {
}
deleteMyNeeds({ demandId }) {
Taro.request({
url: URL.DeleteMyNeeds,
method: 'POST',
dataType: 'json',
data: {
demandId: demandId
},
header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
url: URL.DeleteMyNeeds,
method: 'POST',
dataType: 'json',
data: {
demandId: demandId
},
header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
}).then(res => {
if (res.data.err_msg === "success") {
Taro.showToast({
title: '删除成功',
icon: 'success',
duration: 1500
})
setTimeout(() => {
Taro.reLaunch({
url: '/pages/myNeeds/myNeeds'
})
}, 1500);
} else {
Taro.showToast({
title: res.data.err_msg,
icon: 'none',
duration: 1500
})
}
if (res.data.err_msg === "success") {
Taro.showToast({
title: '删除成功',
icon: 'success',
duration: 1500
})
setTimeout(() => {
Taro.reLaunch({
url: '/pages/myNeeds/myNeeds'
})
}, 1500);
} else {
Taro.showToast({
title: res.data.err_msg,
icon: 'none',
duration: 1500
})
}
})
}
}
render() {
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}>
<AtModalHeader>提示</AtModalHeader>
@ -296,17 +292,18 @@ class GrabOrderPage extends Component {
</AtModal>
const imageElementArray = this.state.images.map((item, 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>
})
return (
<View className='grabOrderPage'>
{modalMessageGrabElement}
{deleteModalWindowElement}
{this.state.isShowRendering ? <View className='rendering-container'>
{renderingElementArray}
</View> : null}
{this.state.isShowRendering ? <RenderingView rendering={this.state.renderingImage}></RenderingView> : null}
{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>
</View></View> : null}

View File

@ -1,17 +1,7 @@
.grabOrderPage{
padding: 10px 20px;
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{
margin-top: 35px;
}
@ -24,6 +14,8 @@
}
}
.image-wrapper{
display: flex;
justify-content:center;
border: 4rpx solid #ddd;
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',
duration: 1500
}).then(() => {
this.setState({ isCheckAll: false, currPageParam: 1 })
this.getMyGoodListApi({})
this.setState({ isCheckAll: false, currPageParam: 1 },()=>{
this.getMyGoodListApi({})
})
})
} else {
Taro.showToast({

View File

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

View File

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