diff --git a/src/app.js b/src/app.js index ecbbbf6..b36edba 100644 --- a/src/app.js +++ b/src/app.js @@ -20,7 +20,7 @@ class App extends Component { config = { pages: [ //'pages/index/index', // index页面 - + 'pages/home/home',//首页 --------------------- 'pages/login/login',//登入页面 --------------------- 'pages/shop/shop',//店铺页面 --------------------- @@ -40,8 +40,6 @@ class App extends Component { 'pages/myNeedsPublish/myNeedsPublish',// 需求发布 'pages/individualCenter/individualCenter',// 个人中心页面 - - // 'pages/shopDescription/shopDescription', ], permission: { diff --git a/src/component/filteredShopComponent/filteredShopComponent.js b/src/component/filteredShopComponent/filteredShopComponent.js index dcbf4e3..62797a7 100644 --- a/src/component/filteredShopComponent/filteredShopComponent.js +++ b/src/component/filteredShopComponent/filteredShopComponent.js @@ -40,12 +40,14 @@ class recommondShop extends Component { } } - goToShop(value) { + goToShop(e) { + console.log('e',e) + const value = e.currentTarget.dataset.eTapAA Taro.navigateTo({ url: '/pages/shop/shop?id=' + value.shop_id }) } - // api 优惠卷请求 + // api 优惠券请求 getVoucherInfo({ user = this.state.userName, phone = this.state.userPhone, shops = [this.props.shop.shop_id], @@ -79,7 +81,7 @@ class recommondShop extends Component { voucherResponseMsg: res.data.tips, isCanVoucher: res.data.canConsult, }) - console.log('优惠卷请求', res) + console.log('优惠券请求', res) }) } @@ -237,8 +239,8 @@ class recommondShop extends Component { const address = this.props.shop.shop_address const distance = this.props.shop.distance const ads = this.props.shop.ads - const voucherLeft = this.props.shop.left_nums // 优惠卷是否为灰色 - const isShowConsultButton = this.props.shop.wx_open === '0' ? false : true // 优惠卷是否为灰色 + const voucherLeft = this.props.shop.left_nums // 优惠券是否为灰色 + const isShowConsultButton = this.props.shop.wx_open === '0' ? false : true // 优惠券是否为灰色 const slicedGoods = goods !== null ? goods.slice(1) : null const goodsElementsArray = goods !== null ? slicedGoods.map((item, index) => { return @@ -249,7 +251,7 @@ class recommondShop extends Component { }) : null - // 优惠卷和咨询元素 + // 优惠券和咨询元素 const consultModalElement = 咨询 @@ -315,9 +317,9 @@ class recommondShop extends Component { {voucherLeft ? + 优惠券 : - + } {isShowConsultButton ? diff --git a/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.js b/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.js index 10d4b22..bbe0a74 100644 --- a/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.js +++ b/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.js @@ -11,7 +11,7 @@ import loginExpired from '../../../util/loginExpired' class VoucherPoster extends Component { config = { - navigationBarTitleText: '优惠卷活动弹窗' + navigationBarTitleText: '优惠券活动弹窗' } constructor() { @@ -134,7 +134,7 @@ class VoucherPoster extends Component { - 当前优惠卷{this.props.voucherLeft}张 + 当前优惠券{this.props.voucherLeft} 联系人: diff --git a/src/pages/goods/goods.js b/src/pages/goods/goods.js index 59dc996..d19998c 100644 --- a/src/pages/goods/goods.js +++ b/src/pages/goods/goods.js @@ -49,6 +49,7 @@ class Goods extends Component { } }) .then(res => { + Taro.hideLoading() console.log('商品详情:', res) if (res.data.err_msg === "success") { this.setState({ @@ -127,7 +128,9 @@ class Goods extends Component { } componentDidMount() { - + Taro.showLoading({ + title: '加载中' + }) this.getGoodDescription() } componentWillReceiveProps(nextProps) { diff --git a/src/pages/grabOrderPage/grabOrderPage.js b/src/pages/grabOrderPage/grabOrderPage.js index 13ab6c1..8ab418c 100644 --- a/src/pages/grabOrderPage/grabOrderPage.js +++ b/src/pages/grabOrderPage/grabOrderPage.js @@ -54,6 +54,7 @@ class GrabOrderPage extends Component { }) .then(res => { console.log('抢单详情获取成功', res) + Taro.hideLoading() if (res.data.err_code === 0) { this.setState({ type: res.data.sdInfo.class_name, @@ -100,6 +101,7 @@ class GrabOrderPage extends Component { } }) .then(res => { + Taro.hideLoading() if (res.data.err_code === 0) { Taro.showToast({ title: '抢单成功', @@ -107,8 +109,8 @@ class GrabOrderPage extends Component { duration: 1500 }) setTimeout(() => { - Taro.navigateTo({ - url: '/pages/home/home' + Taro.navigateBack({ + delta:1 }) }, 1500); @@ -150,11 +152,16 @@ class GrabOrderPage extends Component { handleGrabConfirm() { this.setState({ isOpen: false }) // 确认抢单之后 + Taro.showLoading({ + title: '加载中' + }) this.GrabDemand({ demandId: this.state.grabOrderId }) } componentDidMount() { - + Taro.showLoading({ + title:'加载中' + }) this.getGrabOrderInfo() } componentWillReceiveProps(nextProps) { diff --git a/src/pages/grabOrderPage/renderingView/renderingView.js b/src/pages/grabOrderPage/renderingView/renderingView.js index 698ee6e..83e17ca 100644 --- a/src/pages/grabOrderPage/renderingView/renderingView.js +++ b/src/pages/grabOrderPage/renderingView/renderingView.js @@ -24,7 +24,8 @@ class RenderingView extends Component { } - onClickHandler(item) { + onClickHandler(e) { + const item = e.currentTarget.dataset.eTapAA this.setState({ image: URL.Base + item.file_path, isOpened:true diff --git a/src/pages/home/home.js b/src/pages/home/home.js index fdd569d..8fdeae8 100644 --- a/src/pages/home/home.js +++ b/src/pages/home/home.js @@ -211,7 +211,8 @@ class Home extends Component { } // 点击大类icon - onClickParentCate(item) { + onClickParentCate(e) { + const item = e.currentTarget.dataset.eTapAA Taro.showLoading({ title: '加载中' }) @@ -222,7 +223,8 @@ class Home extends Component { } // 点击子类 - onClickChildCate(item) { + onClickChildCate(e) { + const item = e.currentTarget.dataset.eTapAA Taro.showLoading({ title: '加载中' }) @@ -252,8 +254,9 @@ class Home extends Component { }) } - grabOrderId(Id) { - this.setState({ isOpen: true, grabOrderId: Id }) + grabOrderId(e) { + const id = e.currentTarget.dataset.eTapAA + this.setState({ isOpen: true, grabOrderId: id }) } handleGrabModalClose() { this.setState({ isOpen: false }) @@ -272,9 +275,10 @@ class Home extends Component { // 导航去抢单页面 - goToGrabOrderPage(orderId) { - Taro.navigateTo({ + goToGrabOrderPage(e) { + const orderId = e.currentTarget.dataset.eTapAA + Taro.navigateTo({ url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId }) } diff --git a/src/pages/home/needs-actived.png b/src/pages/home/needs-actived.png deleted file mode 100644 index 013967b..0000000 Binary files a/src/pages/home/needs-actived.png and /dev/null differ diff --git a/src/pages/home/needs.png b/src/pages/home/needs.png deleted file mode 100644 index 53290f9..0000000 Binary files a/src/pages/home/needs.png and /dev/null differ diff --git a/src/pages/individualCenter/individualCenter.js b/src/pages/individualCenter/individualCenter.js index ef2ca17..4745288 100644 --- a/src/pages/individualCenter/individualCenter.js +++ b/src/pages/individualCenter/individualCenter.js @@ -3,6 +3,8 @@ import { View, Image, Button } from '@tarojs/components' import { AtGrid, AtList, AtListItem, AtAvatar, AtButton } from "taro-ui" import LoginService from '../../util/LoginService' +import Logout from '../../util/logout' + import './individualCenter.scss' import URL from '../../serviceAPI.config' @@ -28,13 +30,14 @@ class IndividualCenter extends Component { ], seller: [ { - image: 'https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png', + image: 'https://img30.360buyimg.com/jdphoto/s72x72_jfs/t5770/97/5184449507/2423/294d5f95/595c3b4dNbc6bc95d.png', value: '我的商品' }, { - image: 'https://img20.360buyimg.com/jdphoto/s72x72_jfs/t15151/308/1012305375/2300/536ee6ef/5a411466N040a074b.png', + image: 'https://img14.360buyimg.com/jdphoto/s72x72_jfs/t17251/336/1311038817/3177/72595a07/5ac44618Na1db7b09.png', value: '商品发布' }, + { image: 'https://img10.360buyimg.com/jdphoto/s72x72_jfs/t5872/209/5240187906/2872/8fa98cd/595c3b2aN4155b931.png', value: '我的供求' @@ -47,6 +50,7 @@ class IndividualCenter extends Component { username: '', avatar: '', isShop: false, + vip_level:'' } } handlerGridClick(e) { @@ -88,25 +92,22 @@ class IndividualCenter extends Component { } } handlerTitleBarClick() { - Taro.showToast({ - title: '暂时没有更多', - icon: 'none' - }) + // Taro.showToast({ + // title: '暂时没有更多', + // icon: 'none' + // }) } getInfoFromStorage() { - const username = Taro.getStorageSync('userInfo').login_name - const avatar = Taro.getStorageSync('userInfo').avatar + const username = Taro.getStorageSync('userInfo').login_name||'' + const avatar = Taro.getStorageSync('userInfo').avatar||'' + const vip_level=Taro.getStorageSync('userInfo').vip_name||'' const isShop = Taro.getStorageSync('shopInfo').shop_id ? true : false this.setState({ - username, avatar, isShop + username, avatar, isShop,vip_level }) } handleLogoutClick() { - Taro.clearStorageSync() - Taro.reLaunch({ - url: '/pages/login/login' - }) - + Logout() } componentDidMount() { this.getInfoFromStorage() @@ -121,13 +122,13 @@ class IndividualCenter extends Component { if (!Taro.getStorageSync('userInfo').user_id) { LoginService() return - } - } + } + } componentDidHide() { } render() { - const { client, seller, username, avatar, isShop } = this.state + const { client, seller, username, avatar,vip_level, isShop } = this.state return ( @@ -135,7 +136,7 @@ class IndividualCenter extends Component { {username} - ???? + {vip_level} @@ -146,21 +147,21 @@ class IndividualCenter extends Component { /> - 收藏的宝贝| + {/* 收藏的宝贝| 收藏的店铺| - 我的足迹 + 我的足迹 */} - + {isShop ? - + - + : } {/* 退出 */} diff --git a/src/pages/individualCenter/individualCenter.scss b/src/pages/individualCenter/individualCenter.scss index 9d71c60..a4d2f8d 100644 --- a/src/pages/individualCenter/individualCenter.scss +++ b/src/pages/individualCenter/individualCenter.scss @@ -7,13 +7,19 @@ display: flex; .user-name{ display: flex; - font-size: 25rpx; + font-size: 30rpx; color: #FFFFFF; + height:40rpx; .name{ margin-left: 15rpx } .badge{ - margin-left: 15rpx + margin-left: 15rpx; + background-color: #BFB899; + line-height: 40rpx; + padding-left:10rpx; + padding-right:10rpx; + } } } diff --git a/src/pages/myGoodList/myGoodList.js b/src/pages/myGoodList/myGoodList.js index 616461d..e5725b7 100644 --- a/src/pages/myGoodList/myGoodList.js +++ b/src/pages/myGoodList/myGoodList.js @@ -261,6 +261,7 @@ class MyGoodList extends Component { } }).then(res => { let responseData = JSON.parse(res.data) + Taro.hideLoading() if (responseData.err_code === 0) { this.setState({ isCheckAll: false, @@ -307,6 +308,7 @@ class MyGoodList extends Component { } }).then(res => { let responseData = JSON.parse(res.data) + Taro.hideLoading() if (responseData.err_code === 0) { Taro.showToast({ title: '删除成功', @@ -373,7 +375,11 @@ class MyGoodList extends Component { } // 产品排序 - accendingDescending(value) { + accendingDescending(e) { + Taro.showLoading({ + title: '加载中' + }) + const value = e.currentTarget.dataset.eTapAA this.setState({ selectedFilterValue: value }) if (value == 0) { this.setState({ @@ -484,10 +490,11 @@ class MyGoodList extends Component { // 单个商品选择 - handleCheckChange(Id) { + handleCheckChange(e) { //如果goodid 一样的那么checked 就取反 + const id = e.currentTarget.dataset.eTapAA const newMyGoodList = this.state.myGoodList.map((item) => { - if (item.goods_id === Id) { + if (item.goods_id === id) { item.checked = !item.checked } return item @@ -558,6 +565,9 @@ class MyGoodList extends Component { checkedGoodsId.push(item.goods_id) } }); + Taro.showLoading({ + title: '加载中' + }) this.deleteGood({ goodsID: checkedGoodsId }) } deleteModalClose() { @@ -576,6 +586,9 @@ class MyGoodList extends Component { checkedGoodsId.push(item.goods_id) } }); + Taro.showLoading({ + title: '加载中' + }) this.changeGoodState({ goodsID: checkedGoodsId }) } offStockModalClose() { @@ -592,7 +605,6 @@ class MyGoodList extends Component { Taro.getSystemInfo().then(res => { return res }).then(res => { - console.log('res', res) this.setState({ screenWidth: res.screenWidth - 80 + 'px', screenHeight: res.screenHeight - 200 + 'px' diff --git a/src/pages/myGoodsEdit/myGoodsEdit.js b/src/pages/myGoodsEdit/myGoodsEdit.js index 847a852..7be0adf 100644 --- a/src/pages/myGoodsEdit/myGoodsEdit.js +++ b/src/pages/myGoodsEdit/myGoodsEdit.js @@ -46,7 +46,7 @@ class MyGoodsEdit extends Component { } }) .then(res => { - console.log('res',res) + Taro.hideLoading() if (res.data.err_code === 0) { console.log('商品详情获取成功', res) @@ -238,7 +238,6 @@ class MyGoodsEdit extends Component { 'X-Requested-With': 'XMLHttpRequest' }, success(response) { - const data = JSON.parse(response.data) if (data.err_code === 0) { console.log('imagedata', data) @@ -365,6 +364,9 @@ class MyGoodsEdit extends Component { componentDidMount() { + Taro.showLoading({ + title:'加载中' + }) this.getGoodsInfo() } diff --git a/src/pages/myNeeds/myNeeds.js b/src/pages/myNeeds/myNeeds.js index 5e37c01..457dfd9 100644 --- a/src/pages/myNeeds/myNeeds.js +++ b/src/pages/myNeeds/myNeeds.js @@ -264,7 +264,8 @@ class MyNeeds extends Component { url: '/pages/myNeedsEdit/myNeedsEdit?id=' + id }) } - deleteButton(item) { + deleteButton(e) { + const item = e.currentTarget.dataset.eTapAA this.setState({ isDeleteModal: true, needsItem: item }) } handleWindowModCancel() { diff --git a/src/pages/myNeedsPublish/myNeedsPublish.js b/src/pages/myNeedsPublish/myNeedsPublish.js index 7d992eb..fe62f36 100644 --- a/src/pages/myNeedsPublish/myNeedsPublish.js +++ b/src/pages/myNeedsPublish/myNeedsPublish.js @@ -263,7 +263,6 @@ class MyNeedsPublish extends Component { // this.getSupplyDemandInfo() // 如果路由参数为1 就默认显示 效果图,反之 显示业主需求 const isRenderingPic = this.$router.params.id - console.log(parseInt(isRenderingPic)) if (parseInt(isRenderingPic)) { this.setState({ needsTypeSelected: { name: '效果图', id: '5' } }) } diff --git a/src/pages/mySupplyDemand/mySupplyDemand.js b/src/pages/mySupplyDemand/mySupplyDemand.js index 32dae13..b61a383 100644 --- a/src/pages/mySupplyDemand/mySupplyDemand.js +++ b/src/pages/mySupplyDemand/mySupplyDemand.js @@ -138,6 +138,7 @@ class MySupplyDemand extends Component { } }) .then(res => { + Taro.hideLoading() if (res.data.err_code == 0) { console.log('删除成功') Taro.showToast({ @@ -224,13 +225,18 @@ class MySupplyDemand extends Component { } handleWindowConfirm() { this.setState({ isConfirmWindow: false }) + Taro.showLoading({ + title: '加载中' + }) this.onDelete({ sdID: this.state.demandSupplyId }) } // 删除我的供求 - handleOnDelete(id, itemName) { - this.setState({ isConfirmWindow: true, demandSupplyItemName: itemName, demandSupplyId: id }) + handleOnDelete(e) { + const title = e.currentTarget.dataset.eTapAA.sd_title + const id = e.currentTarget.dataset.eTapAA.sd_id + this.setState({ isConfirmWindow: true, demandSupplyItemName: title, demandSupplyId: id }) } @@ -260,7 +266,6 @@ class MySupplyDemand extends Component { Taro.getSystemInfo().then(res => { return res }).then(res => { - console.log('res', res) this.setState({ screenWidth: res.screenWidth - 80 + 'px', screenHeight: res.screenHeight - 200 + 'px' @@ -370,7 +375,7 @@ class MySupplyDemand extends Component { - + diff --git a/src/pages/shop/shop.js b/src/pages/shop/shop.js index f55452d..5f1dad3 100644 --- a/src/pages/shop/shop.js +++ b/src/pages/shop/shop.js @@ -351,7 +351,8 @@ class Shop extends Component { // 产品排序 - accendingDescending(value) { + accendingDescending(e) { + const value = e.currentTarget.dataset.eTapAA Taro.showLoading({ title: '加载中' }) this.setState({ selectedFilterValue: value }) if (value == 0) { diff --git a/src/pages/supplyDemandView/supplyDemandView.js b/src/pages/supplyDemandView/supplyDemandView.js index a683e25..c2b8d7e 100644 --- a/src/pages/supplyDemandView/supplyDemandView.js +++ b/src/pages/supplyDemandView/supplyDemandView.js @@ -93,6 +93,7 @@ class SupplyDemandView extends Component { } }) .then(res => { + Taro.hideLoading() if (res.data.err_code == 0) { console.log('删除成功') Taro.showToast({ @@ -151,6 +152,9 @@ class SupplyDemandView extends Component { } handleWindowConfirm() { this.setState({ isDeleteModal: false }) + Taro.showLoading({ + title: '加载中' + }) this.onDelete({ sdID: this.state.itemId }) } diff --git a/src/serviceAPI.config.js b/src/serviceAPI.config.js index ae7a179..2b5afca 100644 --- a/src/serviceAPI.config.js +++ b/src/serviceAPI.config.js @@ -1,13 +1,15 @@ -const LOCALURL = "http://192.168.1.230/" + const LOCALURL = "http://192.168.1.230/" // const LOCALURL = "https://www.ihome6.com/" const URL = { Base: LOCALURL, - Login: LOCALURL + 'Applet-login', //登入接口 + Login: LOCALURL + 'Applet-login', //微信登入接口 + StandardLogin: LOCALURL+ 'user-login', // 使用用户名和密码登入 + LogOut:LOCALURL+'User-ajaxLoginOut',//退出接口 ShopWxStore: LOCALURL + 'Shop-ajaxStore', //商城首页信息 ShopSupplyShops: LOCALURL + 'Shop-supplyShops',// 商城店铺信息 GrabDemand: LOCALURL + 'Supply-grabDemand',// 抢单接口 - GetVoucherInfo: LOCALURL + 'Shop-couponsTips',// 优惠卷信息 + GetVoucherInfo: LOCALURL + 'Shop-couponsTips',// 优惠券信息 GetConsultInfo: LOCALURL + 'Shop-consultTips',// 咨询信息 BuyConsult: LOCALURL + 'Shop-consult',// 购买咨询 GetShopItemDetail: LOCALURL + 'GoodsQuery-ajaxGoodsDetail',// 商品详情 diff --git a/src/util/logout.js b/src/util/logout.js new file mode 100644 index 0000000..477e0dc --- /dev/null +++ b/src/util/logout.js @@ -0,0 +1,27 @@ +import Taro from '@tarojs/taro' +import URL from '../serviceAPI.config' + +export default function logout() { + Taro.request({ + url:URL.LogOut, + header: { + 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), + } + }).then(res=>{ + Taro.showToast({ + title:'退出成功' + }) + Taro.clearStorageSync() + setTimeout(() => { + Taro.reLaunch({ + url: '/pages/login/login' + }) + }, 2000); + }).catch(err=>{ + Taro.showToast({ + title:'退出失败', + icon:'none' + }) + Taro.clearStorageSync() + }) +} \ No newline at end of file diff --git a/src/util/standardLogin.js b/src/util/standardLogin.js index 38da3cb..f31e793 100644 --- a/src/util/standardLogin.js +++ b/src/util/standardLogin.js @@ -25,7 +25,7 @@ const setUserInfoToStorage = () => { export default function standardLogin(username, password) { return new Promise((resolve,reject)=>{ Taro.request({ - url: URL.Base + 'user-login', + url: URL.StandardLogin, method: 'POST', dataType: 'json', data: { @@ -38,6 +38,7 @@ export default function standardLogin(username, password) { } }) .then(res => { + console.log('普通登录',res) if (res.data.err_code === 0) { Taro.showToast({ title: '登入成功', diff --git a/weapp.rar b/weapp.rar deleted file mode 100644 index 4d5426c..0000000 Binary files a/weapp.rar and /dev/null differ