修改新用户登入后的就用户的数据还在
This commit is contained in:
parent
55644ac246
commit
04efa389b3
@ -57,7 +57,10 @@ class GoodsTypeInteractionComp extends Component {
|
||||
}) // 用递归来整理无限层次的数据
|
||||
|
||||
} else {
|
||||
console.log('商品分类请求没有成功', res)
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -28,7 +28,7 @@ class ShopTypeInteractionComp extends Component {
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
id: this.props.shopId
|
||||
id: this.props.shopId,
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
@ -41,16 +41,21 @@ class ShopTypeInteractionComp extends Component {
|
||||
// this.formatIndustryType(res.data.data)
|
||||
// this.formatIndustTypeInit(res.data.data)
|
||||
if (res.data.err_msg === 'success') {
|
||||
if(res.data.data===null){
|
||||
return
|
||||
}
|
||||
console.log('店铺分类目录', res)
|
||||
this.setState({
|
||||
interactionMultiArray: this.recursionInteraction(res.data.data),
|
||||
initailMultiArray: this.recursionInitialized(res.data.data)
|
||||
}, () => {
|
||||
|
||||
// this.passDataToParent(this.state.initailMultiArray)
|
||||
//返回初始选项在 在商品编辑页面
|
||||
// if(this.props.shopTypeId){
|
||||
// const foundData=this.findDataByShopTypeId(this.props.shopTypeId)
|
||||
// this.passDataToParent(foundData)
|
||||
// }
|
||||
if(this.props.shopTypeId){
|
||||
const foundData=this.findDataByShopTypeId(this.props.shopTypeId)
|
||||
this.passDataToParent(foundData)
|
||||
}
|
||||
|
||||
// console.log('联动数据', this.state.interactionMultiArray)
|
||||
// console.log('初始化数据', this.state.initailMultiArray)
|
||||
@ -68,19 +73,20 @@ class ShopTypeInteractionComp extends Component {
|
||||
})
|
||||
}
|
||||
findDataByShopTypeId() {
|
||||
console.log('id', this.props.shopTypeId)
|
||||
console.log('id', this.props.shopTypeId,this.state.initailMultiArray)
|
||||
let result=''
|
||||
this.state.initailMultiArray.forEach(items => {
|
||||
items.forEach(item => {
|
||||
if (item.id === this.props.shopTypeId) {
|
||||
return item
|
||||
result =item
|
||||
}
|
||||
})
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
// 递归整理无限层联动数据
|
||||
recursionInteraction(data) {
|
||||
|
||||
let parentArrayHolder = []
|
||||
const keys = Object.keys(data)
|
||||
for (let key of keys) {
|
||||
@ -148,16 +154,13 @@ class ShopTypeInteractionComp extends Component {
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
this.getShopTypeList(this.props.url)
|
||||
}
|
||||
|
||||
// 当然父组件有新的props的 会从新渲染组件
|
||||
componentWillReceiveProps(nextProps) {
|
||||
// if (nextProps.shopTypeId) {
|
||||
// const foundData = this.findDataByShopTypeId(nextProps.shopTypeId)
|
||||
// this.passDataToParent(foundData)
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
|
@ -109,7 +109,7 @@ class GoodsPublish extends Component {
|
||||
})
|
||||
} else if (this.state.isPublishAndAdd) {
|
||||
// 导航到发布页面
|
||||
Taro.navigateTo({
|
||||
Taro.reLaunch({
|
||||
url: '/pages/goodsPublish/goodsPublish'
|
||||
})
|
||||
}
|
||||
@ -180,12 +180,12 @@ class GoodsPublish extends Component {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
},
|
||||
success(response) {
|
||||
const responseMsg = JSON.parse(response.data).err_msg
|
||||
if (responseMsg === 'success' || responseMsg === 'duplicate') {
|
||||
const data = JSON.parse(response.data)
|
||||
const imagePath = URL.Base + data.file_path
|
||||
const responseData = JSON.parse(response.data)
|
||||
console.log('responseData',responseData)
|
||||
if (responseData.err_code===0) {
|
||||
const imagePath = URL.Base + responseData.file_path
|
||||
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
|
||||
const newImageInfo = that.state.ImagesInfo.concat(data)
|
||||
const newImageInfo = that.state.ImagesInfo.concat(responseData)
|
||||
that.setState({ pickerImageUrl: newPickerImageUrl, ImagesInfo: newImageInfo }, () => {
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
@ -196,7 +196,7 @@ class GoodsPublish extends Component {
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: responseMsg,
|
||||
title: responseData.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
|
@ -159,7 +159,7 @@ class GrabOrderPage extends Component {
|
||||
}
|
||||
goToMyNeedsPage() {
|
||||
Taro.switchTab({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
url: '/pages/myNeeds/myNeeds'
|
||||
})
|
||||
}
|
||||
goMyNeedEditPage() {
|
||||
@ -200,7 +200,7 @@ class GrabOrderPage extends Component {
|
||||
duration: 1500
|
||||
})
|
||||
setTimeout(() => {
|
||||
Taro.switchTab({
|
||||
Taro.reLaunch({
|
||||
url: '/pages/myNeeds/myNeeds'
|
||||
})
|
||||
}, 1500);
|
||||
|
@ -76,7 +76,7 @@ class Login extends Component {
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
title: res.data.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
|
@ -34,7 +34,6 @@ class MyDemandSupplyEdit extends Component {
|
||||
isFormCompleted: false,
|
||||
isConfirmWindow: false,// 删除提示框
|
||||
demandSupplyId: '',// 供求id
|
||||
isSave: false,//是否点击保存按钮
|
||||
isSaveAndNew: false//是否点击保存新增按钮
|
||||
|
||||
|
||||
@ -128,24 +127,26 @@ class MyDemandSupplyEdit extends Component {
|
||||
.then(res => {
|
||||
console.log('上传供求', res)
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_msg === 'success') {
|
||||
if (res.data.err_code === 0) {
|
||||
Taro.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
title: res.data.err_msg == 'success' ? '保存成功' : res.data.err_msg,
|
||||
icon: res.data.err_msg == 'success' ? 'success' : 'none',
|
||||
duration: 1000
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
if (this.state.isSave) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + res.data.sd_id
|
||||
})
|
||||
} else if (this.state.isSaveAndNew) {
|
||||
Taro.switchTab({
|
||||
console.log('this.state.isSaveAndNew', this.state.isSaveAndNew)
|
||||
if (this.state.isSaveAndNew) {
|
||||
Taro.reLaunch({
|
||||
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||
})
|
||||
} else {
|
||||
// Taro.navigateTo({
|
||||
// url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + res.data.sd_id
|
||||
// })
|
||||
}
|
||||
}, 1000);
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
@ -153,7 +154,6 @@ class MyDemandSupplyEdit extends Component {
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
@ -280,7 +280,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.content && this.state.demandingSupplyStateSelected) {
|
||||
|
||||
Taro.showLoading({ title: '保存中' }).then(() => {
|
||||
this.setState({ isSave: true }, () => {
|
||||
this.setState({ isSaveAndNew: false }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
})
|
||||
@ -395,7 +395,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
</View>
|
||||
<View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
|
||||
<View className='title' style='font-weight:bold;'>
|
||||
<Text style='color:red'>*</Text>
|
||||
<Text style='color:red'>*</Text>
|
||||
<Text>联系电话:</Text>
|
||||
</View>
|
||||
<View style='margin-left:5%;'>
|
||||
|
@ -46,7 +46,6 @@ class MyGoodList extends Component {
|
||||
isOpenOffStockModal: false,// 是否显示下架模态框
|
||||
isAddToList: false,// 是否下拉加载 如果是 就添加商品到我的商品列表
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex: 1,//上拉加载页面数
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,23 +86,21 @@ class MyGoodList extends Component {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(res => {
|
||||
console.log('baobei', res)
|
||||
const productCate = [{ name: '全部类目', id: '' }]
|
||||
for (let item of res.data.goodsClass) {
|
||||
productCate.push({ name: item.class_name, id: item.class_id })
|
||||
console.log('宝贝类目',res)
|
||||
if (res.data.err_code != 10) {
|
||||
const productCate = [{ name: '全部类目', id: '' }]
|
||||
for (let item of res.data.goodsClass) {
|
||||
productCate.push({ name: item.class_name, id: item.class_id })
|
||||
}
|
||||
this.setState({ productCate: productCate })
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500,
|
||||
})
|
||||
}
|
||||
this.setState({ productCate: productCate })
|
||||
|
||||
}).catch(err => {
|
||||
Taro.showToast({
|
||||
title: '获取宝贝类目失败',
|
||||
icon: 'none',
|
||||
duration: 1500,
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// 获取我的商品列表接口api
|
||||
@ -143,16 +140,15 @@ class MyGoodList extends Component {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.statusCode === 200) {
|
||||
const data = JSON.parse(res.data)
|
||||
if (data.err_code != 10) {
|
||||
console.log('我的商品列表', JSON.parse(res.data))
|
||||
const data = JSON.parse(res.data)
|
||||
Taro.hideLoading()
|
||||
|
||||
if (data.goods.length) {
|
||||
Taro.hideLoading()
|
||||
if (data.goodsCount != '0' && data.goods.length) {
|
||||
data.goods.forEach(item => {
|
||||
item.checked = false
|
||||
});
|
||||
|
||||
if (this.state.isAddToList) {
|
||||
this.setState({ myGoodList: this.state.myGoodList.concat(data.goods) }, () => {
|
||||
this.setState({ isAddToList: false })
|
||||
@ -162,17 +158,26 @@ class MyGoodList extends Component {
|
||||
myGoodList: data.goods,
|
||||
myGoodListTotal: data.goodsCount
|
||||
})
|
||||
|
||||
}
|
||||
} else {
|
||||
this.setState({ isAddToList: false })
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none'
|
||||
})
|
||||
if (data.goods === null) {
|
||||
this.setState({
|
||||
myGoodList: [],
|
||||
myGoodListTotal: data.goodsCount
|
||||
})
|
||||
} else {
|
||||
this.setState({ isAddToList: false })
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log('我的商品列表获取失败')
|
||||
Taro.showToast({
|
||||
title: data.err_msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@ -252,21 +257,24 @@ class MyGoodList extends Component {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.statusCode === 200) {
|
||||
Taro.showToast({
|
||||
title: '下架成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
}).then(() => {
|
||||
this.setState({ isCheckAll: false })
|
||||
let responseData = JSON.parse(res.data)
|
||||
if (responseData.err_code === 0) {
|
||||
|
||||
this.setState({
|
||||
isCheckAll: false,
|
||||
currPageParam: 1,
|
||||
|
||||
}, () => {
|
||||
this.getMyGoodListApi({})
|
||||
|
||||
Taro.showToast({
|
||||
title: '下架成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '下架失败',
|
||||
title: responseData.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
@ -294,21 +302,19 @@ class MyGoodList extends Component {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.statusCode === 200) {
|
||||
console.log('商品删除返回', res)
|
||||
let responseData = JSON.parse(res.data)
|
||||
if (responseData.err_code === 0) {
|
||||
Taro.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
}).then(() => {
|
||||
|
||||
this.setState({ isCheckAll: false })
|
||||
this.setState({ isCheckAll: false, currPageParam: 1 })
|
||||
this.getMyGoodListApi({})
|
||||
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '删除失败',
|
||||
title: responseData.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
@ -316,6 +322,7 @@ class MyGoodList extends Component {
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
@ -328,7 +335,7 @@ class MyGoodList extends Component {
|
||||
Taro.showLoading({
|
||||
title: '加载中',
|
||||
})
|
||||
this.setState({ currPageParam: 1, isCheckAll: false,order:'' }, () => {
|
||||
this.setState({ currPageParam: 1, isCheckAll: false, order: '' }, () => {
|
||||
this.getMyGoodListApi({})
|
||||
})
|
||||
}
|
||||
@ -346,7 +353,7 @@ class MyGoodList extends Component {
|
||||
maximumSold: '',
|
||||
productId: '',
|
||||
productCateSelected: { id: '', name: '全部类目' },
|
||||
order:'',
|
||||
order: '',
|
||||
}, () => {
|
||||
this.getMyGoodListApi({})
|
||||
Taro.showToast({
|
||||
@ -521,7 +528,7 @@ class MyGoodList extends Component {
|
||||
// 导航到商品发布页面
|
||||
|
||||
goToGoodsPublishPage() {
|
||||
Taro.navigateTo({
|
||||
Taro.switchTab({
|
||||
url: '/pages/goodsPublish/goodsPublish'
|
||||
})
|
||||
}
|
||||
@ -580,7 +587,9 @@ class MyGoodList extends Component {
|
||||
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() { }
|
||||
componentDidShow() {
|
||||
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
// 页面位置
|
||||
@ -776,13 +785,13 @@ class MyGoodList extends Component {
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
<View className='mygoodlist-container'>
|
||||
{this.state.myGoodList.length ? <View className='mygoodlist-container'>
|
||||
{goodListElementArray}
|
||||
</View >
|
||||
</View > : <View className='no-more-title'> 没有更多了</View>}
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
|
||||
|
||||
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
</View>
|
||||
)
|
||||
|
@ -16,7 +16,7 @@ class MyGoodsEdit extends Component {
|
||||
super(...arguments)
|
||||
this.state = {
|
||||
shopTypeSelected: { name: '全部', id: '' },
|
||||
shopTypeId:'',
|
||||
shopTypeId: '',
|
||||
shopTypeList: {},//店铺分类列表
|
||||
productName: '',
|
||||
productPrice: '',
|
||||
@ -90,7 +90,6 @@ class MyGoodsEdit extends Component {
|
||||
class_id = "10103",
|
||||
shop_class_id = "1930",
|
||||
goods_id = '123' }) {
|
||||
console.log('上传函数1~~~~')
|
||||
// 上传图片的参数
|
||||
const uploadProductGoodFileParams = []
|
||||
if (this.state.ImagesInfo.length) {
|
||||
@ -115,7 +114,6 @@ class MyGoodsEdit extends Component {
|
||||
} else {
|
||||
alert('图片为空')
|
||||
}
|
||||
console.log('上传函数~~~~')
|
||||
|
||||
Taro.request({
|
||||
url: URL.UploadProduct,
|
||||
@ -143,35 +141,36 @@ class MyGoodsEdit extends Component {
|
||||
})
|
||||
.then(res => {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
if (this.state.isSaveButton) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myGoodsEdit/myGoodsEdit?id=' + this.$router.params.id
|
||||
})
|
||||
} else if (this.state.isSaveAndNewBUtton) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/goodsPublish/goodsPublish'
|
||||
})
|
||||
}
|
||||
}, 1000);
|
||||
})
|
||||
|
||||
console.log('上传商品', res)
|
||||
if (res.data.err_code === 0) {
|
||||
Taro.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
if (this.state.isSaveButton) {
|
||||
// Taro.redirectTo({
|
||||
// url: '/pages/myGoodsEdit/myGoodsEdit?id=' + this.$router.params.id
|
||||
// })
|
||||
} else if (this.state.isSaveAndNewBUtton) {
|
||||
Taro.switchTab({
|
||||
url: '/pages/goodsPublish/goodsPublish'
|
||||
})
|
||||
}
|
||||
}, 1000);
|
||||
})
|
||||
} else {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
.catch(error => {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: '保存失败',
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
productNameChange(event) {
|
||||
this.setState({
|
||||
@ -335,6 +334,7 @@ class MyGoodsEdit extends Component {
|
||||
this.setState({ shopTypeSelected: value })
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
this.getGoodsInfo()
|
||||
}
|
||||
@ -410,7 +410,7 @@ class MyGoodsEdit extends Component {
|
||||
{/* 店铺分类 */}
|
||||
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
|
||||
shopId={Taro.getStorageSync('shopInfo').shop_id}
|
||||
// selectedValue={this.state.shopTypeSelected}
|
||||
selectedValue={this.state.shopTypeSelected}
|
||||
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
||||
shopTypeId={this.state.shopTypeId}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button,Input } from '@tarojs/components'
|
||||
import { View, Text, Button, Input } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
|
||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||
@ -34,7 +34,7 @@ class MyNeedsEdit extends Component {
|
||||
pickerImageUrl: [],
|
||||
ImagesInfo: '',
|
||||
isDeleteModal: false,// 删除提示框
|
||||
isSave: false,//是否点击保存按钮
|
||||
|
||||
isSaveAndNew: false,//是否点击保存新增按钮
|
||||
|
||||
|
||||
@ -59,58 +59,58 @@ class MyNeedsEdit extends Component {
|
||||
console.log('需求详情获取成功', res)
|
||||
// const selectedType = this.state.demandingSupplyCate.filter(item => item.id == res.data.sdInfo.sd_type)[0]
|
||||
// const selectedState = this.state.needsState.filter(item => item.id == res.data.sdInfo.state)[0]
|
||||
let industryType = {}
|
||||
const classId = res.data.sdInfo.class_id
|
||||
for (let outter of res.data.supplyTree) {
|
||||
if (outter.children) {
|
||||
for (let inner of outter.children) {
|
||||
if (inner.class_id === classId) {
|
||||
industryType.name = inner.class_name
|
||||
industryType.id = inner.class_id
|
||||
break
|
||||
if (res.data.err_code === 0) {
|
||||
let industryType = {}
|
||||
const classId = res.data.sdInfo.class_id
|
||||
for (let outter of res.data.supplyTree) {
|
||||
if (outter.children) {
|
||||
for (let inner of outter.children) {
|
||||
if (inner.class_id === classId) {
|
||||
industryType.name = inner.class_name
|
||||
industryType.id = inner.class_id
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if (outter.class_id === classId) {
|
||||
industryType.name = outter.class_name
|
||||
industryType.id = outter.class_id
|
||||
break
|
||||
}
|
||||
}
|
||||
if (outter.class_id === classId) {
|
||||
industryType.name = outter.class_name
|
||||
industryType.id = outter.class_id
|
||||
break
|
||||
if (!Object.keys(industryType).length) {
|
||||
industryType.name = '全部'
|
||||
industryType.id = '-1'
|
||||
}
|
||||
const needsType = this.state.needsType.filter(item => {
|
||||
return item.id === res.data.sdInfo.sd_type
|
||||
})[0]
|
||||
const imageFile = res.data.sdInfo.file_path.map(item => { return { url: URL.Base + item.file_path } })
|
||||
const needsState = this.state.needsState.filter(item => {
|
||||
return item.id === res.data.sdInfo.state
|
||||
})[0]
|
||||
this.setState({
|
||||
sd_id: res.data.sdInfo.sd_id,
|
||||
industryTypeSelected: industryType,
|
||||
needsTypeSelected: needsType,
|
||||
title: res.data.sdInfo.sd_title,
|
||||
contactName: res.data.sdInfo.user_name,
|
||||
contactNumber: res.data.sdInfo.user_phone,
|
||||
contactAddress: res.data.sdInfo.user_address,
|
||||
content: res.data.sdInfo.sd_desc,
|
||||
needsStateSelected: needsState,
|
||||
pickerImageUrl: imageFile,
|
||||
ImagesInfo: res.data.sdInfo.file_path,
|
||||
})
|
||||
Taro.hideLoading()
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
if (!Object.keys(industryType).length) {
|
||||
industryType.name = '全部'
|
||||
industryType.id = '-1'
|
||||
}
|
||||
|
||||
|
||||
|
||||
const needsType = this.state.needsType.filter(item => {
|
||||
return item.id === res.data.sdInfo.sd_type
|
||||
})[0]
|
||||
const imageFile = res.data.sdInfo.file_path.map(item => { return { url: URL.Base + item.file_path } })
|
||||
const needsState = this.state.needsState.filter(item => {
|
||||
return item.id === res.data.sdInfo.state
|
||||
})[0]
|
||||
this.setState({
|
||||
sd_id: res.data.sdInfo.sd_id,
|
||||
industryTypeSelected: industryType,
|
||||
needsTypeSelected: needsType,
|
||||
title: res.data.sdInfo.sd_title,
|
||||
contactName: res.data.sdInfo.user_name,
|
||||
contactNumber: res.data.sdInfo.user_phone,
|
||||
contactAddress: res.data.sdInfo.user_address,
|
||||
content: res.data.sdInfo.sd_desc,
|
||||
needsStateSelected: needsState,
|
||||
pickerImageUrl: imageFile,
|
||||
ImagesInfo: res.data.sdInfo.file_path,
|
||||
})
|
||||
Taro.hideLoading()
|
||||
}
|
||||
|
||||
)
|
||||
.catch(error => {
|
||||
console.log('供求详情获取失败', error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -156,34 +156,33 @@ class MyNeedsEdit extends Component {
|
||||
.then(res => {
|
||||
console.log('上传需求', res)
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_msg === 'success') {
|
||||
|
||||
if (res.data.err_code === 0) {
|
||||
Taro.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
title: res.data.err_msg === 'success' ? '保存成功' : res.data.err_msg,
|
||||
icon: res.data.err_msg === 'success' ? 'success' : 'none',
|
||||
duration: 1500
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
if (this.state.isSave) {
|
||||
console.log('this.state.isSaveAndNew', this.state.isSaveAndNew)
|
||||
if (this.state.isSaveAndNew) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + this.state.sd_id
|
||||
})
|
||||
} else if (this.state.isSaveAndNew) {
|
||||
Taro.switchTab({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
})
|
||||
} else {
|
||||
// Taro.navigateTo({
|
||||
// url: '/pages/myNeedsEdit/myNeedsEdit?id=' + this.state.sd_id
|
||||
// })
|
||||
}
|
||||
|
||||
}, 1500);
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
title: '保存失败',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
@ -259,9 +258,10 @@ class MyNeedsEdit extends Component {
|
||||
duration: 1000
|
||||
})
|
||||
setTimeout(() => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
Taro.reLaunch({
|
||||
url: '/pages/myNeeds/myNeeds'
|
||||
})
|
||||
|
||||
}, 1000);
|
||||
} else {
|
||||
Taro.showToast({
|
||||
@ -302,7 +302,7 @@ class MyNeedsEdit extends Component {
|
||||
this.setState({ content: event.target.value })
|
||||
}
|
||||
goToMyNeedsPage() {
|
||||
Taro.switchTab({
|
||||
Taro.reLaunch({
|
||||
url: '/pages/myNeeds/myNeeds'
|
||||
})
|
||||
}
|
||||
@ -315,10 +315,9 @@ class MyNeedsEdit extends Component {
|
||||
Taro.showLoading({
|
||||
title: '保存中'
|
||||
})
|
||||
this.setState({ isSave: true }, () => {
|
||||
this.setState({ isSaveAndNew: false }, () => {
|
||||
this.uploadMyNeedsApi({})
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
@ -326,7 +325,6 @@ class MyNeedsEdit extends Component {
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
// 保存新增按钮
|
||||
saveAndNewButton() {
|
||||
|
@ -32,11 +32,8 @@ class MyNeedsPublish extends Component {
|
||||
content: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
ImagesInfo: [],// 后台传回来的图片信息
|
||||
isPublish: false,//是否点击发布按钮
|
||||
|
||||
isPublishAndNew: false,//是否点击发布新增按钮
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +61,6 @@ class MyNeedsPublish extends Component {
|
||||
action: 1,
|
||||
sdInfo: JSON.stringify({
|
||||
class_id: this.state.industryTypeSelected.id,
|
||||
|
||||
sd_type: this.state.needsTypeSelected.id,
|
||||
sd_title: this.state.title,
|
||||
user_name: this.state.contactName,
|
||||
@ -91,15 +87,16 @@ class MyNeedsPublish extends Component {
|
||||
duration: 1500
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
if (this.state.isPublish) {
|
||||
if (this.state.isPublishAndNew) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + res.data.sd_id
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
})
|
||||
} else if (this.state.isPublishAndNew) {
|
||||
} else {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + res.data.sd_id
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}, 1500);
|
||||
})
|
||||
@ -184,8 +181,8 @@ class MyNeedsPublish extends Component {
|
||||
contactNameChange(event) {
|
||||
this.setState({ contactName: event })
|
||||
}
|
||||
contactNumberChange(event) {
|
||||
this.setState({ contactNumber: event })
|
||||
contactNumberChange(e) {
|
||||
this.setState({ contactNumber: e.detail.value })
|
||||
}
|
||||
contactAddressChange(event) {
|
||||
this.setState({ contactAddress: event.target.value })
|
||||
@ -203,7 +200,7 @@ class MyNeedsPublish extends Component {
|
||||
Taro.showLoading({
|
||||
title: '发布中'
|
||||
})
|
||||
this.setState({ isPublish: true }, () => {
|
||||
this.setState({ isPublishAndNew: false }, () => {
|
||||
this.uploadMyNeedsApi({})
|
||||
})
|
||||
|
||||
@ -241,7 +238,7 @@ class MyNeedsPublish extends Component {
|
||||
|
||||
}
|
||||
goToMyNeedsPage() {
|
||||
Taro.switchTab({
|
||||
Taro.reLaunch({
|
||||
url: '/pages/myNeeds/myNeeds'
|
||||
})
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ class MySupplyDemand extends Component {
|
||||
|
||||
// 新增我的供求
|
||||
addDemandSupply() {
|
||||
Taro.switchTab({
|
||||
Taro.reLaunch({
|
||||
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||
})
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ class SupplyDemand extends Component {
|
||||
content: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
ImagesInfo: [],// 后台传回来的图片信息
|
||||
isPublish: false,//是否点击发布按钮
|
||||
isPublishAndNew: false,//是否点击发布新增按钮
|
||||
isPublishAndNew: false,//是否点击发布并新增按钮
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,29 +80,28 @@ class SupplyDemand extends Component {
|
||||
.then(res => {
|
||||
console.log('上传供求', res)
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_msg === 'success') {
|
||||
if (res.data.err_code === 0) {
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
title: res.data.err_msg == 'success' ? '上传成功' : res.data.err_msg,
|
||||
icon: res.data.err_msg == 'success' ? 'success' : 'none',
|
||||
duration: 1000
|
||||
}).then(() => {
|
||||
console.log('this.state.isPublishAndNew', this.state.isPublishAndNew)
|
||||
setTimeout(() => {
|
||||
if (this.state.isPublish) {
|
||||
if (this.state.isPublishAndNew) {
|
||||
Taro.reLaunch({
|
||||
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||
})
|
||||
} else {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + res.data.sd_id
|
||||
})
|
||||
|
||||
} else if (this.state.isPublishAndNew) {
|
||||
Taro.switchTab({
|
||||
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||
})
|
||||
}
|
||||
|
||||
}, 1000);
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '上传失败',
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
@ -206,7 +205,7 @@ class SupplyDemand extends Component {
|
||||
if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.content && this.state.demandingSupplyStateSelected) {
|
||||
|
||||
Taro.showLoading({ title: '发布中' }).then(() => {
|
||||
this.setState({ isPublish: true }, () => {
|
||||
this.setState({ isPublishAndNew: false }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
})
|
||||
@ -270,12 +269,8 @@ class SupplyDemand extends Component {
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
|
||||
|
||||
return (
|
||||
<View className='supply-demand'>
|
||||
|
||||
|
||||
<View className='page-section'>
|
||||
<View>
|
||||
<Picker mode='selector' rangeKey='name' range={this.state.demandingSupplyCate} onChange={this.demandingSupplyCate.bind(this)}>
|
||||
|
@ -117,7 +117,7 @@ class SupplyDemandView extends Component {
|
||||
})
|
||||
}
|
||||
goToSDPublishPage() {
|
||||
Taro.switchTab({
|
||||
Taro.reLaunch({
|
||||
url: '/pages/supplyDemandPublish/supplyDemandPublish',// 供求发布页面
|
||||
})
|
||||
}
|
||||
@ -129,10 +129,9 @@ class SupplyDemandView extends Component {
|
||||
|
||||
}
|
||||
goToMySDPage() {
|
||||
Taro.switchTab({
|
||||
Taro.reLaunch({
|
||||
url: '/pages/mySupplyDemand/mySupplyDemand',//我的供求页面
|
||||
})
|
||||
|
||||
}
|
||||
makeAPhoneCall(){
|
||||
Taro.makePhoneCall({
|
||||
|
Loading…
Reference in New Issue
Block a user