Procházet zdrojové kódy

商城改版页面调整

sunlupeng před 1 rokem
rodič
revize
4c82752575
3 změnil soubory, kde provedl 258 přidání a 112 odebrání
  1. 62 65
      src/components/AppSidebar.vue
  2. 83 37
      src/components/SiderInfo.vue
  3. 113 10
      src/views/HomeView/Index.vue

+ 62 - 65
src/components/AppSidebar.vue

@@ -24,32 +24,19 @@
                 </div>
                 <ul class="hot-item-body">
                     <div class="skeleton">
-                        <li class="hot-item hot-item-authors">
-                            <div class="hot-item-text hot-item-text-authors">
-                                <a href="/home/pointsMall/redeem?id=20&name=goodsNotice&type=8" class="info" title="京东云开发者">
-                                    <img src="https://xiaoyou.dgtis.com/images/image/2023/05/16/8nfqz3mxe754qtcnxdia.png"
-                                        alt="avatar" type="avatar" class="hot-item-img"></a>
-                                <span class="title-authors">
-                                    <a href="/home/pointsMall/redeem?id=20&name=goodsNotice&type=8" class="info" title="爱奇艺会员年卡">
-                                        <span class="description">爱奇艺会员年卡
-                                        </span>
-                                    </a>
-                                </span>
+                        <li v-for="(item,index) in hotGoodsList" :key="index" class="hot-item">
+                            <div class="body-index" :class="index == 0 ? 'first-index' : index == 1 ? 'second-index' : index == 2 ? 'third-index' : '' ">
+                                {{ index + 1 }}
+                            </div> 
+                            <div class="hot-item-text">
+                                <img style="width: 30px;height: 30px;" :src="item.url" alt="">
+                                <a :href="item.path" class="title-articles" :title="item.name">
+                                    {{ item.name }}
+                                </a> 
                             </div>
                         </li>
                     </div>
                 </ul>
-                <!-- <div class="divider" style="margin-top: 4px;">
-                    <div class="content"></div>
-                </div> -->
-                <!-- <div class="hot-item-footer">
-                    <a href="/hot/authors/6809637769959178254" class="item-footer-button" target="_blank">
-                        <span>查看更多</span> 
-                        <svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg" class="">
-                            <path d="M6.6094 4.99959L3.22118 1.61137C3.13982 1.53001 3.13982 1.3981 3.22118 1.31674L3.5158 1.02212C3.59716 0.940757 3.72907 0.940757 3.81043 1.02212L7.49328 4.70496C7.656 4.86768 7.656 5.1315 7.49328 5.29422L3.81043 8.97707C3.72907 9.05843 3.59716 9.05843 3.5158 8.97707L3.22118 8.68244C3.13982 8.60108 3.13982 8.46917 3.22118 8.38781L6.6094 4.99959Z"></path>
-                        </svg>
-                    </a>
-                </div> -->
             </div>
         </div>
     </div>
