添加个人中心
This commit is contained in:
parent
09b20e0ef3
commit
036bc4783a
30
src/app.js
30
src/app.js
@ -16,11 +16,11 @@ import './app.scss'
|
|||||||
const store = configStore()
|
const store = configStore()
|
||||||
|
|
||||||
class App extends Component {
|
class App extends Component {
|
||||||
|
|
||||||
isTrue=Taro.getStorageSync('session_id')?true:false
|
|
||||||
config = {
|
config = {
|
||||||
pages: [
|
pages: [
|
||||||
//'pages/index/index', // index页面
|
//'pages/index/index', // index页面
|
||||||
|
'pages/individualCenter/individualCenter',// 个人中心页面
|
||||||
'pages/home/home',//首页 ---------------------
|
'pages/home/home',//首页 ---------------------
|
||||||
'pages/login/login',//登入页面 ---------------------
|
'pages/login/login',//登入页面 ---------------------
|
||||||
'pages/shop/shop',//店铺页面 ---------------------
|
'pages/shop/shop',//店铺页面 ---------------------
|
||||||
@ -39,6 +39,8 @@ class App extends Component {
|
|||||||
'pages/myNeedsEdit/myNeedsEdit',// 单个需求编辑页面
|
'pages/myNeedsEdit/myNeedsEdit',// 单个需求编辑页面
|
||||||
'pages/myNeedsPublish/myNeedsPublish',// 需求发布
|
'pages/myNeedsPublish/myNeedsPublish',// 需求发布
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 'pages/shopDescription/shopDescription',
|
// 'pages/shopDescription/shopDescription',
|
||||||
],
|
],
|
||||||
permission: {
|
permission: {
|
||||||
@ -56,33 +58,27 @@ class App extends Component {
|
|||||||
},
|
},
|
||||||
|
|
||||||
tabBar: {
|
tabBar: {
|
||||||
list:[{
|
list: [{
|
||||||
pagePath: "pages/home/home",
|
pagePath: "pages/home/home",
|
||||||
text: "首页",
|
text: "首页",
|
||||||
iconPath: "./icons/home.png",
|
iconPath: "./icons/home.png",
|
||||||
selectedIconPath: "./icons/home-actived.png"
|
selectedIconPath: "./icons/home-actived.png"
|
||||||
}, {
|
}, {
|
||||||
pagePath: "pages/goodsPublish/goodsPublish",
|
pagePath: "pages/myNeedsPublish/myNeedsPublish",
|
||||||
text: "商品发布",
|
text: "需求发布",
|
||||||
iconPath: "./icons/box.png",
|
|
||||||
selectedIconPath: "./icons/box-actived.png"
|
|
||||||
}, {
|
|
||||||
pagePath: "pages/supplyDemandPublish/supplyDemandPublish",
|
|
||||||
text: "供求发布",
|
|
||||||
iconPath: "./icons/publish.png",
|
iconPath: "./icons/publish.png",
|
||||||
selectedIconPath: "./icons/publish-actived.png"
|
selectedIconPath: "./icons/publish-actived.png"
|
||||||
}
|
|
||||||
, {
|
|
||||||
pagePath: "pages/mySupplyDemand/mySupplyDemand",
|
|
||||||
text: "我的供求",
|
|
||||||
iconPath: "./icons/menu.png",
|
|
||||||
selectedIconPath: "./icons/menu-actived.png"
|
|
||||||
}
|
}
|
||||||
, {
|
, {
|
||||||
pagePath: "pages/myNeeds/myNeeds",
|
pagePath: "pages/myNeeds/myNeeds",
|
||||||
text: "我的需求",
|
text: "我的需求",
|
||||||
iconPath: "./icons/needs.png",
|
iconPath: "./icons/needs.png",
|
||||||
selectedIconPath: "./icons/needs-actived.png"
|
selectedIconPath: "./icons/needs-actived.png"
|
||||||
|
}, {
|
||||||
|
pagePath: "pages/individualCenter/individualCenter",
|
||||||
|
text: "个人中心",
|
||||||
|
iconPath: "./icons/needs.png",
|
||||||
|
selectedIconPath: "./icons/needs-actived.png"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
color: '#333',
|
color: '#333',
|
||||||
@ -94,7 +90,7 @@ class App extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
console.log('this.tabBar', this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidShow() { }
|
componentDidShow() { }
|
||||||
|
53
src/component/backToCenterComponent/backToCenterComponent.js
Normal file
53
src/component/backToCenterComponent/backToCenterComponent.js
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
//scrollToTopComponent
|
||||||
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
|
import { View, Text,MovableArea, MovableView } from '@tarojs/components'
|
||||||
|
|
||||||
|
|
||||||
|
import './backToCenterComponent.scss'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class BackToCenterComponent extends Component {
|
||||||
|
config = {
|
||||||
|
navigationBarTitleText: '顶部'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
goToCenterPage(){
|
||||||
|
Taro.switchTab({
|
||||||
|
url:'/pages/individualCenter/individualCenter'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
}
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
// console.log(this.props, nextProps)
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() { }
|
||||||
|
|
||||||
|
componentDidShow() { }
|
||||||
|
|
||||||
|
componentDidHide() { }
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
// <View className='backToCenterComponent' onClick={this.goToCenterPage.bind(this)}>
|
||||||
|
// <View className='box'>
|
||||||
|
// <View>个人中心</View>
|
||||||
|
|
||||||
|
// </View>
|
||||||
|
|
||||||
|
// </View>
|
||||||
|
<MovableArea style='height: 100vh; width: 100%; position:fixed; top:0; '>
|
||||||
|
<View>hello world</View>
|
||||||
|
<MovableView style='height: 50px; width: 50px; background: blue;opacity:1' direction='all'></MovableView>
|
||||||
|
</MovableArea>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BackToCenterComponent
|
@ -0,0 +1,17 @@
|
|||||||
|
.backToCenterComponent{
|
||||||
|
height:100rpx;
|
||||||
|
width:100rpx;
|
||||||
|
color:#ffffff;
|
||||||
|
background-color:black;
|
||||||
|
opacity: 0.3;
|
||||||
|
border-radius:50%;
|
||||||
|
position:fixed;
|
||||||
|
bottom:12%;
|
||||||
|
right:3%;
|
||||||
|
font-size:25rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -45,7 +45,7 @@ class Interaction extends Component {
|
|||||||
let initailMultiArray = this.recursionInitialized(res.data.data)
|
let initailMultiArray = this.recursionInitialized(res.data.data)
|
||||||
initailMultiArray[1].unshift({ name: '全部', id: '-1' })
|
initailMultiArray[1].unshift({ name: '全部', id: '-1' })
|
||||||
initailMultiArray[0] = [{ name: '--', id: '' }]
|
initailMultiArray[0] = [{ name: '--', id: '' }]
|
||||||
console.log('initailMultiArray', initailMultiArray)
|
// console.log('initailMultiArray', initailMultiArray)
|
||||||
|
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -112,7 +112,7 @@ class Interaction extends Component {
|
|||||||
return new Array(maxDepth).fill(0)
|
return new Array(maxDepth).fill(0)
|
||||||
}
|
}
|
||||||
bindMultiPickerCol(e) {
|
bindMultiPickerCol(e) {
|
||||||
console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
// console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
multiArray: this.state.initailMultiArray,
|
multiArray: this.state.initailMultiArray,
|
||||||
@ -124,7 +124,7 @@ class Interaction extends Component {
|
|||||||
const indexNumber = Number(index)
|
const indexNumber = Number(index)
|
||||||
if (indexNumber === data.multiIndex[0]) {
|
if (indexNumber === data.multiIndex[0]) {
|
||||||
data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children
|
data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children
|
||||||
console.log('datat', data)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
border-radius:50%;
|
border-radius:50%;
|
||||||
text-align:center;
|
text-align:center;
|
||||||
position:fixed;
|
position:fixed;
|
||||||
bottom:10%;
|
bottom:1%;
|
||||||
right:5%;
|
right:3%;
|
||||||
font-size:25rpx;
|
font-size:25rpx;
|
||||||
.box{
|
.box{
|
||||||
margin-top:6%;
|
margin-top:6%;
|
||||||
|
BIN
src/icons/client-needs-actived.png
Normal file
BIN
src/icons/client-needs-actived.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 849 B |
BIN
src/icons/client-needs.png
Normal file
BIN
src/icons/client-needs.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 873 B |
BIN
src/icons/client-publish-actived.png
Normal file
BIN
src/icons/client-publish-actived.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 894 B |
BIN
src/icons/client-publish.png
Normal file
BIN
src/icons/client-publish.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 881 B |
BIN
src/icons/individualCenter-actived.png
Normal file
BIN
src/icons/individualCenter-actived.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
src/icons/individualCenter.png
Normal file
BIN
src/icons/individualCenter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@ -106,12 +106,12 @@ class GoodsPublish extends Component {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.state.isPublish) {
|
if (this.state.isPublish) {
|
||||||
// 导航到编辑页面
|
// 导航到编辑页面
|
||||||
Taro.navigateTo({
|
Taro.redirectTo({
|
||||||
url: '/pages/myGoodsEdit/myGoodsEdit?id=' + res.data.goods_id
|
url: '/pages/myGoodsList/myGoodsList'
|
||||||
})
|
})
|
||||||
} else if (this.state.isPublishAndAdd) {
|
} else if (this.state.isPublishAndAdd) {
|
||||||
// 导航到发布页面
|
// 导航到发布页面
|
||||||
Taro.reLaunch({
|
Taro.navigateTo({
|
||||||
url: '/pages/goodsPublish/goodsPublish'
|
url: '/pages/goodsPublish/goodsPublish'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ class GoodsPublish extends Component {
|
|||||||
LoginService()
|
LoginService()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Taro.navigateTo({
|
Taro.redirectTo({
|
||||||
url: '/pages/myGoodList/myGoodList'
|
url: '/pages/myGoodList/myGoodList'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -403,9 +403,9 @@ class GoodsPublish extends Component {
|
|||||||
{/* <View className='button'>
|
{/* <View className='button'>
|
||||||
<Button type='primary' className='button-a' size='small' >发布并新增</Button>
|
<Button type='primary' className='button-a' size='small' >发布并新增</Button>
|
||||||
</View> */}
|
</View> */}
|
||||||
<View className='button' onClick={this.publishAndNewButton.bind(this)}>
|
{/* <View className='button' onClick={this.publishAndNewButton.bind(this)}>
|
||||||
<Button size='mini' className='button-green'>发布并新增</Button>
|
<Button size='mini' className='button-green'>发布并新增</Button>
|
||||||
</View>
|
</View> */}
|
||||||
<View className='button' onClick={this.goToMyGoodListPage.bind(this)}>
|
<View className='button' onClick={this.goToMyGoodListPage.bind(this)}>
|
||||||
<Button size='mini' className='button-green'>商品列表</Button>
|
<Button size='mini' className='button-green'>商品列表</Button>
|
||||||
</View>
|
</View>
|
||||||
|
@ -76,7 +76,7 @@ class GrabOrderPage extends Component {
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Taro.reLaunch({
|
Taro.switchTab({
|
||||||
url: '/pages/home/home'
|
url: '/pages/home/home'
|
||||||
})
|
})
|
||||||
}, 1500);
|
}, 1500);
|
||||||
@ -218,7 +218,7 @@ class GrabOrderPage extends Component {
|
|||||||
duration: 1500
|
duration: 1500
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Taro.reLaunch({
|
Taro.switchTab({
|
||||||
url: '/pages/myNeeds/myNeeds'
|
url: '/pages/myNeeds/myNeeds'
|
||||||
})
|
})
|
||||||
}, 1500);
|
}, 1500);
|
||||||
|
@ -42,7 +42,6 @@ class Home extends Component {
|
|||||||
supplyLevel: 1,// 筛选1是小类或者2是大类,
|
supplyLevel: 1,// 筛选1是小类或者2是大类,
|
||||||
latitude: '',
|
latitude: '',
|
||||||
longitude: '',
|
longitude: '',
|
||||||
isShopOwner: false
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,22 +289,7 @@ class Home extends Component {
|
|||||||
|
|
||||||
componentDidMount() {
|
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: '加载中' })
|
Taro.showLoading({ title: '加载中' })
|
||||||
// promise 返回经纬度给state 然后调用函数
|
// promise 返回经纬度给state 然后调用函数
|
||||||
this.getUserLocation().then(res => {
|
this.getUserLocation().then(res => {
|
||||||
@ -321,25 +305,11 @@ class Home extends Component {
|
|||||||
this.getHomeCategoriesInfo()
|
this.getHomeCategoriesInfo()
|
||||||
})
|
})
|
||||||
// 本地缓存没有userid时 从新登入
|
// 本地缓存没有userid时 从新登入
|
||||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
Taro.getStorageSync('userInfo').user_id ? true : weChatLogin()
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
@ -348,7 +318,7 @@ class Home extends Component {
|
|||||||
componentWillUnmount() { }
|
componentWillUnmount() { }
|
||||||
|
|
||||||
componentDidShow() {
|
componentDidShow() {
|
||||||
console.log('home', this.$scope.route)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidHide() { }
|
componentDidHide() { }
|
||||||
@ -379,7 +349,6 @@ class Home extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
console.log('this.state.isShopOwner', this.state.isShopOwner)
|
|
||||||
// 提示模态弹窗element
|
// 提示模态弹窗element
|
||||||
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpen}>
|
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpen}>
|
||||||
<AtModalHeader>提示</AtModalHeader>
|
<AtModalHeader>提示</AtModalHeader>
|
||||||
@ -456,7 +425,7 @@ class Home extends Component {
|
|||||||
<View className='text'>{item.class_name}</View>
|
<View className='text'>{item.class_name}</View>
|
||||||
</SwiperItem>
|
</SwiperItem>
|
||||||
}) : null
|
}) : null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className='home'>
|
<View className='home'>
|
||||||
|
|
||||||
|
170
src/pages/individualCenter/individualCenter.js
Normal file
170
src/pages/individualCenter/individualCenter.js
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
|
import { View, Image, Button } from '@tarojs/components'
|
||||||
|
import { AtGrid, AtList, AtListItem, AtAvatar, AtButton } from "taro-ui"
|
||||||
|
|
||||||
|
|
||||||
|
import './individualCenter.scss'
|
||||||
|
import URL from '../../serviceAPI.config'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class IndividualCenter extends Component {
|
||||||
|
config = {
|
||||||
|
navigationBarTitleText: '个人中心'
|
||||||
|
}
|
||||||
|
constructor() {
|
||||||
|
this.state = {
|
||||||
|
client: [
|
||||||
|
{
|
||||||
|
image: 'https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png',
|
||||||
|
value: '需求发布'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
image: 'https://img20.360buyimg.com/jdphoto/s72x72_jfs/t15151/308/1012305375/2300/536ee6ef/5a411466N040a074b.png',
|
||||||
|
value: '我的需求'
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
seller: [
|
||||||
|
{
|
||||||
|
image: 'https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png',
|
||||||
|
value: '我的商品'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
image: 'https://img20.360buyimg.com/jdphoto/s72x72_jfs/t15151/308/1012305375/2300/536ee6ef/5a411466N040a074b.png',
|
||||||
|
value: '商品发布'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
image: 'https://img10.360buyimg.com/jdphoto/s72x72_jfs/t5872/209/5240187906/2872/8fa98cd/595c3b2aN4155b931.png',
|
||||||
|
value: '我的供求'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
image: 'https://img12.360buyimg.com/jdphoto/s72x72_jfs/t10660/330/203667368/1672/801735d7/59c85643N31e68303.png',
|
||||||
|
value: '供求发布'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
username: '',
|
||||||
|
avatar: '',
|
||||||
|
isShop: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handlerGridClick(e) {
|
||||||
|
const value = e.currentTarget.dataset.eTapAA.value
|
||||||
|
switch (value) {
|
||||||
|
case '需求发布':
|
||||||
|
Taro.switchTab({
|
||||||
|
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case '我的需求':
|
||||||
|
Taro.switchTab({
|
||||||
|
url: '/pages/myNeeds/myNeeds'
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case '我的商品':
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: '/pages/myGoodList/myGoodList'
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case '商品发布':
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: '/pages/goodsPublish/goodsPublish'
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case '我的供求':
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: '/pages/mySupplyDemand/mySupplyDemand'
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case '供求发布':
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// code block
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handlerTitleBarClick() {
|
||||||
|
Taro.showToast({
|
||||||
|
title: '暂时没有更多',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getInfoFromStorage() {
|
||||||
|
const username = Taro.getStorageSync('userInfo').login_name
|
||||||
|
const avatar = Taro.getStorageSync('userInfo').avatar
|
||||||
|
const isShop = Taro.getStorageSync('shopInfo').shop_id ? true : false
|
||||||
|
this.setState({
|
||||||
|
username, avatar, isShop
|
||||||
|
})
|
||||||
|
}
|
||||||
|
handleLogoutClick() {
|
||||||
|
Taro.clearStorageSync()
|
||||||
|
Taro.reLaunch({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
componentDidMount() {
|
||||||
|
this.getInfoFromStorage()
|
||||||
|
}
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
console.log(this.props, nextProps)
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() { }
|
||||||
|
|
||||||
|
componentDidShow() { }
|
||||||
|
|
||||||
|
componentDidHide() { }
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { client, seller, username, avatar, isShop } = this.state
|
||||||
|
return (
|
||||||
|
<View className='individualCenter'>
|
||||||
|
<View className='avatar'>
|
||||||
|
<AtAvatar circle={true} size={'large'} image={URL.Base + avatar}></AtAvatar>
|
||||||
|
<View className='user-name'>
|
||||||
|
<View className='name'>
|
||||||
|
{username}</View>
|
||||||
|
<View className='badge'>????</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View className='client-container'>
|
||||||
|
<View className='bg-image'>
|
||||||
|
<Image
|
||||||
|
style='width: 100%;height: 250rpx;'
|
||||||
|
src={URL.Base + 'Public/images/m/bg.jpg'}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
<View className='row'>
|
||||||
|
<View className='title'>收藏的宝贝</View>|
|
||||||
|
<View className='title'>收藏的店铺</View>|
|
||||||
|
<View className='title'>我的足迹</View>
|
||||||
|
</View>
|
||||||
|
<AtList>
|
||||||
|
<AtListItem hasBorder={false} title='业主中心' onClick={this.handlerTitleBarClick.bind(this)} extraText='更多' arrow='right' />
|
||||||
|
</AtList>
|
||||||
|
<AtGrid hasBorder={false} data={client} columnNum={4} onClick={this.handlerGridClick.bind(this)} />
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{isShop ? <View className='seller-container'>
|
||||||
|
<AtList>
|
||||||
|
<AtListItem hasBorder={false} title='店铺中心' onClick={this.handlerTitleBarClick.bind(this)} extraText='更多' arrow='right' />
|
||||||
|
</AtList>
|
||||||
|
<AtGrid hasBorder={false} data={seller} columnNum={4} onClick={this.handlerGridClick.bind(this)} />
|
||||||
|
</View> : <View />}
|
||||||
|
<View className='logout' onClick={this.handleLogoutClick.bind(this)}>
|
||||||
|
{/* <AtButton type='primary' size='normal'>退出</AtButton> */}
|
||||||
|
<Button type='primary' size='noraml' className='button-dark-red' >
|
||||||
|
退出</Button>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default IndividualCenter
|
40
src/pages/individualCenter/individualCenter.scss
Normal file
40
src/pages/individualCenter/individualCenter.scss
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
.individualCenter{
|
||||||
|
position: relative;
|
||||||
|
.avatar{
|
||||||
|
position: absolute;
|
||||||
|
top:190rpx;
|
||||||
|
left: 50rpx;
|
||||||
|
display: flex;
|
||||||
|
.user-name{
|
||||||
|
display: flex;
|
||||||
|
font-size: 25rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
.name{
|
||||||
|
margin-left: 15rpx
|
||||||
|
}
|
||||||
|
.badge{
|
||||||
|
margin-left: 15rpx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.row{
|
||||||
|
height: 80rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content:flex-end;
|
||||||
|
.title{
|
||||||
|
margin-left:10rpx;
|
||||||
|
margin-right:10rpx;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.logout{
|
||||||
|
width:30%;
|
||||||
|
margin:0 auto;
|
||||||
|
margin-top: 10%
|
||||||
|
}
|
||||||
|
.seller-container{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -31,7 +31,6 @@ class MyDemandSupplyEdit extends Component {
|
|||||||
content: '',
|
content: '',
|
||||||
pickerImageUrl: [], // 上传的图片
|
pickerImageUrl: [], // 上传的图片
|
||||||
ImagesInfo: [],// 后台传回来的图片信息
|
ImagesInfo: [],// 后台传回来的图片信息
|
||||||
|
|
||||||
isFormCompleted: false,
|
isFormCompleted: false,
|
||||||
isConfirmWindow: false,// 删除提示框
|
isConfirmWindow: false,// 删除提示框
|
||||||
demandSupplyId: '',// 供求id
|
demandSupplyId: '',// 供求id
|
||||||
@ -57,6 +56,7 @@ class MyDemandSupplyEdit extends Component {
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('供求详情获取成功', res)
|
console.log('供求详情获取成功', res)
|
||||||
|
Taro.hideLoading()
|
||||||
if (res.data.err_code === 0) {
|
if (res.data.err_code === 0) {
|
||||||
const selectedType = this.state.demandingSupplyCate.filter(item => item.id == res.data.sdInfo.sd_type)[0]
|
const selectedType = this.state.demandingSupplyCate.filter(item => item.id == res.data.sdInfo.sd_type)[0]
|
||||||
const selectedState = this.state.demandingSupplyState.filter(item => item.id == res.data.sdInfo.state)[0]
|
const selectedState = this.state.demandingSupplyState.filter(item => item.id == res.data.sdInfo.state)[0]
|
||||||
@ -73,9 +73,14 @@ class MyDemandSupplyEdit extends Component {
|
|||||||
pickerImageUrl: imageFile,
|
pickerImageUrl: imageFile,
|
||||||
ImagesInfo: res.data.sdInfo.file_path,
|
ImagesInfo: res.data.sdInfo.file_path,
|
||||||
})
|
})
|
||||||
Taro.hideLoading()
|
|
||||||
} else if (res.data.err_code === 88888) {
|
} else if (res.data.err_code === 88888) {
|
||||||
loginExpired(res)
|
loginExpired(res)
|
||||||
|
}else{
|
||||||
|
Taro.showToast({
|
||||||
|
title:res.data.err_msg,
|
||||||
|
icon:'none'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -137,7 +142,7 @@ class MyDemandSupplyEdit extends Component {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
console.log('this.state.isSaveAndNew', this.state.isSaveAndNew)
|
console.log('this.state.isSaveAndNew', this.state.isSaveAndNew)
|
||||||
if (this.state.isSaveAndNew) {
|
if (this.state.isSaveAndNew) {
|
||||||
Taro.reLaunch({
|
Taro.navigateTo({
|
||||||
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -309,8 +314,8 @@ class MyDemandSupplyEdit extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
goToMyDemSupPage() {
|
goToMyDemSupPage() {
|
||||||
Taro.switchTab({
|
Taro.navigateBack({
|
||||||
url: '/pages/mySupplyDemand/mySupplyDemand'
|
delta: 1
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
deleteButtonHandler() {
|
deleteButtonHandler() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Taro, { Component } from '@tarojs/taro'
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
import { View, Radio, Button } from '@tarojs/components'
|
import { View, Radio, Button, MovableArea, MovableView } from '@tarojs/components'
|
||||||
import { AtInput, Text, AtIcon, Picker, Image, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
import { AtInput, Text, AtIcon, Picker, Image, 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'
|
||||||
@ -47,6 +47,8 @@ class MyGoodList extends Component {
|
|||||||
isOpenOffStockModal: false,// 是否显示下架模态框
|
isOpenOffStockModal: false,// 是否显示下架模态框
|
||||||
isAddToList: false,// 是否下拉加载 如果是 就添加商品到我的商品列表
|
isAddToList: false,// 是否下拉加载 如果是 就添加商品到我的商品列表
|
||||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||||
|
screenWidth:'',
|
||||||
|
screenHeight:''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +89,7 @@ class MyGoodList extends Component {
|
|||||||
'X-Requested-With': 'XMLHttpRequest'
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log('宝贝类目',res)
|
console.log('宝贝类目', res)
|
||||||
if (res.data.err_code != 10) {
|
if (res.data.err_code != 10) {
|
||||||
const productCate = [{ name: '全部类目', id: '' }]
|
const productCate = [{ name: '全部类目', id: '' }]
|
||||||
for (let item of res.data.goodsClass) {
|
for (let item of res.data.goodsClass) {
|
||||||
@ -144,7 +146,7 @@ class MyGoodList extends Component {
|
|||||||
const data = JSON.parse(res.data)
|
const data = JSON.parse(res.data)
|
||||||
if (data.err_code != 10) {
|
if (data.err_code != 10) {
|
||||||
console.log('我的商品列表', JSON.parse(res.data))
|
console.log('我的商品列表', JSON.parse(res.data))
|
||||||
|
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
if (data.goodsCount != '0' && data.goods.length) {
|
if (data.goodsCount != '0' && data.goods.length) {
|
||||||
data.goods.forEach(item => {
|
data.goods.forEach(item => {
|
||||||
@ -272,9 +274,9 @@ class MyGoodList extends Component {
|
|||||||
duration: 1500
|
duration: 1500
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}else if (responseData.err_code === 88888) {
|
} else if (responseData.err_code === 88888) {
|
||||||
loginExpired(res)
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: responseData.err_msg,
|
title: responseData.err_msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@ -311,14 +313,14 @@ class MyGoodList extends Component {
|
|||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 1500
|
duration: 1500
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.setState({ isCheckAll: false, currPageParam: 1 },()=>{
|
this.setState({ isCheckAll: false, currPageParam: 1 }, () => {
|
||||||
this.getMyGoodListApi({})
|
this.getMyGoodListApi({})
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
}else if (responseData.err_code === 88888) {
|
} else if (responseData.err_code === 88888) {
|
||||||
loginExpired(res)
|
loginExpired(res)
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: responseData.err_msg,
|
title: responseData.err_msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@ -526,7 +528,8 @@ class MyGoodList extends Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 导航到商品编辑页面myGoodsEdit
|
// 导航到商品编辑页面myGoodsEdit
|
||||||
goToGoodEditPage(goodId) {
|
goToGoodEditPage(e) {
|
||||||
|
const goodId = e.currentTarget.dataset.eTapAA
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: '/pages/myGoodsEdit/myGoodsEdit?id=' + goodId
|
url: '/pages/myGoodsEdit/myGoodsEdit?id=' + goodId
|
||||||
})
|
})
|
||||||
@ -534,11 +537,12 @@ class MyGoodList extends Component {
|
|||||||
// 导航到商品发布页面
|
// 导航到商品发布页面
|
||||||
|
|
||||||
goToGoodsPublishPage() {
|
goToGoodsPublishPage() {
|
||||||
Taro.switchTab({
|
Taro.navigateTo({
|
||||||
url: '/pages/goodsPublish/goodsPublish'
|
url: '/pages/goodsPublish/goodsPublish'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
goToGoodspage(goodId) {
|
goToGoodspage(e) {
|
||||||
|
const goodId = e.currentTarget.dataset.eTapAA
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: '/pages/goods/goods?id=' + goodId
|
url: '/pages/goods/goods?id=' + goodId
|
||||||
})
|
})
|
||||||
@ -579,8 +583,26 @@ class MyGoodList extends Component {
|
|||||||
isOpenOffStockModal: false
|
isOpenOffStockModal: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
goToCenterPage() {
|
||||||
|
Taro.switchTab({
|
||||||
|
url: '/pages/individualCenter/individualCenter'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getUserSystemInfo(){
|
||||||
|
Taro.getSystemInfo().then(res=>{
|
||||||
|
return res
|
||||||
|
}).then(res=>{
|
||||||
|
console.log('res',res)
|
||||||
|
this.setState({
|
||||||
|
screenWidth:res.screenWidth-80+'px',
|
||||||
|
screenHeight:res.screenHeight-200+'px'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.getUserSystemInfo()
|
||||||
Taro.showLoading({
|
Taro.showLoading({
|
||||||
title: '加载中'
|
title: '加载中'
|
||||||
})
|
})
|
||||||
@ -594,7 +616,7 @@ class MyGoodList extends Component {
|
|||||||
componentWillUnmount() { }
|
componentWillUnmount() { }
|
||||||
|
|
||||||
componentDidShow() {
|
componentDidShow() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidHide() { }
|
componentDidHide() { }
|
||||||
@ -619,8 +641,6 @@ class MyGoodList extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
|
|
||||||
//等待接口数据
|
//等待接口数据
|
||||||
const goodListElementArray = this.state.myGoodList.map((item, index) => {
|
const goodListElementArray = this.state.myGoodList.map((item, index) => {
|
||||||
return <View key={index} className='good-container'>
|
return <View key={index} className='good-container'>
|
||||||
@ -671,135 +691,141 @@ class MyGoodList extends Component {
|
|||||||
</AtModal>
|
</AtModal>
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className='MyGoodList'>
|
<MovableArea style='height: 100%; width: 100%; '>
|
||||||
{/* 删除模态提示框 */}
|
<View className='MyGoodList' style='position:relative;'>
|
||||||
{modalMessageDeleteElement}
|
{/* 删除模态提示框 */}
|
||||||
{/* 下架模态框提示 */}
|
{modalMessageDeleteElement}
|
||||||
{modalMessageOffStockElement}
|
{/* 下架模态框提示 */}
|
||||||
|
{modalMessageOffStockElement}
|
||||||
|
|
||||||
<View className='border-box'>
|
<View className='border-box'>
|
||||||
<AtInput
|
<AtInput
|
||||||
name='value'
|
name='value'
|
||||||
title='宝贝名称:'
|
title='宝贝名称:'
|
||||||
placeholder='宝贝名称'
|
placeholder='宝贝名称'
|
||||||
type='text'
|
type='text'
|
||||||
value={this.state.productName}
|
value={this.state.productName}
|
||||||
onChange={this.productNameChange.bind(this)}
|
onChange={this.productNameChange.bind(this)}
|
||||||
border={false}
|
border={false}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View className='border-box'>
|
<View className='border-box'>
|
||||||
<AtInput
|
<AtInput
|
||||||
name='value'
|
name='value'
|
||||||
title='最低价:'
|
title='最低价:'
|
||||||
className='input'
|
className='input'
|
||||||
|
|
||||||
type='number'
|
type='number'
|
||||||
value={this.state.lowestPrice}
|
value={this.state.lowestPrice}
|
||||||
onChange={this.lowestPriceChange.bind(this)}
|
onChange={this.lowestPriceChange.bind(this)}
|
||||||
border={false}
|
border={false}
|
||||||
/>
|
/>
|
||||||
<AtInput
|
<AtInput
|
||||||
name='value'
|
name='value'
|
||||||
title='最高价:'
|
title='最高价:'
|
||||||
className='input'
|
className='input'
|
||||||
type='number'
|
type='number'
|
||||||
value={this.state.heightestPrice}
|
value={this.state.heightestPrice}
|
||||||
border={false}
|
border={false}
|
||||||
onChange={this.heightestPriceChange.bind(this)}
|
onChange={this.heightestPriceChange.bind(this)}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View className='border-box'>
|
<View className='border-box'>
|
||||||
<AtInput
|
<AtInput
|
||||||
name='value'
|
name='value'
|
||||||
title='最低销量:'
|
title='最低销量:'
|
||||||
className='input'
|
className='input'
|
||||||
type='number'
|
type='number'
|
||||||
value={this.state.minimumSold}
|
value={this.state.minimumSold}
|
||||||
border={false}
|
border={false}
|
||||||
onChange={this.minimumSoldChange.bind(this)}
|
onChange={this.minimumSoldChange.bind(this)}
|
||||||
/>
|
/>
|
||||||
<AtInput
|
<AtInput
|
||||||
name='value'
|
name='value'
|
||||||
title='最高销量:'
|
title='最高销量:'
|
||||||
className='input'
|
className='input'
|
||||||
type='number'
|
type='number'
|
||||||
value={this.state.maximumSold}
|
value={this.state.maximumSold}
|
||||||
border={false}
|
border={false}
|
||||||
onChange={this.maximumSoldChange.bind(this)}
|
onChange={this.maximumSoldChange.bind(this)}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className='border-box'>
|
<View className='border-box'>
|
||||||
<AtInput
|
<AtInput
|
||||||
border={false}
|
border={false}
|
||||||
name='value'
|
name='value'
|
||||||
title='商品编码:'
|
title='商品编码:'
|
||||||
type='number'
|
type='number'
|
||||||
value={this.state.productId}
|
value={this.state.productId}
|
||||||
onChange={this.productIdChange.bind(this)}
|
onChange={this.productIdChange.bind(this)}
|
||||||
border={false}
|
border={false}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View className='page-section'>
|
<View className='page-section'>
|
||||||
<Picker mode='selector' rangeKey='name' range={this.state.productCate} onChange={this.productCateChange.bind(this)}>
|
<Picker mode='selector' rangeKey='name' range={this.state.productCate} onChange={this.productCateChange.bind(this)}>
|
||||||
<View className='picker'>
|
<View className='picker'>
|
||||||
<View className='title-box'>
|
<View className='title-box'>
|
||||||
<Text className='title'>宝贝类目:</Text>
|
<Text className='title'>宝贝类目:</Text>
|
||||||
|
|
||||||
|
<Text className='selected'>{this.state.productCateSelected.name}</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
<Text className='selected'>{this.state.productCateSelected.name}</Text>
|
|
||||||
</View>
|
</View>
|
||||||
|
</Picker>
|
||||||
|
</View>
|
||||||
|
<View className='button-box'>
|
||||||
|
<View className='button' onClick={this.searchButtonHandler.bind(this)}>
|
||||||
|
<Button size='mini' className='button-orange'>
|
||||||
|
<AtIcon value='search' size='12' color='white'></AtIcon>
|
||||||
|
搜索</Button>
|
||||||
</View>
|
</View>
|
||||||
</Picker>
|
<View className='button' onClick={this.goToGoodsPublishPage.bind(this)}>
|
||||||
</View>
|
<Button className='button-green' size='mini'>
|
||||||
<View className='button-box'>
|
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||||
<View className='button' onClick={this.searchButtonHandler.bind(this)}>
|
新增</Button>
|
||||||
<Button size='mini' className='button-orange'>
|
|
||||||
<AtIcon value='search' size='12' color='white'></AtIcon>
|
|
||||||
搜索</Button>
|
|
||||||
</View>
|
|
||||||
<View className='button' onClick={this.goToGoodsPublishPage.bind(this)}>
|
|
||||||
<Button className='button-green' size='mini'>
|
|
||||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
|
||||||
新增</Button>
|
|
||||||
</View>
|
|
||||||
<View className='button' onClick={this.emptyButtonHanlder.bind(this)}>
|
|
||||||
<Button className='button-dark-red' size='mini'>
|
|
||||||
|
|
||||||
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
|
||||||
清空条件</Button>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className='text'>
|
|
||||||
<Text>出售中的宝贝{this.state.myGoodListTotal}条记录</Text>
|
|
||||||
</View>
|
|
||||||
<View className='filterbar-container'>
|
|
||||||
<View className='filter-bar'>
|
|
||||||
{filterElementsArray}
|
|
||||||
|
|
||||||
</View>
|
|
||||||
<View className='sub-filter'>
|
|
||||||
<Radio className='radio' checked={this.state.isCheckAll} onClick={this.checkAllHandler.bind(this)}>全选</Radio>
|
|
||||||
<View className='button' onClick={this.deleteGoodsHandler.bind(this)}>
|
|
||||||
<Button size='mini' className='button-dark-red'>
|
|
||||||
删除</Button>
|
|
||||||
</View>
|
</View>
|
||||||
<View className='button' onClick={this.offStockGoodHandler.bind(this)}>
|
<View className='button' onClick={this.emptyButtonHanlder.bind(this)}>
|
||||||
<Button size='mini' className='button-blue'>
|
<Button className='button-dark-red' size='mini'>
|
||||||
下架</Button>
|
|
||||||
|
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
||||||
|
清空条件</Button>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
<View className='text'>
|
||||||
|
<Text>出售中的宝贝{this.state.myGoodListTotal}条记录</Text>
|
||||||
|
</View>
|
||||||
|
<View className='filterbar-container'>
|
||||||
|
<View className='filter-bar'>
|
||||||
|
{filterElementsArray}
|
||||||
|
|
||||||
|
</View>
|
||||||
|
<View className='sub-filter'>
|
||||||
|
<Radio className='radio' checked={this.state.isCheckAll} onClick={this.checkAllHandler.bind(this)}>全选</Radio>
|
||||||
|
<View className='button' onClick={this.deleteGoodsHandler.bind(this)}>
|
||||||
|
<Button size='mini' className='button-dark-red'>
|
||||||
|
删除</Button>
|
||||||
|
</View>
|
||||||
|
<View className='button' onClick={this.offStockGoodHandler.bind(this)}>
|
||||||
|
<Button size='mini' className='button-blue'>
|
||||||
|
下架</Button>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
{this.state.myGoodList.length ? <View className='mygoodlist-container'>
|
||||||
|
{goodListElementArray}
|
||||||
|
</View > : <View className='no-more-title'> 没有更多了</View>}
|
||||||
|
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<CopyrightComponent></CopyrightComponent>
|
||||||
|
<MovableView className='movable-point' x={this.state.screenWidth} y={this.state.screenHeight} style='opacity:0.3' direction='all' onClick={this.goToCenterPage.bind(this)} >
|
||||||
|
|
||||||
|
个人中心
|
||||||
|
</MovableView>
|
||||||
</View>
|
</View>
|
||||||
{this.state.myGoodList.length ? <View className='mygoodlist-container'>
|
</MovableArea>
|
||||||
{goodListElementArray}
|
|
||||||
</View > : <View className='no-more-title'> 没有更多了</View>}
|
|
||||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<CopyrightComponent></CopyrightComponent>
|
|
||||||
</View>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,21 @@ $themeColor:#FF7142;
|
|||||||
.button-orange, .button-dark-red,.button-green{
|
.button-orange, .button-dark-red,.button-green{
|
||||||
font-size:28rpx;
|
font-size:28rpx;
|
||||||
}
|
}
|
||||||
|
.movable-point{
|
||||||
|
height:130rpx;
|
||||||
|
width:130rpx;
|
||||||
|
color:#ffffff;
|
||||||
|
background-color:black;
|
||||||
|
opacity: 0.3;
|
||||||
|
border-radius:50%;
|
||||||
|
position:fixed;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content:center;
|
||||||
|
font-size:25rpx;
|
||||||
|
opacity:1 ;
|
||||||
|
position:fixed;
|
||||||
|
}
|
||||||
.MyGoodList{
|
.MyGoodList{
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
.filterbar-container{
|
.filterbar-container{
|
||||||
|
@ -70,7 +70,7 @@ class MyGoodsEdit extends Component {
|
|||||||
for (let key in shopTypeObject) {
|
for (let key in shopTypeObject) {
|
||||||
for (let item of shopTypeObject[key].c) {
|
for (let item of shopTypeObject[key].c) {
|
||||||
if (item.id === res.data.goods.shop_class_id) {
|
if (item.id === res.data.goods.shop_class_id) {
|
||||||
selectedValue = {name:item.n,id:item.id}
|
selectedValue = { name: item.n, id: item.id }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,6 +91,12 @@ class MyGoodsEdit extends Component {
|
|||||||
} else if (res.data.err_code === 88888) {
|
} else if (res.data.err_code === 88888) {
|
||||||
loginExpired(res)
|
loginExpired(res)
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
Taro.showToast({
|
||||||
|
title: res.data.err_msg,
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -166,9 +172,10 @@ class MyGoodsEdit extends Component {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.state.isSaveButton) {
|
if (this.state.isSaveButton) {
|
||||||
// Taro.redirectTo({
|
Taro.navigateBack({
|
||||||
// url: '/pages/myGoodsEdit/myGoodsEdit?id=' + this.$router.params.id
|
delta:1
|
||||||
// })
|
// url: '/pages/myGoodsList/myGoodsEdit?id=' + this.$router.params.id
|
||||||
|
})
|
||||||
} else if (this.state.isSaveAndNewBUtton) {
|
} else if (this.state.isSaveAndNewBUtton) {
|
||||||
Taro.switchTab({
|
Taro.switchTab({
|
||||||
url: '/pages/goodsPublish/goodsPublish'
|
url: '/pages/goodsPublish/goodsPublish'
|
||||||
@ -455,9 +462,9 @@ class MyGoodsEdit extends Component {
|
|||||||
{/* <View className='button'>
|
{/* <View className='button'>
|
||||||
<Button className='button-a' size='mini' >发布并新增</Button>
|
<Button className='button-a' size='mini' >发布并新增</Button>
|
||||||
</View> */}
|
</View> */}
|
||||||
<View className='button' onClick={this.saveAndNewButton.bind(this)}>
|
{/* <View className='button' onClick={this.saveAndNewButton.bind(this)}>
|
||||||
<Button className='button-green' size='mini'>保存并新增</Button>
|
<Button className='button-green' size='mini'>保存并新增</Button>
|
||||||
</View>
|
</View> */}
|
||||||
<View className='button' onClick={this.goToGoodsDetailPage.bind(this)}>
|
<View className='button' onClick={this.goToGoodsDetailPage.bind(this)}>
|
||||||
<Button className='button-green' size='mini'>商品详情</Button>
|
<Button className='button-green' size='mini'>商品详情</Button>
|
||||||
</View>
|
</View>
|
||||||
|
@ -265,7 +265,7 @@ class MyNeedsEdit extends Component {
|
|||||||
duration: 1000
|
duration: 1000
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Taro.reLaunch({
|
Taro.switchTab({
|
||||||
url: '/pages/myNeeds/myNeeds'
|
url: '/pages/myNeeds/myNeeds'
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ class MyNeedsEdit extends Component {
|
|||||||
this.setState({ content: event.target.value })
|
this.setState({ content: event.target.value })
|
||||||
}
|
}
|
||||||
goToMyNeedsPage() {
|
goToMyNeedsPage() {
|
||||||
Taro.reLaunch({
|
Taro.switchTab({
|
||||||
url: '/pages/myNeeds/myNeeds'
|
url: '/pages/myNeeds/myNeeds'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ class MyNeedsPublish extends Component {
|
|||||||
|
|
||||||
}
|
}
|
||||||
goToMyNeedsPage() {
|
goToMyNeedsPage() {
|
||||||
Taro.reLaunch({
|
Taro.switchTab({
|
||||||
url: '/pages/myNeeds/myNeeds'
|
url: '/pages/myNeeds/myNeeds'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,7 @@ class MySupplyDemand extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onSearchButtonHandler() {
|
onSearchButtonHandler() {
|
||||||
|
|
||||||
Taro.showLoading({ title: '加载中' })
|
Taro.showLoading({ title: '加载中' })
|
||||||
|
|
||||||
this.setState({ loadMorePageIndex: 1 }, () => {
|
this.setState({ loadMorePageIndex: 1 }, () => {
|
||||||
@ -160,7 +161,7 @@ class MySupplyDemand extends Component {
|
|||||||
|
|
||||||
// 新增我的供求
|
// 新增我的供求
|
||||||
addDemandSupply() {
|
addDemandSupply() {
|
||||||
Taro.reLaunch({
|
Taro.navigateTo({
|
||||||
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -234,14 +235,16 @@ class MySupplyDemand extends Component {
|
|||||||
// 编辑我的供求
|
// 编辑我的供求
|
||||||
|
|
||||||
// 跳转到我的供求编辑页面
|
// 跳转到我的供求编辑页面
|
||||||
goToMyDSEditPage(sdId) {
|
goToMyDSEditPage(e) {
|
||||||
|
const sdId=e.currentTarget.dataset.eTapAA
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + sdId
|
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + sdId
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
// 转到供求查看页面
|
// 转到供求查看页面
|
||||||
goSupplyDemandView(sdId) {
|
goSupplyDemandView(e) {
|
||||||
|
const sdId=e.currentTarget.dataset.eTapAA
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: '/pages/supplyDemandView/supplyDemandView?sdId=' + sdId
|
url: '/pages/supplyDemandView/supplyDemandView?sdId=' + sdId
|
||||||
})
|
})
|
||||||
|
@ -84,12 +84,12 @@ class SupplyDemand extends Component {
|
|||||||
console.log('this.state.isPublishAndNew', this.state.isPublishAndNew)
|
console.log('this.state.isPublishAndNew', this.state.isPublishAndNew)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.state.isPublishAndNew) {
|
if (this.state.isPublishAndNew) {
|
||||||
Taro.reLaunch({
|
Taro.navigateTo({
|
||||||
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Taro.navigateTo({
|
Taro.redirectTo({
|
||||||
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + res.data.sd_id
|
url: '/pages/mySupplyDemand/mySupplyDemand'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@ -240,7 +240,7 @@ class SupplyDemand extends Component {
|
|||||||
LoginService()
|
LoginService()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Taro.switchTab({
|
Taro.navigateTo({
|
||||||
url: '/pages/mySupplyDemand/mySupplyDemand'
|
url: '/pages/mySupplyDemand/mySupplyDemand'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -383,9 +383,9 @@ class SupplyDemand extends Component {
|
|||||||
<View className='button' onClick={this.publishButtonHandler.bind(this)}>
|
<View className='button' onClick={this.publishButtonHandler.bind(this)}>
|
||||||
<Button size='mini' className='button-orange' >发布</Button>
|
<Button size='mini' className='button-orange' >发布</Button>
|
||||||
</View>
|
</View>
|
||||||
<View className='button' onClick={this.publishAndNewButton.bind(this)}>
|
{/* <View className='button' onClick={this.publishAndNewButton.bind(this)}>
|
||||||
<Button size='mini' className='button-green' >发布并新增</Button>
|
<Button size='mini' className='button-green' >发布并新增</Button>
|
||||||
</View>
|
</View> */}
|
||||||
<View className='button' onClick={this.goToMyDemSupPage.bind(this)}>
|
<View className='button' onClick={this.goToMyDemSupPage.bind(this)}>
|
||||||
<Button size='mini' className='button-green' >我的供求</Button>
|
<Button size='mini' className='button-green' >我的供求</Button>
|
||||||
</View>
|
</View>
|
||||||
|
@ -49,6 +49,7 @@ class SupplyDemandView extends Component {
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('供求详情获取成功', res)
|
console.log('供求详情获取成功', res)
|
||||||
|
Taro.hideLoading()
|
||||||
if (res.data.err_code === 0) {
|
if (res.data.err_code === 0) {
|
||||||
const selectedType = this.state.demandingSupplyCate.filter(item => item.id === res.data.sdInfo.sd_type)[0].name
|
const selectedType = this.state.demandingSupplyCate.filter(item => item.id === res.data.sdInfo.sd_type)[0].name
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -62,10 +63,15 @@ class SupplyDemandView extends Component {
|
|||||||
images: res.data.sdInfo.file_path,
|
images: res.data.sdInfo.file_path,
|
||||||
itemId: res.data.sdInfo.sd_id
|
itemId: res.data.sdInfo.sd_id
|
||||||
})
|
})
|
||||||
Taro.hideLoading()
|
|
||||||
} else if (res.data.err_code === 88888) {
|
} else if (res.data.err_code === 88888) {
|
||||||
loginExpired(res)
|
loginExpired(res)
|
||||||
}
|
}else{
|
||||||
|
Taro.showToast({
|
||||||
|
title:res.data.err_msg,
|
||||||
|
icon:'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -115,7 +121,7 @@ class SupplyDemandView extends Component {
|
|||||||
|
|
||||||
}
|
}
|
||||||
goToSDPublishPage() {
|
goToSDPublishPage() {
|
||||||
Taro.reLaunch({
|
Taro.navigateTo({
|
||||||
url: '/pages/supplyDemandPublish/supplyDemandPublish',// 供求发布页面
|
url: '/pages/supplyDemandPublish/supplyDemandPublish',// 供求发布页面
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -127,7 +133,7 @@ class SupplyDemandView extends Component {
|
|||||||
|
|
||||||
}
|
}
|
||||||
goToMySDPage() {
|
goToMySDPage() {
|
||||||
Taro.reLaunch({
|
Taro.navigateBack({
|
||||||
url: '/pages/mySupplyDemand/mySupplyDemand',//我的供求页面
|
url: '/pages/mySupplyDemand/mySupplyDemand',//我的供求页面
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -18,552 +18,136 @@ bug: 商品编辑 增加图片后 图片顺序乱了
|
|||||||
|
|
||||||
等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口
|
等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口
|
||||||
|
|
||||||
|
import '@tarojs/async-await'
|
||||||
import Taro, { Component } from '@tarojs/taro'
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components'
|
import { Provider } from '@tarojs/redux'
|
||||||
import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
import Home from './pages/home'
|
||||||
import FilteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent'
|
|
||||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
|
||||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
|
||||||
|
|
||||||
import LoginService from '../../util/LoginService'
|
import configStore from './store'
|
||||||
import weChatLogin from '../../util/weChatLogin'
|
|
||||||
import URL from '../../serviceAPI.config'
|
|
||||||
import './home.scss'
|
|
||||||
|
|
||||||
|
import './app.scss'
|
||||||
|
|
||||||
|
// 如果需要在 h5 环境中开启 React Devtools
|
||||||
|
// 取消以下注释:
|
||||||
|
// if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5') {
|
||||||
|
// require('nerv-devtools')
|
||||||
|
// }
|
||||||
|
|
||||||
class Home extends Component {
|
const store = configStore()
|
||||||
|
|
||||||
|
class App extends Component {
|
||||||
|
|
||||||
|
isTrue = Taro.getStorageSync('session_id') ? true : false
|
||||||
config = {
|
config = {
|
||||||
navigationBarTitleText: '首页',
|
pages: [
|
||||||
|
//'pages/index/index', // index页面
|
||||||
|
'pages/home/home',//首页 ---------------------
|
||||||
|
'pages/login/login',//登入页面 ---------------------
|
||||||
|
'pages/shop/shop',//店铺页面 ---------------------
|
||||||
|
'pages/goods/goods',// 商品页面 ---------------------
|
||||||
|
'pages/goodsPublish/goodsPublish',// 商品发布页面 ---------------------
|
||||||
|
'pages/supplyDemandPublish/supplyDemandPublish',// 供求发布页面 ---------------------
|
||||||
|
'pages/mySupplyDemand/mySupplyDemand',// 我的供求列表页面 ---------------------
|
||||||
|
'pages/myGoodsEdit/myGoodsEdit',// 我的商品编辑页面 ---------------------
|
||||||
|
'pages/allDemanding/allDemanding',// 所有供求页面 ---------------------
|
||||||
|
'pages/myGoodList/myGoodList',// 我的商品列表页面 --------------------- 编辑商品按键
|
||||||
|
'pages/myDemandSupplyEdit/myDemandSupplyEdit',// 我的供求编辑页面 ---------------------
|
||||||
|
'pages/supplyDemandView/supplyDemandView',// 查看单个供求页面
|
||||||
|
'pages/grabOrderPage/grabOrderPage',// 抢单页面
|
||||||
|
'pages/myNeeds/myNeeds',// 我的需求页面
|
||||||
|
'pages/myNeedsView/myNeedsView',// 单个需求查看页面
|
||||||
|
'pages/myNeedsEdit/myNeedsEdit',// 单个需求编辑页面
|
||||||
|
'pages/myNeedsPublish/myNeedsPublish',// 需求发布
|
||||||
|
|
||||||
}
|
// 'pages/shopDescription/shopDescription',
|
||||||
|
],
|
||||||
constructor() {
|
permission: {
|
||||||
super(...arguments);
|
"scope.userLocation": {
|
||||||
this.state = {
|
"desc": "你的位置信息将用于小程序位置接口的效果展示"
|
||||||
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: ''
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 => {
|
window: {
|
||||||
console.log('首页基本信息', res)
|
backgroundTextStyle: 'light',
|
||||||
if (res.data.err_msg === 'success') {
|
navigationBarBackgroundColor: '#fff',
|
||||||
|
navigationBarTitleText: 'WeChat',
|
||||||
|
navigationBarTextStyle: 'black',
|
||||||
|
// enablePullDownRefresh:true
|
||||||
|
onReachBottomDistance: 0
|
||||||
|
},
|
||||||
|
|
||||||
this.setState({
|
tabBar: {
|
||||||
ads: res.data.data.adsLb,
|
list: [{
|
||||||
categories: [res.data.data.supplyClass[0], Object.values(res.data.data.supplyClass[1])],
|
pagePath: "pages/home/home",
|
||||||
demanding: res.data.data.demand.supplys,
|
text: "首页",
|
||||||
otherData: res.data.otherData,
|
iconPath: "./icons/home.png",
|
||||||
userName: res.data.otherData.userName,
|
selectedIconPath: "./icons/home-actived.png"
|
||||||
userPhone: res.data.otherData.userPhone,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
Taro.showToast({
|
|
||||||
title: res.data.err_msg,
|
|
||||||
icon: 'none',
|
|
||||||
duration: 1500
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// 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,
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
header: {
|
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
, {
|
||||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
pagePath: "pages/myNeedsPublish/myNeedsPublish",
|
||||||
|
text: "需求发布",
|
||||||
|
iconPath: "./icons/publish.png",
|
||||||
|
selectedIconPath: "./icons/publish-actived.png"
|
||||||
}
|
}
|
||||||
})
|
, {
|
||||||
.then(res => {
|
pagePath: "pages/myNeeds/myNeeds",
|
||||||
console.log('所有店铺的信息', res)
|
text: "我的需求",
|
||||||
Taro.hideLoading()
|
iconPath: "./icons/needs.png",
|
||||||
if (res.data.err_code === 0) {
|
selectedIconPath: "./icons/needs-actived.png"
|
||||||
if (this.state.isAddToList) {
|
|
||||||
if (res.data.shops) {
|
|
||||||
this.setState({ shops: this.state.shops.concat(res.data.shops), isAddToList: false })
|
|
||||||
} else {
|
|
||||||
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 })
|
|
||||||
}
|
}
|
||||||
)
|
// , {
|
||||||
}
|
// pagePath: "pages/individualCenter/individualCenter",
|
||||||
getUserLocation(that) {
|
// text: "个人中心",
|
||||||
Taro.getLocation({
|
// iconPath: "./icons/needs.png",
|
||||||
type: 'gcj02', // 返回可以用于wx.openLocation的经纬度
|
// selectedIconPath: "./icons/needs-actived.png"
|
||||||
success(res) {
|
// }
|
||||||
that.setState({
|
],
|
||||||
latitude: res.latitude,
|
color: '#333',
|
||||||
longitude: res.longitude
|
selectedColor: '#FF7142',
|
||||||
},()=>{
|
backgroundColor: '#fff',
|
||||||
that.getShops({})
|
borderStyle: 'black'
|
||||||
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
|
|
||||||
}
|
}
|
||||||
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({
|
|
||||||
|
|
||||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
|
|
||||||
})
|
|
||||||
}
|
|
||||||
goToMyNeedsPublish() {
|
|
||||||
// 传参数给myNeedsPublish页面- 显示效果图选项
|
|
||||||
Taro.navigateTo({
|
|
||||||
url: '/pages/myNeedsPublish/myNeedsPublish?id=1'
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
// 页面加载后 得到首页的基本信息和推荐店铺的信息
|
|
||||||
Taro.showLoading({ title: '加载中' })
|
|
||||||
this.getUserLocation(this)
|
|
||||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
|
||||||
weChatLogin()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// this.login().then(() => {
|
|
||||||
// this.getShops({})
|
|
||||||
// this.getHomeCategoriesInfo()
|
|
||||||
// }).catch(err => console.log('微信登入失败:', err))
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentDidShow() { }
|
||||||
|
|
||||||
}
|
|
||||||
componentWillUnmount() { }
|
|
||||||
|
|
||||||
componentDidShow() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidHide() { }
|
componentDidHide() { }
|
||||||
|
|
||||||
|
componentCatchError() { }
|
||||||
|
|
||||||
// 微信用户信息
|
componentDidCatchError() { }
|
||||||
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, })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// 在 App 类中的 render() 函数没有实际作用
|
||||||
|
// 请勿修改此函数
|
||||||
render() {
|
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) => {
|
|
||||||
|
|
||||||
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 (
|
return (
|
||||||
<View className='home'>
|
<Provider store={store}>
|
||||||
|
<Home />
|
||||||
{/* 获取微信用户的信息 */}
|
</Provider>
|
||||||
{/* <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 Home
|
Taro.render(<App />, document.getElementById('app'))
|
||||||
|
// {
|
||||||
|
// pagePath: "pages/goodsPublish/goodsPublish",
|
||||||
|
// text: "商品发布",
|
||||||
|
// iconPath: "./icons/box.png",
|
||||||
|
// selectedIconPath: "./icons/box-actived.png"
|
||||||
|
// }, {
|
||||||
|
// pagePath: "pages/supplyDemandPublish/supplyDemandPublish",
|
||||||
|
// text: "供求发布",
|
||||||
|
// iconPath: "./icons/publish.png",
|
||||||
|
// selectedIconPath: "./icons/publish-actived.png"
|
||||||
|
// }
|
||||||
|
// , {
|
||||||
|
// pagePath: "pages/mySupplyDemand/mySupplyDemand",
|
||||||
|
// text: "我的供求",
|
||||||
|
// iconPath: "./icons/menu.png",
|
||||||
|
// selectedIconPath: "./icons/menu-actived.png"
|
||||||
|
// }
|
Loading…
Reference in New Issue
Block a user