diff --git a/src/app.js b/src/app.js
index b36edba..5b3e4d6 100644
--- a/src/app.js
+++ b/src/app.js
@@ -89,7 +89,7 @@ class App extends Component {
}
componentDidMount() {
-
+
}
componentDidShow() { }
diff --git a/src/app.scss b/src/app.scss
index 9551879..8ebfa3b 100644
--- a/src/app.scss
+++ b/src/app.scss
@@ -5,7 +5,9 @@ $linearOrange:linear-gradient(to right, #FF7142, #FF7142);
$linearDarkRed:linear-gradient(to right, #d9534f, #d9534f);;
$linearGreen:linear-gradient(to right, #5cb85c, #5cb85c);;
$linearBlue:linear-gradient(to right, #337ab7, #337ab7);
-
+page{
+ height: 100%;
+}
.input-index--at-input__title{
font-weight: bold
@@ -25,27 +27,31 @@ $linearBlue:linear-gradient(to right, #337ab7, #337ab7);
color:white;
font-size: 28px;
background:$linearGreen;
- margin:20px auto
+ margin:20px auto;
+ border-color: #fff;
}
.button-dark-red{
color:white;
font-size: 28px;
background:$linearDarkRed;
- margin:20px auto
+ margin:20px auto;
+ border-color: #fff;
}
.button-orange{
color:white;
font-size: 28px;
background:$linearOrange;
- margin:20px auto
+ margin:20px auto;
+ border-color: #fff;
}
.button-blue{
color:white;
font-size: 28px;
background:$linearBlue;
- margin:20px auto
+ margin:20px auto;
+ border-color: #fff;
}
.blur{
opacity: 0.5;
diff --git a/src/component/filteredShopComponent/filteredShopComponent.js b/src/component/filteredShopComponent/filteredShopComponent.js
index 62797a7..0926a7d 100644
--- a/src/component/filteredShopComponent/filteredShopComponent.js
+++ b/src/component/filteredShopComponent/filteredShopComponent.js
@@ -4,6 +4,7 @@ import { AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction, AtNotice
import VoucherPosterComponent from './voucherPosterComponent/voucherPosterComponent'
+import onClickValueService from '../../util/onClickValueService'
import './filteredShopComponent.scss'
import URL from '../../serviceAPI.config'
@@ -41,8 +42,8 @@ class recommondShop extends Component {
}
}
goToShop(e) {
- console.log('e',e)
- const value = e.currentTarget.dataset.eTapAA
+
+ const value = onClickValueService(e)
Taro.navigateTo({
url: '/pages/shop/shop?id=' + value.shop_id
})
@@ -245,8 +246,8 @@ class recommondShop extends Component {
const goodsElementsArray = goods !== null ? slicedGoods.map((item, index) => {
return
}) : null
@@ -264,10 +265,10 @@ class recommondShop extends Component {
联系人:
@@ -276,11 +277,11 @@ class recommondShop extends Component {
联系电话:
@@ -296,20 +297,20 @@ class recommondShop extends Component {
{consultModalElement}
-
+
{title}
diff --git a/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.js b/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.js
index bbe0a74..850840a 100644
--- a/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.js
+++ b/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.js
@@ -137,11 +137,11 @@ class VoucherPoster extends Component {
当前优惠券{this.props.voucherLeft}张
- 联系人:
+ 联系人:
- 联系电话:
+ 联系电话:
@@ -151,7 +151,7 @@ class VoucherPoster extends Component {
-
+
diff --git a/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.scss b/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.scss
index 470c9ee..a9dcc57 100644
--- a/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.scss
+++ b/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.scss
@@ -39,9 +39,6 @@ $linearOrange:linear-gradient(to right, #FF7142, #FF7142);
top:0px;
background-size:100% 100%;
min-height:100%;
-
-
-
.close-icon{
margin-left:88%;
margin-top:2%;
@@ -60,7 +57,6 @@ $linearOrange:linear-gradient(to right, #FF7142, #FF7142);
.input-name,.input-number{
margin-top:2%;
margin-left:10%;
-
overflow: hidden;
width: 80%;
@@ -73,6 +69,7 @@ $linearOrange:linear-gradient(to right, #FF7142, #FF7142);
align-items:center;
.title{
margin-left:7%;
+ width:200px;
}
diff --git a/src/pages/allDemanding/allDemanding.js b/src/pages/allDemanding/allDemanding.js
index 60100c2..3fca8e7 100644
--- a/src/pages/allDemanding/allDemanding.js
+++ b/src/pages/allDemanding/allDemanding.js
@@ -1,11 +1,12 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image, Button } from '@tarojs/components'
-import { AtInput, Picker, AtIcon, AtModal, AtToast, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
+import { AtInput, Picker, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
import loginExpired from '../../util/loginExpired'
+import onClickValueService from '../../util/onClickValueService'
import URL from '../../serviceAPI.config'
import './allDemanding.scss'
@@ -165,7 +166,7 @@ class AllDemanding extends Component {
}
grabOrder(e) {
- const id = e.currentTarget.dataset.eTapAA
+ const id = onClickValueService(e)
this.setState({ isOpenedGrabModal: true, grabOrderId: id })
}
handleGrabModalClose() {
@@ -204,7 +205,7 @@ class AllDemanding extends Component {
}
goToGrabOrderPage(e) {
- const id = e.currentTarget.dataset.eTapAA
+ const id = onClickValueService(e)
Taro.navigateTo({
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + id
})
@@ -328,7 +329,7 @@ class AllDemanding extends Component {
{/* 开始和结束日期选择 */}
-
+
开始日期: {this.state.startDateSel}
diff --git a/src/pages/allDemanding/allDemanding.scss b/src/pages/allDemanding/allDemanding.scss
index 954d087..f7b561e 100644
--- a/src/pages/allDemanding/allDemanding.scss
+++ b/src/pages/allDemanding/allDemanding.scss
@@ -54,7 +54,7 @@ $themeColor: #FF7142;
flex-wrap: nowrap;
flex-direction: row;
.picker-container{
- flex:1
+ width: 56px
}
}
.button-box{
diff --git a/src/pages/goods/goods.js b/src/pages/goods/goods.js
index d19998c..b25e9ce 100644
--- a/src/pages/goods/goods.js
+++ b/src/pages/goods/goods.js
@@ -36,6 +36,7 @@ class Goods extends Component {
// 商品详情api
getGoodDescription() {
+
Taro.request({
url: URL.GetShopItemDetail,
method: 'POST',
diff --git a/src/pages/grabOrderPage/renderingView/renderingView.js b/src/pages/grabOrderPage/renderingView/renderingView.js
index 83e17ca..8321488 100644
--- a/src/pages/grabOrderPage/renderingView/renderingView.js
+++ b/src/pages/grabOrderPage/renderingView/renderingView.js
@@ -5,6 +5,7 @@ import { AtCurtain } from 'taro-ui'
import URL from '../../../serviceAPI.config'
import './renderingView.scss'
+import onClickValueService from '../../../util/onClickValueService'
@@ -25,7 +26,7 @@ class RenderingView extends Component {
}
onClickHandler(e) {
- const item = e.currentTarget.dataset.eTapAA
+ const item = onClickValueService(e)
this.setState({
image: URL.Base + item.file_path,
isOpened:true
diff --git a/src/pages/home/clientDemanding/clientDemanding.js b/src/pages/home/clientDemanding/clientDemanding.js
new file mode 100644
index 0000000..3c0054a
--- /dev/null
+++ b/src/pages/home/clientDemanding/clientDemanding.js
@@ -0,0 +1,62 @@
+import Taro, { Component } from '@tarojs/taro'
+import { View, Button, ScrollView, Text } from '@tarojs/components'
+
+import './clientDemanding.scss'
+import onClickValueService from '../../../util/onClickValueService'
+
+
+class ClientDemanding extends Component {
+
+ passIdToParent(e) {
+ this.props.onGrabOrderId(e)
+ }
+ // 导航去抢单页面
+ goToGrabOrderPage(e) {
+ const orderId = onClickValueService(e)
+ Taro.navigateTo({
+ url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
+ })
+ }
+
+ render() {
+ const { ClientDemandingList } = this.props
+ const clientDemandingElementArray = ClientDemandingList.length ? ClientDemandingList.map((item, index) => {
+ return
+
+
+ {item.class_name}
+
+
+ {item.sd_title}
+
+
+ {item.user_address || '--'}
+
+
+ 业主:{item.user_name}
+
+
+ {item.state === '1' ?
+
+ : null || item.state === '2' ?
+
+ : null || item.state === '3' ?
+
+ : null}
+
+
+ }) :
+ return
+ {clientDemandingElementArray}
+
+ }
+}
+export default ClientDemanding
diff --git a/src/pages/home/clientDemanding/clientDemanding.scss b/src/pages/home/clientDemanding/clientDemanding.scss
new file mode 100644
index 0000000..ca8dd40
--- /dev/null
+++ b/src/pages/home/clientDemanding/clientDemanding.scss
@@ -0,0 +1,57 @@
+$themeColor: #FF7142;
+
+.demanding-item{
+ border:2px solid #ddd;
+ border-right: 0px;
+ height:100%;
+ width:40%;
+ display:inline-block;
+ text-align: center;
+ .item-tag{
+ color:white;
+ font-size: 30px;
+ text-align: right;
+ .item-tag-text{
+ padding:5px;
+ background-color: $themeColor;
+ }
+ }
+ .item-title{
+ font-size: 40px;
+ min-height: 21px;
+ clear: both;
+ color: $themeColor;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+ .item-address{
+ padding-top: 5px;
+ font-size: 35px;
+ // margin-top: 20px;
+ }
+ .item-name{
+ color: #ccc;
+ padding-top: 5px;
+ font-size: 30px;
+ // margin-top: 10px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ .button-orange{
+ color:white;
+ font-size: 28px;
+ background:linear-gradient(to right, #FF7142, #FF7142);;
+ margin:20px auto
+ }
+ .blur{
+ opacity: 0.5;
+ }
+
+
+}
+.last{
+ border-right: 2px solid #ddd;
+}
\ No newline at end of file
diff --git a/src/pages/home/home.js b/src/pages/home/home.js
index 8fdeae8..c0f049b 100644
--- a/src/pages/home/home.js
+++ b/src/pages/home/home.js
@@ -1,11 +1,14 @@
import Taro, { Component } from '@tarojs/taro'
-import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components'
+import { View, Button, Text, Swiper, SwiperItem, Image, ScrollView } from '@tarojs/components'
import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
+import MainCateSlider from './mainCateSlider/mainCateSlider'
+import SubCateSlider from './subCateSlider/subCateSlider'
+import ClientDemanding from './clientDemanding/clientDemanding'
import FilteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent'
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
-
+import onClickValueService from '../../util/onClickValueService'
import LoginService from '../../util/LoginService'
import weChatLogin from '../../util/weChatLogin'
import URL from '../../serviceAPI.config'
@@ -212,19 +215,17 @@ class Home extends Component {
}
// 点击大类icon
onClickParentCate(e) {
- const item = e.currentTarget.dataset.eTapAA
+ const item = onClickValueService(e)
Taro.showLoading({
title: '加载中'
})
this.setState({ parentClass: item.class_id, childClass: item.class_id, supplyLevel: 1, subCate: item.children || [] }, () => {
this.getShops({})
})
-
-
}
// 点击子类
- onClickChildCate(e) {
- const item = e.currentTarget.dataset.eTapAA
+ clickChildCateHanlder(e) {
+ const item = onClickValueService(e)
Taro.showLoading({
title: '加载中'
})
@@ -235,13 +236,13 @@ class Home extends Component {
// this.getShops(item.parent_class_id, item.class_id, 2)
}
- scrollToSubCate(item) {
+ scrollToSubFromChild(e) {
Taro.pageScrollTo({
scrollTop: 410,
duration: 300
})
- this.onClickParentCate(item)
+ this.onClickParentCate(e)
}
// 转到其他页面
goToAllDemandingPage() {
@@ -255,7 +256,7 @@ class Home extends Component {
}
grabOrderId(e) {
- const id = e.currentTarget.dataset.eTapAA
+ const id = onClickValueService(e)
this.setState({ isOpen: true, grabOrderId: id })
}
handleGrabModalClose() {
@@ -274,14 +275,7 @@ class Home extends Component {
}
- // 导航去抢单页面
- goToGrabOrderPage(e) {
- const orderId = e.currentTarget.dataset.eTapAA
- Taro.navigateTo({
- url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
- })
- }
goToMyNeedsPublish() {
// 传参数给myNeedsPublish页面- 显示效果图选项
Taro.navigateTo({
@@ -362,60 +356,14 @@ class Home extends Component {
- const demandingElemensArray = this.state.demanding.length ? this.state.demanding.map((item, index) => {
-
- return
-
-
-
- {item.class_name}
-
-
- {item.sd_title}
-
-
- {item.user_address || '--'}
-
-
- 业主:{item.user_name}
-
-
- {item.state === '1' ?
-
- : null || item.state === '2' ?
-
- : null || item.state === '3' ?
-
- : null}
- {/*
-
- */}
-
-
- }) : null
+ const mainCate1 = this.state.categories[0]
+ const mainCate2 = this.state.categories[1]
const adsImgElementsArray = this.state.ads.length ? this.state.ads.map((item, index) => {
return
}) : null
-
- // 这里应该代码可以优化-----
- const categoriesElementsArray1 = this.state.categories.length ? this.state.categories[0].map((item, index) => {
- return
- {/* onClick={this.onClickParentCate.bind(this, item)}> */}
-
- {item.class_name}
-
- }) : null
- const categoriesElementsArray2 = this.state.categories.length ? this.state.categories[1].map((item, index) => {
- return
- {/* onClick={this.onClickParentCate.bind(this, item)}> */}
-
- {item.class_name}
-
- }) : null
-
const shopCollectionElementsArray = this.state.shops.length ? this.state.shops.map((item, index) => {
return
-
+
{/* 获取微信用户的信息 */}
{/* 获取微信用户的信息 */}
@@ -440,8 +394,8 @@ class Home extends Component {
{/* 第二行图片滚动条 */}
+
-
-
-
- {categoriesElementsArray1}
-
-
-
-
- {categoriesElementsArray2}
-
-
-
+
+
{/* 第三行图片滚动条 */}
-
- {demandingElemensArray}
-
+
-
- {this.state.subCate.length ? 4.5 ? 4.5 : this.state.subCate.length}
- >
- {subCateElementsArray}
- : null}
-
+ {this.state.subCate.length ?
+
+ : }
行业推荐
@@ -559,7 +476,7 @@ class Home extends Component {
{/* */}
{/* {this.state.isShopOwner ? : } */}
-
+
)
}
}
diff --git a/src/pages/home/home.scss b/src/pages/home/home.scss
index db3c5f6..9392169 100644
--- a/src/pages/home/home.scss
+++ b/src/pages/home/home.scss
@@ -1,7 +1,16 @@
$themeColor: #FF7142;
.home{
overflow: hidden;
+
+ .first-banner{
+ height:250px;
+ .banner-img{
+ height: 100%;
+ width: 100%;
+ }
+ }
.first-banner ,.third-banner{
+ height:200px;
.banner-img{
height: 100%;
width: 100%;
@@ -47,7 +56,8 @@ $themeColor: #FF7142;
}
}
.customer-demanding{
- padding:0 20px;
+ padding:0 20px 20px;
+ height: 300px;
.demanding-item{
border: 2rpx solid #ddd;
border-right:0px;
@@ -127,8 +137,7 @@ $themeColor: #FF7142;
}
.second-banner{
- height:28vh;
-
+ height:330px;
.categories{
display: flex;
flex-wrap: wrap;
@@ -148,18 +157,6 @@ $themeColor: #FF7142;
}
}
.second-banner-level2{
- .swipper{
- text-align: center;
- font-size: 30px;
- border-bottom:1px solid #F2F2F2;
-
- .text{
- margin-top: 20px
- }
- }
+ padding: 20px;
}
-
-.swiper-sub{
- margin-bottom: 0px;
-}
diff --git a/src/pages/home/mainCateSlider/mainCateSlider.js b/src/pages/home/mainCateSlider/mainCateSlider.js
new file mode 100644
index 0000000..9da9a55
--- /dev/null
+++ b/src/pages/home/mainCateSlider/mainCateSlider.js
@@ -0,0 +1,64 @@
+import Taro, { Component } from '@tarojs/taro'
+import { View } from '@tarojs/components'
+import { AtGrid, Swiper, SwiperItem } from 'taro-ui'
+
+import URL from '../../../serviceAPI.config'
+import './mainCateSlider.scss'
+
+
+class MainCateSlider extends Component {
+
+
+ passDataToParent(e) {
+
+ this.props.onScrollFromChild(e)
+ }
+ componentWillReceiveProps(nextProps) {
+ console.log(this.props, nextProps)
+ }
+
+ componentWillUnmount() { }
+
+ componentDidShow() { }
+
+ componentDidHide() { }
+ formateSliderData(data) {
+ const formatedData = data.map(item => {
+ item.image = URL.Base + item.icon
+ item.value = item.class_name
+ return item
+ })
+ console.log('formatedData', formatedData)
+ return formatedData
+ }
+ render() {
+ const { firstSlideData, secondSlideData } = this.props
+
+ const formatedFirstSlideData = firstSlideData ? this.formateSliderData(firstSlideData) : []
+ const formatedSecondSlideData = secondSlideData ? this.formateSliderData(secondSlideData) : []
+
+ return (
+
+
+
+ < AtGrid hasBorder={false} columnNum={5} data={formatedFirstSlideData} onClick={this.passDataToParent.bind(this)} />
+
+
+
+ < AtGrid hasBorder={false} columnNum={5} data={formatedSecondSlideData} onClick={this.passDataToParent.bind(this)} />
+
+
+
+
+ )
+ }
+}
+
+export default MainCateSlider
diff --git a/src/pages/home/mainCateSlider/mainCateSlider.scss b/src/pages/home/mainCateSlider/mainCateSlider.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/pages/home/subCateSlider/subCateSlider.js b/src/pages/home/subCateSlider/subCateSlider.js
new file mode 100644
index 0000000..f741fc7
--- /dev/null
+++ b/src/pages/home/subCateSlider/subCateSlider.js
@@ -0,0 +1,45 @@
+import Taro, { Component } from '@tarojs/taro'
+import { View } from '@tarojs/components'
+import { AtGrid, Swiper, SwiperItem } from 'taro-ui'
+import URL from '../../../serviceAPI.config'
+import './subCateSlider.scss'
+
+
+class SubCateSlider extends Component {
+
+
+ passDataToParent(e) {
+
+ this.props.onClickChildCate(e)
+ }
+
+ render() {
+ const { subCateList } = this.props
+ const subCateElementsArray = subCateList.map((item, index) => {
+ return
+ {item.class_name}
+
+ })
+
+ return (
+
+
+
+ {subCateElementsArray}
+
+
+
+ )
+ }
+}
+
+export default SubCateSlider
diff --git a/src/pages/home/subCateSlider/subCateSlider.scss b/src/pages/home/subCateSlider/subCateSlider.scss
new file mode 100644
index 0000000..72031e3
--- /dev/null
+++ b/src/pages/home/subCateSlider/subCateSlider.scss
@@ -0,0 +1,11 @@
+.scroll-view{
+ height:100%;
+ padding:0px 0px;
+ .view-item{
+ width:150px;
+ display:inline-block;
+ text-align:center;
+ padding-bottom: 10px;
+ border-bottom:2px solid #F2F2F2;
+ }
+}
\ No newline at end of file
diff --git a/src/pages/individualCenter/individualCenter.js b/src/pages/individualCenter/individualCenter.js
index 4745288..058cd4e 100644
--- a/src/pages/individualCenter/individualCenter.js
+++ b/src/pages/individualCenter/individualCenter.js
@@ -7,6 +7,7 @@ import Logout from '../../util/logout'
import './individualCenter.scss'
import URL from '../../serviceAPI.config'
+import onClickValueService from '../../util/onClickValueService';
@@ -54,7 +55,8 @@ class IndividualCenter extends Component {
}
}
handlerGridClick(e) {
- const value = e.currentTarget.dataset.eTapAA.value
+ const value = onClickValueService(e).value
+
switch (value) {
case '需求发布':
Taro.switchTab({
diff --git a/src/pages/login/login.js b/src/pages/login/login.js
index 638f8eb..ee1a6e2 100644
--- a/src/pages/login/login.js
+++ b/src/pages/login/login.js
@@ -55,10 +55,8 @@ class Login extends Component {
Taro.showToast({
title: '未知错误请联系管理员',
icon: 'none',
-
})
}
-
}
componentDidMount() {
@@ -96,7 +94,7 @@ class Login extends Component {
-
+
diff --git a/src/pages/myGoodList/myGoodList.js b/src/pages/myGoodList/myGoodList.js
index e5725b7..e456ef7 100644
--- a/src/pages/myGoodList/myGoodList.js
+++ b/src/pages/myGoodList/myGoodList.js
@@ -7,6 +7,7 @@ import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToT
import URL from '../../serviceAPI.config'
import './myGoodList.scss'
import loginExpired from '../../util/loginExpired';
+import onClickValueService from '../../util/onClickValueService';
class MyGoodList extends Component {
@@ -379,7 +380,7 @@ class MyGoodList extends Component {
Taro.showLoading({
title: '加载中'
})
- const value = e.currentTarget.dataset.eTapAA
+ const value = onClickValueService(e)
this.setState({ selectedFilterValue: value })
if (value == 0) {
this.setState({
@@ -492,7 +493,7 @@ class MyGoodList extends Component {
// 单个商品选择
handleCheckChange(e) {
//如果goodid 一样的那么checked 就取反
- const id = e.currentTarget.dataset.eTapAA
+ const id = onClickValueService(e)
const newMyGoodList = this.state.myGoodList.map((item) => {
if (item.goods_id === id) {
item.checked = !item.checked
@@ -536,7 +537,9 @@ class MyGoodList extends Component {
}
// 导航到商品编辑页面myGoodsEdit
goToGoodEditPage(e) {
- const goodId = e.currentTarget.dataset.eTapAA
+ console.log('e',e)
+ const goodId = onClickValueService(e)
+ console.log('goodId',goodId)
Taro.navigateTo({
url: '/pages/myGoodsEdit/myGoodsEdit?id=' + goodId
})
@@ -549,7 +552,7 @@ class MyGoodList extends Component {
})
}
goToGoodspage(e) {
- const goodId = e.currentTarget.dataset.eTapAA
+ const goodId = onClickValueService(e)
Taro.navigateTo({
url: '/pages/goods/goods?id=' + goodId
})
diff --git a/src/pages/myNeeds/myNeeds.js b/src/pages/myNeeds/myNeeds.js
index 457dfd9..6ac92c9 100644
--- a/src/pages/myNeeds/myNeeds.js
+++ b/src/pages/myNeeds/myNeeds.js
@@ -10,6 +10,7 @@ import LoginService from '../../util/LoginService'
import './myNeeds.scss'
import loginExpired from '../../util/loginExpired';
+import onClickValueService from '../../util/onClickValueService';
class MyNeeds extends Component {
@@ -252,20 +253,20 @@ class MyNeeds extends Component {
})
}
goToMyNeedsViewPage(e) {
- const id = e.currentTarget.dataset.eTapAA
+ const id = onClickValueService(e)
Taro.navigateTo({
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + id
})
}
goToMyNeedsEditPage(e) {
- const id = e.currentTarget.dataset.eTapAA
+ const id = onClickValueService(e)
Taro.navigateTo({
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + id
})
}
deleteButton(e) {
- const item = e.currentTarget.dataset.eTapAA
+ const item = onClickValueService(e)
this.setState({ isDeleteModal: true, needsItem: item })
}
handleWindowModCancel() {
diff --git a/src/pages/mySupplyDemand/mySupplyDemand.js b/src/pages/mySupplyDemand/mySupplyDemand.js
index b61a383..1027c80 100644
--- a/src/pages/mySupplyDemand/mySupplyDemand.js
+++ b/src/pages/mySupplyDemand/mySupplyDemand.js
@@ -10,6 +10,7 @@ import loginExpired from '../../util/loginExpired'
import './mySupplyDemand.scss'
+import onClickValueService from '../../util/onClickValueService';
class MySupplyDemand extends Component {
@@ -234,8 +235,8 @@ class MySupplyDemand extends Component {
// 删除我的供求
handleOnDelete(e) {
- const title = e.currentTarget.dataset.eTapAA.sd_title
- const id = e.currentTarget.dataset.eTapAA.sd_id
+ const title = onClickValueService(e).sd_title
+ const id = onClickValueService(e).sd_id
this.setState({ isConfirmWindow: true, demandSupplyItemName: title, demandSupplyId: id })
}
@@ -244,7 +245,7 @@ class MySupplyDemand extends Component {
// 跳转到我的供求编辑页面
goToMyDSEditPage(e) {
- const sdId = e.currentTarget.dataset.eTapAA
+ const sdId = onClickValueService(e)
Taro.navigateTo({
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + sdId
})
@@ -252,7 +253,7 @@ class MySupplyDemand extends Component {
}
// 转到供求查看页面
goSupplyDemandView(e) {
- const sdId = e.currentTarget.dataset.eTapAA
+ const sdId = onClickValueService(e)
Taro.navigateTo({
url: '/pages/supplyDemandView/supplyDemandView?sdId=' + sdId
})
diff --git a/src/pages/shop/shop.js b/src/pages/shop/shop.js
index 5f1dad3..f9a45a6 100644
--- a/src/pages/shop/shop.js
+++ b/src/pages/shop/shop.js
@@ -11,6 +11,7 @@ import './shop.scss'
import ShopItem from '../../component/shopItemComponent/shopItemComponent'
//import BottomNav from '../../component/bottomNav/bottomNav'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
+import onClickValueService from '../../util/onClickValueService';
const locationIcon = require('../../assets/img/location.png')
@@ -352,7 +353,7 @@ class Shop extends Component {
// 产品排序
accendingDescending(e) {
- const value = e.currentTarget.dataset.eTapAA
+ const value = onClickValueService(e)
Taro.showLoading({ title: '加载中' })
this.setState({ selectedFilterValue: value })
if (value == 0) {
@@ -705,8 +706,8 @@ class Shop extends Component {
{widthnessElementsArray}
-
-
+
+
diff --git a/src/todo list.txt b/src/todo list.txt
index 0055330..fd602e5 100644
--- a/src/todo list.txt
+++ b/src/todo list.txt
@@ -18,36 +18,86 @@ bug: 商品编辑 增加图片后 图片顺序乱了
等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口
import Taro, { Component } from '@tarojs/taro'
-import { View, Input, Button, Image } from '@tarojs/components'
+import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components'
+import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
+import MainCateSlider from './mainCateSlider/mainCateSlider'
+import FilteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent'
+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'
-
-import './login.scss'
+import './home.scss'
-class Login extends Component {
+
+class Home extends Component {
+
config = {
- navigationBarTitleText: '登入'
+ navigationBarTitleText: '首页',
+
}
+
constructor() {
+ super(...arguments);
this.state = {
- username: '',
- password: '',
- backgroundImage: 'background-image:url(' + URL.Base + '/Public/images/bg3.jpg);'
+ 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: '',
+
}
}
- //用户信息姓名和电话号码接口
- setUserInfoToStorage() {
+
+ // 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'),
+ // 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
}
})
.then(res => {
+ console.log('首页基本信息', res)
if (res.data.err_msg === 'success') {
- Taro.setStorageSync('user_identity', { username: res.data.otherData.userName, userphone: res.data.otherData.userPhone })
+ 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,
@@ -57,115 +107,482 @@ class Login extends Component {
}
})
}
- loginApi() {
+ // 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.Base + 'user-login',
+ url: URL.ShopSupplyShops,
method: 'POST',
dataType: 'json',
data: {
- username: this.state.username,
- password: this.state.password,
+ 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'),
+ }
+ })
+ .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 {
+ 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() {
+ return new Promise((resolve, reject) => {
+ Taro.getLocation({
+ type: 'wgs84', // 返回可以用于wx.openLocation的经纬度
+ success(res) {
+ resolve(res)
+ },
+ fail(res) {
+ Taro.showToast({
+ title: '获取定位失败',
+ icon: 'none'
+ })
+ reject(res)
+ }
+ })
+
+ })
+
+ }
+
+
+ // 微信用户设置
+ // 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 => {
- if (res.data.err_code === 0) {
+ Taro.showToast({
+ title: res.data.err_msg === 'success' ? '抢单成功' : res.data.err_msg,
+ icon: 'none',
+ duration: 1500
+ })
- Taro.showToast({
- title: res.data.err_msg && '登入成功',
- icon: 'success',
- duration: 1000
- })
- Taro.setStorageSync('session_id', res.data.session_id)
- Taro.setStorageSync('shopInfo', res.data.shop_info)
- Taro.setStorageSync('userInfo', res.data.user_info)
- Taro.setStorageSync('accountInfo',{username:this.state.username,password:this.state.password})
-
- this.setUserInfoToStorage()
-
- setTimeout(() => {
- // Taro.navigateBack({
- // delta: 1
- // })
- Taro.reLaunch({
- url:'/pages/home/home'
- })
- }, 1000);
-
- } else {
- Taro.showToast({
- title: res.data.msg,
- icon: 'none',
- duration: 2000
- })
- }
+ console.log('抢单请求:', res)
})
}
+ // 点击大类icon
+ onClickParentCate(e) {
+ const item = e.currentTarget.dataset.eTapAA
+ Taro.showLoading({
+ title: '加载中'
+ })
+ this.setState({ parentClass: item.class_id, childClass: item.class_id, supplyLevel: 1, subCate: item.children || [] }, () => {
+ this.getShops({})
+ })
+
- usernameHandler(e) {
- let value = e.detail.value
- this.setState({ username: value })
}
- passwordHandler(e) {
- let value = e.detail.value
- this.setState({ password: value })
+ // 点击子类
+ onClickChildCate(e) {
+ const item = e.currentTarget.dataset.eTapAA
+ Taro.showLoading({
+ title: '加载中'
+ })
+ this.setState({ childClass: item.class_id, supplyLevel: 2 }, () => {
+ this.getShops({})
+
+ })
+ // this.getShops(item.parent_class_id, item.class_id, 2)
+
}
- loginHandler() {
- this.loginApi()
+ 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(e) {
+ const id = e.currentTarget.dataset.eTapAA
+ 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(e) {
+ const orderId = e.currentTarget.dataset.eTapAA
+
+ Taro.navigateTo({
+ url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
+ })
+ }
+ goToMyNeedsPublish() {
+ // 传参数给myNeedsPublish页面- 显示效果图选项
+ Taro.navigateTo({
+ url: '/pages/myNeedsPublish/myNeedsPublish?id=1'
+ })
+
+ }
+
+
componentDidMount() {
+ // 页面加载后 得到首页的基本信息和推荐店铺的信息
+
+ Taro.showLoading({ title: '加载中' })
+ // 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时 从新登入
+ Taro.getStorageSync('userInfo').user_id ? true : weChatLogin()
+
+
+
}
- componentWillReceiveProps(nextProps) {
- console.log(this.props, nextProps)
- }
+ componentWillMount() {
+ }
componentWillUnmount() { }
- componentDidShow() { }
+ 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, })
+ })
+ }
+
render() {
+ // 提示模态弹窗element
+ const modalMessageGrabElement =
+ 提示
+
+ 确认抢单?
+
+
+
+
+ const demandingElemensArray = this.state.demanding.length ? this.state.demanding.map((item, index) => {
+
+ return
+
+
+
+ {item.class_name}
+
+
+ {item.sd_title}
+
+
+ {item.user_address || '--'}
+
+
+ 业主:{item.user_name}
+
+
+ {item.state === '1' ?
+
+ : null || item.state === '2' ?
+
+ : null || item.state === '3' ?
+
+ : null}
+ {/*
+
+ */}
+
+
+ }) : null
+
+ const adsImgElementsArray = this.state.ads.length ? this.state.ads.map((item, index) => {
+ return
+
+
+ }) : null
+
+ // 这里应该代码可以优化-----
+ const categoriesElementsArray1 = this.state.categories.length ? this.state.categories[0].map((item, index) => {
+ return
+ {/* onClick={this.onClickParentCate.bind(this, item)}> */}
+
+ {item.class_name}
+
+ }) : null
+ const categoriesElementsArray2 = this.state.categories.length ? this.state.categories[1].map((item, index) => {
+ return
+ {/* onClick={this.onClickParentCate.bind(this, item)}> */}
+
+ {item.class_name}
+
+ }) : null
+
+ const shopCollectionElementsArray = this.state.shops.length ? this.state.shops.map((item, index) => {
+ return
+ }) : 没有更多了
+ const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => {
+ return
+ {item.class_name}
+
+ }) : null
+
return (
-
-
-
-
-
-
-
+
- 全屋定制商城
-
+ {/* 获取微信用户的信息 */}
+ {/* 获取微信用户的信息 */}
+ {modalMessageGrabElement}
+
+
+
+ {adsImgElementsArray}
+
+
-
- 用户登入
-
-
-
-
+ {/* 第二行图片滚动条 */}
+ {/*
+
+
+
+ {categoriesElementsArray1}
-
-
+
+
+
+ {categoriesElementsArray2}
-
-
-
-
+
+
+ */}
+
+ {/* 第三行图片滚动条 */}
+
+
+
+
+
+
+
+ {/* 业主需求和行业推荐 */}
+
+
+
+
+ 业主需求
+
+
+ 更多>>
+
+
+
+
+ {demandingElemensArray}
+
+
+
+
+ {this.state.subCate.length ? 4.5 ? 4.5 : this.state.subCate.length}
+ >
+ {subCateElementsArray}
+ : null}
+
+
+
+ 行业推荐
+
+
+
+
+
+ {shopCollectionElementsArray}
+
+
+
+ {this.state.isShowTopNav ? : null}
+
+
+
+
+
+
+
+
+
+ {/* */}
+
+ {/* {this.state.isShopOwner ? : } */}
)
}
}
-export default Login
+export default Home
diff --git a/src/util/onClickValueService.js b/src/util/onClickValueService.js
new file mode 100644
index 0000000..781c78b
--- /dev/null
+++ b/src/util/onClickValueService.js
@@ -0,0 +1,11 @@
+
+
+export default function onClickValueService(e) {
+ let value
+ if (process.env.TARO_ENV === 'alipay') {
+ value = e.currentTarget.dataset.eOnTapAA
+ } else if (process.env.TARO_ENV === 'weapp') {
+ value = e.currentTarget.dataset.eTapAA
+ }
+ return value
+}
\ No newline at end of file