支付宝测试
This commit is contained in:
parent
870fc47323
commit
ff5c1c1389
@ -173,6 +173,7 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
this.passDataToParent(result)
|
this.passDataToParent(result)
|
||||||
}
|
}
|
||||||
invokeAliPicker() {
|
invokeAliPicker() {
|
||||||
|
console.log('clicked')
|
||||||
this.setState({
|
this.setState({
|
||||||
AliIsShowPicker:true
|
AliIsShowPicker:true
|
||||||
})
|
})
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
|
||||||
|
.shop-interaction{
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
.page-section{
|
.page-section{
|
||||||
border-bottom: 1Px solid #d6e4ef;
|
border-bottom: 1Px solid #d6e4ef;
|
||||||
font-size:32rpx;
|
font-size:32rpx;
|
||||||
@ -79,3 +83,9 @@
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// .picker-wrapper{
|
||||||
|
// .at-list__item{
|
||||||
|
// background: rgba(0,0,0,1)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import Taro, { Component } from '@tarojs/taro'
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
import { View, Text, Image, Button,Picker } from '@tarojs/components'
|
import { View, Text, Image, Button, Picker } from '@tarojs/components'
|
||||||
import { AtInput, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
import { AtInput, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||||
|
|
||||||
|
import AliIndustryTypeInteraction from '../../component/aliIndustryTypeInteraction/aliIndustryTypeInteraction'
|
||||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||||
import loginExpired from '../../util/loginExpired'
|
import loginExpired from '../../util/loginExpired'
|
||||||
import onClickValueService from '../../util/onClickValueService'
|
import onClickValueService from '../../util/onClickValueService'
|
||||||
@ -13,373 +14,383 @@ import './allDemanding.scss'
|
|||||||
import eyeIcon from '../../icons/eye.png'
|
import eyeIcon from '../../icons/eye.png'
|
||||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||||
import { showLoading } from '../../util/hideShowLoading';
|
import { showLoading } from '../../util/hideShowLoading';
|
||||||
|
import platformChecker from '../../util/plaformChecker';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AllDemanding extends Component {
|
class AllDemanding extends Component {
|
||||||
config = {
|
config = {
|
||||||
navigationBarTitleText: '全部业主需求'
|
navigationBarTitleText: '全部业主需求'
|
||||||
|
}
|
||||||
|
constructor() {
|
||||||
|
super(...arguments)
|
||||||
|
this.state = {
|
||||||
|
supplys: [], // 需求列表
|
||||||
|
demandingState: [{ name: '全部', id: '' }, { name: '在用', id: '1' }, { name: '已抢单', id: '2' }, { name: '已抢光', id: '3' },], // 供求状态选择
|
||||||
|
demandingStateSelected: { name: '全部', id: '' }, // 当前供求状态
|
||||||
|
industryTypeSelected: { name: '全部', id: '' },// 当前行业分类
|
||||||
|
title: '',
|
||||||
|
startDateSel: '',
|
||||||
|
endDateSel: '',
|
||||||
|
isOpenedGrabModal: false,
|
||||||
|
grabOrderId: '',//抢到订单的id
|
||||||
|
isGrabOrderSuccess: false,// 是否显示轻提示
|
||||||
|
grabOrderSuccess: '无法显示绑定后的字段',// 抢单成功返回字段
|
||||||
|
isAddToList: false,// / 请求业主需求的时候是否添加到旧列表里
|
||||||
|
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||||
|
loadMorePageIndex: 1
|
||||||
|
|
||||||
}
|
}
|
||||||
constructor() {
|
}
|
||||||
super(...arguments)
|
|
||||||
this.state = {
|
|
||||||
supplys: [], // 需求列表
|
|
||||||
demandingState: [{ name: '全部', id: '' }, { name: '在用', id: '1' }, { name: '已抢单', id: '2' }, { name: '已抢光', id: '3' },], // 供求状态选择
|
|
||||||
demandingStateSelected: { name: '全部', id: '' }, // 当前供求状态
|
|
||||||
industryTypeSelected: { name: '全部', id: '' },// 当前行业分类
|
|
||||||
title: '',
|
|
||||||
startDateSel: '',
|
|
||||||
endDateSel: '',
|
|
||||||
isOpenedGrabModal: false,
|
|
||||||
grabOrderId: '',//抢到订单的id
|
|
||||||
isGrabOrderSuccess: false,// 是否显示轻提示
|
|
||||||
grabOrderSuccess: '无法显示绑定后的字段',// 抢单成功返回字段
|
|
||||||
isAddToList: false,// / 请求业主需求的时候是否添加到旧列表里
|
|
||||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
|
||||||
loadMorePageIndex: 1
|
|
||||||
|
|
||||||
}
|
// 搜索业主需求函数
|
||||||
}
|
searchDemanding({
|
||||||
|
curr_page = 1,
|
||||||
|
page_count = 10,
|
||||||
|
sd_title = this.state.title,
|
||||||
|
state = this.state.demandingStateSelected.id,
|
||||||
|
update_dateL = this.state.startDateSel,
|
||||||
|
update_dateU = this.state.endDateSel,
|
||||||
|
class_id = this.state.industryTypeSelected.id
|
||||||
|
}) {
|
||||||
|
Taro.request({
|
||||||
|
url: URL.GetAllDemanding,
|
||||||
|
method: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
param: JSON.stringify({
|
||||||
|
curr_page: curr_page,
|
||||||
|
page_count: page_count,
|
||||||
|
sd_title: sd_title,
|
||||||
|
state: state,
|
||||||
|
update_dateL: update_dateL,
|
||||||
|
update_dateU: update_dateU,
|
||||||
|
class_id: class_id
|
||||||
|
|
||||||
// 搜索业主需求函数
|
}),
|
||||||
searchDemanding({
|
},
|
||||||
curr_page = 1,
|
header: {
|
||||||
page_count = 10,
|
'content-type': 'application/x-www-form-urlencoded',
|
||||||
sd_title = this.state.title,
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
state = this.state.demandingStateSelected.id,
|
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||||
update_dateL = this.state.startDateSel,
|
}
|
||||||
update_dateU = this.state.endDateSel,
|
})
|
||||||
class_id = this.state.industryTypeSelected.id
|
.then(res => {
|
||||||
}) {
|
Taro.hideLoading()
|
||||||
Taro.request({
|
if (res.data.err_code === 0) {
|
||||||
url: URL.GetAllDemanding,
|
if (res.data.supplys) {
|
||||||
method: 'POST',
|
if (this.state.isAddToList) {
|
||||||
dataType: 'json',
|
this.setState({ supplys: this.state.supplys.concat(res.data.supplys), isAddToList: false })
|
||||||
data: {
|
} else {
|
||||||
param: JSON.stringify({
|
this.setState({ supplys: res.data.supplys })
|
||||||
curr_page: curr_page,
|
|
||||||
page_count: page_count,
|
|
||||||
sd_title: sd_title,
|
|
||||||
state: state,
|
|
||||||
update_dateL: update_dateL,
|
|
||||||
update_dateU: update_dateU,
|
|
||||||
class_id: class_id
|
|
||||||
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
|
||||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
|
||||||
}
|
}
|
||||||
})
|
} else {
|
||||||
.then(res => {
|
if (this.state.isAddToList) {
|
||||||
Taro.hideLoading()
|
Taro.showToast({
|
||||||
if (res.data.err_code === 0) {
|
title: '没有更多了',
|
||||||
if (res.data.supplys) {
|
icon: 'none'
|
||||||
if (this.state.isAddToList) {
|
})
|
||||||
this.setState({ supplys: this.state.supplys.concat(res.data.supplys), isAddToList: false })
|
} else {
|
||||||
} else {
|
this.setState({ supplys: [] })
|
||||||
this.setState({ supplys: res.data.supplys })
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (this.state.isAddToList) {
|
|
||||||
Taro.showToast({
|
|
||||||
title: '没有更多了',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.setState({ supplys: [] })
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} else if (res.data.err_code === 88888) {
|
|
||||||
loginExpired(res)
|
|
||||||
} else {
|
|
||||||
Taro.showToast({
|
|
||||||
title: res.data.err_msg,
|
|
||||||
icon: 'none',
|
|
||||||
duration: 1500
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.setState({ isAddToList: false })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 改变需求选项
|
|
||||||
changeDemandingState = e => {
|
|
||||||
this.setState({
|
|
||||||
demandingStateSelected: this.state.demandingState[e.detail.value]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
titleChange(event) {
|
|
||||||
this.setState({ title: event })
|
|
||||||
}
|
|
||||||
|
|
||||||
//改变开始日期
|
|
||||||
onStartDateChange = e => {
|
|
||||||
this.setState({
|
|
||||||
startDateSel: e.detail.value,
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// 改变结束日期
|
|
||||||
onEndDateChange = e => {
|
|
||||||
this.setState({
|
|
||||||
endDateSel: e.detail.value
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// 抢单接口
|
|
||||||
GrabDemand({ demandId = 218 }) {
|
|
||||||
Taro.request({
|
|
||||||
url: URL.GrabDemand,
|
|
||||||
method: 'POST',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
demandId: demandId
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
|
||||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
|
||||||
'X-Requested-With': 'XMLHttpRequest'
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
if (res.data.err_code === 0) {
|
|
||||||
Taro.showToast({
|
|
||||||
title: res.data.err_msg === 'success' ? '抢单成功' : res.data.err_msg,
|
|
||||||
icon: res.data.err_msg === 'success' ? 'success' : 'none'
|
|
||||||
})
|
|
||||||
this.searchDemanding({ curr_page: 1 })
|
|
||||||
} else if (res.data.err_code === 88888) {
|
|
||||||
loginExpired(res)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
Taro.showToast({
|
}
|
||||||
title: res.data.err_msg,
|
} else if (res.data.err_code === 88888) {
|
||||||
icon: 'none'
|
loginExpired(res)
|
||||||
})
|
} else {
|
||||||
}
|
Taro.showToast({
|
||||||
|
title: res.data.err_msg,
|
||||||
console.log('抢单请求:', res)
|
icon: 'none',
|
||||||
})
|
duration: 1500
|
||||||
|
})
|
||||||
}
|
|
||||||
grabOrder(e) {
|
|
||||||
const id = onClickValueService(e)
|
|
||||||
this.setState({ isOpenedGrabModal: true, grabOrderId: id })
|
|
||||||
}
|
|
||||||
handleGrabModalClose() {
|
|
||||||
this.setState({ isOpenedGrabModal: false })
|
|
||||||
}
|
|
||||||
handleGrabModalCancel() {
|
|
||||||
this.setState({ isOpenedGrabModal: false })
|
|
||||||
}
|
|
||||||
handleGrabConfirm() {
|
|
||||||
this.setState({ isOpenedGrabModal: false })
|
|
||||||
this.GrabDemand({ demandId: this.state.grabOrderId })
|
|
||||||
}
|
|
||||||
searchHanlder() {
|
|
||||||
showLoading({ title: '加载中' })
|
|
||||||
this.searchDemanding({})
|
|
||||||
}
|
|
||||||
//清空筛选项
|
|
||||||
emptyFilter() {
|
|
||||||
this.setState({
|
|
||||||
title: '',
|
|
||||||
endDateSel: '',
|
|
||||||
startDateSel: '',
|
|
||||||
demandingStateSelected: { name: '全部', id: '' },
|
|
||||||
industryTypeSelected: { name: '全部', id: '' },
|
|
||||||
})
|
|
||||||
Taro.showToast({
|
|
||||||
title: '已清空',
|
|
||||||
icon: 'success',
|
|
||||||
duration: 1000
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
getDataFromChild(value) {
|
|
||||||
console.log('从子组件传回来的值', value)
|
|
||||||
this.setState({ industryTypeSelected: value })
|
|
||||||
}
|
|
||||||
|
|
||||||
goToGrabOrderPage(e) {
|
|
||||||
const id = onClickValueService(e)
|
|
||||||
let orderId=encodeURIComponent(id)
|
|
||||||
Taro.navigateTo({
|
|
||||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
|
||||||
console.log(this.props, nextProps)
|
|
||||||
}
|
|
||||||
componentDidMount() {
|
|
||||||
// 得到第一页需求数据
|
|
||||||
showLoading({ title: '加载中' })
|
|
||||||
this.searchDemanding({})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() { }
|
|
||||||
|
|
||||||
componentDidShow() { }
|
|
||||||
|
|
||||||
componentDidHide() { }
|
|
||||||
// 页面位置
|
|
||||||
onPageScroll(location) {
|
|
||||||
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
|
||||||
this.setState({ isShowTopNav: false })
|
|
||||||
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
|
||||||
this.setState({ isShowTopNav: true })
|
|
||||||
}
|
}
|
||||||
|
this.setState({ isAddToList: false })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 改变需求选项
|
||||||
|
changeDemandingState = e => {
|
||||||
|
this.setState({
|
||||||
|
demandingStateSelected: this.state.demandingState[e.detail.value]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
titleChange(event) {
|
||||||
|
this.setState({ title: event })
|
||||||
|
}
|
||||||
|
|
||||||
|
//改变开始日期
|
||||||
|
onStartDateChange = e => {
|
||||||
|
this.setState({
|
||||||
|
startDateSel: e.detail.value,
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 改变结束日期
|
||||||
|
onEndDateChange = e => {
|
||||||
|
this.setState({
|
||||||
|
endDateSel: e.detail.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 抢单接口
|
||||||
|
GrabDemand({ demandId = 218 }) {
|
||||||
|
Taro.request({
|
||||||
|
url: URL.GrabDemand,
|
||||||
|
method: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
demandId: demandId
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/x-www-form-urlencoded',
|
||||||
|
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (res.data.err_code === 0) {
|
||||||
|
Taro.showToast({
|
||||||
|
title: res.data.err_msg === 'success' ? '抢单成功' : res.data.err_msg,
|
||||||
|
icon: res.data.err_msg === 'success' ? 'success' : 'none'
|
||||||
|
})
|
||||||
|
this.searchDemanding({ curr_page: 1 })
|
||||||
|
} else if (res.data.err_code === 88888) {
|
||||||
|
loginExpired(res)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
Taro.showToast({
|
||||||
|
title: res.data.err_msg,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('抢单请求:', res)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
grabOrder(e) {
|
||||||
|
const id = onClickValueService(e)
|
||||||
|
this.setState({ isOpenedGrabModal: true, grabOrderId: id })
|
||||||
|
}
|
||||||
|
handleGrabModalClose() {
|
||||||
|
this.setState({ isOpenedGrabModal: false })
|
||||||
|
}
|
||||||
|
handleGrabModalCancel() {
|
||||||
|
this.setState({ isOpenedGrabModal: false })
|
||||||
|
}
|
||||||
|
handleGrabConfirm() {
|
||||||
|
this.setState({ isOpenedGrabModal: false })
|
||||||
|
this.GrabDemand({ demandId: this.state.grabOrderId })
|
||||||
|
}
|
||||||
|
searchHanlder() {
|
||||||
|
showLoading({ title: '加载中' })
|
||||||
|
this.searchDemanding({})
|
||||||
|
}
|
||||||
|
//清空筛选项
|
||||||
|
emptyFilter() {
|
||||||
|
this.setState({
|
||||||
|
title: '',
|
||||||
|
endDateSel: '',
|
||||||
|
startDateSel: '',
|
||||||
|
demandingStateSelected: { name: '全部', id: '' },
|
||||||
|
industryTypeSelected: { name: '全部', id: '' },
|
||||||
|
})
|
||||||
|
Taro.showToast({
|
||||||
|
title: '已清空',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 1000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getDataFromChild(value) {
|
||||||
|
console.log('从子组件传回来的值', value)
|
||||||
|
this.setState({ industryTypeSelected: value })
|
||||||
|
}
|
||||||
|
|
||||||
|
goToGrabOrderPage(e) {
|
||||||
|
const id = onClickValueService(e)
|
||||||
|
let orderId = encodeURIComponent(id)
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
console.log(this.props, nextProps)
|
||||||
|
}
|
||||||
|
componentDidMount() {
|
||||||
|
// 得到第一页需求数据
|
||||||
|
showLoading({ title: '加载中' })
|
||||||
|
this.searchDemanding({})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() { }
|
||||||
|
|
||||||
|
componentDidShow() { }
|
||||||
|
|
||||||
|
componentDidHide() { }
|
||||||
|
// 页面位置
|
||||||
|
onPageScroll(location) {
|
||||||
|
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
||||||
|
this.setState({ isShowTopNav: false })
|
||||||
|
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
||||||
|
this.setState({ isShowTopNav: true })
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 底部加载
|
// 底部加载
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
showLoading({
|
showLoading({
|
||||||
title: '加载中'
|
title: '加载中'
|
||||||
})
|
})
|
||||||
|
|
||||||
this.setState({ isAddToList: true, loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
this.setState({ isAddToList: true, loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
||||||
this.searchDemanding({ curr_page: this.state.loadMorePageIndex })
|
this.searchDemanding({ curr_page: this.state.loadMorePageIndex })
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
// 提示模态弹窗element
|
// 提示模态弹窗element
|
||||||
|
|
||||||
|
|
||||||
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpenedGrabModal}>
|
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpenedGrabModal}>
|
||||||
<AtModalHeader>提示</AtModalHeader>
|
<AtModalHeader>提示</AtModalHeader>
|
||||||
<AtModalContent>
|
<AtModalContent>
|
||||||
确认抢单?
|
确认抢单?
|
||||||
</AtModalContent>
|
</AtModalContent>
|
||||||
<AtModalAction> <Button onClick={this.handleGrabModalCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleGrabConfirm.bind(this)}>确定</Button> </AtModalAction>
|
<AtModalAction> <Button onClick={this.handleGrabModalCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleGrabConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||||
</AtModal>
|
</AtModal>
|
||||||
|
|
||||||
const allDemandingElementArray = this.state.supplys.length ? this.state.supplys.map((item, index) => {
|
const allDemandingElementArray = this.state.supplys.length ? this.state.supplys.map((item, index) => {
|
||||||
return <View className='demanding-info' key={index}>
|
return <View className='demanding-info' key={index}>
|
||||||
<View className='header'>
|
<View className='header'>
|
||||||
<AtIcon value='user' size='12' color='#2196F3'></AtIcon>
|
<AtIcon value='user' size='12' color='#2196F3'></AtIcon>
|
||||||
<View className='name'> 业主:{item.user_name}</View>
|
<View className='name'> 业主:{item.user_name}</View>
|
||||||
<View className='others'>
|
<View className='others'>
|
||||||
<Text className='cate'>{item.class_name + ' '} </Text>
|
<Text className='cate'>{item.class_name + ' '} </Text>
|
||||||
|
|
|
|
||||||
<Image src={eyeIcon} style='width:12px; height:12px; vertical-align:middle;' />
|
<Image src={eyeIcon} style='width:12px; height:12px; vertical-align:middle;' />
|
||||||
<Text className='watch'>{item.browse_times}</Text>
|
<Text className='watch'>{item.browse_times}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className='body'>
|
<View className='body'>
|
||||||
<View className='image-container' onClick={this.goToGrabOrderPage.bind(this, item.sd_id)}>
|
<View className='image-container' onClick={this.goToGrabOrderPage.bind(this, item.sd_id)}>
|
||||||
<Image style='width:100%;height:100%' src={URL.Base + item.file_path[0].thumb_path} />
|
<Image style='width:100%;height:100%' src={URL.Base + item.file_path[0].thumb_path} />
|
||||||
</View>
|
</View>
|
||||||
<View className='detail'>
|
<View className='detail'>
|
||||||
<View className='title'>{item.sd_title}</View>
|
<View className='title'>{item.sd_title}</View>
|
||||||
<View className='para'>{item.sd_desc}</View>
|
<View className='para'>{item.sd_desc}</View>
|
||||||
{item.state === '1' ? <View className='button' onClick={this.grabOrder.bind(this, item.sd_id)}>
|
{item.state === '1' ? <View className='button' onClick={this.grabOrder.bind(this, item.sd_id)}>
|
||||||
<Button size='mini' className='button-orange'>抢单</Button>
|
<Button size='mini' className='button-orange'>抢单</Button>
|
||||||
</View> : null || item.state === '2' ? <View className='button'>
|
</View> : null || item.state === '2' ? <View className='button'>
|
||||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||||
</View> : null || item.state === '3' ? <View className='button'>
|
</View> : null || item.state === '3' ? <View className='button'>
|
||||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||||
</View> : null}
|
</View> : null}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className='footer'>
|
<View className='footer'>
|
||||||
<View className='location'><AtIcon value='map-pin' size='12' color='black'></AtIcon>{item.user_address}</View>
|
<View className='location'><AtIcon value='map-pin' size='12' color='black'></AtIcon>{item.user_address}</View>
|
||||||
<View className='time'>更新日期:{item.update_date}</View>
|
<View className='time'>更新日期:{item.update_date}</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
</View>
|
||||||
|
}) : <View className='no-more-title'>没有更多了</View>
|
||||||
|
return (
|
||||||
|
<View className='allDemanding'>
|
||||||
|
{/* 模态框 */}
|
||||||
|
{modalMessageGrabElement}
|
||||||
|
|
||||||
|
<View className='page-section'>
|
||||||
|
{/* 供求状态选择 */}
|
||||||
|
<View>
|
||||||
|
<Picker mode='selector' rangeKey='name' range={this.state.demandingState} onChange={this.changeDemandingState}>
|
||||||
|
<View className='picker'>
|
||||||
|
<View className='title-box'>
|
||||||
|
<Text className='title'> 供求状态:</Text> <Text className='selected'>{this.state.demandingStateSelected.name}</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
</View>
|
||||||
|
</Picker>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View className='input-box'>
|
||||||
|
|
||||||
|
<AtInput
|
||||||
|
name='value'
|
||||||
|
title='需求标题:'
|
||||||
|
type='text'
|
||||||
|
placeholder='需求标题'
|
||||||
|
value={this.state.title}
|
||||||
|
onChange={this.titleChange.bind(this)}
|
||||||
|
border={false}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
{/* 开始和结束日期选择 */}
|
||||||
|
<View className='page-section-picker'>
|
||||||
|
<View className='picker-box'>
|
||||||
|
<View className='picker-wrapper'>
|
||||||
|
<Picker mode='date' className='picker-container' onChange={this.onStartDateChange}>
|
||||||
|
<View className='picker'>
|
||||||
|
<View className='title-box'>
|
||||||
|
<Text className='title'>开始日期:</Text> <Text className='date'>{this.state.startDateSel}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</Picker>
|
||||||
</View>
|
</View>
|
||||||
}) : <View className='no-more-title'>没有更多了</View>
|
|
||||||
return (
|
|
||||||
<View className='allDemanding'>
|
|
||||||
{/* 模态框 */}
|
|
||||||
{modalMessageGrabElement}
|
|
||||||
|
|
||||||
<View className='page-section'>
|
<View className='picker-wrapper'>
|
||||||
{/* 供求状态选择 */}
|
<Picker className='picker-container' mode='date' start={this.state.startDateSel} onChange={this.onEndDateChange}>
|
||||||
<View>
|
<View className='picker'>
|
||||||
<Picker mode='selector' rangeKey='name' range={this.state.demandingState} onChange={this.changeDemandingState}>
|
<View className='title-box'>
|
||||||
<View className='picker'>
|
<Text className='title'>结束日期:</Text> <Text className='date'>{this.state.endDateSel}</Text>
|
||||||
<View className='title-box'>
|
</View>
|
||||||
<Text className='title'> 供求状态:</Text> <Text className='selected'>{this.state.demandingStateSelected.name}</Text>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
</Picker>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
|
</Picker>
|
||||||
<View className='input-box'>
|
|
||||||
|
|
||||||
<AtInput
|
|
||||||
name='value'
|
|
||||||
title='需求标题:'
|
|
||||||
type='text'
|
|
||||||
placeholder='需求标题'
|
|
||||||
value={this.state.title}
|
|
||||||
onChange={this.titleChange.bind(this)}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
{/* 开始和结束日期选择 */}
|
|
||||||
<View className='page-section'>
|
|
||||||
<View className='picker-box'>
|
|
||||||
<View className='picker-wrapper'>
|
|
||||||
<Picker mode='date' className='picker-container' onChange={this.onStartDateChange}>
|
|
||||||
<View className='picker'>
|
|
||||||
<View className='title-box'>
|
|
||||||
<Text className='title'>开始日期:</Text> <Text className='date'>{this.state.startDateSel}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</Picker>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View className='picker-wrapper'>
|
|
||||||
<Picker className='picker-container' mode='date' start={this.state.startDateSel} onChange={this.onEndDateChange}>
|
|
||||||
<View className='picker'>
|
|
||||||
<View className='title-box'>
|
|
||||||
<Text className='title'>结束日期:</Text> <Text className='date'>{this.state.endDateSel}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</Picker>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
{/* 行业分类选择 */}
|
|
||||||
<InteractionComponent url={URL.GetIndustryTypeList} onPassDataToChild={this.getDataFromChild.bind(this)} selectedValue={this.state.industryTypeSelected}></InteractionComponent>
|
|
||||||
|
|
||||||
|
|
||||||
<View className='button-box'>
|
|
||||||
<View className='button' onClick={this.searchHanlder.bind(this)}>
|
|
||||||
<Button type='primary' size='mini' className='button-orange' >
|
|
||||||
<AtIcon value='search' size='12' color='white'></AtIcon>
|
|
||||||
搜索</Button>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View className='button' onClick={this.emptyFilter.bind(this)}>
|
|
||||||
<Button type='primary' size='mini' className='button-dark-red' >
|
|
||||||
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
|
||||||
清空</Button>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
{/* 供求页面的数据加载 */}
|
|
||||||
<View className='demanding-box'>
|
|
||||||
{allDemandingElementArray}
|
|
||||||
</View>
|
|
||||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
|
||||||
<CopyrightComponent></CopyrightComponent>
|
|
||||||
</View>
|
</View>
|
||||||
)
|
|
||||||
}
|
</View>
|
||||||
|
</View>
|
||||||
|
{/* 行业分类选择 */}
|
||||||
|
{platformChecker() ?
|
||||||
|
<InteractionComponent url={URL.GetIndustryTypeList}
|
||||||
|
onPassDataToChild={this.getDataFromChild.bind(this)}
|
||||||
|
selectedValue={this.state.industryTypeSelected}></InteractionComponent> :
|
||||||
|
<AliIndustryTypeInteraction url={URL.GetIndustryTypeList}
|
||||||
|
onPassDataToChild={this.getDataFromChild.bind(this)}
|
||||||
|
selectedValue={this.state.industryTypeSelected} />
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<View className='button-box'>
|
||||||
|
<View className='button' onClick={this.searchHanlder.bind(this)}>
|
||||||
|
<Button type='primary' size='mini' className='button-orange' >
|
||||||
|
<AtIcon value='search' size='12' color='white'></AtIcon>
|
||||||
|
搜索</Button>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View className='button' onClick={this.emptyFilter.bind(this)}>
|
||||||
|
<Button type='primary' size='mini' className='button-dark-red' >
|
||||||
|
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
||||||
|
清空</Button>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
{/* 供求页面的数据加载 */}
|
||||||
|
<View className='demanding-box'>
|
||||||
|
{allDemandingElementArray}
|
||||||
|
</View>
|
||||||
|
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||||
|
<CopyrightComponent></CopyrightComponent>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AllDemanding
|
export default AllDemanding
|
||||||
|
@ -17,31 +17,34 @@ $themeColor: #FF7142;
|
|||||||
.page-section{
|
.page-section{
|
||||||
border-bottom: 1Px solid #d6e4ef;
|
border-bottom: 1Px solid #d6e4ef;
|
||||||
|
|
||||||
.picker{
|
|
||||||
// padding: 24rpx 0;
|
|
||||||
.selected{
|
|
||||||
display: inline-block;
|
|
||||||
margin-left: 20%;
|
|
||||||
font-size: 32rpx
|
|
||||||
}
|
|
||||||
.date{
|
|
||||||
display: inline-block;
|
|
||||||
|
|
||||||
font-size: 32rpx
|
|
||||||
}
|
|
||||||
.title-box{
|
|
||||||
.title{
|
|
||||||
//color: #333;
|
|
||||||
margin-right:16rpx;
|
|
||||||
width:172rpx;
|
|
||||||
font-size:32rpx;
|
|
||||||
line-height:100px;
|
|
||||||
// vertical-align:middle;
|
|
||||||
text-align:left;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
.page-section-picker{
|
||||||
|
.picker{
|
||||||
|
// padding: 24rpx 0;
|
||||||
|
.selected{
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 20%;
|
||||||
|
font-size: 32rpx
|
||||||
|
}
|
||||||
|
.date{
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
font-size: 32rpx
|
||||||
|
}
|
||||||
|
.title-box{
|
||||||
|
.title{
|
||||||
|
//color: #333;
|
||||||
|
margin-right:16rpx;
|
||||||
|
width:172rpx;
|
||||||
|
font-size:32rpx;
|
||||||
|
line-height:100px;
|
||||||
|
// vertical-align:middle;
|
||||||
|
text-align:left;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.input-box{
|
.input-box{
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -28,7 +28,6 @@ class GoodsPublish extends Component {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments)
|
super(...arguments)
|
||||||
this.state = {
|
this.state = {
|
||||||
|
|
||||||
shopTypeSelected: { name: '选择店铺类型', id: '' },//已选的店铺分类
|
shopTypeSelected: { name: '选择店铺类型', id: '' },//已选的店铺分类
|
||||||
goodsTypeSelected: { name: '选择商品分类', id: '' },// 已选的商品分类
|
goodsTypeSelected: { name: '选择商品分类', id: '' },// 已选的商品分类
|
||||||
productName: '',
|
productName: '',
|
||||||
|
@ -147,13 +147,11 @@ class Home extends Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
getUserLocation() {
|
getUserLocation() {
|
||||||
|
|
||||||
if (process.env.TARO_ENV === 'alipay') {
|
if (process.env.TARO_ENV === 'alipay') {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
my.getLocation({
|
my.getLocation({
|
||||||
success(res) {
|
success(res) {
|
||||||
my.hideLoading();
|
my.hideLoading();
|
||||||
|
|
||||||
resolve(res)
|
resolve(res)
|
||||||
},
|
},
|
||||||
fail(res) {
|
fail(res) {
|
||||||
@ -164,9 +162,6 @@ class Home extends Component {
|
|||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else if (process.env.TARO_ENV === 'weapp') {
|
} else if (process.env.TARO_ENV === 'weapp') {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
Taro.getLocation({
|
Taro.getLocation({
|
||||||
@ -182,12 +177,8 @@ class Home extends Component {
|
|||||||
reject(res)
|
reject(res)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -312,25 +303,24 @@ class Home extends Component {
|
|||||||
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
// // 页面加载后 得到首页的基本信息和推荐店铺的信息
|
// 页面加载后 得到首页的基本信息和推荐店铺的信息
|
||||||
// showLoading({ title: '加载中' })
|
showLoading({ title: '加载中' })
|
||||||
// // promise 返回经纬度给state 然后调用函数
|
// promise 返回经纬度给state 然后调用函数
|
||||||
// this.getUserLocation().then(res => {
|
|
||||||
// this.setState({
|
|
||||||
// latitude: res.latitude,
|
|
||||||
// longitude: res.longitude
|
|
||||||
// }, () => {
|
|
||||||
// this.getShops({})
|
|
||||||
// this.getHomeCategoriesInfo()
|
|
||||||
// })
|
|
||||||
// }).catch(err => {
|
|
||||||
// this.getShops({})
|
|
||||||
// this.getHomeCategoriesInfo()
|
|
||||||
// })
|
|
||||||
this.getShops({})
|
this.getShops({})
|
||||||
this.getHomeCategoriesInfo()
|
this.getHomeCategoriesInfo()
|
||||||
// 本地缓存没有userid时 从新登入
|
|
||||||
Taro.getStorageSync('userInfo').user_id ? true : weChatLogin()
|
Taro.getStorageSync('userInfo').user_id ? true : weChatLogin()
|
||||||
|
|
||||||
|
this.getUserLocation().then(res => {
|
||||||
|
this.setState({
|
||||||
|
latitude: res.latitude,
|
||||||
|
longitude: res.longitude
|
||||||
|
})
|
||||||
|
}).catch(err => {
|
||||||
|
Taro.showToast({
|
||||||
|
title: '定位获取失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
|
@ -32,9 +32,11 @@ class Login extends Component {
|
|||||||
loginHandler() {
|
loginHandler() {
|
||||||
if (this.state.username && this.state.password) {
|
if (this.state.username && this.state.password) {
|
||||||
standardLogin(this.state.username, this.state.password).then(res => {
|
standardLogin(this.state.username, this.state.password).then(res => {
|
||||||
Taro.reLaunch({
|
setTimeout(() => {
|
||||||
url: '/pages/home/home'
|
Taro.reLaunch({
|
||||||
})
|
url: '/pages/home/home'
|
||||||
|
})
|
||||||
|
}, 1000);
|
||||||
}).catch(res => {
|
}).catch(res => {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.msg,
|
title: res.data.msg,
|
||||||
@ -65,7 +67,7 @@ class Login extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
console.log(this.props, nextProps)
|
// console.log(this.props, nextProps)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() { }
|
componentWillUnmount() { }
|
||||||
|
@ -311,7 +311,8 @@ class MyGoodList extends Component {
|
|||||||
'X-Requested-With': 'XMLHttpRequest'
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
let responseData = JSON.parse(res.data)
|
console.log('res',res)
|
||||||
|
let responseData = platformChecker()? JSON.parse(res.data):res.data
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
if (responseData.err_code === 0) {
|
if (responseData.err_code === 0) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
|
@ -479,8 +479,6 @@ class MySupplyDemand extends Component {
|
|||||||
<CopyrightComponent></CopyrightComponent>
|
<CopyrightComponent></CopyrightComponent>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|
||||||
<MovableView className='movable-point' x={this.state.screenWidth} y={this.state.screenHeight} style='opacity:0.3' direction='all' >
|
<MovableView className='movable-point' x={this.state.screenWidth} y={this.state.screenHeight} style='opacity:0.3' direction='all' >
|
||||||
<View className='movable-point' onClick={this.goToCenterPage.bind(this)}> 个人中心</View>
|
<View className='movable-point' onClick={this.goToCenterPage.bind(this)}> 个人中心</View>
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -60,6 +60,7 @@ $themeColor:#FF7142;
|
|||||||
.interaction{
|
.interaction{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.homepage-link{
|
.homepage-link{
|
||||||
|
@ -4,60 +4,59 @@ import { setGlobalStorage, getGlobalStorage } from './getSetStoage';
|
|||||||
|
|
||||||
|
|
||||||
const setUserInfoToStorage = () => {
|
const setUserInfoToStorage = () => {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: URL.ShopWxStore,
|
url: URL.ShopWxStore,
|
||||||
header: {
|
header: {
|
||||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.data.err_msg === 'success') {
|
|
||||||
setGlobalStorage('user_identity', { username: res.data.otherData.userName, userphone: res.data.otherData.userPhone })
|
|
||||||
|
|
||||||
} else {
|
if (res.data.err_msg === 'success') {
|
||||||
Taro.showToast({
|
setGlobalStorage('user_identity', { username: res.data.otherData.userName, userphone: res.data.otherData.userPhone })
|
||||||
title: res.data.err_msg,
|
|
||||||
icon: 'none',
|
} else {
|
||||||
duration: 1500
|
Taro.showToast({
|
||||||
})
|
title: res.data.err_msg,
|
||||||
}
|
icon: 'none',
|
||||||
|
duration: 1500
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
export default function standardLogin(username, password) {
|
export default function standardLogin(username, password) {
|
||||||
return new Promise((resolve,reject)=>{
|
return new Promise((resolve, reject) => {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: URL.StandardLogin,
|
url: URL.StandardLogin,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: {
|
data: {
|
||||||
username: username,
|
username: username,
|
||||||
password: password,
|
password: password,
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
'content-type': 'application/x-www-form-urlencoded',
|
||||||
'X-Requested-With': 'XMLHttpRequest'
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('普通登录',res)
|
console.log('普通登录', res)
|
||||||
if (res.data.err_code === 0) {
|
if (res.data.err_code === 0) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '登入成功',
|
title: '登入成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
})
|
})
|
||||||
|
setGlobalStorage('session_id', res.data.session_id)
|
||||||
setGlobalStorage('session_id', res.data.session_id)
|
setGlobalStorage('shopInfo', res.data.shop_info)
|
||||||
setGlobalStorage('shopInfo', res.data.shop_info)
|
setGlobalStorage('userInfo', res.data.user_info)
|
||||||
setGlobalStorage('userInfo', res.data.user_info)
|
setGlobalStorage('accountInfo', { username: username, password: password })
|
||||||
setGlobalStorage('accountInfo', { username: username, password: password })
|
setUserInfoToStorage()
|
||||||
setUserInfoToStorage()
|
resolve('success')
|
||||||
resolve('success')
|
} else {
|
||||||
} else {
|
reject(res)
|
||||||
|
}
|
||||||
reject(res)
|
})
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import URL from '../serviceAPI.config'
|
import URL from '../serviceAPI.config'
|
||||||
import { getGlobalStorage } from './getSetStoage';
|
import { getGlobalStorage } from './getSetStoage';
|
||||||
|
import platformChecker from './plaformChecker'
|
||||||
|
|
||||||
//用户信息姓名和电话号码接口
|
//用户信息姓名和电话号码接口
|
||||||
const setUserInfoToStorage = () => {
|
const setUserInfoToStorage = () => {
|
||||||
@ -28,54 +29,61 @@ const setUserInfoToStorage = () => {
|
|||||||
|
|
||||||
// 异步函数登入api
|
// 异步函数登入api
|
||||||
export default function wechatLogin() {
|
export default function wechatLogin() {
|
||||||
return new Promise((resolve,reject)=>{
|
//微信登录的时候查看小程序端是什么平台
|
||||||
Taro.login({
|
if (platformChecker()) {
|
||||||
success(res) {
|
return new Promise((resolve, reject) => {
|
||||||
if (res.code) {
|
Taro.login({
|
||||||
// 发起网络请求
|
success(res) {
|
||||||
console.log('手机端微信code:', res.code)
|
if (res.code) {
|
||||||
Taro.request({
|
// 发起网络请求
|
||||||
url: URL.Login,
|
Taro.request({
|
||||||
method: 'POST',
|
url: URL.Login,
|
||||||
dataType: 'json',
|
method: 'POST',
|
||||||
data: {
|
dataType: 'json',
|
||||||
code: res.code
|
data: {
|
||||||
},
|
code: res.code
|
||||||
header: {
|
},
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
header: {
|
||||||
}
|
'content-type': 'application/x-www-form-urlencoded',
|
||||||
})
|
}
|
||||||
.then(response => {
|
})
|
||||||
if (response.data.err_code === 0) {
|
.then(response => {
|
||||||
console.log('微信登入成功', response)
|
if (response.data.err_code === 0) {
|
||||||
Taro.showToast({
|
console.log('微信登入成功', response)
|
||||||
title: '微信登入成功',
|
Taro.showToast({
|
||||||
icon: 'success',
|
title: '微信登入成功',
|
||||||
duration: 2000
|
icon: 'success',
|
||||||
})
|
duration: 2000
|
||||||
Taro.setStorageSync('session_id', response.data.session_id)
|
})
|
||||||
Taro.setStorageSync('shopInfo', response.data.shop_info)
|
Taro.setStorageSync('session_id', response.data.session_id)
|
||||||
Taro.setStorageSync('userInfo', response.data.user_info)
|
Taro.setStorageSync('shopInfo', response.data.shop_info)
|
||||||
setUserInfoToStorage()
|
Taro.setStorageSync('userInfo', response.data.user_info)
|
||||||
resolve('微信登入成功')
|
setUserInfoToStorage()
|
||||||
} else {
|
resolve('微信登入成功')
|
||||||
Taro.showToast({
|
} else {
|
||||||
title: '微信登入失败',
|
Taro.showToast({
|
||||||
icon: 'none',
|
title: '微信登入失败',
|
||||||
duration: 2000
|
icon: 'none',
|
||||||
})
|
duration: 2000
|
||||||
reject('微信登入失败')
|
})
|
||||||
// Taro.clearStorageSync()
|
reject('微信登入失败')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
else {
|
||||||
}
|
console.log('微信登录失败!' + res.errMsg)
|
||||||
else {
|
}
|
||||||
console.log('登录失败!' + res.errMsg)
|
}
|
||||||
}
|
})
|
||||||
}
|
})
|
||||||
})
|
|
||||||
})
|
}else{
|
||||||
|
return new Promise((resolve, reject)=>{
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user