修改switchtab 后按键无效
This commit is contained in:
parent
0df437e7bc
commit
55644ac246
@ -2,7 +2,7 @@
|
||||
"miniprogramRoot": "./dist",
|
||||
"projectname": "cf-wx-app",
|
||||
"description": "cf-wx-app",
|
||||
"appid": "touristappid",
|
||||
"appid": "wx424f6c9c24717e53",
|
||||
"setting": {
|
||||
"urlCheck": true,
|
||||
"es6": false,
|
||||
|
@ -81,7 +81,7 @@ class App extends Component {
|
||||
color: '#333',
|
||||
selectedColor: '#333',
|
||||
backgroundColor: '#fff',
|
||||
borderStyle: '#ccc'
|
||||
borderStyle: 'black'
|
||||
}
|
||||
|
||||
|
||||
|
@ -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',
|
||||
@ -46,6 +46,12 @@ class ShopTypeInteractionComp extends Component {
|
||||
interactionMultiArray: this.recursionInteraction(res.data.data),
|
||||
initailMultiArray: this.recursionInitialized(res.data.data)
|
||||
}, () => {
|
||||
//返回初始选项在 在商品编辑页面
|
||||
// if(this.props.shopTypeId){
|
||||
// const foundData=this.findDataByShopTypeId(this.props.shopTypeId)
|
||||
// this.passDataToParent(foundData)
|
||||
// }
|
||||
|
||||
// console.log('联动数据', this.state.interactionMultiArray)
|
||||
// console.log('初始化数据', this.state.initailMultiArray)
|
||||
// console.log('index初始化', this.state.multiIndex)
|
||||
@ -61,8 +67,16 @@ class ShopTypeInteractionComp extends Component {
|
||||
console.log('店铺分类请求错误', error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
findDataByShopTypeId() {
|
||||
console.log('id', this.props.shopTypeId)
|
||||
this.state.initailMultiArray.forEach(items => {
|
||||
items.forEach(item => {
|
||||
if (item.id === this.props.shopTypeId) {
|
||||
return item
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 递归整理无限层联动数据
|
||||
recursionInteraction(data) {
|
||||
@ -134,14 +148,16 @@ class ShopTypeInteractionComp extends Component {
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
this.getShopTypeList(this.props.url)
|
||||
|
||||
this.getShopTypeList(this.props.url)
|
||||
}
|
||||
|
||||
// 当然父组件有新的props的 会从新渲染组件
|
||||
componentWillReceiveProps(nextProps) {
|
||||
|
||||
// if (nextProps.shopTypeId) {
|
||||
// const foundData = this.findDataByShopTypeId(nextProps.shopTypeId)
|
||||
// this.passDataToParent(foundData)
|
||||
// }
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
|
@ -16,6 +16,7 @@ class GrabOrderPage extends Component {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.state = {
|
||||
isShowRendering: false,
|
||||
type: '',
|
||||
title: '',
|
||||
browsing: '',
|
||||
@ -28,7 +29,9 @@ class GrabOrderPage extends Component {
|
||||
grabOrderId: this.$router.params.orderId,
|
||||
stateId: '',
|
||||
stateName: '',
|
||||
userId: ''
|
||||
userId: '',
|
||||
renderingImage: [],
|
||||
isDeleteModal: false
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,8 +63,8 @@ class GrabOrderPage extends Component {
|
||||
images: res.data.sdInfo.file_path,
|
||||
stateId: res.data.sdInfo.state,
|
||||
stateName: res.data.sdInfo.state_name,
|
||||
userId: res.data.sdInfo.user_id
|
||||
|
||||
userId: res.data.sdInfo.user_id,
|
||||
renderingImage: res.data.sdInfo.render_pics || []
|
||||
})
|
||||
}
|
||||
)
|
||||
@ -111,6 +114,11 @@ class GrabOrderPage extends Component {
|
||||
})
|
||||
|
||||
}
|
||||
showImageButton() {
|
||||
this.setState({
|
||||
isShowRendering: true
|
||||
})
|
||||
}
|
||||
callPhoneNumber() {
|
||||
Taro.makePhoneCall({
|
||||
phoneNumber: this.state.contactNumber
|
||||
@ -144,9 +152,85 @@ class GrabOrderPage extends Component {
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
goMyNeedsPublishPage() {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
})
|
||||
}
|
||||
goToMyNeedsPage() {
|
||||
Taro.switchTab({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
})
|
||||
}
|
||||
goMyNeedEditPage() {
|
||||
let id = this.$router.params.orderId
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + id
|
||||
})
|
||||
}
|
||||
deleteButton() {
|
||||
this.setState({ isDeleteModal: true })
|
||||
}
|
||||
handleWindowModCancel() {
|
||||
this.setState({ isDeleteModal: false })
|
||||
}
|
||||
handleWindowConfirm() {
|
||||
this.setState({ isDeleteModal: false })
|
||||
this.deleteMyNeeds({ demandId: this.$router.params.orderId })
|
||||
}
|
||||
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'
|
||||
}
|
||||
}).then(res => {
|
||||
|
||||
if (res.data.err_msg === "success") {
|
||||
Taro.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
setTimeout(() => {
|
||||
Taro.switchTab({
|
||||
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>
|
||||
<AtModalContent>
|
||||
确认删除{this.state.needsItem.sd_title}?
|
||||
</AtModalContent>
|
||||
<AtModalAction> <Button onClick={this.handleWindowModCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleWindowConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
</AtModal>
|
||||
let ButtonElement
|
||||
if (localStoageUserId === this.state.userId && this.state.stateId === '1') {
|
||||
ButtonElement = <View className='button-box'>
|
||||
@ -219,6 +303,13 @@ class GrabOrderPage extends Component {
|
||||
return (
|
||||
<View className='grabOrderPage'>
|
||||
{modalMessageGrabElement}
|
||||
{deleteModalWindowElement}
|
||||
{this.state.isShowRendering ? <View className='rendering-container'>
|
||||
{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)}>
|
||||
<Button className='button-orange'>查看效果图</Button>
|
||||
</View></View> : null}
|
||||
<View className='type box'>
|
||||
<Text className='title'>行业分类:</Text>
|
||||
<Text className='content'>{this.state.type}</Text>
|
||||
|
@ -1,6 +1,17 @@
|
||||
.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;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ class Login extends Component {
|
||||
// Taro.navigateBack({
|
||||
// delta: 1
|
||||
// })
|
||||
Taro.switchTab({
|
||||
Taro.reLaunch({
|
||||
url:'/pages/home/home'
|
||||
})
|
||||
}, 1000);
|
||||
|
@ -140,7 +140,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + res.data.sd_id
|
||||
})
|
||||
} else if (this.state.isSaveAndNew) {
|
||||
Taro.navigateTo({
|
||||
Taro.switchTab({
|
||||
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||
})
|
||||
}
|
||||
@ -311,7 +311,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
}
|
||||
}
|
||||
goToMyDemSupPage() {
|
||||
Taro.navigateTo({
|
||||
Taro.switchTab({
|
||||
url: '/pages/mySupplyDemand/mySupplyDemand'
|
||||
})
|
||||
}
|
||||
|
@ -10,12 +10,13 @@ import './myGoodsEdit.scss'
|
||||
|
||||
class MyGoodsEdit extends Component {
|
||||
config = {
|
||||
navigationBarTitleText: '商品编辑'
|
||||
navigationBarTitleText: '编辑商品'
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments)
|
||||
this.state = {
|
||||
shopTypeSelected: { name: '全部', id: '' },
|
||||
shopTypeId:'',
|
||||
shopTypeList: {},//店铺分类列表
|
||||
productName: '',
|
||||
productPrice: '',
|
||||
@ -51,16 +52,16 @@ class MyGoodsEdit extends Component {
|
||||
const imageFile = res.data.goodsFiles.map((item) => {
|
||||
return { url: URL.Base + item.files.file_path }
|
||||
})
|
||||
let shopTypeSelected
|
||||
// let shopTypeSelected
|
||||
|
||||
const shopTypeId = res.data.goods.shop_class_id
|
||||
for (let key in this.state.shopTypeList) {
|
||||
for (let item of this.state.shopTypeList[key].c) {
|
||||
if (item.id === shopTypeId) {
|
||||
shopTypeSelected = { name: item.n, id: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
// const shopTypeId = res.data.goods.shop_class_id
|
||||
// for (let key in this.state.shopTypeList) {
|
||||
// for (let item of this.state.shopTypeList[key].c) {
|
||||
// if (item.id === shopTypeId) {
|
||||
// shopTypeSelected = { name: item.n, id: item.id }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
this.setState({
|
||||
productName: res.data.goods.goods_name,
|
||||
productPrice: res.data.goods.goods_price,
|
||||
@ -68,7 +69,7 @@ class MyGoodsEdit extends Component {
|
||||
productDescript: res.data.goods.goods_profiles,
|
||||
pickerImageUrl: imageFile,
|
||||
ImagesInfo: res.data.goodsFiles,
|
||||
shopTypeSelected: shopTypeSelected,
|
||||
shopTypeId: res.data.goods.shop_class_id,
|
||||
goodsTypeParam: res.data.goods.class_id,
|
||||
goodId: res.data.goods.goods_id,
|
||||
})
|
||||
@ -89,7 +90,7 @@ class MyGoodsEdit extends Component {
|
||||
class_id = "10103",
|
||||
shop_class_id = "1930",
|
||||
goods_id = '123' }) {
|
||||
|
||||
console.log('上传函数1~~~~')
|
||||
// 上传图片的参数
|
||||
const uploadProductGoodFileParams = []
|
||||
if (this.state.ImagesInfo.length) {
|
||||
@ -114,6 +115,7 @@ class MyGoodsEdit extends Component {
|
||||
} else {
|
||||
alert('图片为空')
|
||||
}
|
||||
console.log('上传函数~~~~')
|
||||
|
||||
Taro.request({
|
||||
url: URL.UploadProduct,
|
||||
@ -171,10 +173,6 @@ class MyGoodsEdit extends Component {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
productNameChange(event) {
|
||||
this.setState({
|
||||
productName: event
|
||||
@ -214,22 +212,32 @@ class MyGoodsEdit extends Component {
|
||||
success(response) {
|
||||
|
||||
const data = JSON.parse(response.data)
|
||||
console.log('imagedata', data)
|
||||
const imagePath = URL.Base + data.file_path
|
||||
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
|
||||
const newImageInfo = that.state.ImagesInfo.concat(data)
|
||||
console.log('新添加后的图片列表', newImageInfo)
|
||||
if (data.err_code === 0) {
|
||||
console.log('imagedata', data)
|
||||
const imagePath = URL.Base + data.file_path
|
||||
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
|
||||
const newImageInfo = that.state.ImagesInfo.concat(data)
|
||||
console.log('新添加后的图片列表', newImageInfo)
|
||||
|
||||
that.setState({
|
||||
pickerImageUrl: newPickerImageUrl,
|
||||
ImagesInfo: newImageInfo
|
||||
}, () => {
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
that.setState({
|
||||
pickerImageUrl: newPickerImageUrl,
|
||||
ImagesInfo: newImageInfo
|
||||
}, () => {
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -328,6 +336,7 @@ class MyGoodsEdit extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getGoodsInfo()
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@ -401,8 +410,10 @@ 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}
|
||||
|
||||
></ShopTypeInteractionComp>
|
||||
{/* 店铺分类结束 */}
|
||||
|
||||
|
@ -168,7 +168,7 @@ class MyNeedsEdit extends Component {
|
||||
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + this.state.sd_id
|
||||
})
|
||||
} else if (this.state.isSaveAndNew) {
|
||||
Taro.navigateTo({
|
||||
Taro.switchTab({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
})
|
||||
}
|
||||
@ -302,7 +302,7 @@ class MyNeedsEdit extends Component {
|
||||
this.setState({ content: event.target.value })
|
||||
}
|
||||
goToMyNeedsPage() {
|
||||
Taro.navigateTo({
|
||||
Taro.switchTab({
|
||||
url: '/pages/myNeeds/myNeeds'
|
||||
})
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ class MyNeedsPublish extends Component {
|
||||
|
||||
}
|
||||
goToMyNeedsPage() {
|
||||
Taro.navigateTo({
|
||||
Taro.switchTab({
|
||||
url: '/pages/myNeeds/myNeeds'
|
||||
})
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ class MySupplyDemand extends Component {
|
||||
|
||||
// 新增我的供求
|
||||
addDemandSupply() {
|
||||
Taro.navigateTo({
|
||||
Taro.switchTab({
|
||||
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||
})
|
||||
}
|
||||
|
@ -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 } from 'taro-ui'
|
||||
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
@ -93,7 +93,7 @@ class SupplyDemand extends Component {
|
||||
})
|
||||
|
||||
} else if (this.state.isPublishAndNew) {
|
||||
Taro.navigateTo({
|
||||
Taro.switchTab({
|
||||
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||
})
|
||||
}
|
||||
@ -131,18 +131,26 @@ class SupplyDemand extends Component {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
},
|
||||
success(response) {
|
||||
console.log('response', response)
|
||||
const data = JSON.parse(response.data)
|
||||
const imagePath = URL.Base + data.file_path
|
||||
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
|
||||
const newImageInfo = that.state.ImagesInfo.concat(data)
|
||||
if (data.err_code === 0) {
|
||||
const imagePath = URL.Base + data.file_path
|
||||
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
|
||||
const newImageInfo = that.state.ImagesInfo.concat(data)
|
||||
that.setState({ pickerImageUrl: newPickerImageUrl, ImagesInfo: newImageInfo })
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
that.setState({ pickerImageUrl: newPickerImageUrl, ImagesInfo: newImageInfo })
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -179,8 +187,8 @@ class SupplyDemand 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 })
|
||||
@ -235,19 +243,19 @@ class SupplyDemand extends Component {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
Taro.navigateTo({
|
||||
Taro.switchTab({
|
||||
url: '/pages/mySupplyDemand/mySupplyDemand'
|
||||
})
|
||||
}
|
||||
componentWillMount(){
|
||||
|
||||
componentWillMount() {
|
||||
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
// console.log(this.props, nextProps)
|
||||
// console.log(this.props, nextProps)
|
||||
}
|
||||
|
||||
componentWillUnmount() { }
|
||||
@ -257,12 +265,12 @@ class SupplyDemand extends Component {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<View className='supply-demand'>
|
||||
@ -314,7 +322,7 @@ class SupplyDemand extends Component {
|
||||
onInput={this.contactNumberChange.bind(this)}
|
||||
/></View>
|
||||
</View>
|
||||
|
||||
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>联系地址:</Text>
|
||||
|
@ -117,7 +117,7 @@ class SupplyDemandView extends Component {
|
||||
})
|
||||
}
|
||||
goToSDPublishPage() {
|
||||
Taro.navigateTo({
|
||||
Taro.switchTab({
|
||||
url: '/pages/supplyDemandPublish/supplyDemandPublish',// 供求发布页面
|
||||
})
|
||||
}
|
||||
@ -129,7 +129,7 @@ class SupplyDemandView extends Component {
|
||||
|
||||
}
|
||||
goToMySDPage() {
|
||||
Taro.navigateTo({
|
||||
Taro.switchTab({
|
||||
url: '/pages/mySupplyDemand/mySupplyDemand',//我的供求页面
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user