@@ -61,6 +48,26 @@ export default {
     name: 'AppSidebar',
     data() {
         return {
+            hotGoodsList:[
+                {
+                    id:1,
+                    path:'/home/pointsMall/redeem?id=20&name=goodsNotice&type=8',
+                    url:'https://xiaoyou.dgtis.com/images/image/2023/05/16/8nfqz3mxe754qtcnxdia.png',
+                    name:'爱奇艺会员年卡',
+                },
+                {
+                    id:2,
+                    path:'/home/pointsMall/redeem?id=19&name=goodsNotice&type=8',
+                    url:'https://xiaoyou.dgtis.com/images/image/2023/07/27/vcsqrnhcgzsr5yqpdolj.jpg',
+                    name:'优酷会员年卡',
+                },
+                {
+                    id:3,
+                    path:'/home/pointsMall/redeem?id=18&name=goodsNotice&type=8',
+                    url:'https://xiaoyou.dgtis.com/images/image/2023/07/05/pjwrhbotzayyny9vk1be.jpg',
+                    name:'百度网盘年度会员',
+                },
+            ],
             sideBarList: [
                 {
                     value: 'index',
@@ -330,59 +337,49 @@ ul {
 li {
     list-style: none;
 }
-.hot-list-item .hot-item-body .hot-item .hot-item-text-authors, .hot-list-item .hot-item-body .hot-item .hot-item-text-authors .title-authors {
+.hot-list-item .hot-item-body .hot-item .body-index{
+    font-weight: 800;
+    min-width: 18px;
+    line-height: 22px;
+    margin: 0 .2rem 0 0;
+    color: #8a919f;
+    text-align: left;
+}
+.hot-list-item .hot-item-body .hot-item .first-index{
+    background: linear-gradient(180deg, #f64242 20%, rgba(246, 66, 66, .4) 80%);
+    -webkit-background-clip: text;
+    background-clip: text;
+    color: transparent;
+}
+.hot-list-item .hot-item-body .hot-item .second-index{
+    background: linear-gradient(180deg, #ff7426 20%, rgba(255, 116, 38, .4) 80%);
+    -webkit-background-clip: text;
+    background-clip: text;
+    color: transparent;
+}
+.hot-list-item .hot-item-body .hot-item .third-index{
+    background: linear-gradient(180deg, #ffac0c 20%, rgba(255, 172, 12, .4) 80%);
+    -webkit-background-clip: text;
+    background-clip: text;
+    color: transparent;
+}
+.hot-list-item .hot-item-body .hot-item .hot-item-text{
     display: flex;
-    flex-direction: row;
-    justify-content: space-between;
-    width: 100%;
-}
-.hot-list-item .hot-item-body .hot-item .hot-item-text-authors{
-    height: 100%;
     align-items: center;
-}
-.hot-list-item .hot-item-body .hot-item .hot-item-text {
-    color: var(--juejin-font-1);
+    color: #252933;
     text-overflow: ellipsis;
     white-space: nowrap;
     overflow: hidden;
     flex: 1;
 }
-a {
-    background-color: transparent;
-    margin: initial;
-    text-decoration: none;
-    cursor: pointer;
-}
-.hot-list-item .hot-item-body .hot-item .hot-item-text .hot-item-img {
-    width: 40px;
-    height: 40px;
-    /* border-radius: 50%; */
-    margin-right: 8px;
-    line-height: 0;
-}
-img {
-    border-style: none;
-}
-.hot-list-item .hot-item-body .hot-item .hot-item-text-authors .title-authors .info {
-    display: flex;
-    flex-direction: column;
-    justify-content: space-between;
-    max-width: 100px;
-}
-.hot-list-item .hot-item-body .hot-item .hot-item-text-authors .title-authors .info .title {
-    font-size: 14px;
+.hot-list-item .hot-item-body .hot-item .title-articles{
+    font-size: 0.9rem;
+    margin-left: 5px;
     color: #252933;
-    white-space: nowrap;
-    overflow: hidden;
+    display: inline-block;
+    width: 100%;
     text-overflow: ellipsis;
-    word-break: break-all;
-}
-.hot-list-item .hot-item-body .hot-item .hot-item-text-authors .title-authors .info .description {
-    font-size: 14px;
-    /* color: #515767 !important; */
     white-space: nowrap;
     overflow: hidden;
-    text-overflow: ellipsis;
-    word-break: break-all;
 }
 </style>

+ 83 - 37
src/components/SiderInfo.vue

@@ -31,18 +31,19 @@
                 </div>
             </div>
         </div>
-        <div class="sidebar-block banner-block">
+        <div class="sidebar-block banner-block" v-for="(item,index) in activitykist" :key="index">
             <div class="banner banner">
-                <a href="/home/festiveEvents">
-                    <img src="https://xiaoyou.dgtis.com/images/image/2024/08/23/xd5idemwj5itooa9t2ee.jpg" width="240" height="200" class="banner-image">
-                </a> 
-                <!-- <div class="ctrl-box">
-                    <a class="label" href="/">
-                        <span class="inco">投放</span> 
-                        <span>广告</span>
-                    </a>
-                </div> -->
-            </div>
+                    <img :src="item.img" width="240" height="200" class="banner-image">
+                    <div class="ctrl-box">
+                        <div class="label">
+                            <span>{{ item.name }}</span>
+                        </div>
+                        <div class="status" @click="goFestiveEvents(item.status)">
+                            <span v-if="item.status==0" style="color: #1e80ff;">{{ item.statusName }}</span>
+                            <span v-else>{{ item.statusName }}</span>
+                        </div>
+                    </div>
+                </div>
         </div>
         <div class="sticky-block">
             <div class="sidebar-block signin-tip">
@@ -61,20 +62,21 @@
                 </div>
             </div>
         </div>
-            <div class="sidebar-block banner-block">
-            <div class="banner banner">
-                <a href="/home/festiveEvents">
-                    <img src="https://xiaoyou.dgtis.com/images/image/2024/08/23/xd5idemwj5itooa9t2ee.jpg" width="240" height="200" class="banner-image">
-                </a> 
-                <!-- <div class="ctrl-box">
-                    <a class="label" href="/">
-                        <span class="inco">投放</span> 
-                        <span>广告</span>
-                    </a>
-                </div> -->
+            <div class="sidebar-block banner-block" v-for="(item,index) in activitykist" :key="index">
+                <div class="banner banner">
+                    <img :src="item.img" width="240" height="200" class="banner-image">
+                    <div class="ctrl-box">
+                        <div class="label">
+                            <span>{{ item.name }}</span>
+                        </div>
+                        <div class="status" @click="goFestiveEvents(item.status)">
+                            <span v-if="item.status==0" style="color: #1e80ff;">{{ item.statusName }}</span>
+                            <span v-else>{{ item.statusName }}</span>
+                        </div>
+                    </div>
+                </div>
             </div>
         </div>
-        </div>
     </div>
 </template>
 <script>
@@ -82,6 +84,26 @@ import { mapGetters } from 'vuex'
 export default {
     data() {
         return {
+            activitykist:[
+                {
+                    status:0,
+                    statusName:'未参加',
+                    name:'每日签到',
+                    img:'https://xiaoyou.dgtis.com/images/image/2024/08/23/xd5idemwj5itooa9t2ee.jpg'
+                },
+                {
+                    status:1,
+                    statusName:'已参加',
+                    name:'每周竞技',
+                    img:'https://xiaoyou.dgtis.com/images/image/2024/08/23/xd5idemwj5itooa9t2ee.jpg'
+                },
+                {
+                    status:2,
+                    statusName:'未开启',
+                    name:'每月抽奖',
+                    img:'https://xiaoyou.dgtis.com/images/image/2024/08/23/xd5idemwj5itooa9t2ee.jpg'
+                }
+            ],
             hoursTip:'你好!',
             isActive: false,
         };
@@ -94,6 +116,13 @@ export default {
         this.getHoursTip()
     },
     methods: {
+        goFestiveEvents(val){
+            if(val==0){
+                this.$router.push({
+                    path: '/home/festiveEvents',
+                });
+            }
+        },
         goToSignIn(){
             this.$router.push({
                 path: '/home/signIn',
@@ -113,7 +142,7 @@ export default {
      // 保存滚动值,这是兼容的写法
      handleScroll() {
         var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
-        if (scrollTop >= 550) {
+        if (scrollTop >= 950) {
             this.isActive = true
         } else {
             this.isActive = false
@@ -326,23 +355,40 @@ a {
 }
 .banner .ctrl-box .label{
     position: absolute;
-    right: 10px;
-    bottom: 10px;
-    line-height: 36px;
-    height: 36px;
-    font-size: 20px;
+    left: 20px;
+    top: 20px;
+    line-height: 32px;
+    height: 32px;
+    width: 100px;
+    text-align: center;
+    font-size: 16px;
     z-index: 1;
-    transform: scale(.5);
-    transform-origin: right bottom;
-    color: #fff;
-    background-color: rgba(0, 0, 0, .2);
+    color: black;
+    background-color: #fff;
     border: 1px solid #fff;
     border-radius: 6px;
-    padding-left: 15px;
-    padding-right: 15px;
-    font-weight: 300;
+    font-weight: 500;
 }
-.banner .ctrl-box .label[data-v-f3038604]:hover {
+.banner .ctrl-box .status{
+    position: absolute;
+    left: 20px;
+    top: 70px;
+    line-height: 32px;
+    height: 32px;
+    width: 100px;
+    text-align: center;
+    font-size: 16px;
+    z-index: 1;
+    color: black;
+    background-color: #fff;
+    border: 1px solid #fff;
+    border-radius: 6px;
+    font-weight: 500;
+}
+/* .banner .ctrl-box .label:hover {
     background-color: rgba(0, 0, 0, .4);
 }
+.banner .ctrl-box .status:hover {
+    background-color: rgba(0, 0, 0, .4);
+} */
 </style>

+ 113 - 10
src/views/HomeView/Index.vue

@@ -2,15 +2,45 @@
     <div class="timeline-container">
         <div class="timeline-content">
             <div class="timeline-entry-list">
-                <img src="@/assets/image/banner4.png" alt="banner" class="banner">
-                <!-- <div class="hot-list-wrap">
+                <!-- <img src="@/assets/image/banner4.png" alt="banner" class="banner"> -->
+                <div class="hot-list-wrap">
+                    <el-empty :image-size="120" v-if="bannerList.length < 1"></el-empty>
+                    <el-carousel indicator-position="none" height="120px" :interval="5000" v-if="bannerList.length > 0">
+                        <el-carousel-item v-for="(item, index) in bannerList" :key="index">
+                            <router-link :to="item.remark">
+                                <img style="width: 100%; height: 100%" :src="item.dictValue" class="banner" />
+                            </router-link>
+                        </el-carousel-item>
+                    </el-carousel>
+                </div>
+                <div class="hot-list-wrap">
                     <el-empty :image-size="200" v-if="bannerList.length < 1"></el-empty>
-                    <el-carousel arrow="never" indicator-position="none" height="120px" :interval="5000" v-if="bannerList.length > 0">
+                    <el-carousel indicator-position="none" height="120px" :interval="5000" v-if="bannerList.length > 0">
                         <el-carousel-item v-for="(item, index) in bannerList" :key="index">
-                                <img style="width: 100%; height: 100%" :src="item.url" class="banner" />
+                            <router-link :to="item.remark">
+                                <img style="width: 100%; height: 100%" :src="item.dictValue" class="banner" />
+                            </router-link>
                         </el-carousel-item>
                     </el-carousel>
-                </div> -->
+                </div>
+                <div class="entry-list-container" style="margin-bottom: 20px;">
+                    <div class="tab-header" style="border-bottom:none">
+                        <span class="tab-title">特价商品</span>
+                    </div>
+                    <div class="special-goods-list">
+                        <div class="special-goods-item" v-for="(item,index) in specialGoodsList" :key="index">
+                            <img width="100%" :src="item.url" alt="">
+                            <div class="ctrl-box">
+                                <a class="label" :href="item.path">
+                                    <span>{{ item.name }}</span>
+                                </a>
+                                <!-- <a class="status" href="/">
+                                    <span>已参与</span>
+                                </a> -->
+                            </div>
+                        </div>
+                    </div>
+                </div>
                 <div class="entry-list-container">
                     <div class="tab-header">
                         <span class="tab-title">最新通知</span>
@@ -45,7 +75,7 @@
     </div>
 </template>
 <script scoped>
-import { msgList } from "@/api/allApi";
+import { msgList,dictList } from "@/api/allApi";
 import SiderInfo from '@/components/SiderInfo.vue';
 import { debounce } from '@/utils/index';
 export default{
@@ -55,10 +85,26 @@ export default{
   data() {
     return {
         dataInfo:'',
-        bannerList: [
-            {
-                url: require('@/assets/image/banner4.png')
-            },
+        bannerList: [],
+        specialGoodsList:[
+        {
+                    id:1,
+                    path:'/home/pointsMall/redeem?id=20&name=goodsNotice&type=8',
+                    url:'https://xiaoyou.dgtis.com/images/image/2023/07/05/pjwrhbotzayyny9vk1be.jpg',
+                    name:'特价商品',
+                },
+                {
+                    id:2,
+                    path:'/home/pointsMall/redeem?id=19&name=goodsNotice&type=8',
+                    url:'https://xiaoyou.dgtis.com/images/image/2023/07/05/pjwrhbotzayyny9vk1be.jpg',
+                    name:'限时商品',
+                },
+                {
+                    id:3,
+                    path:'/home/pointsMall/redeem?id=18&name=goodsNotice&type=8',
+                    url:'https://xiaoyou.dgtis.com/images/image/2023/07/05/pjwrhbotzayyny9vk1be.jpg',
+                    name:'团购商品',
+                },
         ],
         dataList:[],
         page:1,
@@ -67,8 +113,14 @@ export default{
   },
  created(){
     this.getDataList();
+    this.getBannerList();
   },
   methods:{
+    getBannerList(){
+            dictList({dictType:'index_lbt'}).then(response=>{
+                this.bannerList = response.data.data; 
+            })
+        },
     handleClickMag(id) {
         this.$router.push({
             path: '/home/index/msgDetail',
@@ -244,4 +296,55 @@ export default{
     margin-left: 24px;
     border-radius: 2px;
 }
+.special-goods-list{
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+}
+.special-goods-list .special-goods-item{
+    position: relative;
+    /* padding: 0 6px; */
+    width: 230px;
+    height: 169px;
+    min-width: 0;
+}
+.special-goods-item .ctrl-box .label{
+    position: absolute;
+    left: 20px;
+    top: 40px;
+    line-height: 32px;
+    height: 32px;
+    width: 100px;
+    text-align: center;
+    font-size: 16px;
+    z-index: 1;
+    color: black;
+    background-color: #fff;
+    border: 1px solid #fff;
+    /* border-radius: 6px; */
+    font-weight: 800;
+    
+}
+.special-goods-item .ctrl-box .status{
+    position: absolute;
+    left: 20px;
+    top: 70px;
+    line-height: 32px;
+    height: 32px;
+    width: 100px;
+    text-align: center;
+    font-size: 16px;
+    z-index: 1;
+    color: #fff;
+    background-color: rgba(0, 0, 0, .2);
+    border: 1px solid #fff;
+    border-radius: 6px;
+    font-weight: 300;
+}
+/* .special-goods-item .ctrl-box .label:hover {
+    background-color: rgba(0, 0, 0, .4);
+}
+.special-goods-item .ctrl-box .status:hover {
+    background-color: rgba(0, 0, 0, .4);
+} */
 </style>