v 1.0.0
This commit is contained in:
parent
59a4a40eb4
commit
09b20e0ef3
18
src/app.js
18
src/app.js
@ -2,6 +2,7 @@ import '@tarojs/async-await'
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { Provider } from '@tarojs/redux'
|
||||
import Home from './pages/home'
|
||||
|
||||
import configStore from './store'
|
||||
|
||||
import './app.scss'
|
||||
@ -15,7 +16,8 @@ import './app.scss'
|
||||
const store = configStore()
|
||||
|
||||
class App extends Component {
|
||||
|
||||
|
||||
isTrue=Taro.getStorageSync('session_id')?true:false
|
||||
config = {
|
||||
pages: [
|
||||
//'pages/index/index', // index页面
|
||||
@ -36,9 +38,14 @@ class App extends Component {
|
||||
'pages/myNeedsView/myNeedsView',// 单个需求查看页面
|
||||
'pages/myNeedsEdit/myNeedsEdit',// 单个需求编辑页面
|
||||
'pages/myNeedsPublish/myNeedsPublish',// 需求发布
|
||||
|
||||
|
||||
// 'pages/shopDescription/shopDescription',
|
||||
],
|
||||
permission: {
|
||||
"scope.userLocation": {
|
||||
"desc": "你的位置信息将用于小程序位置接口的效果展示"
|
||||
}
|
||||
},
|
||||
window: {
|
||||
backgroundTextStyle: 'light',
|
||||
navigationBarBackgroundColor: '#fff',
|
||||
@ -49,7 +56,7 @@ class App extends Component {
|
||||
},
|
||||
|
||||
tabBar: {
|
||||
list: [{
|
||||
list:[{
|
||||
pagePath: "pages/home/home",
|
||||
text: "首页",
|
||||
iconPath: "./icons/home.png",
|
||||
@ -84,10 +91,11 @@ class App extends Component {
|
||||
borderStyle: 'black'
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
componentDidMount() { }
|
||||
componentDidMount() {
|
||||
console.log('this.tabBar', this)
|
||||
}
|
||||
|
||||
componentDidShow() { }
|
||||
|
||||
|
47
src/component/clientTabBarComponent/clientTabBarComponent.js
Normal file
47
src/component/clientTabBarComponent/clientTabBarComponent.js
Normal file
@ -0,0 +1,47 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View } from '@tarojs/components'
|
||||
|
||||
import { AtTabBar } from 'taro-ui'
|
||||
import './clientTabBarComponent.scss'
|
||||
|
||||
|
||||
|
||||
class ClientTabBarComponent extends Component {
|
||||
config = {
|
||||
navigationBarTitleText: '业主底栏导航'
|
||||
}
|
||||
|
||||
//http://ihome6.com/Shop-supplyShops
|
||||
componentDidMount() {
|
||||
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
}
|
||||
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View className='clientTabBarComponent'>
|
||||
<AtTabBar
|
||||
fixed
|
||||
tabList={[
|
||||
{ title: '首页', iconType: 'bullet-list', text: 'new' },
|
||||
{ title: '需求发布', iconType: 'camera' },
|
||||
{ title: '我的需求', iconType: 'folder', text: '100', max: '99' },
|
||||
{ title: '个人中心', iconType: 'folder', text: '100', max: '99' },
|
||||
]}
|
||||
onClick={this.handleClick.bind(this)}
|
||||
current={this.state.current}
|
||||
/>
|
||||
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default ClientTabBarComponent
|
@ -123,7 +123,6 @@ class VoucherPoster extends Component {
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
console.log('i am poster')
|
||||
return (
|
||||
<View className='voucherEventPopUpComponent'>
|
||||
{/* <!-- The Modal --> */}
|
||||
|
@ -6,7 +6,7 @@
|
||||
border-radius:50%;
|
||||
text-align:center;
|
||||
position:fixed;
|
||||
bottom:3%;
|
||||
bottom:10%;
|
||||
right:5%;
|
||||
font-size:25rpx;
|
||||
.box{
|
||||
|
78
src/component/sellerTabBarComponent/sellerTabBarComponent.js
Normal file
78
src/component/sellerTabBarComponent/sellerTabBarComponent.js
Normal file
@ -0,0 +1,78 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View } from '@tarojs/components'
|
||||
|
||||
import { AtTabBar } from 'taro-ui'
|
||||
import './sellerTabBarComponent.scss'
|
||||
|
||||
|
||||
|
||||
class SellerTabBarComponent extends Component {
|
||||
config = {
|
||||
navigationBarTitleText: '店铺底栏导航'
|
||||
}
|
||||
constructor(){
|
||||
this.state = {
|
||||
current: 0,
|
||||
options:[
|
||||
{ title: '首页', url: '/pages/home/home', iconType: 'bullet-list', text: 'new' },
|
||||
{ title: '商品发布', url: '/pages/goodsPublish/goodsPublish', iconType: 'camera' },
|
||||
{ title: '供求发布', url: '/pages/supplyDemandPublish/supplyDemandPublish', iconType: 'folder', text: '100', max: '99' },
|
||||
{ title: '我的供求', url: '/pages/mySupplyDemand/mySupplyDemand', iconType: 'folder', text: '100', max: '99' },
|
||||
{ title: '我的需求', url: '/pages/myNeeds/myNeeds', iconType: 'folder', text: '100', max: '99' }
|
||||
]
|
||||
|
||||
}
|
||||
}
|
||||
handleClick(value) {
|
||||
|
||||
this.setState({
|
||||
current: value
|
||||
})
|
||||
|
||||
let path = this.state.options[value].url
|
||||
Taro.navigateTo({
|
||||
url: path,
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
}
|
||||
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
console.log('this.props.currentUrl',this.props.currentUrl)
|
||||
if(this.props.currentUrl==='pages/home/home'){
|
||||
this.setState({
|
||||
current:0
|
||||
})
|
||||
}else if(this.props.currentUrl==='pages/supplyDemandPublish/supplyDemandPublish'){
|
||||
this.setState({
|
||||
current:2
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View className='sellerTabBarComponent'>
|
||||
<AtTabBar
|
||||
fixed
|
||||
tabList={this.state.options}
|
||||
onClick={this.handleClick.bind(this)}
|
||||
current={this.state.current}
|
||||
/>
|
||||
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default SellerTabBarComponent
|
@ -5,6 +5,7 @@ import FilteredShopComponent from '../../component/filteredShopComponent/filtere
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
|
||||
|
||||
import LoginService from '../../util/LoginService'
|
||||
import weChatLogin from '../../util/weChatLogin'
|
||||
import URL from '../../serviceAPI.config'
|
||||
@ -12,6 +13,7 @@ import './home.scss'
|
||||
|
||||
|
||||
|
||||
|
||||
class Home extends Component {
|
||||
|
||||
config = {
|
||||
@ -37,7 +39,11 @@ class Home extends Component {
|
||||
isAddToList: false,
|
||||
parentClass: '',// 大类的id
|
||||
childClass: '-1',//小类的id
|
||||
supplyLevel: 1,// 筛选1是小类或者2是大类
|
||||
supplyLevel: 1,// 筛选1是小类或者2是大类,
|
||||
latitude: '',
|
||||
longitude: '',
|
||||
isShopOwner: false
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,7 +102,9 @@ class Home extends Component {
|
||||
parent_supply_class: parent_supply_class, //父级class id
|
||||
supply_class: supply_class,// 子级class id
|
||||
supply_level: supply_level,// 层级
|
||||
action: action
|
||||
action: action,
|
||||
latitude: this.state.latitude,
|
||||
longitude: this.state.longitude,
|
||||
})
|
||||
},
|
||||
header: {
|
||||
@ -133,6 +141,25 @@ class Home extends Component {
|
||||
}
|
||||
)
|
||||
}
|
||||
getUserLocation() {
|
||||
return new Promise((resolve, reject) => {
|
||||
Taro.getLocation({
|
||||
type: 'wgs84', // 返回可以用于wx.openLocation的经纬度
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(res) {
|
||||
Taro.showToast({
|
||||
title: '获取定位失败',
|
||||
icon: 'none'
|
||||
})
|
||||
reject(res)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 微信用户设置
|
||||
@ -263,18 +290,56 @@ class Home extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
// 页面加载后 得到首页的基本信息和推荐店铺的信息
|
||||
// Taro.setTabBarItem({
|
||||
// index: 2,
|
||||
// text: 'client',
|
||||
// iconPath: './icons/needs-actived.png',
|
||||
// selectedIconPath: './icon/needs.png',
|
||||
// success: function (res) {
|
||||
// console.log('indexBarSuccess3', res)
|
||||
// },
|
||||
|
||||
// fail: function (res) {
|
||||
// console.log('indexBarFail3', res)
|
||||
// },
|
||||
// complete: function (res) {
|
||||
// console.log('indexBarComplete3', res)
|
||||
// }
|
||||
// })
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
if(!Taro.getStorageSync('userInfo').user_id){
|
||||
weChatLogin()
|
||||
// promise 返回经纬度给state 然后调用函数
|
||||
this.getUserLocation().then(res => {
|
||||
this.setState({
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude
|
||||
}, () => {
|
||||
this.getShops({})
|
||||
this.getHomeCategoriesInfo()
|
||||
})
|
||||
}).catch(err => {
|
||||
this.getShops({})
|
||||
this.getHomeCategoriesInfo()
|
||||
})
|
||||
// 本地缓存没有userid时 从新登入
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
weChatLogin().then(res => {
|
||||
Taro.getStorageSync('shopInfo').shop_id ? this.setState({
|
||||
isShopOwner: true
|
||||
}) : this.setState({
|
||||
isShopOwner: false
|
||||
})
|
||||
|
||||
}).catch(err => {
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.getStorageSync('shopInfo').shop_id ? this.setState({
|
||||
isShopOwner: true
|
||||
}) : this.setState({
|
||||
isShopOwner: false
|
||||
})
|
||||
}
|
||||
this.getShops({})
|
||||
this.getHomeCategoriesInfo()
|
||||
|
||||
// this.login().then(() => {
|
||||
// this.getShops({})
|
||||
// this.getHomeCategoriesInfo()
|
||||
// }).catch(err => console.log('微信登入失败:', err))
|
||||
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
@ -283,7 +348,7 @@ class Home extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
|
||||
console.log('home', this.$scope.route)
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
@ -314,6 +379,7 @@ class Home extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
console.log('this.state.isShopOwner', this.state.isShopOwner)
|
||||
// 提示模态弹窗element
|
||||
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpen}>
|
||||
<AtModalHeader>提示</AtModalHeader>
|
||||
@ -382,7 +448,7 @@ class Home extends Component {
|
||||
shop={item}
|
||||
key={index}
|
||||
categoryLevel={this.state.supplyLevel}
|
||||
classId={this.state.parentClass===this.state.childClass?this.state.parentClass:this.state.childClass}
|
||||
classId={this.state.parentClass === this.state.childClass ? this.state.parentClass : this.state.childClass}
|
||||
></FilteredShopComponent>
|
||||
}) : <View className='no-more-title top'> 没有更多了</View>
|
||||
const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => {
|
||||
@ -390,7 +456,7 @@ class Home extends Component {
|
||||
<View className='text'>{item.class_name}</View>
|
||||
</SwiperItem>
|
||||
}) : null
|
||||
|
||||
|
||||
return (
|
||||
<View className='home'>
|
||||
|
||||
@ -519,9 +585,7 @@ class Home extends Component {
|
||||
<View className='bottom-nav-box'>
|
||||
{/* <BottomNav otherData={this.state.otherData} /> */}
|
||||
</View>
|
||||
|
||||
|
||||
|
||||
{/* {this.state.isShopOwner ? <SellerTabBarComponent currentUrl={currentUrl} /> : <ClientTabBarComponent currentUrl={currentUrl} />} */}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
BIN
src/pages/home/needs-actived.png
Normal file
BIN
src/pages/home/needs-actived.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
src/pages/home/needs.png
Normal file
BIN
src/pages/home/needs.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
@ -1,6 +1,6 @@
|
||||
|
||||
const LOCALURL = "http://192.168.1.230/"
|
||||
//const LOCALURL = "https://www.ihome6.com/"
|
||||
const LOCALURL = "http://192.168.1.230/"
|
||||
// const LOCALURL = "https://www.ihome6.com/"
|
||||
const URL = {
|
||||
Base: LOCALURL,
|
||||
Login: LOCALURL + 'Applet-login', //登入接口
|
||||
|
@ -18,373 +18,552 @@ bug: 商品编辑 增加图片后 图片顺序乱了
|
||||
|
||||
等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口
|
||||
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components'
|
||||
import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import FilteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent'
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
|
||||
import { Picker } from 'taro-ui'
|
||||
import LoginService from '../../util/LoginService'
|
||||
import weChatLogin from '../../util/weChatLogin'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './home.scss'
|
||||
|
||||
import './goodsTypeInteractionComp.scss'
|
||||
import loginExpired from '../../util/loginExpired'
|
||||
|
||||
let maxDepth = 0
|
||||
let initialDataArray = []
|
||||
class GoodsTypeInteractionComp extends Component {
|
||||
|
||||
config = {
|
||||
navigationBarTitleText: 'goodsTypeInteractionComp'
|
||||
class Home extends Component {
|
||||
|
||||
config = {
|
||||
navigationBarTitleText: '首页',
|
||||
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.state = {
|
||||
shops: [], // 推荐店铺的信息
|
||||
ads: [], //广告图片数组
|
||||
categories: [],// 大类
|
||||
subCate: [], //小类
|
||||
demanding: [],// 业主需求
|
||||
otherData: [], // 底部导航栏
|
||||
isOpen: false, // 抢单消息提示
|
||||
grabOrderId: '',//抢到订单的id
|
||||
userName: Taro.getStorageSync('user_identity').userName || '',//用户名字
|
||||
userPhone: Taro.getStorageSync('user_identity').userPhone || '',// 用户电话
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex: 1,//下拉加载页面数
|
||||
isAddToList: false,
|
||||
parentClass: '',// 大类的id
|
||||
childClass: '-1',//小类的id
|
||||
supplyLevel: 1,// 筛选1是小类或者2是大类,
|
||||
latitude: '',
|
||||
longitude: ''
|
||||
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
}
|
||||
|
||||
this.state = {
|
||||
///---行业分类 开始
|
||||
initailMultiArray: [[{ class_name: '选择商品分类', class_id: '' }], [], []], // 初始化底部数据
|
||||
multiIndex: [0, 0, 0, 0],// 默认联动列数为4个并且每一列都是第一行
|
||||
interactionMultiArray: [],// 联动
|
||||
// onPullDownRefresh() {
|
||||
// Taro.showLoading({ title: '加载中' })
|
||||
|
||||
// this.login().then(() => {
|
||||
// this.getShops({})
|
||||
// this.getHomeCategoriesInfo()
|
||||
// }).catch(err => console.log('微信登入失败:', err))
|
||||
|
||||
// Taro.stopPullDownRefresh()
|
||||
// }
|
||||
|
||||
|
||||
///---行业分类 结束
|
||||
//api得到首页的信息
|
||||
getHomeCategoriesInfo() {
|
||||
Taro.request({
|
||||
url: URL.ShopWxStore,
|
||||
header: {
|
||||
// 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
console.log('首页基本信息', res)
|
||||
if (res.data.err_msg === 'success') {
|
||||
|
||||
this.setState({
|
||||
ads: res.data.data.adsLb,
|
||||
categories: [res.data.data.supplyClass[0], Object.values(res.data.data.supplyClass[1])],
|
||||
demanding: res.data.data.demand.supplys,
|
||||
otherData: res.data.otherData,
|
||||
userName: res.data.otherData.userName,
|
||||
userPhone: res.data.otherData.userPhone,
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
//商品目录请求api GetShopCategoryList
|
||||
getProductCateList(url) {
|
||||
Taro.request({
|
||||
url: url,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
}
|
||||
// api 得到推荐商店的信息
|
||||
getShops({ parent_supply_class = this.state.parentClass, supply_class = this.state.childClass, supply_level = this.state.supplyLevel, curr_page = 1,
|
||||
page_count = 5, action = "2" }) {
|
||||
Taro.request({
|
||||
url: URL.ShopSupplyShops,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
param: JSON.stringify({
|
||||
curr_page: curr_page,
|
||||
page_count: page_count,
|
||||
parent_supply_class: parent_supply_class, //父级class id
|
||||
supply_class: supply_class,// 子级class id
|
||||
supply_level: supply_level,// 层级
|
||||
action: action,
|
||||
latitude:this.state.latitude,
|
||||
longitude:this.state.longitude,
|
||||
})
|
||||
.then(res => {
|
||||
if (res.data.err_code === 0) {
|
||||
console.log('商品分类目录', res)
|
||||
|
||||
const recursionInteractionData=this.recursionInteraction(res.data.data)
|
||||
this.recursionInitialized(res.data.data) //
|
||||
console.log('initialDataArray',initialDataArray.reverse())
|
||||
this.setState({
|
||||
interactionMultiArray: recursionInteractionData,
|
||||
multiIndex: this.recursionDepth(res.data.data),
|
||||
initailMultiArray:initialDataArray.reverse()
|
||||
}, () => {
|
||||
initialDataArray=[]// 把全局变变量赋值给state之后,初始化商品分类为空, 不然第二次进去的时候会自动添加进去
|
||||
// console.log('联动数据', this.state.interactionMultiArray)
|
||||
// console.log('初始化数据', this.state.initailMultiArray)
|
||||
|
||||
|
||||
}) // 用递归来整理无限层次的数据
|
||||
// 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,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
.catch(error => {
|
||||
console.log('商品分类请求错误', error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//联动确认
|
||||
bindMultiPickerChange(e) {
|
||||
// 如果没有上商品 那就不执行
|
||||
if(Taro.getStorageSync('shopInfo').shop_id){
|
||||
this.setState({
|
||||
multiIndex: e.detail.value.map(item => { if (item === null) { item = 0 } return item })
|
||||
}, () => {
|
||||
// console.log('picker发送选择改变,携带值为', this.state.multiIndex)
|
||||
this.returnResultToParent()
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
returnResultToParent() {
|
||||
let selected = this.state.interactionMultiArray
|
||||
for (let index of this.state.multiIndex) {
|
||||
if (selected[index].children[0].id) {
|
||||
selected = selected[index].children
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
console.log('所有店铺的信息', res)
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_code === 0) {
|
||||
if (this.state.isAddToList) {
|
||||
if (res.data.shops) {
|
||||
this.setState({ shops: this.state.shops.concat(res.data.shops), isAddToList: false })
|
||||
} else {
|
||||
this.props.onPassDataToChild(selected[index])
|
||||
break
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
} else {
|
||||
res.data.shops ? this.setState({ shops: res.data.shops }) : this.setState({ shops: [] })
|
||||
}
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
this.setState({ isAddToList: false })
|
||||
}
|
||||
)
|
||||
}
|
||||
getUserLocation(that) {
|
||||
Taro.getLocation({
|
||||
type: 'gcj02', // 返回可以用于wx.openLocation的经纬度
|
||||
success(res) {
|
||||
that.setState({
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude
|
||||
},()=>{
|
||||
that.getShops({})
|
||||
that.getHomeCategoriesInfo()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 微信用户设置
|
||||
// wxUserSetting() {
|
||||
// Taro.getSetting({
|
||||
// success(res) {
|
||||
// if (res.authSetting['scope.userInfo']) {
|
||||
// console.log('personal info', res)
|
||||
// Taro.authorize({
|
||||
// scope: 'scope.userInfo',
|
||||
// success() {
|
||||
// // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
|
||||
// // Taro.getUserInfo({
|
||||
// // success(res1) {
|
||||
// // console.log('res1',res1)
|
||||
// // }
|
||||
// // })
|
||||
// console.log('权限允许')
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// api 抢单请求
|
||||
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=' + Taro.getStorageSync('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg === 'success' ? '抢单成功' : res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
|
||||
console.log('抢单请求:', res)
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
// 点击大类icon
|
||||
onClickParentCate(item) {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ parentClass: item.class_id, childClass: item.class_id, supplyLevel: 1, subCate: item.children || [] }, () => {
|
||||
this.getShops({})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
// 点击子类
|
||||
onClickChildCate(item) {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ childClass: item.class_id, supplyLevel: 2 }, () => {
|
||||
this.getShops({})
|
||||
|
||||
})
|
||||
// this.getShops(item.parent_class_id, item.class_id, 2)
|
||||
|
||||
}
|
||||
scrollToSubCate(item) {
|
||||
|
||||
Taro.pageScrollTo({
|
||||
scrollTop: 410,
|
||||
duration: 300
|
||||
})
|
||||
this.onClickParentCate(item)
|
||||
}
|
||||
// 转到其他页面
|
||||
goToAllDemandingPage() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
// 递归整理无限层初始数据,将整理好的数据赋值给initialDataArray
|
||||
recursionInitialized(data) {
|
||||
const arrayTem = []
|
||||
if (data.length) {
|
||||
for (let item of data) {
|
||||
arrayTem.push({ name: item.class_name, id: item.class_id })
|
||||
}
|
||||
}
|
||||
if(data[0].children.length){
|
||||
this.recursionInitialized(data[0].children)
|
||||
}
|
||||
initialDataArray.push(arrayTem)
|
||||
return arrayTem
|
||||
Taro.navigateTo({
|
||||
url: '/pages/allDemanding/allDemanding'
|
||||
})
|
||||
}
|
||||
|
||||
grabOrderId(Id) {
|
||||
this.setState({ isOpen: true, grabOrderId: Id })
|
||||
}
|
||||
handleGrabModalClose() {
|
||||
this.setState({ isOpen: false })
|
||||
}
|
||||
handleGrabModalCancel() {
|
||||
this.setState({ isOpen: false })
|
||||
}
|
||||
handleGrabConfirm() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
LoginService()
|
||||
}
|
||||
this.setState({ isOpen: false })
|
||||
// 确认抢单之后
|
||||
this.GrabDemand({ demandId: this.state.grabOrderId })
|
||||
}
|
||||
|
||||
|
||||
// 导航去抢单页面
|
||||
goToGrabOrderPage(orderId) {
|
||||
Taro.navigateTo({
|
||||
|
||||
// 递归整理无限层联动数据
|
||||
recursionInteraction(data) {
|
||||
let arrayTem = []
|
||||
for (let items of data) {
|
||||
arrayTem.push({ name: items.class_name, id: items.class_id })
|
||||
if (items.children) {
|
||||
arrayTem[arrayTem.length - 1].children = this.recursionInteraction(items.children)
|
||||
} else {
|
||||
arrayTem[arrayTem.length - 1].children = [{ name: '', id: '' }]
|
||||
}
|
||||
}
|
||||
return arrayTem // 返回联动数据
|
||||
// return arrayTem
|
||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
|
||||
})
|
||||
}
|
||||
goToMyNeedsPublish() {
|
||||
// 传参数给myNeedsPublish页面- 显示效果图选项
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish?id=1'
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
// 页面加载后 得到首页的基本信息和推荐店铺的信息
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
this.getUserLocation(this)
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
weChatLogin()
|
||||
}
|
||||
// 递归整理无限层初始数据
|
||||
// recursionInitialized(data) {
|
||||
// const arrayTem = []
|
||||
// const childrenHolderArray = []
|
||||
// if (data.length) {
|
||||
// for (let item of data) {
|
||||
// arrayTem.push({ name: item.class_name, id: item.class_id })
|
||||
// item.children ? childrenHolderArray.push(...item.children) : null
|
||||
// }
|
||||
// this.recursionInitialized(childrenHolderArray)
|
||||
// }
|
||||
|
||||
|
||||
// arrayTem.length ? initialDataArray.push(arrayTem) : null // 数组为空则不添加
|
||||
// return initialDataArray
|
||||
// }
|
||||
|
||||
// 递归整理无限层初始数据
|
||||
recursionDepth(data) {
|
||||
const arrayTem = []
|
||||
const childrenHolderArray = []
|
||||
if (data.length) {
|
||||
for (let item of data) {
|
||||
arrayTem.push({ name: item.class_name, id: item.class_id })
|
||||
item.children ? childrenHolderArray.push(...item.children) : null
|
||||
}
|
||||
this.recursionDepth(childrenHolderArray)
|
||||
maxDepth += 1
|
||||
}
|
||||
return new Array(maxDepth).fill(0)
|
||||
// this.login().then(() => {
|
||||
// this.getShops({})
|
||||
// this.getHomeCategoriesInfo()
|
||||
// }).catch(err => console.log('微信登入失败:', err))
|
||||
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
|
||||
// 微信用户信息
|
||||
onGotUserInfo(e) {
|
||||
console.log(e.detail.errMsg)
|
||||
console.log(e.detail.userInfo)
|
||||
console.log(e.detail.rawData)
|
||||
}
|
||||
// 页面位置
|
||||
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() {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ loadMorePageIndex: this.state.loadMorePageIndex + 1, isAddToList: true }, () => {
|
||||
this.getShops({ curr_page: this.state.loadMorePageIndex, })
|
||||
})
|
||||
}
|
||||
|
||||
// 触动联动筛选
|
||||
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
|
||||
}
|
||||
data.multiIndex[e.detail.column] = e.detail.value
|
||||
render() {
|
||||
// 提示模态弹窗element
|
||||
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpen}>
|
||||
<AtModalHeader>提示</AtModalHeader>
|
||||
<AtModalContent>
|
||||
确认抢单?
|
||||
</AtModalContent>
|
||||
<AtModalAction> <Button onClick={this.handleGrabModalCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleGrabConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
</AtModal>
|
||||
|
||||
const demandingElemensArray = this.state.demanding.length ? this.state.demanding.map((item, index) => {
|
||||
|
||||
if (e.detail.column == 0) {
|
||||
for (let index in data.multiArray[0]) {
|
||||
const indexNumber = Number(index)
|
||||
if (indexNumber === data.multiIndex[0]) {
|
||||
// data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[indexNumber].children[0].children
|
||||
// data.multiArray[3] = this.state.interactionMultiArray[indexNumber].children[0].children[0].children
|
||||
data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children
|
||||
data.multiArray[2] = this.state.interactionMultiArray[indexNumber].children[data.multiIndex[1]].children
|
||||
data.multiArray[3] = this.state.interactionMultiArray[indexNumber].children[data.multiIndex[1]].children[data.multiIndex[2]].children
|
||||
}
|
||||
}
|
||||
} else if (e.detail.column == 1) {
|
||||
for (let index in data.multiArray[1]) {
|
||||
const indexNumber = Number(index)
|
||||
if (indexNumber === data.multiIndex[1]) {
|
||||
data.multiArray[2] = this.state.interactionMultiArray[data.multiIndex[0]].children[indexNumber].children
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (e.detail.column == 2) {
|
||||
for (let index in data.multiArray[2]) {
|
||||
const indexNumber = Number(index)
|
||||
if (indexNumber === data.multiIndex[2]) {
|
||||
data.multiArray[3] = this.state.interactionMultiArray[data.multiIndex[0]].children[data.multiIndex[1]].children[indexNumber].children
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// switch (e.detail.column) {// 移动了第几列
|
||||
// case 0:
|
||||
// switch (data.multiIndex[0]) { // 第一个index 是多少
|
||||
// case 0:
|
||||
// data.multiArray[1] = this.state.interactionMultiArray[0].children
|
||||
// data.multiArray[2]=this.state.interactionMultiArray[0].children[0].children
|
||||
// break
|
||||
// case 1:
|
||||
// data.multiArray[1] = this.state.interactionMultiArray[1].children
|
||||
// break
|
||||
// case 2:
|
||||
// data.multiArray[1] = this.state.interactionMultiArray[2].children
|
||||
// break
|
||||
// case 3:
|
||||
// data.multiArray[1] = this.state.interactionMultiArray[3].children
|
||||
// break
|
||||
// case 4:
|
||||
// data.multiArray[1] = this.state.interactionMultiArray[4].children
|
||||
// break
|
||||
// }
|
||||
// data.multiIndex[1] = 0
|
||||
// data.multiIndex[2] = 0
|
||||
// data.multiIndex[3] = 0
|
||||
// break
|
||||
// case 1:
|
||||
// switch (data.multiIndex[0]) {
|
||||
// case 0:
|
||||
|
||||
// break
|
||||
// case 1:
|
||||
// switch (data.multiIndex[1]) {
|
||||
// case 0:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[1].children[0].children
|
||||
// break
|
||||
// case 1:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[1].children[1].children
|
||||
// break
|
||||
// case 2:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[1].children[2].children
|
||||
// break
|
||||
// case 3:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[1].children[3].children ? this.state.interactionMultiArray[1].children[3].children : [{ class_name: '' }]
|
||||
// break
|
||||
// }
|
||||
// break
|
||||
// case 2:
|
||||
// switch (data.multiIndex[1]) {
|
||||
// case 0:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[2].children[0].children
|
||||
// break
|
||||
// case 1:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[2].children[1].children
|
||||
// break
|
||||
// case 2:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[2].children[2].children
|
||||
// break
|
||||
// case 3:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[2].children[3].children
|
||||
// break
|
||||
// case 4:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[2].children[4].children
|
||||
// break
|
||||
// case 5:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[2].children[5].children
|
||||
// break
|
||||
// }
|
||||
// break
|
||||
// case 3:
|
||||
// switch (data.multiIndex[1]) {
|
||||
// case 0:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[3].children[0].children
|
||||
// break
|
||||
// case 1:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[3].children[1].children
|
||||
// break
|
||||
// case 2:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[3].children[2].children
|
||||
// break
|
||||
// case 3:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[3].children[3].children
|
||||
// break
|
||||
// case 3:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[3].children[3].children
|
||||
// break
|
||||
// }
|
||||
// break
|
||||
// case 4:
|
||||
// switch (data.multiIndex[1]) {
|
||||
// case 0:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[4].children[0].children
|
||||
// break
|
||||
// case 1:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[4].children[1].children
|
||||
// break
|
||||
// case 2:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[4].children[2].children
|
||||
// break
|
||||
|
||||
// }
|
||||
// break
|
||||
|
||||
// }
|
||||
// data.multiIndex[2] = 0
|
||||
// data.multiIndex[3] = 0
|
||||
// break
|
||||
// }
|
||||
this.setState({ multiIndex: data.multiIndex })
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
if(Taro.getStorageSync('shopInfo').shop_id){
|
||||
this.getProductCateList(this.props.url)
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 当然父组件有新的props的 会从新渲染组件
|
||||
componentWillReceiveProps(nextProps) {
|
||||
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View class='page-section'>
|
||||
<Picker
|
||||
rangeKey='name'
|
||||
mode='multiSelector'
|
||||
onChange={this.bindMultiPickerChange.bind(this)}
|
||||
onColumnchange={this.bindMultiPickerCol.bind(this)}
|
||||
value={this.state.multiIndex}
|
||||
range={this.state.initailMultiArray}
|
||||
>
|
||||
<View class='picker type'>
|
||||
<View className='title-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<Text className='title'>商品分类:</Text>
|
||||
<Text className='first-col'>
|
||||
{this.props.selectedValue.name}
|
||||
</Text>
|
||||
|
||||
{/* {this.state.initailMultiArray[0].length?<Text className='first-col'> {this.state.initailMultiArray[0][this.state.multiIndex[0]].name}</Text>:null}
|
||||
{this.state.initailMultiArray[1].length?<Text className='second-col'>{this.state.initailMultiArray[1][this.state.multiIndex[1]].name}</Text>:null}
|
||||
{this.state.initailMultiArray[2].length?<Text className='third-col'>{this.state.initailMultiArray[2][this.state.multiIndex[2]].name}</Text>:null} */}
|
||||
|
||||
</View>
|
||||
</View>
|
||||
</Picker>
|
||||
return <SwiperItem key={index} >
|
||||
<View className={this.state.demanding.length - 1 === index ? 'demanding-item last' : 'demanding-item'}>
|
||||
<View onClick={this.goToGrabOrderPage.bind(this, item.sd_id)}>
|
||||
<View className='item-tag'>
|
||||
<Text className='item-tag-text'> {item.class_name}</Text>
|
||||
</View>
|
||||
<View className='item-title'>
|
||||
{item.sd_title}
|
||||
</View>
|
||||
<View className='item-address'>
|
||||
{item.user_address || '--'}
|
||||
</View>
|
||||
<View className='item-name'>
|
||||
业主:{item.user_name}
|
||||
</View>
|
||||
</View>
|
||||
{item.state === '1' ? <View className='button' onClick={this.grabOrderId.bind(this, item.sd_id)}>
|
||||
<Button size='mini' className='button-orange'>抢单</Button>
|
||||
</View> : null || item.state === '2' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null || item.state === '3' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null}
|
||||
{/* <View className='item-button-box' onClick={this.grabOrderId.bind(this, item.sd_id)}>
|
||||
<Button className='item-button' > {item.state_name === '在用' ? '抢单' : '已抢光'}</Button>
|
||||
</View> */}
|
||||
</View>
|
||||
</SwiperItem >
|
||||
}) : null
|
||||
|
||||
const adsImgElementsArray = this.state.ads.length ? this.state.ads.map((item, index) => {
|
||||
return <SwiperItem key={index}>
|
||||
<Image className='banner-img' src={URL.Base + item.ads_pic} />
|
||||
</SwiperItem>
|
||||
}) : null
|
||||
|
||||
// 这里应该代码可以优化-----
|
||||
const categoriesElementsArray1 = this.state.categories.length ? this.state.categories[0].map((item, index) => {
|
||||
return <View className='category-item' key={index} onClick={this.scrollToSubCate.bind(this, item)}>
|
||||
{/* onClick={this.onClickParentCate.bind(this, item)}> */}
|
||||
<Image className='cate-img' src={URL.Base + item.icon} />
|
||||
<View>{item.class_name}</View>
|
||||
</View>
|
||||
}) : null
|
||||
const categoriesElementsArray2 = this.state.categories.length ? this.state.categories[1].map((item, index) => {
|
||||
return <View className='category-item' key={index} onClick={this.scrollToSubCate.bind(this, item)}>
|
||||
{/* onClick={this.onClickParentCate.bind(this, item)}> */}
|
||||
<Image className='cate-img' src={URL.Base + item.icon} />
|
||||
<View>{item.class_name}</View>
|
||||
</View>
|
||||
}) : null
|
||||
|
||||
const shopCollectionElementsArray = this.state.shops.length ? this.state.shops.map((item, index) => {
|
||||
return <FilteredShopComponent
|
||||
shop={item}
|
||||
key={index}
|
||||
categoryLevel={this.state.supplyLevel}
|
||||
classId={this.state.parentClass === this.state.childClass ? this.state.parentClass : this.state.childClass}
|
||||
></FilteredShopComponent>
|
||||
}) : <View className='no-more-title top'> 没有更多了</View>
|
||||
const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => {
|
||||
return <SwiperItem key={index} onClick={this.onClickChildCate.bind(this, item)}>
|
||||
<View className='text'>{item.class_name}</View>
|
||||
</SwiperItem>
|
||||
}) : null
|
||||
|
||||
return (
|
||||
<View className='home'>
|
||||
|
||||
{/* 获取微信用户的信息 */}
|
||||
{/* <AtButton open-type='getUserInfo' lang='zh_CN' type='primary' size='normal' onGetUserInfo={this.onGotUserInfo.bind(this)}>获取微信用户的信息</AtButton> */}
|
||||
|
||||
{modalMessageGrabElement}
|
||||
|
||||
<View className='first-banner'>
|
||||
<Swiper
|
||||
className='swipper'
|
||||
style='height:120px;'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
circular
|
||||
indicatorDots
|
||||
autoplay
|
||||
>
|
||||
{adsImgElementsArray}
|
||||
|
||||
</Swiper>
|
||||
</View>
|
||||
{/* 第二行图片滚动条 */}
|
||||
<View className='second-banner'>
|
||||
<Swiper
|
||||
style='height:100%;'
|
||||
className='swipper'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
circular
|
||||
indicatorDots
|
||||
// autoplay
|
||||
>
|
||||
<SwiperItem>
|
||||
<View className='categories'>
|
||||
{categoriesElementsArray1}
|
||||
</View>
|
||||
</SwiperItem>
|
||||
<SwiperItem>
|
||||
<View className='categories'>
|
||||
{categoriesElementsArray2}
|
||||
</View>
|
||||
</SwiperItem>
|
||||
</Swiper>
|
||||
</View>
|
||||
{/* 第三行图片滚动条 */}
|
||||
<View className='third-banner'>
|
||||
<Swiper
|
||||
style='height:100px;'
|
||||
className='swipper'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
horizontal
|
||||
circular
|
||||
indicatorDots
|
||||
autoplay
|
||||
>
|
||||
<SwiperItem onClick={this.goToMyNeedsPublish.bind(this)}>
|
||||
<Image className='banner-img' src={URL.Base + 'Public/images/xgt.png'} />
|
||||
</SwiperItem>
|
||||
|
||||
|
||||
)
|
||||
}
|
||||
</Swiper>
|
||||
</View>
|
||||
|
||||
{/* 业主需求和行业推荐 */}
|
||||
<View className='container'>
|
||||
<View className='title'>
|
||||
|
||||
<Text className='title-block'></Text>
|
||||
<Text className='title-text'>业主需求</Text>
|
||||
|
||||
<Text className='more-link' onClick={this.goToAllDemandingPage.bind(this)}>
|
||||
更多>>
|
||||
</Text>
|
||||
</View>
|
||||
<View className='customer-demanding'>
|
||||
<Swiper
|
||||
style='height:180px;'
|
||||
className='swipper swiper-sub'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
horizontal
|
||||
|
||||
displayMultipleItems='2.5'
|
||||
>
|
||||
{demandingElemensArray}
|
||||
</Swiper>
|
||||
</View>
|
||||
|
||||
<View className='second-banner-level2'>
|
||||
{this.state.subCate.length ? <Swiper
|
||||
style='height:35px;'
|
||||
className='swipper swiper-sub'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
horizontal
|
||||
displayMultipleItems={this.state.subCate.length > 4.5 ? 4.5 : this.state.subCate.length}
|
||||
>
|
||||
{subCateElementsArray}
|
||||
</Swiper> : null}
|
||||
</View>
|
||||
<View className='title'>
|
||||
<Text className='title-block'></Text>
|
||||
<Text className='title-text'>行业推荐</Text>
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
<View className='shop-box'>
|
||||
{shopCollectionElementsArray}
|
||||
|
||||
|
||||
</View>
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
<View className='gap'>
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
</View>
|
||||
<View className='bottom-nav-box'>
|
||||
{/* <BottomNav otherData={this.state.otherData} /> */}
|
||||
</View>
|
||||
|
||||
|
||||
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default GoodsTypeInteractionComp
|
||||
|
||||
|
||||
export default Home
|
||||
|
@ -27,6 +27,7 @@ const setUserInfoToStorage = () => {
|
||||
|
||||
// 异步函数登入api
|
||||
export default function login() {
|
||||
return new Promise((resolve,reject)=>{
|
||||
Taro.login({
|
||||
success(res) {
|
||||
if (res.code) {
|
||||
@ -55,12 +56,14 @@ export default function login() {
|
||||
Taro.setStorageSync('shopInfo', response.data.shop_info)
|
||||
Taro.setStorageSync('userInfo', response.data.user_info)
|
||||
setUserInfoToStorage()
|
||||
resolve('微信登入成功')
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '微信登入失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
reject('微信登入失败')
|
||||
// Taro.clearStorageSync()
|
||||
}
|
||||
|
||||
@ -72,4 +75,6 @@ export default function login() {
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user