From 036bc4783ac455039365bfe61a243fd291d052e4 Mon Sep 17 00:00:00 2001 From: Maoqiang Zheng Date: Mon, 4 Mar 2019 17:42:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=AA=E4=BA=BA=E4=B8=AD?= =?UTF-8?q?=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.js | 30 +- .../backToCenterComponent.js | 53 ++ .../backToCenterComponent.scss | 17 + .../interactionComponent.js | 6 +- .../scrollToTopComponent.scss | 4 +- src/icons/client-needs-actived.png | Bin 0 -> 849 bytes src/icons/client-needs.png | Bin 0 -> 873 bytes src/icons/client-publish-actived.png | Bin 0 -> 894 bytes src/icons/client-publish.png | Bin 0 -> 881 bytes src/icons/individualCenter-actived.png | Bin 0 -> 1179 bytes src/icons/individualCenter.png | Bin 0 -> 1217 bytes src/pages/goodsPublish/goodsPublish.js | 12 +- src/pages/grabOrderPage/grabOrderPage.js | 4 +- src/pages/home/home.js | 39 +- .../individualCenter/individualCenter.js | 170 +++++ .../individualCenter/individualCenter.scss | 40 ++ .../myDemandSupplyEdit/myDemandSupplyEdit.js | 15 +- src/pages/myGoodList/myGoodList.js | 294 +++++---- src/pages/myGoodList/myGoodList.scss | 15 + src/pages/myGoodsEdit/myGoodsEdit.js | 19 +- src/pages/myNeedsEdit/myNeedsEdit.js | 4 +- src/pages/myNeedsPublish/myNeedsPublish.js | 2 +- src/pages/mySupplyDemand/mySupplyDemand.js | 9 +- .../supplyDemandPublish.js | 12 +- .../supplyDemandView/supplyDemandView.js | 14 +- src/todo list.txt | 618 +++--------------- 26 files changed, 634 insertions(+), 743 deletions(-) create mode 100644 src/component/backToCenterComponent/backToCenterComponent.js create mode 100644 src/component/backToCenterComponent/backToCenterComponent.scss create mode 100644 src/icons/client-needs-actived.png create mode 100644 src/icons/client-needs.png create mode 100644 src/icons/client-publish-actived.png create mode 100644 src/icons/client-publish.png create mode 100644 src/icons/individualCenter-actived.png create mode 100644 src/icons/individualCenter.png create mode 100644 src/pages/individualCenter/individualCenter.js create mode 100644 src/pages/individualCenter/individualCenter.scss diff --git a/src/app.js b/src/app.js index c0bcb21..87baeb9 100644 --- a/src/app.js +++ b/src/app.js @@ -16,11 +16,11 @@ import './app.scss' const store = configStore() class App extends Component { - - isTrue=Taro.getStorageSync('session_id')?true:false + config = { pages: [ //'pages/index/index', // index页面 + 'pages/individualCenter/individualCenter',// 个人中心页面 'pages/home/home',//首页 --------------------- 'pages/login/login',//登入页面 --------------------- 'pages/shop/shop',//店铺页面 --------------------- @@ -39,6 +39,8 @@ class App extends Component { 'pages/myNeedsEdit/myNeedsEdit',// 单个需求编辑页面 'pages/myNeedsPublish/myNeedsPublish',// 需求发布 + + // 'pages/shopDescription/shopDescription', ], permission: { @@ -56,33 +58,27 @@ class App extends Component { }, tabBar: { - list:[{ + list: [{ pagePath: "pages/home/home", text: "首页", iconPath: "./icons/home.png", selectedIconPath: "./icons/home-actived.png" }, { - pagePath: "pages/goodsPublish/goodsPublish", - text: "商品发布", - iconPath: "./icons/box.png", - selectedIconPath: "./icons/box-actived.png" - }, { - pagePath: "pages/supplyDemandPublish/supplyDemandPublish", - text: "供求发布", + pagePath: "pages/myNeedsPublish/myNeedsPublish", + text: "需求发布", iconPath: "./icons/publish.png", selectedIconPath: "./icons/publish-actived.png" - } - , { - pagePath: "pages/mySupplyDemand/mySupplyDemand", - text: "我的供求", - iconPath: "./icons/menu.png", - selectedIconPath: "./icons/menu-actived.png" } , { pagePath: "pages/myNeeds/myNeeds", text: "我的需求", iconPath: "./icons/needs.png", selectedIconPath: "./icons/needs-actived.png" + }, { + pagePath: "pages/individualCenter/individualCenter", + text: "个人中心", + iconPath: "./icons/needs.png", + selectedIconPath: "./icons/needs-actived.png" } ], color: '#333', @@ -94,7 +90,7 @@ class App extends Component { } componentDidMount() { - console.log('this.tabBar', this) + } componentDidShow() { } diff --git a/src/component/backToCenterComponent/backToCenterComponent.js b/src/component/backToCenterComponent/backToCenterComponent.js new file mode 100644 index 0000000..345ff27 --- /dev/null +++ b/src/component/backToCenterComponent/backToCenterComponent.js @@ -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 ( + // + // + // 个人中心 + + // + + // + + hello world + + + ) + } +} + +export default BackToCenterComponent diff --git a/src/component/backToCenterComponent/backToCenterComponent.scss b/src/component/backToCenterComponent/backToCenterComponent.scss new file mode 100644 index 0000000..bd79283 --- /dev/null +++ b/src/component/backToCenterComponent/backToCenterComponent.scss @@ -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 + + +} \ No newline at end of file diff --git a/src/component/interactionComponent/interactionComponent.js b/src/component/interactionComponent/interactionComponent.js index 8077912..b4b53a7 100644 --- a/src/component/interactionComponent/interactionComponent.js +++ b/src/component/interactionComponent/interactionComponent.js @@ -45,7 +45,7 @@ class Interaction extends Component { let initailMultiArray = this.recursionInitialized(res.data.data) initailMultiArray[1].unshift({ name: '全部', id: '-1' }) initailMultiArray[0] = [{ name: '--', id: '' }] - console.log('initailMultiArray', initailMultiArray) + // console.log('initailMultiArray', initailMultiArray) this.setState({ @@ -112,7 +112,7 @@ class Interaction extends Component { return new Array(maxDepth).fill(0) } bindMultiPickerCol(e) { - console.log('修改的列为', e.detail.column, ',值为', e.detail.value) + // console.log('修改的列为', e.detail.column, ',值为', e.detail.value) const data = { multiArray: this.state.initailMultiArray, @@ -124,7 +124,7 @@ class Interaction extends Component { const indexNumber = Number(index) if (indexNumber === data.multiIndex[0]) { data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children - console.log('datat', data) + } } } diff --git a/src/component/scrollToTopComponent/scrollToTopComponent.scss b/src/component/scrollToTopComponent/scrollToTopComponent.scss index c7ae4d0..675267e 100644 --- a/src/component/scrollToTopComponent/scrollToTopComponent.scss +++ b/src/component/scrollToTopComponent/scrollToTopComponent.scss @@ -6,8 +6,8 @@ border-radius:50%; text-align:center; position:fixed; - bottom:10%; - right:5%; + bottom:1%; + right:3%; font-size:25rpx; .box{ margin-top:6%; diff --git a/src/icons/client-needs-actived.png b/src/icons/client-needs-actived.png new file mode 100644 index 0000000000000000000000000000000000000000..5b92fc3b6be8496c9d1099d4adf3b0e401b3fb5f GIT binary patch literal 849 zcmV-X1FrmuP)lyyu6QOx&Jv_M@aK{Q z;1F&1z;L;<01>kW2G5QfK)OoXU8_iV1q|IDlt-!cv=bMG%KxVW>EX#C_fOKrxHChs zdE@bU>I0Aq`lS%g(ROOa5&#f((01zmvKOiYKzhB&eTX}?OylHv6%Jseg3<-r?)tG^ zg8u*o?|@WI+il5nmNGJJSvU?Q6IX#~068VckbKU7I+T z2gpWlMfbOhtbg#;Pbah^I2T6X-rp^OpNjct|N8)Rm~nUizi~q03QC=Ij3K4yvZYWU zjAW{T^@+D>py9s-h42BX8C{dt@bcxPtjd`nI{+2|dWj;H^JwDz&;W(-0jLb6s%9+F zt({?$b!~2D=Or|QD2A|!w$n6L03npVzsuOuU%jRzou=(>lVw%_I19t5VqM#_kv_-1 zeIT>B4g8u;yX{5BnypYAgwOY8b|id`xXfjnD!9Si<=IPqNHC zAZz>Sgx3flIIwu%-!OYH=>#~t;93Z885$i9Ht03@4;4j4rn>;M5kBo-qW#{aHQvoRxW~!Hb4&{9ODT$ b?{nsFHSwu18sI6j00000NkvXXu0mjfL7JGO literal 0 HcmV?d00001 diff --git a/src/icons/client-needs.png b/src/icons/client-needs.png new file mode 100644 index 0000000000000000000000000000000000000000..44df01db0fb568a62eb64cac06209ce4513c251c GIT binary patch literal 873 zcmV-v1D5=WP)P2$0sMT63BnajpMUr{4At`Ij&u&cV#W^iI@8_HMX5P$0u#K6S znZ4O;_Aw&vvj2DRJwik$Ow;TKfFS@lMnq2?=m8dmq?8>>sTYX2$%$f#j2&PU0J4bK zr|bHITDI~4)6>&lpU;;BfZeqeD$JJx05dB@>?fjo)okVg;_>(aP1By$>D*HL3!q?& znfa;^;!-8sc>u#O`VeufUI1o(B!oC3rHnE2^D=gNiD{X9Tn^H{m7YcTVY5Mp~W zncSF4rCtL-yWJ2o-xWgitr>u27!gnDx_-;;3K|lDV!i?3g0Aa>h{#Ss8VOL%=Qt7d zu4xKttoT2G`v@>|w-92=>1MLz=H})+nM~#&A`Sz<7Mrd+0A@CX5K%YI?Xsq6UIu_G z>j_{vw;+ncT?7hR13sVcejpIYxQRp}k=Ub@di75!aO2RSY+Vs>Xxow4`T{WXH6g^s z^{RvqbzMJ-h)PNsVrJ`f4HMDV{3TZDI&MTAVCIQ*I(@jOrzdBc<_-Xu2Y?L#@Cg8d zMD(pJK!fT)2LN;vQC3Pxx~`kn%L@@F5YY<&$BAfkO#tHYxM*!{ec9I5_N!QwnE8$n z;-q01od7WA@p!sIq0swk*Rkt5U_EY|o13?VLZOd^)ZPGq)3(iblZejPH)BKJ1I+xk zrKKh8_xpbuhH)Jc&z3yRmJqR>h|v+ZTyM77fEVgosbvIA4uGQ7Mr~>{LpP z0023FNNJkZ8Hq%!;$k&7Q;67Q(_2(ZbyQmUADhsDv#KJqv$MXHm6dd{v1R5Dh`67K zth81gtKD%e!D{oSY5JKtj)-rVc}NK1xX=6zA=SY!PKou>00000NkvXXu0mjfr?!*( literal 0 HcmV?d00001 diff --git a/src/icons/client-publish-actived.png b/src/icons/client-publish-actived.png new file mode 100644 index 0000000000000000000000000000000000000000..4b6d512d9ba4d1b51adc53b90879c337d9be4700 GIT binary patch literal 894 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 literal 0 HcmV?d00001 diff --git a/src/icons/individualCenter.png b/src/icons/individualCenter.png new file mode 100644 index 0000000000000000000000000000000000000000..f7d1e77b0d0b3f722cadf717347698f7cbd4f418 GIT binary patch literal 1217 zcmV;y1U~zTP)(YpqT8-kn{w_?KEuTcth}MM=7`!WuASvvcHzB<$bJZne<+G7R^8-}&au zx#ye_Y_@V^)aB+W;P_M-;ICUL+EEy1TnOAA}DS zkV>Vt0C*Qb>_0kRg#AK9_c8OuT0Auc7-Nzmk^>W$A31)^Z__TL>(c*Pb#JE4-{aG*+xW1LkPZ##bWWPsi_UV?|%Sb%|eLn z5qz$-we`c9nVB?zdqOz2DWyJH+%JoOG3H#@7g*wAvDgOSQvfX$PQ>^92OP(-8GkAy zg6EmJvr0fFlj$rLi)TZCzcKSIT5AtLyq2AaWRy|~W6ZBav^t2(ah%RXB5~gCFGau@ zGekr$hX^>q%v+5ye-qL50e1f|^L1M5&j4%*`3*x#saGlm*ne+xAZUHg%zavGTXt*K z1`(N5O0Cjbe*xg$5Uyj)yuDJuX(GBSMD=Vm8eN{x=MMnb6YvX$T3T8T&CbqF)yR=j z$Z2NYR4E`wL@UD1vWN^tqtW4fK7Sa%gQd12@;)=~@;vWZ5jhyfLqs`do{!>E4rr|> z0N4%}wruCy&deu_F*}K9t%zK5UDw#8S~$iZ6H!wgo(X22Z)~MWI7UPp>j1weq9>Wz zKC4zLmAch&oC8F(t4<`xlu~zB3OHiFE&wPZ@;rcpxm-?SvDj|k_XhxM6cLw*z6D?_ z=rA+SX{}!ZurEZ!QD&a+u%!{$OGK{*fSzII*HWp}?T+Kv9#AtpY>CL%N~z7+Y<69tP&ftPhC1QB+}zyU)7#s7A)QWt7a+ESnSUx1 zU|+P>;{euIWcOoAsgH~?86xVdlOv1US!Rx>)9D@dbX4%2Q%WuQDC-4U>p=j=N&qwM z?d{8K^Rba=(D}TX>$;n#r>Dl$?w z5Q$5U<2;^BCQYsV(6M}EWMrA^x^Dp3QCc$^6(k}@06fLaQ$d)9E+)np+a+y@wGF5d zjO{DClgXqlTA`~EvLyn~^Hz(<6L$0>qE(ewGZFd5-iq4V+Pto=u0lQMRfVV#z}2?7 fq6l1V=a%nZWZv#D1b{|000000NkvXXu0mjfZbLj& literal 0 HcmV?d00001 diff --git a/src/pages/goodsPublish/goodsPublish.js b/src/pages/goodsPublish/goodsPublish.js index aaaa74d..f552819 100644 --- a/src/pages/goodsPublish/goodsPublish.js +++ b/src/pages/goodsPublish/goodsPublish.js @@ -106,12 +106,12 @@ class GoodsPublish extends Component { setTimeout(() => { if (this.state.isPublish) { // 导航到编辑页面 - Taro.navigateTo({ - url: '/pages/myGoodsEdit/myGoodsEdit?id=' + res.data.goods_id + Taro.redirectTo({ + url: '/pages/myGoodsList/myGoodsList' }) } else if (this.state.isPublishAndAdd) { // 导航到发布页面 - Taro.reLaunch({ + Taro.navigateTo({ url: '/pages/goodsPublish/goodsPublish' }) } @@ -269,7 +269,7 @@ class GoodsPublish extends Component { LoginService() return } - Taro.navigateTo({ + Taro.redirectTo({ url: '/pages/myGoodList/myGoodList' }) } @@ -403,9 +403,9 @@ class GoodsPublish extends Component { {/* */} - + {/* - + */} diff --git a/src/pages/grabOrderPage/grabOrderPage.js b/src/pages/grabOrderPage/grabOrderPage.js index 04bed15..444da30 100644 --- a/src/pages/grabOrderPage/grabOrderPage.js +++ b/src/pages/grabOrderPage/grabOrderPage.js @@ -76,7 +76,7 @@ class GrabOrderPage extends Component { icon: 'none' }) setTimeout(() => { - Taro.reLaunch({ + Taro.switchTab({ url: '/pages/home/home' }) }, 1500); @@ -218,7 +218,7 @@ class GrabOrderPage extends Component { duration: 1500 }) setTimeout(() => { - Taro.reLaunch({ + Taro.switchTab({ url: '/pages/myNeeds/myNeeds' }) }, 1500); diff --git a/src/pages/home/home.js b/src/pages/home/home.js index 57c8434..fdd569d 100644 --- a/src/pages/home/home.js +++ b/src/pages/home/home.js @@ -42,7 +42,6 @@ class Home extends Component { supplyLevel: 1,// 筛选1是小类或者2是大类, latitude: '', longitude: '', - isShopOwner: false } } @@ -290,22 +289,7 @@ class Home extends Component { componentDidMount() { // 页面加载后 得到首页的基本信息和推荐店铺的信息 - // Taro.setTabBarItem({ - // index: 2, - // text: 'client', - // iconPath: './icons/needs-actived.png', - // selectedIconPath: './icon/needs.png', - // success: function (res) { - // console.log('indexBarSuccess3', res) - // }, - // fail: function (res) { - // console.log('indexBarFail3', res) - // }, - // complete: function (res) { - // console.log('indexBarComplete3', res) - // } - // }) Taro.showLoading({ title: '加载中' }) // promise 返回经纬度给state 然后调用函数 this.getUserLocation().then(res => { @@ -321,25 +305,11 @@ class Home extends Component { this.getHomeCategoriesInfo() }) // 本地缓存没有userid时 从新登入 - if (!Taro.getStorageSync('userInfo').user_id) { - weChatLogin().then(res => { - Taro.getStorageSync('shopInfo').shop_id ? this.setState({ - isShopOwner: true - }) : this.setState({ - isShopOwner: false - }) + Taro.getStorageSync('userInfo').user_id ? true : weChatLogin() + - }).catch(err => { - }) - } else { - Taro.getStorageSync('shopInfo').shop_id ? this.setState({ - isShopOwner: true - }) : this.setState({ - isShopOwner: false - }) - } } componentWillMount() { @@ -348,7 +318,7 @@ class Home extends Component { componentWillUnmount() { } componentDidShow() { - console.log('home', this.$scope.route) + } componentDidHide() { } @@ -379,7 +349,6 @@ class Home extends Component { } render() { - console.log('this.state.isShopOwner', this.state.isShopOwner) // 提示模态弹窗element const modalMessageGrabElement = 提示 @@ -456,7 +425,7 @@ class Home extends Component { {item.class_name} }) : null - + return ( diff --git a/src/pages/individualCenter/individualCenter.js b/src/pages/individualCenter/individualCenter.js new file mode 100644 index 0000000..1a5d7af --- /dev/null +++ b/src/pages/individualCenter/individualCenter.js @@ -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 ( + + + + + + {username} + ???? + + + + + + + + 收藏的宝贝| + 收藏的店铺| + 我的足迹 + + + + + + + + {isShop ? + + + + + : } + + {/* 退出 */} + + + + ) + } +} + +export default IndividualCenter diff --git a/src/pages/individualCenter/individualCenter.scss b/src/pages/individualCenter/individualCenter.scss new file mode 100644 index 0000000..9d71c60 --- /dev/null +++ b/src/pages/individualCenter/individualCenter.scss @@ -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{ + + } +} \ No newline at end of file diff --git a/src/pages/myDemandSupplyEdit/myDemandSupplyEdit.js b/src/pages/myDemandSupplyEdit/myDemandSupplyEdit.js index 4fec13b..5a91871 100644 --- a/src/pages/myDemandSupplyEdit/myDemandSupplyEdit.js +++ b/src/pages/myDemandSupplyEdit/myDemandSupplyEdit.js @@ -31,7 +31,6 @@ class MyDemandSupplyEdit extends Component { content: '', pickerImageUrl: [], // 上传的图片 ImagesInfo: [],// 后台传回来的图片信息 - isFormCompleted: false, isConfirmWindow: false,// 删除提示框 demandSupplyId: '',// 供求id @@ -57,6 +56,7 @@ class MyDemandSupplyEdit extends Component { }) .then(res => { console.log('供求详情获取成功', res) + Taro.hideLoading() if (res.data.err_code === 0) { const selectedType = this.state.demandingSupplyCate.filter(item => item.id == res.data.sdInfo.sd_type)[0] const selectedState = this.state.demandingSupplyState.filter(item => item.id == res.data.sdInfo.state)[0] @@ -73,9 +73,14 @@ class MyDemandSupplyEdit extends Component { pickerImageUrl: imageFile, ImagesInfo: res.data.sdInfo.file_path, }) - Taro.hideLoading() + } else if (res.data.err_code === 88888) { loginExpired(res) + }else{ + Taro.showToast({ + title:res.data.err_msg, + icon:'none' + }) } }) @@ -137,7 +142,7 @@ class MyDemandSupplyEdit extends Component { setTimeout(() => { console.log('this.state.isSaveAndNew', this.state.isSaveAndNew) if (this.state.isSaveAndNew) { - Taro.reLaunch({ + Taro.navigateTo({ url: '/pages/supplyDemandPublish/supplyDemandPublish' }) } else { @@ -309,8 +314,8 @@ class MyDemandSupplyEdit extends Component { } } goToMyDemSupPage() { - Taro.switchTab({ - url: '/pages/mySupplyDemand/mySupplyDemand' + Taro.navigateBack({ + delta: 1 }) } deleteButtonHandler() { diff --git a/src/pages/myGoodList/myGoodList.js b/src/pages/myGoodList/myGoodList.js index 1161a7e..6b2c978 100644 --- a/src/pages/myGoodList/myGoodList.js +++ b/src/pages/myGoodList/myGoodList.js @@ -1,5 +1,5 @@ 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 CopyrightComponent from '../../component/copyrightComponent/copyrightComponent' import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent' @@ -47,6 +47,8 @@ class MyGoodList extends Component { isOpenOffStockModal: false,// 是否显示下架模态框 isAddToList: false,// 是否下拉加载 如果是 就添加商品到我的商品列表 isShowTopNav: false,// 是否显示返回顶部按钮 + screenWidth:'', + screenHeight:'' } } @@ -87,7 +89,7 @@ class MyGoodList extends Component { 'X-Requested-With': 'XMLHttpRequest' } }).then(res => { - console.log('宝贝类目',res) + console.log('宝贝类目', res) if (res.data.err_code != 10) { const productCate = [{ name: '全部类目', id: '' }] for (let item of res.data.goodsClass) { @@ -144,7 +146,7 @@ class MyGoodList extends Component { const data = JSON.parse(res.data) if (data.err_code != 10) { console.log('我的商品列表', JSON.parse(res.data)) - + Taro.hideLoading() if (data.goodsCount != '0' && data.goods.length) { data.goods.forEach(item => { @@ -272,9 +274,9 @@ class MyGoodList extends Component { duration: 1500 }) }) - }else if (responseData.err_code === 88888) { + } else if (responseData.err_code === 88888) { loginExpired(res) - } else { + } else { Taro.showToast({ title: responseData.err_msg, icon: 'none', @@ -311,14 +313,14 @@ class MyGoodList extends Component { icon: 'success', duration: 1500 }).then(() => { - this.setState({ isCheckAll: false, currPageParam: 1 },()=>{ + this.setState({ isCheckAll: false, currPageParam: 1 }, () => { this.getMyGoodListApi({}) }) - + }) - }else if (responseData.err_code === 88888) { + } else if (responseData.err_code === 88888) { loginExpired(res) - } else { + } else { Taro.showToast({ title: responseData.err_msg, icon: 'none', @@ -526,7 +528,8 @@ class MyGoodList extends Component { }) } // 导航到商品编辑页面myGoodsEdit - goToGoodEditPage(goodId) { + goToGoodEditPage(e) { + const goodId = e.currentTarget.dataset.eTapAA Taro.navigateTo({ url: '/pages/myGoodsEdit/myGoodsEdit?id=' + goodId }) @@ -534,11 +537,12 @@ class MyGoodList extends Component { // 导航到商品发布页面 goToGoodsPublishPage() { - Taro.switchTab({ + Taro.navigateTo({ url: '/pages/goodsPublish/goodsPublish' }) } - goToGoodspage(goodId) { + goToGoodspage(e) { + const goodId = e.currentTarget.dataset.eTapAA Taro.navigateTo({ url: '/pages/goods/goods?id=' + goodId }) @@ -579,8 +583,26 @@ class MyGoodList extends Component { 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() { + this.getUserSystemInfo() Taro.showLoading({ title: '加载中' }) @@ -594,7 +616,7 @@ class MyGoodList extends Component { componentWillUnmount() { } componentDidShow() { - + } componentDidHide() { } @@ -619,8 +641,6 @@ class MyGoodList extends Component { } render() { - - //等待接口数据 const goodListElementArray = this.state.myGoodList.map((item, index) => { return @@ -671,135 +691,141 @@ class MyGoodList extends Component { return ( - - {/* 删除模态提示框 */} - {modalMessageDeleteElement} - {/* 下架模态框提示 */} - {modalMessageOffStockElement} + + + {/* 删除模态提示框 */} + {modalMessageDeleteElement} + {/* 下架模态框提示 */} + {modalMessageOffStockElement} - - - - - + + + + - - - - - - + type='number' + value={this.state.lowestPrice} + onChange={this.lowestPriceChange.bind(this)} + border={false} + /> + + + + + + - - - - - - - - 宝贝类目: + + + + + + + + 宝贝类目: + + {this.state.productCateSelected.name} + - {this.state.productCateSelected.name} - + + + + + - - - - - - - - - - - - - - - 出售中的宝贝{this.state.myGoodListTotal}条记录 - - - - {filterElementsArray} - - - - 全选 - - + + - - + + + + 出售中的宝贝{this.state.myGoodListTotal}条记录 + + + + {filterElementsArray} + + + + 全选 + + + + + + + + + {this.state.myGoodList.length ? + {goodListElementArray} + : 没有更多了} + {this.state.isShowTopNav ? : null} + + + + + + + 个人中心 + - {this.state.myGoodList.length ? - {goodListElementArray} - : 没有更多了} - {this.state.isShowTopNav ? : null} - - - - - + ) } } diff --git a/src/pages/myGoodList/myGoodList.scss b/src/pages/myGoodList/myGoodList.scss index b425041..2cdd250 100644 --- a/src/pages/myGoodList/myGoodList.scss +++ b/src/pages/myGoodList/myGoodList.scss @@ -2,6 +2,21 @@ $themeColor:#FF7142; .button-orange, .button-dark-red,.button-green{ 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{ padding: 10px 20px; .filterbar-container{ diff --git a/src/pages/myGoodsEdit/myGoodsEdit.js b/src/pages/myGoodsEdit/myGoodsEdit.js index 0fb7823..e91053d 100644 --- a/src/pages/myGoodsEdit/myGoodsEdit.js +++ b/src/pages/myGoodsEdit/myGoodsEdit.js @@ -70,7 +70,7 @@ class MyGoodsEdit extends Component { for (let key in shopTypeObject) { for (let item of shopTypeObject[key].c) { if (item.id === res.data.goods.shop_class_id) { - selectedValue = {name:item.n,id:item.id} + selectedValue = { name: item.n, id: item.id } } } } @@ -91,6 +91,12 @@ class MyGoodsEdit extends Component { } else if (res.data.err_code === 88888) { loginExpired(res) } + else { + Taro.showToast({ + title: res.data.err_msg, + icon: 'none', + }) + } } ) @@ -166,9 +172,10 @@ class MyGoodsEdit extends Component { }).then(() => { setTimeout(() => { if (this.state.isSaveButton) { - // Taro.redirectTo({ - // url: '/pages/myGoodsEdit/myGoodsEdit?id=' + this.$router.params.id - // }) + Taro.navigateBack({ + delta:1 + // url: '/pages/myGoodsList/myGoodsEdit?id=' + this.$router.params.id + }) } else if (this.state.isSaveAndNewBUtton) { Taro.switchTab({ url: '/pages/goodsPublish/goodsPublish' @@ -455,9 +462,9 @@ class MyGoodsEdit extends Component { {/* */} - + {/* - + */} diff --git a/src/pages/myNeedsEdit/myNeedsEdit.js b/src/pages/myNeedsEdit/myNeedsEdit.js index 5d8ea04..1b9b17a 100644 --- a/src/pages/myNeedsEdit/myNeedsEdit.js +++ b/src/pages/myNeedsEdit/myNeedsEdit.js @@ -265,7 +265,7 @@ class MyNeedsEdit extends Component { duration: 1000 }) setTimeout(() => { - Taro.reLaunch({ + Taro.switchTab({ url: '/pages/myNeeds/myNeeds' }) @@ -311,7 +311,7 @@ class MyNeedsEdit extends Component { this.setState({ content: event.target.value }) } goToMyNeedsPage() { - Taro.reLaunch({ + Taro.switchTab({ url: '/pages/myNeeds/myNeeds' }) } diff --git a/src/pages/myNeedsPublish/myNeedsPublish.js b/src/pages/myNeedsPublish/myNeedsPublish.js index 1a7b00e..3651e27 100644 --- a/src/pages/myNeedsPublish/myNeedsPublish.js +++ b/src/pages/myNeedsPublish/myNeedsPublish.js @@ -239,7 +239,7 @@ class MyNeedsPublish extends Component { } goToMyNeedsPage() { - Taro.reLaunch({ + Taro.switchTab({ url: '/pages/myNeeds/myNeeds' }) } diff --git a/src/pages/mySupplyDemand/mySupplyDemand.js b/src/pages/mySupplyDemand/mySupplyDemand.js index 775d087..efaa0eb 100644 --- a/src/pages/mySupplyDemand/mySupplyDemand.js +++ b/src/pages/mySupplyDemand/mySupplyDemand.js @@ -111,6 +111,7 @@ class MySupplyDemand extends Component { } onSearchButtonHandler() { + Taro.showLoading({ title: '加载中' }) this.setState({ loadMorePageIndex: 1 }, () => { @@ -160,7 +161,7 @@ class MySupplyDemand extends Component { // 新增我的供求 addDemandSupply() { - Taro.reLaunch({ + Taro.navigateTo({ url: '/pages/supplyDemandPublish/supplyDemandPublish' }) } @@ -234,14 +235,16 @@ class MySupplyDemand extends Component { // 编辑我的供求 // 跳转到我的供求编辑页面 - goToMyDSEditPage(sdId) { + goToMyDSEditPage(e) { + const sdId=e.currentTarget.dataset.eTapAA Taro.navigateTo({ url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + sdId }) } // 转到供求查看页面 - goSupplyDemandView(sdId) { + goSupplyDemandView(e) { + const sdId=e.currentTarget.dataset.eTapAA Taro.navigateTo({ url: '/pages/supplyDemandView/supplyDemandView?sdId=' + sdId }) diff --git a/src/pages/supplyDemandPublish/supplyDemandPublish.js b/src/pages/supplyDemandPublish/supplyDemandPublish.js index bb1283d..0f6faee 100644 --- a/src/pages/supplyDemandPublish/supplyDemandPublish.js +++ b/src/pages/supplyDemandPublish/supplyDemandPublish.js @@ -84,12 +84,12 @@ class SupplyDemand extends Component { console.log('this.state.isPublishAndNew', this.state.isPublishAndNew) setTimeout(() => { if (this.state.isPublishAndNew) { - Taro.reLaunch({ + Taro.navigateTo({ url: '/pages/supplyDemandPublish/supplyDemandPublish' }) } else { - Taro.navigateTo({ - url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + res.data.sd_id + Taro.redirectTo({ + url: '/pages/mySupplyDemand/mySupplyDemand' }) } }, 1000); @@ -240,7 +240,7 @@ class SupplyDemand extends Component { LoginService() return } - Taro.switchTab({ + Taro.navigateTo({ url: '/pages/mySupplyDemand/mySupplyDemand' }) } @@ -383,9 +383,9 @@ class SupplyDemand extends Component { - + {/* - + */} diff --git a/src/pages/supplyDemandView/supplyDemandView.js b/src/pages/supplyDemandView/supplyDemandView.js index d535937..09b011d 100644 --- a/src/pages/supplyDemandView/supplyDemandView.js +++ b/src/pages/supplyDemandView/supplyDemandView.js @@ -49,6 +49,7 @@ class SupplyDemandView extends Component { }) .then(res => { console.log('供求详情获取成功', res) + Taro.hideLoading() if (res.data.err_code === 0) { const selectedType = this.state.demandingSupplyCate.filter(item => item.id === res.data.sdInfo.sd_type)[0].name this.setState({ @@ -62,10 +63,15 @@ class SupplyDemandView extends Component { images: res.data.sdInfo.file_path, itemId: res.data.sdInfo.sd_id }) - Taro.hideLoading() + } else if (res.data.err_code === 88888) { loginExpired(res) - } + }else{ + Taro.showToast({ + title:res.data.err_msg, + icon:'none' + }) + } } ) @@ -115,7 +121,7 @@ class SupplyDemandView extends Component { } goToSDPublishPage() { - Taro.reLaunch({ + Taro.navigateTo({ url: '/pages/supplyDemandPublish/supplyDemandPublish',// 供求发布页面 }) } @@ -127,7 +133,7 @@ class SupplyDemandView extends Component { } goToMySDPage() { - Taro.reLaunch({ + Taro.navigateBack({ url: '/pages/mySupplyDemand/mySupplyDemand',//我的供求页面 }) } diff --git a/src/todo list.txt b/src/todo list.txt index 4006aff..8307de8 100644 --- a/src/todo list.txt +++ b/src/todo list.txt @@ -18,552 +18,136 @@ bug: 商品编辑 增加图片后 图片顺序乱了 等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口 +import '@tarojs/async-await' import Taro, { Component } from '@tarojs/taro' -import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components' -import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui' -import FilteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent' -import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent' -import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent' +import { Provider } from '@tarojs/redux' +import Home from './pages/home' -import LoginService from '../../util/LoginService' -import weChatLogin from '../../util/weChatLogin' -import URL from '../../serviceAPI.config' -import './home.scss' +import configStore from './store' +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 = { - 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',// 需求发布 - } - - constructor() { - super(...arguments); - this.state = { - shops: [], // 推荐店铺的信息 - ads: [], //广告图片数组 - categories: [],// 大类 - subCate: [], //小类 - demanding: [],// 业主需求 - otherData: [], // 底部导航栏 - isOpen: false, // 抢单消息提示 - grabOrderId: '',//抢到订单的id - userName: Taro.getStorageSync('user_identity').userName || '',//用户名字 - userPhone: Taro.getStorageSync('user_identity').userPhone || '',// 用户电话 - isShowTopNav: false,// 是否显示返回顶部按钮 - loadMorePageIndex: 1,//下拉加载页面数 - isAddToList: false, - parentClass: '',// 大类的id - childClass: '-1',//小类的id - supplyLevel: 1,// 筛选1是小类或者2是大类, - latitude: '', - longitude: '' - - } - } - - // 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'), + // 'pages/shopDescription/shopDescription', + ], + permission: { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序位置接口的效果展示" } - }) - .then(res => { - console.log('首页基本信息', res) - if (res.data.err_msg === 'success') { + }, + window: { + backgroundTextStyle: 'light', + navigationBarBackgroundColor: '#fff', + navigationBarTitleText: 'WeChat', + navigationBarTextStyle: 'black', + // enablePullDownRefresh:true + onReachBottomDistance: 0 + }, - this.setState({ - ads: res.data.data.adsLb, - categories: [res.data.data.supplyClass[0], Object.values(res.data.data.supplyClass[1])], - demanding: res.data.data.demand.supplys, - otherData: res.data.otherData, - userName: res.data.otherData.userName, - userPhone: res.data.otherData.userPhone, - }) - } else { - Taro.showToast({ - title: res.data.err_msg, - icon: 'none', - duration: 1500 - }) - } - }) - } - // api 得到推荐商店的信息 - 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, - }) + tabBar: { + list: [{ + pagePath: "pages/home/home", + text: "首页", + iconPath: "./icons/home.png", + selectedIconPath: "./icons/home-actived.png" }, - 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 => { - 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 }) + , { + pagePath: "pages/myNeeds/myNeeds", + text: "我的需求", + iconPath: "./icons/needs.png", + selectedIconPath: "./icons/needs-actived.png" } - ) - } - getUserLocation(that) { - Taro.getLocation({ - type: 'gcj02', // 返回可以用于wx.openLocation的经纬度 - success(res) { - that.setState({ - latitude: res.latitude, - longitude: res.longitude - },()=>{ - that.getShops({}) - that.getHomeCategoriesInfo() - }) - } - }) - } - - - // 微信用户设置 - // wxUserSetting() { - // Taro.getSetting({ - // success(res) { - // if (res.authSetting['scope.userInfo']) { - // console.log('personal info', res) - // Taro.authorize({ - // scope: 'scope.userInfo', - // success() { - // // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问 - // // Taro.getUserInfo({ - // // success(res1) { - // // console.log('res1',res1) - // // } - // // }) - // console.log('权限允许') - // } - // }) - // } - // } - // }) - // } - // api 抢单请求 - GrabDemand({ demandId = 218 }) { - Taro.request({ - url: URL.GrabDemand, - method: 'POST', - dataType: 'json', - data: { - demandId: demandId - }, - header: { - 'content-type': 'application/x-www-form-urlencoded', - 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), - 'X-Requested-With': 'XMLHttpRequest' - } - }) - .then(res => { - Taro.showToast({ - title: res.data.err_msg === 'success' ? '抢单成功' : res.data.err_msg, - icon: 'none', - duration: 1500 - }) - - console.log('抢单请求:', res) - - }) - - } - // 点击大类icon - onClickParentCate(item) { - Taro.showLoading({ - title: '加载中' - }) - this.setState({ parentClass: item.class_id, childClass: item.class_id, supplyLevel: 1, subCate: item.children || [] }, () => { - this.getShops({}) - }) - - - } - // 点击子类 - onClickChildCate(item) { - Taro.showLoading({ - title: '加载中' - }) - this.setState({ childClass: item.class_id, supplyLevel: 2 }, () => { - this.getShops({}) - - }) - // this.getShops(item.parent_class_id, item.class_id, 2) - - } - scrollToSubCate(item) { - - Taro.pageScrollTo({ - scrollTop: 410, - duration: 300 - }) - this.onClickParentCate(item) - } - // 转到其他页面 - goToAllDemandingPage() { - if (!Taro.getStorageSync('userInfo').user_id) { - LoginService() - return + // , { + // pagePath: "pages/individualCenter/individualCenter", + // text: "个人中心", + // iconPath: "./icons/needs.png", + // selectedIconPath: "./icons/needs-actived.png" + // } + ], + color: '#333', + selectedColor: '#FF7142', + backgroundColor: '#fff', + borderStyle: 'black' } - 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() { - // 页面加载后 得到首页的基本信息和推荐店铺的信息 - 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() { - - } - componentWillUnmount() { } - - componentDidShow() { - - } + componentDidShow() { } componentDidHide() { } + componentCatchError() { } - // 微信用户信息 - 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, }) - }) - } + componentDidCatchError() { } + // 在 App 类中的 render() 函数没有实际作用 + // 请勿修改此函数 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} - - - - - - - - - - {/* */} - - - - - + + + ) } } -export default Home +Taro.render(, 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" + // } \ No newline at end of file