| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883 |
- <template>
- <div class="home-pages">
- <div class="head-pages">
- <div class="bg-img">
- <img :src="carouselList.length && carouselList[carouselIndex].imageUrl" alt="" />
- </div>
- <!-- 头部 -->
- <div class="home-head" @mouseleave="leaveClassify">
- <!-- 分类 -->
- <div class="classify" :class="classifyShow ? 'classify-show' : ''">
- <div
- class="classify-list"
- v-for="(item, index) in classifyList"
- :class="item.id == classifyId && classifyShow ? 'classify-hig' : ''"
- :key="index"
- @mouseenter="enterClassify(item)"
- v-show="classifyShow ? true : Number(index) < 8"
- >
- <div class="label ellipsis" @click="onPath('/search?id=' + item.id)">{{ item.label }}</div>
- <div class="two-level">
- <template v-for="(item1, index1) in item.children" :key="index1">
- <div class="two-hig" v-if="Number(index1) < 2">{{ item1.label }}</div>
- <div style="margin: 0 4px" v-if="index1 == 0 && item.children.length > 1">/</div>
- </template>
- </div>
- </div>
- </div>
- <div class="classify-bos" v-if="classifyShow">
- <div v-for="(item, index) in classifyInfo" :key="index" class="classify-item">
- <div class="two-level ellipsis">{{ item.label || '' }}</div>
- <el-icon class="classify-icon" :size="14" color="#364153">
- <ArrowRight />
- </el-icon>
- <div class="classify-label">
- <div v-for="(item1, index1) in item.children" :key="index1">{{ item1.label || '' }}</div>
- </div>
- </div>
- </div>
- <!-- 轮播区域 -->
- <div class="carousel-bos">
- <el-carousel trigger="click" height="540px" @change="onCarousel">
- <el-carousel-item v-for="item in carouselList" :key="item">
- <img :src="item.imageUrl" alt="" />
- </el-carousel-item>
- </el-carousel>
- </div>
- <!-- 右边 -->
- <div class="head-right">
- <div class="login-bos">
- <div class="login-box">
- <img :src="userInfo.avatar ? userInfo.avatar : profile" alt="" />
- <div>
- <div class="login1">您好,欢迎来到优易达</div>
- <div class="login2">{{ userInfo.nickName ? userInfo.nickName : '请先登录' }}</div>
- </div>
- </div>
- <div class="login-btn">
- <el-button v-if="!userInfo.nickName" type="primary" round size="small" style="width: 64px" @click="onPath('/login')">登录</el-button>
- <el-button v-if="!userInfo.nickName" type="primary" plain round size="small" style="width: 64px" @click="onPath('/reg')"
- >注册</el-button
- >
- <el-button v-if="userInfo.nickName" type="primary" plain round size="small" style="width: 64px" @click="onPath('/reg')">退出</el-button>
- </div>
- </div>
- <div class="real-time">
- <div class="real-title flex-row-between">
- <div class="real1">优易资讯</div>
- <div class="real2 flex-row-start">
- <div>更多</div>
- <el-icon :size="13" color="#83899F">
- <ArrowRight />
- </el-icon>
- </div>
- </div>
- <template v-for="(item, index) in realList" :key="index">
- <div class="real-list ellipsis" v-if="Number(index) < 7">{{ item.announcementTitle }}</div>
- </template>
- </div>
- <div class="interests">
- <div class="interests-title">企业会员权益</div>
- <div class="interests-bos">
- <div v-for="(item, index) in interestsList" :key="index" class="interests-item flex-column-center">
- <img :src="item.imageUrl" alt="" />
- <div>{{ item.title }}</div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="pages-bos">
- <!-- 轮播展位商品 -->
- <div class="sell-bos">
- <template v-for="(item, index) in sellList" :key="index">
- <div v-if="Number(index) < 5" class="sell-list">
- <img class="sell-img" :src="item.productImage ? item.productImage.split(',')[0] : ''" alt="" />
- <div class="sell-name ellipsis2">{{ item.itemName || '' }}</div>
- <div class="sell-price">
- <span class="price1">¥{{ item.memberPrice || '' }}</span>
- <span class="price2">¥{{ item.marketPrice || '' }}</span>
- </div>
- </div>
- </template>
- </div>
- <!-- 商业标签(工业装修-商业标签) -->
- <div class="trade-bos">
- <template v-for="(item, index) in tradeList" :key="index">
- <div v-if="Number(index) < 4" class="trade-list flex-row-between">
- <div class="trade-box flex-column-between">
- <div class="trade-title">{{ item.title || '' }}</div>
- <div class="trade-info ellipsis2">
- {{ item.remark || '' }}
- </div>
- <img class="trade-look" src="@/assets/images/home/indexMro1.png" alt="" />
- </div>
- <img class="trade-img" :src="item.imageUrl" alt="" />
- </div>
- </template>
- </div>
- <!-- 循环-商品 -->
- <div class="goods-bos" v-for="(item, index) in goodsList" :key="index">
- <div class="goods-title flex-row-center">
- <img src="@/assets/images/home/indexMro2.png" alt="" />
- <span class="text-primary">{{ item.name }}</span>
- <span>精选</span>
- <img src="@/assets/images/home/indexMro3.png" alt="" />
- </div>
- <div class="goods-box">
- <img class="goods-one" :src="item.imageUrl" alt="" />
- <div class="goods-shop">
- <template v-for="(item1, index1) in item.goodsList" :key="index1">
- <div v-if="Number(index1) < 8" class="shop-list flex-column-between">
- <img class="shop-img" :src="item1.productImage ? item1.productImage.split(',')[0] : ''" alt="" />
- <div class="shop-name ellipsis2">{{ item1.itemName || '' }}</div>
- <div class="shop-price">
- <span class="price1">¥{{ item1.memberPrice || '' }}</span>
- <span class="price2">¥{{ item1.marketPrice || '' }}</span>
- </div>
- </div>
- </template>
- </div>
- <div class="goods-brand flex-column-between" v-if="item.brandList && item.brandList.length > 0">
- <div class="brand-bos">
- <template v-for="(item1, index1) in item.brandList" :key="index1">
- <img clear-both v-if="Number(index1) < 6" class="brand-img" :src="item1.brandLogo" alt="" />
- </template>
- </div>
- <div class="brand-more flex-row-center">
- <div>更多品牌</div>
- <el-icon><ArrowRight /></el-icon>
- </div>
- </div>
- </div>
- </div>
- <!-- 为你推荐 -->
- <div class="goods-title flex-row-center">
- <img src="@/assets/images/home/indexMro2.png" alt="" />
- <span class="text-primary">为你推荐</span>
- <img src="@/assets/images/home/indexMro3.png" alt="" />
- </div>
- <div class="nav-bos flex-row-center">
- <template v-for="(item, index) in recommendNav" :key="index">
- <div @click="onNav(item)" class="nav-list" :class="categoryId == item.id ? 'hig' : ''" v-if="Number(index) < 9">{{ item.title }}</div>
- </template>
- </div>
- <!-- 轮播展位商品 -->
- <div class="sell-bos recommend">
- <div v-for="(item, index) in recommendList" :key="index" class="sell-list">
- <img class="sell-img" :src="item.productImage ? item.productImage.split(',')[0] : ''" alt="" />
- <div class="sell-name ellipsis2">{{ item.itemName || '' }}</div>
- <div class="sell-price">
- <span class="price1">¥{{ item.memberPrice || '' }}</span>
- <span class="price2">¥{{ item.marketPrice || '' }}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script setup lang="ts">
- import {
- getProductCategoryTree,
- getHomeAdList,
- getHomeIconAd,
- getCarouselDisplayProductList,
- getBusinessLabelList,
- getIndustrialFloor,
- getIndustrialFloorProductList,
- getIndustrialFloorBrand,
- getRecommendedCategory,
- getRecommendedCategoryProductList
- } from '@/api/home/index-mro';
- import { getYouYiZiXunPage } from '@/api/home/index';
- import { onPath } from '@/utils/siteConfig';
- import { getToken } from '@/utils/auth';
- import { getInfo } from '@/api/login';
- import profile from '@/assets/images/profile.jpg';
- const userInfo = ref<any>({});
- const classifyId = ref<any>('');
- const classifyShow = ref<any>(false);
- const classifyInfo = ref<any>([]);
- const classifyList = ref<any>([]);
- const carouselList = ref<any>([]);
- const carouselIndex = ref<any>(0);
- const realList = ref<any>([]);
- const interestsList = ref<any>([]);
- const sellList = ref<any>([]);
- const tradeList = ref<any>([]);
- const goodsList = ref<any>([]);
- const recommendNav = ref<any>([]);
- const recommendList = ref<any>([]);
- const categoryId = ref<any>('');
- onMounted(() => {
- if (getToken()) {
- getInfo().then((res) => {
- if (res.code == 200) {
- userInfo.value = res.data.user;
- }
- });
- }
- });
- //移出分类
- const leaveClassify = () => {
- classifyShow.value = false;
- };
- //移入分类
- const enterClassify = (res: any) => {
- classifyShow.value = true;
- classifyId.value = res.id;
- classifyInfo.value = res.children;
- };
- //头部分类
- getProductCategoryTree({
- platform: 1
- }).then((res) => {
- if (res.code == 200) {
- classifyList.value = res.data;
- }
- });
- //头部轮播
- getHomeAdList({}).then((res) => {
- if (res.code == 200) {
- carouselList.value = res.data;
- carouselIndex.value = 0;
- }
- });
- //头部优易资讯
- getYouYiZiXunPage({}).then((res) => {
- if (res.code == 200) {
- realList.value = res.data;
- }
- });
- //头部会员权益
- getHomeIconAd({}).then((res) => {
- if (res.code == 200) {
- interestsList.value = res.data;
- }
- });
- //轮播展位商品(工业装修-轮播展位商品)
- getCarouselDisplayProductList({}).then((res) => {
- if (res.code == 200) {
- sellList.value = res.data;
- }
- });
- //商业标签(工业装修-商业标签)
- getBusinessLabelList({}).then((res) => {
- if (res.code == 200) {
- tradeList.value = res.data;
- }
- });
- //循环
- getIndustrialFloor({}).then(async (res) => {
- if (res.code == 200) {
- for (const item of res.data) {
- try {
- const datas2 = await getIndustrialFloorProductList({ floorId: item.id });
- if (datas2.code == 200) {
- item.goodsList = datas2.data;
- }
- const datas3 = await getIndustrialFloorBrand({ floorId: item.id });
- if (datas2.code == 200) {
- item.brandList = datas3.data;
- }
- } catch (error) {}
- }
- goodsList.value = res.data;
- }
- });
- //为你推荐-分类
- getRecommendedCategory({}).then((res) => {
- if (res.code == 200) {
- recommendNav.value = res.data;
- recommendNav.value.unshift({
- id: '',
- title: '全部'
- });
- }
- });
- //为你推荐-商品
- getRecommendedCategoryProductList({}).then((res) => {
- if (res.code == 200) {
- recommendList.value = res.data;
- }
- });
- const onNav = (item: any) => {
- categoryId.value = item.id;
- getRecommendedCategoryProductList({ categoryId: categoryId.value }).then((res) => {
- if (res.code == 200) {
- recommendList.value = res.data;
- }
- });
- };
- const onCarousel = (res: any) => {
- carouselIndex.value = res;
- };
- </script>
- <style lang="scss" scoped>
- .home-pages {
- width: 100%;
- .head-pages {
- width: 100%;
- // background: #000000;
- margin-top: 10px;
- background-size: 100% 100%;
- background-repeat: no-repeat;
- position: relative;
- backdrop-filter: blur(95px);
- filter: blur(30rpx);
- .bg-img {
- position: absolute;
- width: 100%;
- height: 100%;
- top: 0;
- z-index: -1;
- filter: blur(30rpx);
- overflow: hidden;
- img {
- width: 100%;
- height: 100%;
- transform: scale(1.2);
- filter: blur(30px);
- }
- }
- // 头部
- .home-head {
- width: 1200px;
- margin: 0 auto;
- position: relative;
- display: flex;
- gap: 0px 10px;
- .classify {
- width: 234px;
- height: 540px;
- background: #323232;
- padding: 10px 0px;
- &.classify-show {
- position: absolute;
- z-index: 10;
- height: auto;
- min-height: 540px;
- }
- .classify-list {
- width: 100%;
- height: 60px;
- cursor: pointer;
- position: relative;
- display: flex;
- flex-direction: column;
- justify-content: center;
- padding-left: 25px;
- &.classify-hig {
- border: 1px solid var(--el-color-primary);
- border-right: 0px solid var(--el-color-primary);
- }
- .label {
- width: 100%;
- font-size: 14px;
- color: #ffffff;
- white-space: nowrap;
- margin-right: 10px;
- &:hover {
- color: var(--el-color-primary);
- }
- }
- .two-level {
- display: flex;
- align-items: center;
- font-size: 12px;
- color: #a2a2a2;
- margin-top: 6px;
- .two-hig {
- &:hover {
- color: var(--el-color-primary);
- }
- }
- }
- }
- }
- .classify-bos {
- position: absolute;
- top: 0;
- right: 0;
- width: 966px;
- height: 100%;
- border: 1px solid var(--el-color-primary);
- background-color: #ffffff;
- overflow-y: auto;
- padding-left: 30px;
- z-index: 10;
- .classify-item {
- display: flex;
- padding-top: 10px;
- border-bottom: 1px solid #e5e7eb;
- .two-level {
- width: 90px;
- font-size: 14px;
- color: var(--el-color-primary);
- cursor: pointer;
- }
- .classify-icon {
- margin: 4px 15px 0 15px;
- }
- .classify-label {
- display: flex;
- flex-wrap: wrap;
- flex: 1;
- font-size: 14px;
- color: #364153;
- div {
- margin-right: 20px;
- margin-bottom: 10px;
- cursor: pointer;
- &:hover {
- color: var(--el-color-primary);
- }
- }
- }
- }
- }
- // 头部中间
- .carousel-bos {
- width: 756px;
- height: 540px;
- img {
- width: 756px;
- height: 540px;
- }
- }
- //右边
- .head-right {
- flex: 1;
- width: 0;
- height: 540px;
- background: #ffffff;
- display: flex;
- flex-direction: column;
- .login-bos {
- width: calc(100% - 20px);
- height: 110px;
- border-bottom: 1px solid #e5e7eb;
- margin: 0 10px;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- padding: 16px 0;
- .login-box {
- display: flex;
- align-items: center;
- img {
- width: 40px;
- height: 40px;
- margin-right: 8px;
- border-radius: 40px;
- }
- .login-btn {
- width: 100%;
- }
- .login1 {
- font-size: 13px;
- color: #444444;
- }
- .login2 {
- margin-top: 2px;
- font-size: 12px;
- color: #6a7282;
- }
- }
- }
- .real-time {
- width: calc(100% - 20px);
- height: 227px;
- border-bottom: 1px solid #e5e7eb;
- margin: 0 10px;
- padding-top: 15px;
- .real-title {
- position: relative;
- margin-bottom: 12px;
- &::after {
- content: '';
- top: 3px;
- left: 0;
- position: absolute;
- width: 4px;
- height: 14px;
- background: var(--el-color-primary);
- }
- .real1 {
- font-weight: 600;
- font-size: 14px;
- color: #1d2129;
- padding-left: 15px;
- }
- .real2 {
- font-size: 13px;
- color: #83899f;
- cursor: pointer;
- }
- }
- .real-list {
- width: 100%;
- font-size: 14px;
- color: #1d2129;
- margin-bottom: 12px;
- cursor: pointer;
- &:hover {
- color: var(--el-color-primary);
- }
- }
- }
- .interests {
- flex: 1;
- width: calc(100% - 20px);
- margin: 0 10px;
- padding-top: 15px;
- .interests-title {
- position: relative;
- font-weight: 600;
- font-size: 14px;
- color: #1d2129;
- padding-left: 15px;
- &::after {
- content: '';
- top: 3px;
- left: 0;
- position: absolute;
- width: 4px;
- height: 14px;
- background: var(--el-color-primary);
- }
- }
- .interests-bos {
- display: flex;
- flex-wrap: wrap;
- .interests-item {
- width: 33.333%;
- font-size: 12px;
- color: #101828;
- margin-top: 15px;
- cursor: pointer;
- &:hover {
- color: var(--el-color-primary);
- }
- img {
- width: 34px;
- height: 34px;
- margin-bottom: 7px;
- }
- }
- }
- }
- }
- }
- }
- .pages-bos {
- width: 1200px;
- margin: 0 auto;
- //轮播展位商品
- .sell-bos {
- width: 1200px;
- display: flex;
- gap: 0 20px;
- margin-top: 30px;
- .sell-list {
- width: 224px;
- height: 306px;
- background: #ffffff;
- border-radius: 10px;
- padding: 20px;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- cursor: pointer;
- transition: transform 0.2s ease;
- &:hover {
- transform: translateY(-2px);
- }
- .sell-img {
- width: 184px;
- height: 182px;
- }
- .sell-name {
- width: 184px;
- height: 38px;
- font-size: 14px;
- color: #101828;
- }
- .sell-price {
- .price1 {
- color: var(--el-color-primary);
- font-size: 16px;
- color: #e7000b;
- }
- .price2 {
- font-size: 12px;
- color: #99a1af;
- line-height: 20px;
- text-decoration-line: line-through;
- text-transform: none;
- margin-left: 6px;
- }
- }
- }
- }
- //商业标签(工业装修-商业标签)
- .trade-bos {
- width: 1200px;
- display: flex;
- gap: 0 10px;
- margin-top: 30px;
- .trade-list {
- width: 292.5px;
- height: 146px;
- background: #ffffff;
- border-radius: 4px;
- padding: 22px;
- cursor: pointer;
- transition: transform 0.2s ease;
- &:hover {
- transform: translateY(-2px);
- }
- .trade-box {
- width: 144px;
- height: 100%;
- .trade-title {
- font-weight: 600;
- font-size: 16px;
- color: #000000;
- }
- .trade-info {
- font-size: 12px;
- color: #364153;
- height: 32px;
- }
- .trade-look {
- width: 89px;
- height: 28px;
- }
- }
- .trade-img {
- width: 79px;
- height: 79px;
- }
- }
- }
- //标题
- .goods-title {
- width: 1200px;
- height: 56px;
- border-radius: 10px;
- background: #ffffff;
- font-weight: 600;
- font-size: 20px;
- margin-top: 20px;
- img {
- width: 30px;
- height: 21px;
- margin: 0 10px;
- }
- }
- //循环-商品
- .goods-bos {
- .goods-box {
- display: flex;
- gap: 0 10px;
- margin-top: 15px;
- .goods-one {
- width: 236px;
- height: 560px;
- border-radius: 10px;
- background: #ffffff;
- cursor: pointer;
- transition: transform 0.2s ease;
- &:hover {
- transform: translateY(-2px);
- }
- }
- .goods-shop {
- width: 802px;
- height: 560px;
- display: flex;
- flex-wrap: wrap;
- gap: 10px;
- .shop-list {
- width: 193px;
- height: 275px;
- background: #ffffff;
- border-radius: 10px;
- padding: 20px;
- cursor: pointer;
- transition: transform 0.2s ease;
- &:hover {
- transform: translateY(-2px);
- }
- .shop-img {
- width: 153px;
- height: 150px;
- border-radius: 6px;
- }
- .shop-name {
- width: 153px;
- height: 38px;
- font-size: 14px;
- color: #101828;
- }
- .shop-price {
- .price1 {
- color: var(--el-color-primary);
- font-size: 16px;
- color: #e7000b;
- }
- .price2 {
- font-size: 12px;
- color: #99a1af;
- line-height: 20px;
- text-decoration-line: line-through;
- text-transform: none;
- margin-left: 6px;
- }
- }
- }
- }
- .goods-brand {
- width: 142px;
- height: 560px;
- border-radius: 10px;
- background: #ffffff;
- padding: 20px 10px;
- .brand-bos {
- width: 100%;
- display: flex;
- flex-direction: column;
- gap: 10px 0;
- img {
- width: 100%;
- height: 74px;
- border-radius: 4px;
- border: 1px solid #e5e7eb;
- cursor: pointer;
- transition: transform 0.2s ease;
- &:hover {
- transform: translateY(-2px);
- }
- }
- }
- .brand-more {
- color: var(--el-color-primary);
- font-size: 14px;
- cursor: pointer;
- }
- }
- }
- }
- //为你推荐
- .nav-bos {
- width: 1200px;
- height: 48px;
- background: #ffffff;
- border-radius: 10px;
- margin-top: 14px;
- padding: 0 1.5px;
- .nav-list {
- width: 133px;
- position: relative;
- font-size: 14px;
- color: #000000;
- text-align: center;
- cursor: pointer;
- &.hig {
- color: var(--el-color-primary);
- }
- &::after {
- content: '';
- position: absolute;
- right: 0;
- top: 2.5px;
- width: 1px;
- height: 14px;
- background-color: #e5e7eb;
- }
- &:last-child::after {
- display: none;
- }
- }
- }
- .recommend {
- margin-top: 14px;
- gap: 14px 20px;
- flex-wrap: wrap;
- margin-bottom: 60px;
- }
- }
- }
- </style>
|