diff --git a/framework/0-conf.js b/framework/0-conf.js index 7efb0e0..a9b4c7d 100644 --- a/framework/0-conf.js +++ b/framework/0-conf.js @@ -18,6 +18,7 @@ const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService' // #ifdef APP || MP-WEIXIN const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上 const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上 + // const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上 // const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/ // #endif diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue index 271b7bc..74e7620 100644 --- a/pages/order_food/order_food.vue +++ b/pages/order_food/order_food.vue @@ -48,7 +48,7 @@ + :class="{ active: titleTopNumIndex == index }" @click="titleClickHandle(item.id,index)"> {{ item.name }} @@ -267,6 +267,8 @@ showShopInfo: false, showShopsku: false, titleTopNumIndex: 0, + titleTopNumIndexFalg: true, + timer: null, titleTopNums: [], showCart: false, tableCode: '', //code, @@ -300,6 +302,7 @@ backgroundColor: '#000000' }); } + this.countScrollTitle(e.scrollTop); }, onLoad(e) { @@ -424,7 +427,7 @@ break; case 'addcart': this.cartLists = msg - console.log(msg, 1111) + // console.log(msg, 1111) this.productqueryProduct() //list 数据 try { if (msg.data.length != 0) { @@ -452,7 +455,7 @@ } break; } - console.log(this.cartLists.data, 1111111) + // console.log(this.cartLists.data, 1111111) this.cartListsdatashow = this.cartLists.data.length == 0 ? false : true } } catch (e) { @@ -663,7 +666,9 @@ }); }, // 点击菜单商品滚动到指定为止 - titleClickHandle(id) { + titleClickHandle(id,index) { + this.titleTopNumIndexFalg = false; + this.titleTopNumIndex = index; uni.createSelectorQuery() .select('#wrapper') .boundingClientRect((data) => { @@ -686,7 +691,8 @@ }, // 计算滚动到那个标题 countScrollTitle: _.throttle(function(top) { - if (this.titleTopNums.length > 1) { + + if (this.titleTopNums.length > 1 && this.titleTopNumIndexFalg) { for (let i = 0; i <= this.titleTopNums.length - 1; i++) { if (top >= this.titleTopNums[i] && top < this.titleTopNums[i + 1]) { this.titleTopNumIndex = i; @@ -696,6 +702,13 @@ this.titleTopNumIndex = this.titleTopNums.length - 1; } } + //这里必须要每次滚动前 清除一次 + clearTimeout(this.timer) + // 如果停留则表示滚动结束 一旦空了1s就判定为滚动结束 + this.timer = setTimeout(() => { + this.titleTopNumIndexFalg = true; + // console.log('结束滚动') + }, 1000) }, 100), // 统计每个标题到顶部的距离 countTitleTopNum() { @@ -704,9 +717,9 @@ uni.createSelectorQuery() .select(`#title${i.id}`) .boundingClientRect((res) => { - topNums.push(res.top + this.menuInfo.top + this.menuInfo.height + this - .paddingBtmSize - - this.tabHeadHeight - this.tabHeadHeight / 2); + topNums.push(res.top - this.menuInfo.top - this.menuInfo.height - this + .paddingBtmSize*8 - + this.tabHeadHeight + 40); }) .exec(); }