登入过期处理
This commit is contained in:
parent
89d9c94aff
commit
0ba9766007
@ -177,6 +177,9 @@ class recommondShop extends Component {
|
|||||||
console.log('从voucherposter件传回来的值', value)
|
console.log('从voucherposter件传回来的值', value)
|
||||||
this.setState({ isOpenVoucher: value })
|
this.setState({ isOpenVoucher: value })
|
||||||
}
|
}
|
||||||
|
isOpenVoucher(){
|
||||||
|
this.setState({isOpenVoucher:true})
|
||||||
|
}
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
//console.log(this.props, nextProps)
|
//console.log(this.props, nextProps)
|
||||||
}
|
}
|
||||||
@ -250,7 +253,6 @@ class recommondShop extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View className='shop-list-box' >
|
<View className='shop-list-box' >
|
||||||
{voucherModalElement}
|
|
||||||
{consultModalElement}
|
{consultModalElement}
|
||||||
<VoucherPosterComponent
|
<VoucherPosterComponent
|
||||||
userName={this.state.userName}
|
userName={this.state.userName}
|
||||||
|
@ -5,6 +5,7 @@ import { AtIcon } from 'taro-ui'
|
|||||||
|
|
||||||
import './voucherPosterComponent.scss'
|
import './voucherPosterComponent.scss'
|
||||||
import URL from '../../../serviceAPI.config'
|
import URL from '../../../serviceAPI.config'
|
||||||
|
import loginExpired from '../../../util/loginExpired'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +47,7 @@ class VoucherPoster extends Component {
|
|||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('购买咨询请求成功', res)
|
console.log('购买咨询请求成功', res)
|
||||||
|
|
||||||
if (res.data.err_msg === 'success') {
|
if (res.data.err_code === 0) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '领取成功',
|
title: '领取成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
@ -56,6 +57,8 @@ class VoucherPoster extends Component {
|
|||||||
this.passDataToParent()
|
this.passDataToParent()
|
||||||
}, 1500);
|
}, 1500);
|
||||||
|
|
||||||
|
}else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
|
|
||||||
|
|
||||||
import Taro, { Component } from '@tarojs/taro'
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
import { View, Text } from '@tarojs/components'
|
import { View, Text } from '@tarojs/components'
|
||||||
|
|
||||||
import { Picker } from 'taro-ui'
|
import { Picker } from 'taro-ui'
|
||||||
|
|
||||||
import './goodsTypeInteractionComp.scss'
|
import './goodsTypeInteractionComp.scss'
|
||||||
|
import loginExpired from '../../util/loginExpired'
|
||||||
|
|
||||||
let maxDepth = 0
|
let maxDepth = 0
|
||||||
let initialDataArray = []
|
let initialDataArray = []
|
||||||
@ -41,9 +40,9 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
if (res.data.err_code === 0) {
|
||||||
if (res.data.err_msg === 'success') {
|
|
||||||
console.log('商品分类目录', res)
|
console.log('商品分类目录', res)
|
||||||
|
|
||||||
const recursionInteractionData=this.recursionInteraction(res.data.data)
|
const recursionInteractionData=this.recursionInteraction(res.data.data)
|
||||||
this.recursionInitialized(res.data.data) //
|
this.recursionInitialized(res.data.data) //
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -59,6 +58,8 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
}) // 用递归来整理无限层次的数据
|
}) // 用递归来整理无限层次的数据
|
||||||
// console.log('联动数据', this.recursionInteraction(res.data.data))
|
// console.log('联动数据', this.recursionInteraction(res.data.data))
|
||||||
// console.log('初始数据', this.recursionInitialized(res.data.data).reverse())
|
// console.log('初始数据', this.recursionInitialized(res.data.data).reverse())
|
||||||
|
}else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
|
@ -5,6 +5,7 @@ import { View, Text } from '@tarojs/components'
|
|||||||
import { Picker } from 'taro-ui'
|
import { Picker } from 'taro-ui'
|
||||||
|
|
||||||
import './interactionComponent.scss'
|
import './interactionComponent.scss'
|
||||||
|
import loginExpired from '../../util/loginExpired';
|
||||||
|
|
||||||
|
|
||||||
let maxDepth = 0
|
let maxDepth = 0
|
||||||
@ -39,7 +40,7 @@ class Interaction extends Component {
|
|||||||
'X-Requested-With': 'XMLHttpRequest'
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.data.err_msg === 'success') {
|
if (res.data.err_code === 0) {
|
||||||
console.log('行业分类目录', res)
|
console.log('行业分类目录', res)
|
||||||
let initailMultiArray = this.recursionInitialized(res.data.data)
|
let initailMultiArray = this.recursionInitialized(res.data.data)
|
||||||
initialDataArray[1].unshift({ name: '全部', id: '-1' }) // 默认
|
initialDataArray[1].unshift({ name: '全部', id: '-1' }) // 默认
|
||||||
@ -49,6 +50,7 @@ class Interaction extends Component {
|
|||||||
multiIndex: this.recursionDepth(res.data.data),
|
multiIndex: this.recursionDepth(res.data.data),
|
||||||
|
|
||||||
}, () => {
|
}, () => {
|
||||||
|
console.log('interactionMultiArray',this.state.interactionMultiArray)
|
||||||
initialDataArray = []// 把全局变变量赋值给state之后,初始化商品分类为空, 不然第二次进去的时候会自动添加进去
|
initialDataArray = []// 把全局变变量赋值给state之后,初始化商品分类为空, 不然第二次进去的时候会自动添加进去
|
||||||
// console.log('联动数据', this.state.interactionMultiArray)
|
// console.log('联动数据', this.state.interactionMultiArray)
|
||||||
// console.log('初始化数据', this.state.initailMultiArray)
|
// console.log('初始化数据', this.state.initailMultiArray)
|
||||||
@ -56,6 +58,8 @@ class Interaction extends Component {
|
|||||||
|
|
||||||
}) // 用递归来整理无限层次的数据
|
}) // 用递归来整理无限层次的数据
|
||||||
|
|
||||||
|
}else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
console.log('行业分类请求没有成功', res)
|
console.log('行业分类请求没有成功', res)
|
||||||
}
|
}
|
||||||
@ -90,7 +94,6 @@ class Interaction extends Component {
|
|||||||
}
|
}
|
||||||
this.recursionInitialized(childrenHolderArray)
|
this.recursionInitialized(childrenHolderArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayTem.length ? initialDataArray.push(arrayTem) : null // 数组为空则不添加
|
arrayTem.length ? initialDataArray.push(arrayTem) : null // 数组为空则不添加
|
||||||
return initialDataArray
|
return initialDataArray
|
||||||
}
|
}
|
||||||
@ -110,7 +113,7 @@ class Interaction extends Component {
|
|||||||
}
|
}
|
||||||
bindMultiPickerCol(e) {
|
bindMultiPickerCol(e) {
|
||||||
console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
||||||
console.log(this.state.initailMultiArray)
|
|
||||||
const data = {
|
const data = {
|
||||||
multiArray: this.state.initailMultiArray,
|
multiArray: this.state.initailMultiArray,
|
||||||
multiIndex: this.state.multiIndex
|
multiIndex: this.state.multiIndex
|
||||||
@ -121,6 +124,7 @@ class Interaction extends Component {
|
|||||||
const indexNumber = Number(index)
|
const indexNumber = Number(index)
|
||||||
if (indexNumber === data.multiIndex[0]) {
|
if (indexNumber === data.multiIndex[0]) {
|
||||||
data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children
|
data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children
|
||||||
|
console.log('datat',data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,7 +152,6 @@ class Interaction extends Component {
|
|||||||
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
||||||
this.getIndustryTypeList(this.props.url)
|
this.getIndustryTypeList(this.props.url)
|
||||||
}
|
}
|
||||||
// 当然父组件有新的props的 会从新渲染组件
|
// 当然父组件有新的props的 会从新渲染组件
|
||||||
|
@ -4,6 +4,7 @@ import { View, Text } from '@tarojs/components'
|
|||||||
import { Picker } from 'taro-ui'
|
import { Picker } from 'taro-ui'
|
||||||
|
|
||||||
import './shopTypeInteractionComp.scss'
|
import './shopTypeInteractionComp.scss'
|
||||||
|
import loginExpired from '../../util/loginExpired';
|
||||||
|
|
||||||
|
|
||||||
class ShopTypeInteractionComp extends Component {
|
class ShopTypeInteractionComp extends Component {
|
||||||
@ -40,22 +41,22 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
// console.log('店铺分类目录', res)
|
// console.log('店铺分类目录', res)
|
||||||
// this.formatIndustryType(res.data.data)
|
// this.formatIndustryType(res.data.data)
|
||||||
// this.formatIndustTypeInit(res.data.data)
|
// this.formatIndustTypeInit(res.data.data)
|
||||||
if (res.data.err_msg === 'success') {
|
if (res.data.err_code === 0) {
|
||||||
if (res.data.data === null) {
|
if (res.data.data === null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log('店铺分类目录', res)
|
console.log('店铺分类目录', res)
|
||||||
|
if(!Taro.getStorageSync('shopTypeObject')){
|
||||||
|
Taro.setStorageSync('shopTypeObject',res.data.data)
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
interactionMultiArray: this.recursionInteraction(res.data.data),
|
interactionMultiArray: this.interactionData(res.data.data),
|
||||||
initailMultiArray: this.recursionInitialized(res.data.data)
|
initailMultiArray: this.initializedData(res.data.data),
|
||||||
}, () => {
|
}, () => {
|
||||||
|
|
||||||
// this.passDataToParent(this.state.initailMultiArray)
|
// this.passDataToParent(this.state.initailMultiArray)
|
||||||
//返回初始选项在 在商品编辑页面
|
//返回初始选项在 在商品编辑页面
|
||||||
if (this.props.shopTypeId) {
|
|
||||||
const foundData = this.findDataByShopTypeId(this.props.shopTypeId)
|
|
||||||
this.passDataToParent(foundData)
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.log('联动数据', this.state.interactionMultiArray)
|
// console.log('联动数据', this.state.interactionMultiArray)
|
||||||
// console.log('初始化数据', this.state.initailMultiArray)
|
// console.log('初始化数据', this.state.initailMultiArray)
|
||||||
@ -63,6 +64,8 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
|
|
||||||
|
|
||||||
}) // 用递归来整理无限层次的数据
|
}) // 用递归来整理无限层次的数据
|
||||||
|
}else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
console.log('店铺分类目录获取失败', res)
|
console.log('店铺分类目录获取失败', res)
|
||||||
}
|
}
|
||||||
@ -72,21 +75,10 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
console.log('店铺分类请求错误', error)
|
console.log('店铺分类请求错误', error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
findDataByShopTypeId() {
|
|
||||||
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) {
|
|
||||||
result = item
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
// 递归整理无限层联动数据
|
// 递归整理无限层联动数据
|
||||||
recursionInteraction(data) {
|
interactionData(data) {
|
||||||
let parentArrayHolder = []
|
let parentArrayHolder = []
|
||||||
const keys = Object.keys(data)
|
const keys = Object.keys(data)
|
||||||
for (let key of keys) {
|
for (let key of keys) {
|
||||||
@ -102,7 +94,7 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
return parentArrayHolder
|
return parentArrayHolder
|
||||||
}
|
}
|
||||||
// 递归整理无限层初始数据
|
// 递归整理无限层初始数据
|
||||||
recursionInitialized(data) {
|
initializedData(data) {
|
||||||
let outter = []
|
let outter = []
|
||||||
let inner = []
|
let inner = []
|
||||||
const keys = Object.keys(data)
|
const keys = Object.keys(data)
|
||||||
|
@ -5,6 +5,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
|||||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||||
|
|
||||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||||
|
import loginExpired from '../../util/loginExpired'
|
||||||
|
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
import './allDemanding.scss'
|
import './allDemanding.scss'
|
||||||
@ -72,7 +73,7 @@ class AllDemanding extends Component {
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
if (res.data.err_msg === 'success') {
|
if (res.data.err_code === 0) {
|
||||||
if (res.data.supplys) {
|
if (res.data.supplys) {
|
||||||
if (this.state.isAddToList) {
|
if (this.state.isAddToList) {
|
||||||
this.setState({ supplys: this.state.supplys.concat(res.data.supplys), isAddToList: false })
|
this.setState({ supplys: this.state.supplys.concat(res.data.supplys), isAddToList: false })
|
||||||
@ -90,7 +91,9 @@ class AllDemanding extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
|
}else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@ -145,8 +148,12 @@ class AllDemanding extends Component {
|
|||||||
title: res.data.err_msg === 'success' ? '抢单成功' : res.data.err_msg,
|
title: res.data.err_msg === 'success' ? '抢单成功' : res.data.err_msg,
|
||||||
icon: res.data.err_msg === 'success' ? 'success' : 'none'
|
icon: res.data.err_msg === 'success' ? 'success' : 'none'
|
||||||
})
|
})
|
||||||
this.searchDemanding({ curr_page:1 })
|
this.searchDemanding({ curr_page: 1 })
|
||||||
} else {
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
|
@ -4,7 +4,7 @@ import { View, Text, Image, Swiper, SwiperItem } from '@tarojs/components'
|
|||||||
import { AtTabs, AtTabsPane, AtSegmentedControl, AtIcon, Picker } from 'taro-ui'
|
import { AtTabs, AtTabsPane, AtSegmentedControl, AtIcon, Picker } from 'taro-ui'
|
||||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
|
|
||||||
import LoginService from '../../LoginService'
|
import LoginService from '../../util/LoginService'
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
import './goods.scss'
|
import './goods.scss'
|
||||||
|
|
||||||
|
@ -7,11 +7,12 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
|||||||
import ShopTypeInteractionComp from '../../component/shopTypeInteractionComp/shopTypeInteractionComp'
|
import ShopTypeInteractionComp from '../../component/shopTypeInteractionComp/shopTypeInteractionComp'
|
||||||
import GoodsTypeInteractionComp from '../../component/goodsTypeInteractionComp/goodsTypeInteractionComp'
|
import GoodsTypeInteractionComp from '../../component/goodsTypeInteractionComp/goodsTypeInteractionComp'
|
||||||
|
|
||||||
import LoginService from '../../LoginService'
|
import LoginService from '../../util/LoginService'
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
|
|
||||||
|
|
||||||
import './goodsPublish.scss'
|
import './goodsPublish.scss'
|
||||||
|
import loginExpired from '../../util/loginExpired';
|
||||||
|
|
||||||
class GoodsPublish extends Component {
|
class GoodsPublish extends Component {
|
||||||
|
|
||||||
@ -94,7 +95,8 @@ class GoodsPublish extends Component {
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
if (res.data.err_msg === 'success') {
|
console.log('发布消息', res)
|
||||||
|
if (res.data.err_code === 0) {
|
||||||
|
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '发布成功',
|
title: '发布成功',
|
||||||
@ -115,6 +117,8 @@ class GoodsPublish extends Component {
|
|||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
@ -122,27 +126,11 @@ class GoodsPublish extends Component {
|
|||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
console.log('上传商品', res)
|
console.log('上传商品', res)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(error => {
|
|
||||||
Taro.hideLoading()
|
|
||||||
Taro.showToast({
|
|
||||||
title: '保存失败',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 1000
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
productNameChange(event) {
|
productNameChange(event) {
|
||||||
this.setState({
|
this.setState({
|
||||||
productName: event
|
productName: event
|
||||||
@ -181,8 +169,8 @@ class GoodsPublish extends Component {
|
|||||||
},
|
},
|
||||||
success(response) {
|
success(response) {
|
||||||
const responseData = JSON.parse(response.data)
|
const responseData = JSON.parse(response.data)
|
||||||
console.log('responseData',responseData)
|
console.log('responseData', responseData)
|
||||||
if (responseData.err_code===0) {
|
if (responseData.err_code === 0) {
|
||||||
const imagePath = URL.Base + responseData.file_path
|
const imagePath = URL.Base + responseData.file_path
|
||||||
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
|
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
|
||||||
const newImageInfo = that.state.ImagesInfo.concat(responseData)
|
const newImageInfo = that.state.ImagesInfo.concat(responseData)
|
||||||
@ -218,10 +206,7 @@ class GoodsPublish extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
publishButtonHandler() {
|
publishButtonHandler() {
|
||||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
|
||||||
LoginService()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (this.state.productName &&
|
if (this.state.productName &&
|
||||||
this.state.productPrice &&
|
this.state.productPrice &&
|
||||||
this.state.productUnit &&
|
this.state.productUnit &&
|
||||||
@ -249,10 +234,7 @@ class GoodsPublish extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
publishAndNewButton() {
|
publishAndNewButton() {
|
||||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
|
||||||
LoginService()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (this.state.productName &&
|
if (this.state.productName &&
|
||||||
this.state.productPrice &&
|
this.state.productPrice &&
|
||||||
this.state.productUnit &&
|
this.state.productUnit &&
|
||||||
@ -316,10 +298,10 @@ class GoodsPublish extends Component {
|
|||||||
componentWillUnmount() { }
|
componentWillUnmount() { }
|
||||||
|
|
||||||
componentDidShow() {
|
componentDidShow() {
|
||||||
if(!Taro.getStorageSync('shopInfo').shop_id&&Taro.getStorageSync('userInfo').user_id){
|
if (!Taro.getStorageSync('shopInfo').shop_id && Taro.getStorageSync('userInfo').user_id) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title:'您还没有店铺,不能使用该功能,快去申请吧',
|
title: '您还没有店铺,不能使用该功能,快去申请吧',
|
||||||
icon:'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import URL from '../../serviceAPI.config'
|
|||||||
import RenderingView from './renderingView/renderingView'
|
import RenderingView from './renderingView/renderingView'
|
||||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
import './grabOrderPage.scss'
|
import './grabOrderPage.scss'
|
||||||
|
import loginExpired from '../../util/loginExpired';
|
||||||
|
|
||||||
|
|
||||||
class GrabOrderPage extends Component {
|
class GrabOrderPage extends Component {
|
||||||
@ -53,6 +54,7 @@ class GrabOrderPage extends Component {
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('抢单详情获取成功', res)
|
console.log('抢单详情获取成功', res)
|
||||||
|
if (res.data.err_code === 0) {
|
||||||
this.setState({
|
this.setState({
|
||||||
type: res.data.sdInfo.class_name,
|
type: res.data.sdInfo.class_name,
|
||||||
title: res.data.sdInfo.sd_title,
|
title: res.data.sdInfo.sd_title,
|
||||||
@ -67,6 +69,19 @@ class GrabOrderPage extends Component {
|
|||||||
userId: res.data.sdInfo.user_id,
|
userId: res.data.sdInfo.user_id,
|
||||||
renderingImage: res.data.sdInfo.render_pics || []
|
renderingImage: res.data.sdInfo.render_pics || []
|
||||||
})
|
})
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
Taro.clearStorageSync()
|
||||||
|
Taro.showToast({
|
||||||
|
title: res.data.err_msg,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
Taro.reLaunch({
|
||||||
|
url: '/pages/home/home'
|
||||||
|
})
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@ -89,7 +104,7 @@ class GrabOrderPage extends Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.data.err_msg === 'success') {
|
if (res.data.err_code === 0) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '抢单成功',
|
title: '抢单成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
@ -101,6 +116,8 @@ class GrabOrderPage extends Component {
|
|||||||
})
|
})
|
||||||
}, 1500);
|
}, 1500);
|
||||||
|
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
@ -194,7 +211,7 @@ class GrabOrderPage extends Component {
|
|||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
|
||||||
if (res.data.err_msg === "success") {
|
if (res.data.err_code === 0) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '删除成功',
|
title: '删除成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
@ -205,6 +222,8 @@ class GrabOrderPage extends Component {
|
|||||||
url: '/pages/myNeeds/myNeeds'
|
url: '/pages/myNeeds/myNeeds'
|
||||||
})
|
})
|
||||||
}, 1500);
|
}, 1500);
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
|
@ -5,8 +5,8 @@ import FilteredShopComponent from '../../component/filteredShopComponent/filtere
|
|||||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
|
|
||||||
import LoginService from '../../LoginService'
|
import LoginService from '../../util/LoginService'
|
||||||
import weChatLogin from '../../weChatLogin'
|
import weChatLogin from '../../util/weChatLogin'
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
import './home.scss'
|
import './home.scss'
|
||||||
|
|
||||||
@ -265,10 +265,9 @@ class Home extends Component {
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
// 页面加载后 得到首页的基本信息和推荐店铺的信息
|
// 页面加载后 得到首页的基本信息和推荐店铺的信息
|
||||||
Taro.showLoading({ title: '加载中' })
|
Taro.showLoading({ title: '加载中' })
|
||||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
if(!Taro.getStorageSync('userInfo').user_id){
|
||||||
weChatLogin()
|
weChatLogin()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getShops({})
|
this.getShops({})
|
||||||
this.getHomeCategoriesInfo()
|
this.getHomeCategoriesInfo()
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import URL from '../../serviceAPI.config'
|
|||||||
|
|
||||||
|
|
||||||
import './myDemandSupplyEdit.scss'
|
import './myDemandSupplyEdit.scss'
|
||||||
|
import loginExpired from '../../util/loginExpired';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ class MyDemandSupplyEdit extends Component {
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('供求详情获取成功', res)
|
console.log('供求详情获取成功', res)
|
||||||
|
if (res.data.err_code === 0) {
|
||||||
const selectedType = this.state.demandingSupplyCate.filter(item => item.id == res.data.sdInfo.sd_type)[0]
|
const selectedType = this.state.demandingSupplyCate.filter(item => item.id == res.data.sdInfo.sd_type)[0]
|
||||||
const selectedState = this.state.demandingSupplyState.filter(item => item.id == res.data.sdInfo.state)[0]
|
const selectedState = this.state.demandingSupplyState.filter(item => item.id == res.data.sdInfo.state)[0]
|
||||||
const imageFile = res.data.sdInfo.file_path.map(item => { return { url: URL.Base + item.file_path } })
|
const imageFile = res.data.sdInfo.file_path.map(item => { return { url: URL.Base + item.file_path } })
|
||||||
@ -72,12 +74,11 @@ class MyDemandSupplyEdit extends Component {
|
|||||||
ImagesInfo: res.data.sdInfo.file_path,
|
ImagesInfo: res.data.sdInfo.file_path,
|
||||||
})
|
})
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
)
|
|
||||||
.catch(error => {
|
|
||||||
console.log('供求详情获取失败', error)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -147,6 +148,8 @@ class MyDemandSupplyEdit extends Component {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
@ -219,7 +222,7 @@ class MyDemandSupplyEdit extends Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.data.err_msg == 'success') {
|
if (res.data.err_code == 0) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '删除成功'
|
title: '删除成功'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
@ -230,6 +233,8 @@ class MyDemandSupplyEdit extends Component {
|
|||||||
}, 1500);
|
}, 1500);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
@ -239,13 +244,6 @@ class MyDemandSupplyEdit extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(error => {
|
|
||||||
|
|
||||||
Taro.showToast({
|
|
||||||
title: '删除失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
// 修改供求类型
|
// 修改供求类型
|
||||||
demandingSupplyCate = e => {
|
demandingSupplyCate = e => {
|
||||||
|
@ -8,6 +8,7 @@ import URL from '../../serviceAPI.config'
|
|||||||
|
|
||||||
|
|
||||||
import './myGoodList.scss'
|
import './myGoodList.scss'
|
||||||
|
import loginExpired from '../../util/loginExpired';
|
||||||
|
|
||||||
|
|
||||||
class MyGoodList extends Component {
|
class MyGoodList extends Component {
|
||||||
@ -259,7 +260,6 @@ class MyGoodList extends Component {
|
|||||||
}).then(res => {
|
}).then(res => {
|
||||||
let responseData = JSON.parse(res.data)
|
let responseData = JSON.parse(res.data)
|
||||||
if (responseData.err_code === 0) {
|
if (responseData.err_code === 0) {
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
isCheckAll: false,
|
isCheckAll: false,
|
||||||
currPageParam: 1,
|
currPageParam: 1,
|
||||||
@ -272,6 +272,8 @@ class MyGoodList extends Component {
|
|||||||
duration: 1500
|
duration: 1500
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
}else if (responseData.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: responseData.err_msg,
|
title: responseData.err_msg,
|
||||||
@ -314,6 +316,8 @@ class MyGoodList extends Component {
|
|||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
}else if (responseData.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: responseData.err_msg,
|
title: responseData.err_msg,
|
||||||
|
@ -7,6 +7,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
|||||||
|
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
import './myGoodsEdit.scss'
|
import './myGoodsEdit.scss'
|
||||||
|
import loginExpired from '../../util/loginExpired';
|
||||||
|
|
||||||
class MyGoodsEdit extends Component {
|
class MyGoodsEdit extends Component {
|
||||||
config = {
|
config = {
|
||||||
@ -16,8 +17,6 @@ class MyGoodsEdit extends Component {
|
|||||||
super(...arguments)
|
super(...arguments)
|
||||||
this.state = {
|
this.state = {
|
||||||
shopTypeSelected: { name: '全部', id: '' },
|
shopTypeSelected: { name: '全部', id: '' },
|
||||||
shopTypeId: '',
|
|
||||||
shopTypeList: {},//店铺分类列表
|
|
||||||
productName: '',
|
productName: '',
|
||||||
productPrice: '',
|
productPrice: '',
|
||||||
productUnit: '',
|
productUnit: '',
|
||||||
@ -30,6 +29,7 @@ class MyGoodsEdit extends Component {
|
|||||||
isSaveAndNewBUtton: false,// 是否点击了保存新增按钮
|
isSaveAndNewBUtton: false,// 是否点击了保存新增按钮
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取商品信息api GetProductInfo
|
//获取商品信息api GetProductInfo
|
||||||
getGoodsInfo() {
|
getGoodsInfo() {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
@ -46,7 +46,7 @@ class MyGoodsEdit extends Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.data.err_msg === 'success') {
|
if (res.data.err_code === 0) {
|
||||||
console.log('商品详情获取成功', res)
|
console.log('商品详情获取成功', res)
|
||||||
|
|
||||||
const imageFile = res.data.goodsFiles.map((item) => {
|
const imageFile = res.data.goodsFiles.map((item) => {
|
||||||
@ -62,6 +62,18 @@ class MyGoodsEdit extends Component {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
if (Taro.getStorageSync('shopTypeObject')) {
|
||||||
|
let selectedValue = ''
|
||||||
|
const shopTypeObject = Taro.getStorageSync('shopTypeObject')
|
||||||
|
for (let key in shopTypeObject) {
|
||||||
|
for (let item of shopTypeObject[key].c) {
|
||||||
|
if (item.id === res.data.goods.shop_class_id) {
|
||||||
|
selectedValue = {name:item.n,id:item.id}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
productName: res.data.goods.goods_name,
|
productName: res.data.goods.goods_name,
|
||||||
productPrice: res.data.goods.goods_price,
|
productPrice: res.data.goods.goods_price,
|
||||||
@ -69,13 +81,17 @@ class MyGoodsEdit extends Component {
|
|||||||
productDescript: res.data.goods.goods_profiles,
|
productDescript: res.data.goods.goods_profiles,
|
||||||
pickerImageUrl: imageFile,
|
pickerImageUrl: imageFile,
|
||||||
ImagesInfo: res.data.goodsFiles,
|
ImagesInfo: res.data.goodsFiles,
|
||||||
shopTypeId: res.data.goods.shop_class_id,
|
shopTypeSelected: selectedValue,
|
||||||
goodsTypeParam: res.data.goods.class_id,
|
goodsTypeParam: res.data.goods.class_id,
|
||||||
goodId: res.data.goods.goods_id,
|
goodId: res.data.goods.goods_id,
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@ -160,6 +176,8 @@ class MyGoodsEdit extends Component {
|
|||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
})
|
})
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
@ -337,6 +355,7 @@ class MyGoodsEdit extends Component {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.getGoodsInfo()
|
this.getGoodsInfo()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
@ -351,7 +370,6 @@ class MyGoodsEdit extends Component {
|
|||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className='goods-publish'>
|
<View className='goods-publish'>
|
||||||
<View className='goods-category'>
|
<View className='goods-category'>
|
||||||
@ -412,7 +430,6 @@ class MyGoodsEdit extends Component {
|
|||||||
shopId={Taro.getStorageSync('shopInfo').shop_id}
|
shopId={Taro.getStorageSync('shopInfo').shop_id}
|
||||||
selectedValue={this.state.shopTypeSelected}
|
selectedValue={this.state.shopTypeSelected}
|
||||||
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
||||||
shopTypeId={this.state.shopTypeId}
|
|
||||||
|
|
||||||
></ShopTypeInteractionComp>
|
></ShopTypeInteractionComp>
|
||||||
{/* 店铺分类结束 */}
|
{/* 店铺分类结束 */}
|
||||||
|
@ -6,9 +6,10 @@ import URL from '../../serviceAPI.config'
|
|||||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
import LoginService from '../../LoginService'
|
import LoginService from '../../util/LoginService'
|
||||||
|
|
||||||
import './myNeeds.scss'
|
import './myNeeds.scss'
|
||||||
|
import loginExpired from '../../util/loginExpired';
|
||||||
|
|
||||||
class MyNeeds extends Component {
|
class MyNeeds extends Component {
|
||||||
|
|
||||||
@ -92,7 +93,7 @@ class MyNeeds extends Component {
|
|||||||
}).then(res => {
|
}).then(res => {
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
console.log('我的需求列表', res)
|
console.log('我的需求列表', res)
|
||||||
if (res.data.err_msg === "success") {
|
if (res.data.err_code === 0) {
|
||||||
if (res.data.supplys) { // 查看res.data 里面是否有supplys 这个key
|
if (res.data.supplys) { // 查看res.data 里面是否有supplys 这个key
|
||||||
if (this.state.isAddToList) { // 如果是上拉
|
if (this.state.isAddToList) { // 如果是上拉
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -121,10 +122,7 @@ class MyNeeds extends Component {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(JSON.parse(res.data).err_code===88888){
|
if(JSON.parse(res.data).err_code===88888){
|
||||||
Taro.showToast({
|
loginExpired(res)
|
||||||
title: JSON.parse(res.data).err_msg,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
@ -155,7 +153,7 @@ class MyNeeds extends Component {
|
|||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log('删除我的列表', res)
|
console.log('删除我的列表', res)
|
||||||
if (res.data.err_msg === "success") {
|
if (res.data.err_code === 0) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '删除成功',
|
title: '删除成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
@ -165,6 +163,8 @@ class MyNeeds extends Component {
|
|||||||
this.getMyNeedsList({
|
this.getMyNeedsList({
|
||||||
})
|
})
|
||||||
}, 1500);
|
}, 1500);
|
||||||
|
}else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
|
@ -7,6 +7,7 @@ import InteractionComponent from '../../component/interactionComponent/interacti
|
|||||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
import './myNeedsEdit.scss'
|
import './myNeedsEdit.scss'
|
||||||
|
import loginExpired from '../../util/loginExpired';
|
||||||
|
|
||||||
class MyNeedsEdit extends Component {
|
class MyNeedsEdit extends Component {
|
||||||
|
|
||||||
@ -60,6 +61,7 @@ class MyNeedsEdit extends Component {
|
|||||||
// const selectedType = this.state.demandingSupplyCate.filter(item => item.id == res.data.sdInfo.sd_type)[0]
|
// 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]
|
// const selectedState = this.state.needsState.filter(item => item.id == res.data.sdInfo.state)[0]
|
||||||
if (res.data.err_code === 0) {
|
if (res.data.err_code === 0) {
|
||||||
|
|
||||||
let industryType = {}
|
let industryType = {}
|
||||||
const classId = res.data.sdInfo.class_id
|
const classId = res.data.sdInfo.class_id
|
||||||
for (let outter of res.data.supplyTree) {
|
for (let outter of res.data.supplyTree) {
|
||||||
@ -102,12 +104,15 @@ class MyNeedsEdit extends Component {
|
|||||||
pickerImageUrl: imageFile,
|
pickerImageUrl: imageFile,
|
||||||
ImagesInfo: res.data.sdInfo.file_path,
|
ImagesInfo: res.data.sdInfo.file_path,
|
||||||
})
|
})
|
||||||
Taro.hideLoading()
|
|
||||||
|
}else if (JSON.parse(res.data).err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: JSON.parse(res.data).err_msg,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -176,6 +181,8 @@ class MyNeedsEdit extends Component {
|
|||||||
}
|
}
|
||||||
}, 1500);
|
}, 1500);
|
||||||
})
|
})
|
||||||
|
}else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '保存失败',
|
title: '保存失败',
|
||||||
@ -251,7 +258,7 @@ class MyNeedsEdit extends Component {
|
|||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log('删除我的列表', res)
|
console.log('删除我的列表', res)
|
||||||
if (res.data.err_msg === "success") {
|
if (res.data.err_code === 0) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '删除成功',
|
title: '删除成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
@ -263,6 +270,8 @@ class MyNeedsEdit extends Component {
|
|||||||
})
|
})
|
||||||
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
}else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
@ -368,8 +377,6 @@ class MyNeedsEdit extends Component {
|
|||||||
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
||||||
Taro.showLoading({ title: '加载中' })
|
|
||||||
this.getMyNeedEditInfo()
|
this.getMyNeedEditInfo()
|
||||||
}
|
}
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import Taro, { Component } from '@tarojs/taro'
|
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 { AtInput, AtImagePicker, AtTextarea, Picker } from 'taro-ui'
|
||||||
|
|
||||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
@ -9,6 +9,7 @@ import InteractionComponent from '../../component/interactionComponent/interacti
|
|||||||
|
|
||||||
|
|
||||||
import './myNeedsPublish.scss'
|
import './myNeedsPublish.scss'
|
||||||
|
import loginExpired from '../../util/loginExpired';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -80,7 +81,7 @@ class MyNeedsPublish extends Component {
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('上传需求', res)
|
console.log('上传需求', res)
|
||||||
if (res.data.err_msg === 'success') {
|
if (res.data.err_code === 0) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '发布成功',
|
title: '发布成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
@ -96,11 +97,11 @@ class MyNeedsPublish extends Component {
|
|||||||
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + res.data.sd_id
|
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + res.data.sd_id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}, 1500);
|
}, 1500);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
@ -253,10 +254,10 @@ class MyNeedsPublish extends Component {
|
|||||||
// Taro.showLoading({title:'加载中'})
|
// Taro.showLoading({title:'加载中'})
|
||||||
// this.getSupplyDemandInfo()
|
// this.getSupplyDemandInfo()
|
||||||
// 如果路由参数为1 就默认显示 效果图,反之 显示业主需求
|
// 如果路由参数为1 就默认显示 效果图,反之 显示业主需求
|
||||||
const isRenderingPic=this.$router.params.id
|
const isRenderingPic = this.$router.params.id
|
||||||
console.log(parseInt(isRenderingPic))
|
console.log(parseInt(isRenderingPic))
|
||||||
if(parseInt(isRenderingPic)){
|
if (parseInt(isRenderingPic)) {
|
||||||
this.setState({needsTypeSelected:{ name: '效果图', id: '5' }})
|
this.setState({ needsTypeSelected: { name: '效果图', id: '5' } })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
|
@ -8,6 +8,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
|||||||
|
|
||||||
|
|
||||||
import './myNeedsView.scss'
|
import './myNeedsView.scss'
|
||||||
|
import loginExpired from '../../util/loginExpired';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ class SupplyDemandView extends Component {
|
|||||||
content: '',//描述
|
content: '',//描述
|
||||||
pickerImageUrl: [],
|
pickerImageUrl: [],
|
||||||
ImagesInfo: [],
|
ImagesInfo: [],
|
||||||
isShowAllButtons:true// 是否显示所有按钮
|
isShowAllButtons: true// 是否显示所有按钮
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//获取需求信息api
|
//获取需求信息api
|
||||||
@ -59,7 +60,7 @@ class SupplyDemandView extends Component {
|
|||||||
// const selectedType = this.state.demandingSupplyCate.filter(item => item.id == res.data.sdInfo.sd_type)[0]
|
// 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]
|
// const selectedState = this.state.needsState.filter(item => item.id == res.data.sdInfo.state)[0]
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
if(res.data.err_msg==='success'){
|
if (res.data.err_code === 0) {
|
||||||
let industryType = {}
|
let industryType = {}
|
||||||
const classId = res.data.sdInfo.class_id
|
const classId = res.data.sdInfo.class_id
|
||||||
for (let outter of res.data.supplyTree) {
|
for (let outter of res.data.supplyTree) {
|
||||||
@ -100,16 +101,16 @@ class SupplyDemandView extends Component {
|
|||||||
pickerImageUrl: imageFile,
|
pickerImageUrl: imageFile,
|
||||||
ImagesInfo: res.data.sdInfo.file_path,
|
ImagesInfo: res.data.sdInfo.file_path,
|
||||||
isDeleteModal: false,
|
isDeleteModal: false,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
}else{
|
loginExpired(res)
|
||||||
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
isShowAllButtons:false
|
isShowAllButtons: false
|
||||||
})
|
})
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title:res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
icon:'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +140,7 @@ class SupplyDemandView extends Component {
|
|||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log('删除我的列表', res)
|
console.log('删除我的列表', res)
|
||||||
if (res.data.err_msg === "success") {
|
if (res.data.err_code === 0) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '删除成功',
|
title: '删除成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
@ -148,6 +149,8 @@ class SupplyDemandView extends Component {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.goToMyNeedsPage()
|
this.goToMyNeedsPage()
|
||||||
}, 1500);
|
}, 1500);
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
@ -215,7 +218,7 @@ class SupplyDemandView extends Component {
|
|||||||
// const imageArrayElement = this.state.ImagesInfo.map((item, index) => {
|
// const imageArrayElement = this.state.ImagesInfo.map((item, index) => {
|
||||||
// return <Image key={index} className='image' mode='widthFix' src={URL.Base + item.file_path} style='max-width: 100%; max-height:100%;' />
|
// return <Image key={index} className='image' mode='widthFix' src={URL.Base + item.file_path} style='max-width: 100%; max-height:100%;' />
|
||||||
// })
|
// })
|
||||||
const imageArrayElement=this.state.ImagesInfo.map((item, index) => {
|
const imageArrayElement = this.state.ImagesInfo.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>
|
||||||
@ -228,7 +231,7 @@ class SupplyDemandView extends Component {
|
|||||||
{deleteModalWindowElement}
|
{deleteModalWindowElement}
|
||||||
<View className='type box'>
|
<View className='type box'>
|
||||||
<Text className='title'>行业分类:</Text>
|
<Text className='title'>行业分类:</Text>
|
||||||
<Text className='content'>{this.state.industryTypeSelected.name?this.state.industryTypeSelected.name:'--'}</Text>
|
<Text className='content'>{this.state.industryTypeSelected.name ? this.state.industryTypeSelected.name : '--'}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className='needed-title box'>
|
<View className='needed-title box'>
|
||||||
<Text className='title'>需求标题:</Text>
|
<Text className='title'>需求标题:</Text>
|
||||||
@ -255,7 +258,7 @@ class SupplyDemandView extends Component {
|
|||||||
<Text className='content'>{this.state.content}</Text>
|
<Text className='content'>{this.state.content}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className='image-container box'>
|
<View className='image-container box'>
|
||||||
{this.state.ImagesInfo.length?<Text className='title'>业主需求图片:</Text>:null}
|
{this.state.ImagesInfo.length ? <Text className='title'>业主需求图片:</Text> : null}
|
||||||
{imageArrayElement}
|
{imageArrayElement}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
@ -270,7 +273,7 @@ class SupplyDemandView extends Component {
|
|||||||
</View>:null
|
</View>:null
|
||||||
} */}
|
} */}
|
||||||
|
|
||||||
{this.state.isShowAllButtons? <View className='button-box'>
|
{this.state.isShowAllButtons ? <View className='button-box'>
|
||||||
<View className='button' onClick={this.goMyNeedsPublishPage.bind(this)}>
|
<View className='button' onClick={this.goMyNeedsPublishPage.bind(this)}>
|
||||||
<Button size='mini' className='button-green'>
|
<Button size='mini' className='button-green'>
|
||||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||||
@ -292,7 +295,7 @@ class SupplyDemandView extends Component {
|
|||||||
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
||||||
删除</Button>
|
删除</Button>
|
||||||
</View>
|
</View>
|
||||||
</View>:<View className='button-box'>
|
</View> : <View className='button-box'>
|
||||||
<View className='button' onClick={this.goMyNeedsPublishPage.bind(this)}>
|
<View className='button' onClick={this.goMyNeedsPublishPage.bind(this)}>
|
||||||
<Button size='mini' className='button-green'>
|
<Button size='mini' className='button-green'>
|
||||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||||
|
@ -5,7 +5,8 @@ import URL from '../../serviceAPI.config'
|
|||||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||||
|
|
||||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
import LoginService from '../../LoginService'
|
import LoginService from '../../util/LoginService'
|
||||||
|
import loginExpired from '../../util/loginExpired'
|
||||||
|
|
||||||
|
|
||||||
import './mySupplyDemand.scss'
|
import './mySupplyDemand.scss'
|
||||||
@ -69,7 +70,7 @@ class MySupplyDemand extends Component {
|
|||||||
}).then(res => {
|
}).then(res => {
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
console.log('我的供求列表', res)
|
console.log('我的供求列表', res)
|
||||||
if (res.data.err_msg === "success") {
|
if (res.data.err_code === 0) {
|
||||||
if (this.state.isAddToList) {
|
if (this.state.isAddToList) {
|
||||||
if (res.data.supplys.length && res.data.count !== '0') {
|
if (res.data.supplys.length && res.data.count !== '0') {
|
||||||
this.setState({ allDemandSupply: this.state.allDemandSupply.concat(res.data.supplys) }, () => {
|
this.setState({ allDemandSupply: this.state.allDemandSupply.concat(res.data.supplys) }, () => {
|
||||||
@ -94,7 +95,11 @@ class MySupplyDemand extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@ -130,7 +135,7 @@ class MySupplyDemand extends Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.data.err_msg == 'success') {
|
if (res.data.err_code == 0) {
|
||||||
console.log('删除成功')
|
console.log('删除成功')
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '删除成功'
|
title: '删除成功'
|
||||||
@ -138,8 +143,9 @@ class MySupplyDemand extends Component {
|
|||||||
this.getMySupplyDemand({})
|
this.getMySupplyDemand({})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
@ -149,13 +155,7 @@ class MySupplyDemand extends Component {
|
|||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(error => {
|
|
||||||
|
|
||||||
Taro.showToast({
|
|
||||||
title: '删除失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增我的供求
|
// 新增我的供求
|
||||||
@ -267,10 +267,10 @@ class MySupplyDemand extends Component {
|
|||||||
LoginService()
|
LoginService()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if(!Taro.getStorageSync('shopInfo').shop_id&&Taro.getStorageSync('userInfo').user_id){
|
if (!Taro.getStorageSync('shopInfo').shop_id && Taro.getStorageSync('userInfo').user_id) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title:'您还没有店铺,不能使用该功能,快去申请吧',
|
title: '您还没有店铺,不能使用该功能,快去申请吧',
|
||||||
icon:'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,8 +119,6 @@ class Shop extends Component {
|
|||||||
console.log('筛选项目成功', res)
|
console.log('筛选项目成功', res)
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
this.formatFilterData(res.data).then(data => {
|
this.formatFilterData(res.data).then(data => {
|
||||||
console.log('data', data)
|
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
sideFilterdata: data,
|
sideFilterdata: data,
|
||||||
mainType: data.mainType,
|
mainType: data.mainType,
|
||||||
@ -275,6 +273,7 @@ class Shop extends Component {
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('searchGood', res)
|
console.log('searchGood', res)
|
||||||
|
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
if (res.data.goods && res.data.goods.length) {
|
if (res.data.goods && res.data.goods.length) {
|
||||||
if (this.state.isAddToList) {
|
if (this.state.isAddToList) {
|
||||||
@ -319,7 +318,7 @@ class Shop extends Component {
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
|
if (res.data.err_msg === 0) {
|
||||||
this.setState({
|
this.setState({
|
||||||
shopDescriptionData: res.data,
|
shopDescriptionData: res.data,
|
||||||
shopName: res.data.data.shop_name,
|
shopName: res.data.data.shop_name,
|
||||||
@ -329,12 +328,15 @@ class Shop extends Component {
|
|||||||
shopDescription: res.data.data.shop_desc,
|
shopDescription: res.data.data.shop_desc,
|
||||||
latitude: res.data.data.shop_map.split(',')[1],
|
latitude: res.data.data.shop_map.split(',')[1],
|
||||||
longitude: res.data.data.shop_map.split(',')[0],
|
longitude: res.data.data.shop_map.split(',')[0],
|
||||||
|
})
|
||||||
}, () => {
|
} else {
|
||||||
// console.log(this.state.shopDescriptionData)
|
Taro.showToast({
|
||||||
|
title: res.data.err_msg,
|
||||||
|
icon: 'none'
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,15 +4,13 @@ import { View, Text, Button, Input } from '@tarojs/components'
|
|||||||
import { AtInput, AtImagePicker, AtTextarea, Picker } from 'taro-ui'
|
import { AtInput, AtImagePicker, AtTextarea, Picker } from 'taro-ui'
|
||||||
|
|
||||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
import LoginService from '../../LoginService'
|
import LoginService from '../../util/LoginService'
|
||||||
|
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
import './supplyDemandPublish.scss'
|
import './supplyDemandPublish.scss'
|
||||||
|
import loginExpired from '../../util/loginExpired';
|
||||||
|
|
||||||
|
|
||||||
class SupplyDemand extends Component {
|
class SupplyDemand extends Component {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
navigationBarTitleText: '供求发布'
|
navigationBarTitleText: '供求发布'
|
||||||
}
|
}
|
||||||
@ -24,8 +22,8 @@ class SupplyDemand extends Component {
|
|||||||
demandingSupplyState: [{ name: '上架', id: '1' }, { name: '下架', id: '0' }], // 状态选择
|
demandingSupplyState: [{ name: '上架', id: '1' }, { name: '下架', id: '0' }], // 状态选择
|
||||||
demandingSupplyStateSelected: { name: '上架', id: '1' },// 当前状态
|
demandingSupplyStateSelected: { name: '上架', id: '1' },// 当前状态
|
||||||
title: '',
|
title: '',
|
||||||
contactName: Taro.getStorageSync('user_identity').username,
|
contactName: Taro.getStorageSync('user_identity').username||'',
|
||||||
contactNumber: Taro.getStorageSync('user_identity').userphone,
|
contactNumber: Taro.getStorageSync('user_identity').userphone||'',
|
||||||
contactAddress: '',
|
contactAddress: '',
|
||||||
content: '',
|
content: '',
|
||||||
pickerImageUrl: [], // 上传的图片
|
pickerImageUrl: [], // 上传的图片
|
||||||
@ -96,7 +94,10 @@ class SupplyDemand extends Component {
|
|||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
})
|
})
|
||||||
} else {
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
|
}
|
||||||
|
else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@ -261,10 +262,10 @@ class SupplyDemand extends Component {
|
|||||||
LoginService()
|
LoginService()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if(!Taro.getStorageSync('shopInfo').shop_id&&Taro.getStorageSync('userInfo').user_id){
|
if (!Taro.getStorageSync('shopInfo').shop_id && Taro.getStorageSync('userInfo').user_id) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title:'您还没有店铺,不能使用该功能,快去申请吧',
|
title: '您还没有店铺,不能使用该功能,快去申请吧',
|
||||||
icon:'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
|
|
||||||
import Taro, { Component } from '@tarojs/taro'
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
import { View, Text, Image,Button } from '@tarojs/components'
|
import { View, Text, Image, Button } from '@tarojs/components'
|
||||||
import { AtIcon,AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
import { AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||||
|
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
|
|
||||||
|
|
||||||
import './supplyDemandView.scss'
|
import './supplyDemandView.scss'
|
||||||
|
import loginExpired from '../../util/loginExpired';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ class SupplyDemandView extends Component {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments)
|
super(...arguments)
|
||||||
this.state = {
|
this.state = {
|
||||||
demandingSupplyCate: [{name:'需求',id:'1'}, {name:'供求',id:'2'}, {name:'人才',id:'3'}], //供求类型选择
|
demandingSupplyCate: [{ name: '需求', id: '1' }, { name: '供求', id: '2' }, { name: '人才', id: '3' }], //供求类型选择
|
||||||
type: '',
|
type: '',
|
||||||
title: '',
|
title: '',
|
||||||
browsing: '',
|
browsing: '',
|
||||||
@ -28,7 +29,7 @@ class SupplyDemandView extends Component {
|
|||||||
address: '',
|
address: '',
|
||||||
content: '',
|
content: '',
|
||||||
images: [],
|
images: [],
|
||||||
isDeleteModal:false
|
isDeleteModal: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//获取商品信息api GetProductInfo
|
//获取商品信息api GetProductInfo
|
||||||
@ -48,9 +49,8 @@ class SupplyDemandView extends Component {
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('供求详情获取成功', res)
|
console.log('供求详情获取成功', res)
|
||||||
|
if (res.data.err_code === 0) {
|
||||||
|
const selectedType = this.state.demandingSupplyCate.filter(item => item.id === res.data.sdInfo.sd_type)[0].name
|
||||||
const selectedType=this.state.demandingSupplyCate.filter(item=> item.id===res.data.sdInfo.sd_type)[0].name
|
|
||||||
this.setState({
|
this.setState({
|
||||||
type: selectedType,
|
type: selectedType,
|
||||||
title: res.data.sdInfo.sd_title,
|
title: res.data.sdInfo.sd_title,
|
||||||
@ -60,14 +60,16 @@ class SupplyDemandView extends Component {
|
|||||||
address: res.data.sdInfo.user_address,
|
address: res.data.sdInfo.user_address,
|
||||||
content: res.data.sdInfo.sd_desc,
|
content: res.data.sdInfo.sd_desc,
|
||||||
images: res.data.sdInfo.file_path,
|
images: res.data.sdInfo.file_path,
|
||||||
itemId:res.data.sdInfo.sd_id
|
itemId: res.data.sdInfo.sd_id
|
||||||
})
|
})
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(error => {
|
|
||||||
console.log('供求详情获取失败', error)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
// 删除我的供求api
|
// 删除我的供求api
|
||||||
onDelete({ sdID = 0 }) {
|
onDelete({ sdID = 0 }) {
|
||||||
@ -85,18 +87,20 @@ class SupplyDemandView extends Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.data.err_msg == 'success') {
|
if (res.data.err_code == 0) {
|
||||||
console.log('删除成功')
|
console.log('删除成功')
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '删除成功',
|
title: '删除成功',
|
||||||
icon:'success',
|
icon: 'success',
|
||||||
duration:1500
|
duration: 1500
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.goToMySDPage()
|
this.goToMySDPage()
|
||||||
}, 1500);
|
}, 1500);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
@ -108,14 +112,8 @@ class SupplyDemandView extends Component {
|
|||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(error => {
|
|
||||||
|
|
||||||
Taro.showToast({
|
}
|
||||||
title: '删除失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
goToSDPublishPage() {
|
goToSDPublishPage() {
|
||||||
Taro.reLaunch({
|
Taro.reLaunch({
|
||||||
url: '/pages/supplyDemandPublish/supplyDemandPublish',// 供求发布页面
|
url: '/pages/supplyDemandPublish/supplyDemandPublish',// 供求发布页面
|
||||||
@ -127,13 +125,13 @@ class SupplyDemandView extends Component {
|
|||||||
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + this.state.itemId
|
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + this.state.itemId
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
goToMySDPage() {
|
goToMySDPage() {
|
||||||
Taro.reLaunch({
|
Taro.reLaunch({
|
||||||
url: '/pages/mySupplyDemand/mySupplyDemand',//我的供求页面
|
url: '/pages/mySupplyDemand/mySupplyDemand',//我的供求页面
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
makeAPhoneCall(){
|
makeAPhoneCall() {
|
||||||
Taro.makePhoneCall({
|
Taro.makePhoneCall({
|
||||||
phoneNumber: this.state.contactNumber
|
phoneNumber: this.state.contactNumber
|
||||||
})
|
})
|
||||||
@ -152,7 +150,7 @@ class SupplyDemandView extends Component {
|
|||||||
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
Taro.showLoading({title:'加载中'})
|
Taro.showLoading({ title: '加载中' })
|
||||||
this.getSupplyDemandInfo()
|
this.getSupplyDemandInfo()
|
||||||
}
|
}
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
|
@ -1,27 +1,26 @@
|
|||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import URL from './serviceAPI.config'
|
|
||||||
|
|
||||||
//用户信息姓名和电话号码接口
|
// //用户信息姓名和电话号码接口
|
||||||
const setUserInfoToStorage=()=>{
|
// const setUserInfoToStorage=()=>{
|
||||||
Taro.request({
|
// Taro.request({
|
||||||
url: URL.ShopWxStore,
|
// url: URL.ShopWxStore,
|
||||||
header: {
|
// header: {
|
||||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
// 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
.then(res => {
|
// .then(res => {
|
||||||
if (res.data.err_msg === 'success') {
|
// if (res.data.err_msg === 'success') {
|
||||||
Taro.setStorageSync('user_identity', { username: res.data.otherData.userName, userphone: res.data.otherData.userPhone })
|
// Taro.setStorageSync('user_identity', { username: res.data.otherData.userName, userphone: res.data.otherData.userPhone })
|
||||||
|
|
||||||
} else {
|
// } else {
|
||||||
Taro.showToast({
|
// Taro.showToast({
|
||||||
title: res.data.err_msg,
|
// title: res.data.err_msg,
|
||||||
icon: 'none',
|
// icon: 'none',
|
||||||
duration: 1500
|
// duration: 1500
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
14
src/util/loginExpired.js
Normal file
14
src/util/loginExpired.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import Taro from '@tarojs/taro'
|
||||||
|
|
||||||
|
export default function loginExpired(res){
|
||||||
|
Taro.clearStorageSync()
|
||||||
|
Taro.showToast({
|
||||||
|
title: res.data.err_msg,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
Taro.reLaunch({
|
||||||
|
url: '/pages/home/home'
|
||||||
|
})
|
||||||
|
}, 1500);
|
||||||
|
}
|
75
src/util/weChatLogin.js
Normal file
75
src/util/weChatLogin.js
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
import Taro from '@tarojs/taro'
|
||||||
|
import URL from '../serviceAPI.config'
|
||||||
|
|
||||||
|
//用户信息姓名和电话号码接口
|
||||||
|
const setUserInfoToStorage = () => {
|
||||||
|
Taro.request({
|
||||||
|
url: URL.ShopWxStore,
|
||||||
|
header: {
|
||||||
|
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (res.data.err_msg === 'success') {
|
||||||
|
Taro.setStorageSync('user_identity', { username: res.data.otherData.userName, userphone: res.data.otherData.userPhone })
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Taro.showToast({
|
||||||
|
title: res.data.err_msg,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1500
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 异步函数登入api
|
||||||
|
export default function login() {
|
||||||
|
Taro.login({
|
||||||
|
success(res) {
|
||||||
|
if (res.code) {
|
||||||
|
// 发起网络请求
|
||||||
|
console.log('手机端微信code:', res.code)
|
||||||
|
Taro.request({
|
||||||
|
url: URL.Login,
|
||||||
|
method: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
code: res.code
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/x-www-form-urlencoded',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
if (response.data.err_code === 0) {
|
||||||
|
console.log('微信登入成功', response)
|
||||||
|
Taro.showToast({
|
||||||
|
title: '微信登入成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
Taro.setStorageSync('session_id', response.data.session_id)
|
||||||
|
Taro.setStorageSync('shopInfo', response.data.shop_info)
|
||||||
|
Taro.setStorageSync('userInfo', response.data.user_info)
|
||||||
|
setUserInfoToStorage()
|
||||||
|
} else {
|
||||||
|
Taro.showToast({
|
||||||
|
title: '微信登入失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
// Taro.clearStorageSync()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log('登录失败!' + res.errMsg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
@ -1,73 +0,0 @@
|
|||||||
import Taro from '@tarojs/taro'
|
|
||||||
import URL from './serviceAPI.config'
|
|
||||||
|
|
||||||
//用户信息姓名和电话号码接口
|
|
||||||
const setUserInfoToStorage=()=>{
|
|
||||||
Taro.request({
|
|
||||||
url: URL.ShopWxStore,
|
|
||||||
header: {
|
|
||||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
if (res.data.err_msg === 'success') {
|
|
||||||
Taro.setStorageSync('user_identity', { username: res.data.otherData.userName, userphone: res.data.otherData.userPhone })
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Taro.showToast({
|
|
||||||
title: res.data.err_msg,
|
|
||||||
icon: 'none',
|
|
||||||
duration: 1500
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 异步函数登入api
|
|
||||||
export default function login() {
|
|
||||||
Taro.login({
|
|
||||||
success(res) {
|
|
||||||
if (res.code) {
|
|
||||||
// 发起网络请求
|
|
||||||
console.log('手机端微信code:',res.code)
|
|
||||||
Taro.request({
|
|
||||||
url: URL.Login,
|
|
||||||
method: 'POST',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
code: res.code
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
if (response.data.err_code === 0) {
|
|
||||||
console.log('微信登入成功', response)
|
|
||||||
Taro.showToast({
|
|
||||||
title: '微信登入成功',
|
|
||||||
icon: 'success',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
Taro.setStorageSync('session_id', response.data.session_id)
|
|
||||||
Taro.setStorageSync('shopInfo', response.data.shop_info)
|
|
||||||
Taro.setStorageSync('userInfo', response.data.user_info)
|
|
||||||
setUserInfoToStorage()
|
|
||||||
}else{
|
|
||||||
Taro.showToast({
|
|
||||||
title: '微信登入失败',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log('登录失败!' + res.errMsg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user