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