暂存code
This commit is contained in:
+40
-27
@@ -1,12 +1,12 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_classify_data = require("../../common/classify.data.js");
|
||||
const api_common = require("../../api/common.js");
|
||||
const CustomTabBar = () => "../../components/custom-tab-bar.js";
|
||||
const _sfc_main = {
|
||||
components: { CustomTabBar },
|
||||
data() {
|
||||
return {
|
||||
selCategory: 1,
|
||||
tabbar: common_classify_data.classifyData,
|
||||
scrollTop: 0,
|
||||
//tab标题的滚动条位置
|
||||
current: null,
|
||||
@@ -27,12 +27,28 @@ const _sfc_main = {
|
||||
tabbarContentLoading: false
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
onShow() {
|
||||
},
|
||||
onShow() {
|
||||
this.getSort(0).then((resp) => {
|
||||
if (resp && resp.length !== 0) {
|
||||
const fData = resp[0];
|
||||
this.tabbarList = resp;
|
||||
this.swichMenu(fData, 0);
|
||||
const sortId = common_vendor.index.getStorageSync("sortId");
|
||||
if (sortId && sortId !== 0) {
|
||||
let fData = {};
|
||||
let currentIndex = 0;
|
||||
resp.map((item, index) => {
|
||||
if (item.id === sortId) {
|
||||
fData = item;
|
||||
currentIndex = index;
|
||||
return;
|
||||
}
|
||||
});
|
||||
this.swichMenu(fData, currentIndex);
|
||||
} else {
|
||||
const fData = resp[0];
|
||||
this.swichMenu(fData, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -40,9 +56,13 @@ const _sfc_main = {
|
||||
checkCategory(val) {
|
||||
this.selCategory = val;
|
||||
},
|
||||
jumpSearch() {
|
||||
jumpSearch(item) {
|
||||
let path = "/pages/search/search";
|
||||
if (item && Object.keys(item).length !== 0) {
|
||||
path = path + "?keyword=" + item.name;
|
||||
}
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/search/search"
|
||||
url: path
|
||||
});
|
||||
},
|
||||
// 查询分类
|
||||
@@ -92,12 +112,6 @@ const _sfc_main = {
|
||||
this[dataVal] = res.height;
|
||||
}).exec();
|
||||
});
|
||||
},
|
||||
// 跳转到搜索页面
|
||||
jumpProduct(item) {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/search/search?categoryId=" + item.id
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -106,8 +120,8 @@ if (!Array) {
|
||||
const _easycom_up_swiper2 = common_vendor.resolveComponent("up-swiper");
|
||||
const _easycom_up_loading_page2 = common_vendor.resolveComponent("up-loading-page");
|
||||
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
|
||||
const _component_template = common_vendor.resolveComponent("template");
|
||||
(_easycom_up_search2 + _easycom_up_swiper2 + _easycom_up_loading_page2 + _easycom_up_image2 + _component_template)();
|
||||
const _component_CustomTabBar = common_vendor.resolveComponent("CustomTabBar");
|
||||
(_easycom_up_search2 + _easycom_up_swiper2 + _easycom_up_loading_page2 + _easycom_up_image2 + _component_CustomTabBar)();
|
||||
}
|
||||
const _easycom_up_search = () => "../../uni_modules/uview-plus/components/u-search/u-search.js";
|
||||
const _easycom_up_swiper = () => "../../uni_modules/uview-plus/components/u-swiper/u-swiper.js";
|
||||
@@ -122,19 +136,15 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
}, $data.selCategory === 1 ? {} : {}, {
|
||||
b: common_vendor.n($data.selCategory === 1 ? "category_item category_item_sel" : "category_item"),
|
||||
c: common_vendor.o(($event) => $options.checkCategory(1)),
|
||||
d: $data.selCategory === 2
|
||||
}, $data.selCategory === 2 ? {} : {}, {
|
||||
e: common_vendor.n($data.selCategory === 2 ? "category_item category_item_sel" : "category_item"),
|
||||
f: common_vendor.o(($event) => $options.checkCategory(2)),
|
||||
g: common_vendor.p({
|
||||
d: common_vendor.p({
|
||||
shape: "square",
|
||||
bgColor: "#EEEEEEFF",
|
||||
color: "#666666FF",
|
||||
showAction: false,
|
||||
placeholder: "搜索"
|
||||
}),
|
||||
h: common_vendor.o((...args) => $options.jumpSearch && $options.jumpSearch(...args)),
|
||||
i: common_vendor.f($data.tabbarList, (item, index, i0) => {
|
||||
e: common_vendor.o((...args) => $options.jumpSearch && $options.jumpSearch(...args)),
|
||||
f: common_vendor.f($data.tabbarList, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.name),
|
||||
b: index,
|
||||
@@ -143,15 +153,15 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
e: common_vendor.o(($event) => $options.swichMenu(item, index), index)
|
||||
};
|
||||
}),
|
||||
j: $data.scrollTop,
|
||||
k: common_vendor.p({
|
||||
g: $data.scrollTop,
|
||||
h: common_vendor.p({
|
||||
list: $data.bannerList,
|
||||
height: "80px"
|
||||
}),
|
||||
l: common_vendor.p({
|
||||
i: common_vendor.p({
|
||||
loading: $data.tabbarContentLoading
|
||||
}),
|
||||
m: common_vendor.f($data.tabbarContentList, (item, index, i0) => {
|
||||
j: common_vendor.f($data.tabbarContentList, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(item.name),
|
||||
b: item.foods && item.foods.length !== 0
|
||||
@@ -161,7 +171,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
a: item1.icon ? item1.icon : "/static/common/def_img.jpg",
|
||||
b: common_vendor.t(item1.name),
|
||||
c: index1,
|
||||
d: common_vendor.o(($event) => $options.jumpProduct(item1), index1)
|
||||
d: common_vendor.o(($event) => $options.jumpSearch(item1), index1)
|
||||
};
|
||||
})
|
||||
} : {
|
||||
@@ -175,6 +185,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
}, {
|
||||
f: index
|
||||
});
|
||||
}),
|
||||
k: common_vendor.p({
|
||||
tabIndex: 1
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"navigationStyle": "custom",
|
||||
"usingComponents": {
|
||||
"custom-tab-bar": "../../components/custom-tab-bar",
|
||||
"up-search": "../../uni_modules/uview-plus/components/u-search/u-search",
|
||||
"up-swiper": "../../uni_modules/uview-plus/components/u-swiper/u-swiper",
|
||||
"up-loading-page": "../../uni_modules/uview-plus/components/u-loading-page/u-loading-page",
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
<view class="sort_warp data-v-1255c49a"><view class="sort_header data-v-1255c49a"><view class="sort_category_header data-v-1255c49a"><view class="{{['data-v-1255c49a', b]}}" bindtap="{{c}}"><view class="data-v-1255c49a">分类</view><view wx:if="{{a}}" class="category_item_sel_but data-v-1255c49a"></view></view><view class="{{['data-v-1255c49a', e]}}" bindtap="{{f}}"><view class="data-v-1255c49a">品牌</view><view wx:if="{{d}}" class="category_item_sel_but data-v-1255c49a"></view></view></view><view class="data-v-1255c49a" style="width:200rpx" bindtap="{{h}}"><up-search wx:if="{{g}}" class="data-v-1255c49a" u-i="1255c49a-0" bind:__l="__l" u-p="{{g}}"></up-search></view></view><view class="u-menu-wrap data-v-1255c49a"><scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view data-v-1255c49a" scroll-top="{{j}}"><view wx:for="{{i}}" wx:for-item="item" wx:key="b" class="{{['u-tab-item', 'data-v-1255c49a', item.c]}}" data-current="{{item.d}}" catchtap="{{item.e}}"><text class="u-line-1 data-v-1255c49a">{{item.a}}</text></view></scroll-view><block class="data-v-1255c49a" u-s="{{['d']}}"><scroll-view scroll-y class="right-box data-v-1255c49a"><view class="data-v-1255c49a" style="padding:0rpx 20rpx"><up-swiper wx:if="{{k}}" class="data-v-1255c49a" u-i="1255c49a-1" bind:__l="__l" u-p="{{k}}"></up-swiper></view><view class="page-view data-v-1255c49a"><up-loading-page wx:if="{{l}}" class="data-v-1255c49a" u-i="1255c49a-2" bind:__l="__l" u-p="{{l}}"></up-loading-page><view wx:for="{{m}}" wx:for-item="item" wx:key="f" class="class-item data-v-1255c49a"><view class="item-title data-v-1255c49a"><text class="data-v-1255c49a">{{item.a}}</text></view><view wx:if="{{item.b}}" class="item-container data-v-1255c49a"><view wx:for="{{item.c}}" wx:for-item="item1" wx:key="c" class="thumb-box data-v-1255c49a" bindtap="{{item1.d}}"><image class="item-menu-image data-v-1255c49a" src="{{item1.a}}" mode=""></image><view class="item-menu-name data-v-1255c49a">{{item1.b}}</view></view></view><view wx:else class="not_order_warp data-v-1255c49a"><view class="not_order_warp_img data-v-1255c49a"><up-image wx:if="{{item.e}}" class="data-v-1255c49a" u-i="{{item.d}}" bind:__l="__l" u-p="{{item.e}}"></up-image></view><view class="not_order_msg_warp data-v-1255c49a">暂无分类,快去添加吧~</view></view></view></view></scroll-view></block></view></view>
|
||||
<view class="sort_warp data-v-1255c49a"><view class="sort_header data-v-1255c49a"><view class="sort_category_header data-v-1255c49a"><view class="{{['data-v-1255c49a', b]}}" bindtap="{{c}}"><view class="data-v-1255c49a">分类</view><view wx:if="{{a}}" class="category_item_sel_but data-v-1255c49a"></view></view></view><view class="data-v-1255c49a" style="width:200rpx" bindtap="{{e}}"><up-search wx:if="{{d}}" class="data-v-1255c49a" u-i="1255c49a-0" bind:__l="__l" u-p="{{d}}"></up-search></view></view><view class="u-menu-wrap data-v-1255c49a"><scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view data-v-1255c49a" scroll-top="{{g}}"><view wx:for="{{f}}" wx:for-item="item" wx:key="b" class="{{['u-tab-item', 'data-v-1255c49a', item.c]}}" data-current="{{item.d}}" catchtap="{{item.e}}"><text class="u-line-1 data-v-1255c49a">{{item.a}}</text></view></scroll-view><scroll-view scroll-y class="right-box data-v-1255c49a"><view class="data-v-1255c49a" style="padding:0rpx 20rpx"><up-swiper wx:if="{{h}}" class="data-v-1255c49a" u-i="1255c49a-1" bind:__l="__l" u-p="{{h}}"></up-swiper></view><view class="page-view data-v-1255c49a"><up-loading-page wx:if="{{i}}" class="data-v-1255c49a" u-i="1255c49a-2" bind:__l="__l" u-p="{{i}}"></up-loading-page><view wx:for="{{j}}" wx:for-item="item" wx:key="f" class="class-item data-v-1255c49a"><view class="item-title data-v-1255c49a"><text class="data-v-1255c49a">{{item.a}}</text></view><view wx:if="{{item.b}}" class="item-container data-v-1255c49a"><view wx:for="{{item.c}}" wx:for-item="item1" wx:key="c" class="thumb-box data-v-1255c49a" bindtap="{{item1.d}}"><image class="item-menu-image data-v-1255c49a" src="{{item1.a}}" mode=""></image><view class="item-menu-name data-v-1255c49a">{{item1.b}}</view></view></view><view wx:else class="not_order_warp data-v-1255c49a"><view class="not_order_warp_img data-v-1255c49a"><up-image wx:if="{{item.e}}" class="data-v-1255c49a" u-i="{{item.d}}" bind:__l="__l" u-p="{{item.e}}"></up-image></view><view class="not_order_msg_warp data-v-1255c49a">暂无分类,快去添加吧~</view></view></view></view></scroll-view></view><custom-tab-bar wx:if="{{k}}" class="data-v-1255c49a" u-i="1255c49a-4" bind:__l="__l" u-p="{{k}}"/></view>
|
||||
+3
-3
@@ -24,7 +24,7 @@
|
||||
/* 垂直间距 */
|
||||
.sort_warp.data-v-1255c49a {
|
||||
padding: 130rpx 0rpx 0rpx;
|
||||
height: calc(100vh - 130rpx);
|
||||
height: calc(100vh - 270rpx);
|
||||
}
|
||||
.sort_header.data-v-1255c49a {
|
||||
display: flex;
|
||||
@@ -58,7 +58,7 @@
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
margin-top: 20rpx;
|
||||
height: calc(100vh - 216rpx);
|
||||
height: calc(100vh - 356rpx);
|
||||
}
|
||||
.u-search-inner.data-v-1255c49a {
|
||||
background-color: #eaeaea;
|
||||
@@ -75,10 +75,10 @@
|
||||
.u-tab-view.data-v-1255c49a {
|
||||
width: 200rpx;
|
||||
height: 100%;
|
||||
background: #f6f6f6;
|
||||
}
|
||||
.u-tab-item.data-v-1255c49a {
|
||||
height: 110rpx;
|
||||
background: #f6f6f6;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user