From d853816c959089a545f57a2980ca3f42fdd20fa1 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期二, 11 二月 2025 14:44:33 +0800
Subject: [PATCH] feat: 首页
---
apps/cMiniApp/src/pages/home/index.vue | 146 ++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 127 insertions(+), 19 deletions(-)
diff --git a/apps/cMiniApp/src/pages/home/index.vue b/apps/cMiniApp/src/pages/home/index.vue
index daa5593..62093b5 100644
--- a/apps/cMiniApp/src/pages/home/index.vue
+++ b/apps/cMiniApp/src/pages/home/index.vue
@@ -1,31 +1,91 @@
<template>
- <PageLayoutWithBg class="index-page-wrapper" :title="'棣栭〉'" :need-auth="false">
+ <PageLayoutWithBg class="index-page-wrapper" :title="''" :need-auth="false">
<template #left>
<div class="menu-btn-wrapper menu-logo">
<img :src="IconLogo" class="logo" />
</div>
</template>
- <div class="home-searchbar-wrapper">
- <BlSearchbar v-model.trim="searchValue"></BlSearchbar>
+ <div class="home-header">
+ <div class="home-searchbar-wrapper">
+ <div class="searchbar-container">
+ <BlSearchbar v-model.trim="searchValue" placeholder="鎼滅储浠诲姟"></BlSearchbar>
+ </div>
+ <div class="city-btn" @click="goCitySelect">
+ <Location2 :size="16" />
+ <div class="city-btn-text">{{ locationCity }}</div>
+ </div>
+ </div>
+ <div class="home-banner-wrapper">
+ <nut-swiper :auto-play="3000">
+ <nut-swiper-item v-for="(item, index) in list" :key="index">
+ <img :src="item" class="banner-img" draggable="false" />
+ </nut-swiper-item>
+ </nut-swiper>
+ </div>
</div>
+ <ProTabs
+ v-model="queryState.orderType"
+ name="home-tab"
+ :showPaneContent="false"
+ class="home-tabs"
+ isTransparent
+ title-gutter="12"
+ title-scroll
+ >
+ <ProTabPane :title="`鎺ㄨ崘`" :pane-key="HomeOrderType.Recommend"></ProTabPane>
+ <ProTabPane :title="`鏈�鏂癭" :pane-key="HomeOrderType.LastShelfTime"></ProTabPane>
+ <template #right>
+ <Menu>
+ <MenuItem
+ v-model="queryState.orderByProperty"
+ title="绛涢��"
+ ref="selectItem"
+ :options="[
+ { text: '鎺掑簭', value: 'userId' },
+ { text: '鎸夊叧娉ㄦ椂闂�', value: 'creationTime' },
+ ]"
+ />
+ </Menu>
+ </template>
+ </ProTabs>
+ <InfiniteLoading
+ scrollViewClassName="common-infinite-scroll-list home-list"
+ v-bind="infiniteLoadingProps"
+ :key="queryState.orderType"
+ >
+ <template #renderItem="{ item }">
+ <TaskCard />
+ </template>
+ </InfiniteLoading>
</PageLayoutWithBg>
</template>
<script setup lang="ts">
import { useUser } from '@/hooks';
import { useUserStore } from '@/stores/modules/user';
-import { RectDown } from '@nutui/icons-vue-taro';
+import { RectDown, Location2 } from '@nutui/icons-vue-taro';
import Taro from '@tarojs/taro';
import { LocationUtils, trim } from '@12333/utils';
import _ from 'lodash';
import IconLogo from '@/assets/home/icon-logo.png';
+import { useInfiniteLoading } from '@12333/hooks';
+import { OrderInputType } from '@12333/constants';
+import * as orderServices from '@12333/services/api/Order';
+import { TaskCard, ProTabs, ProTabPane } from '@12333/components';
+import { HomeOrderType } from './constants';
const { locationCity } = useUser();
+Taro.usePageScroll(() => {
+ console.log('11', 11);
+});
+
const searchValue = ref('');
const queryState = reactive({
searchValueTrim: '',
+ orderType: HomeOrderType.Recommend,
+ orderByProperty: 'userId',
});
const handleSearch = _.debounce(function () {
@@ -39,13 +99,36 @@
url: RouterPath.citySelect,
});
}
-// onMounted(async () => {
-// if (!isSetMatchMakingIdentity.value) {
-// Taro.navigateTo({
-// url: RouterPath.toggleMatchMakingIdentity,
-// });
-// }
-// });
+
+const list = ref([
+ 'https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg',
+ 'https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg',
+ 'https://storage.360buyimg.com/jdc-article/welcomenutui.jpg',
+ 'https://storage.360buyimg.com/jdc-article/fristfabu.jpg',
+]);
+
+const { infiniteLoadingProps } = useInfiniteLoading(
+ ({ pageParam }) => {
+ let params: API.FrontOrderListInput = {
+ pageModel: {
+ rows: 20,
+ page: pageParam,
+ orderInput: [
+ queryState.orderType === HomeOrderType.Recommend
+ ? { property: 'isRecommend', order: OrderInputType.Desc }
+ : { property: 'lastShelfTime', order: OrderInputType.Desc },
+ ],
+ },
+ };
+
+ return orderServices.getFrontOrderList(params, {
+ showLoading: false,
+ });
+ },
+ {
+ queryKey: ['orderServices/getFrontOrderList', queryState],
+ }
+);
</script>
<style lang="scss">
@@ -61,19 +144,44 @@
}
}
- .city-btn {
+ .home-searchbar-wrapper {
+ padding: 32px 0;
display: flex;
- align-items: center;
- .city-btn-text {
- max-width: 200px;
- @include ellipsis;
- margin-right: 12px;
+ .searchbar-container {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .city-btn {
+ display: flex;
+ align-items: center;
+ padding-left: 36px;
+ color: boleGetCssVar('text-color', 'primary');
+
+ .city-btn-text {
+ max-width: 200px;
+ @include ellipsis;
+ margin-left: 12px;
+ font-size: 30px;
+ }
}
}
- .home-searchbar-wrapper {
- padding: 32px 0;
+ .home-banner-wrapper {
+ .banner-img {
+ width: 100%;
+ height: 260px;
+ object-fit: cover;
+ }
}
+
+ .home-header {
+ padding: 0 boleGetCssVar('size', 'body-padding-h');
+ }
+}
+
+.home-list {
+ @include infiniteLoadingInTabBarPage;
}
</style>
--
Gitblit v1.10.0