|
|
@@ -12,7 +12,7 @@
|
|
|
</nav>
|
|
|
<div class="hot-list-container">
|
|
|
<div class="hot-list-item">
|
|
|
- <div class="hot-item-header">
|
|
|
+ <!-- <div class="hot-item-header">
|
|
|
<div class="hot-title">
|
|
|
<img src="../assets/image/hot.png"
|
|
|
type="icon" alt="icon" class="hot-icon">
|
|
|
@@ -21,18 +21,61 @@
|
|
|
</div>
|
|
|
<div class="divider" style="margin-bottom: 4px;">
|
|
|
<div class="content"></div>
|
|
|
+ </div> -->
|
|
|
+ <el-radio-group v-model="tabType" size="small" @change="tabChange">
|
|
|
+ <el-radio-button label="hot">热门商品</el-radio-button>
|
|
|
+ <el-radio-button label="new">商城新品</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
+ <ul class="hot-item-body">
|
|
|
+ <div class="skeleton">
|
|
|
+ <li v-for="(item,index) in goodsList" :key="index" class="hot-item">
|
|
|
+ <a href="/home/pointsMall">
|
|
|
+ <img style="width: 150px;height: 150px;" :src="item.imgUrl" alt="">
|
|
|
+ </a>
|
|
|
+
|
|
|
+ <div class="hot-item-text" :class="tabType=='new'?'justifyCenter':'justifyBetween'">
|
|
|
+ <div class="body-index" v-if="tabType=='hot'">
|
|
|
+ {{ index + 1 }}
|
|
|
+ </div>
|
|
|
+ <div class="title-articles">
|
|
|
+ ¥{{ item.price }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ </div>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="hot-list-container sticky-block">
|
|
|
+ <div class="hot-list-item">
|
|
|
+ <!-- <div class="hot-item-header">
|
|
|
+ <div class="hot-title">
|
|
|
+ <img src="../assets/image/hot.png"
|
|
|
+ type="icon" alt="icon" class="hot-icon">
|
|
|
+ <span title="热门商品" class="title-text">热门商品</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ <div class="divider" style="margin-bottom: 4px;">
|
|
|
+ <div class="content"></div>
|
|
|
+ </div> -->
|
|
|
+ <el-radio-group v-model="tabType" size="small" @change="tabChange">
|
|
|
+ <el-radio-button label="hot">热门商品</el-radio-button>
|
|
|
+ <el-radio-button label="new">商城新品</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
<ul class="hot-item-body">
|
|
|
<div class="skeleton">
|
|
|
- <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>
|
|
|
+ <li v-for="(item,index) in goodsList" :key="index" class="hot-item">
|
|
|
+ <a href="/home/pointsMall">
|
|
|
+ <img style="width: 150px;height: 150px;" :src="item.imgUrl" alt="">
|
|
|
+ </a>
|
|
|
+
|
|
|
+ <div class="hot-item-text" :class="tabType=='new'?'justifyCenter':'justifyBetween'">
|
|
|
+ <div class="body-index" v-if="tabType=='hot'">
|
|
|
+ {{ index + 1 }}
|
|
|
+ </div>
|
|
|
+ <div class="title-articles">
|
|
|
+ ¥{{ item.price }}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</li>
|
|
|
</div>
|
|
|
@@ -44,30 +87,13 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { removeTab } from '@/utils/auth'
|
|
|
+import { hotSkuList,newSkuList } from "@/api/allApi";
|
|
|
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:'百度网盘年度会员',
|
|
|
- },
|
|
|
- ],
|
|
|
+ tabType:'hot',
|
|
|
+ goodsList:[],
|
|
|
sideBarList: [
|
|
|
{
|
|
|
value: 'index',
|
|
|
@@ -149,6 +175,20 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ tabChange(val){
|
|
|
+ this.getGoodsInfo(val);
|
|
|
+ },
|
|
|
+ getGoodsInfo(val){
|
|
|
+ if(val=='hot'){
|
|
|
+ hotSkuList().then(response=>{
|
|
|
+ this.goodsList = response.data.data.list;
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ newSkuList().then(response=>{
|
|
|
+ this.goodsList = response.data.data.list;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
removeTab() {
|
|
|
removeTab();
|
|
|
},
|
|
|
@@ -165,7 +205,7 @@ export default {
|
|
|
// 保存滚动值,这是兼容的写法
|
|
|
handleScroll() {
|
|
|
var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
|
|
|
- if (scrollTop >= 80) {
|
|
|
+ if (scrollTop >= 1200) {
|
|
|
this.isActive = true
|
|
|
} else {
|
|
|
this.isActive = false
|
|
|
@@ -177,6 +217,7 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.getRoute();
|
|
|
+ this.getGoodsInfo('hot');
|
|
|
},
|
|
|
mounted() {
|
|
|
window.addEventListener('scroll', this.handleScroll)
|
|
|
@@ -191,9 +232,9 @@ export default {
|
|
|
<style scoped>
|
|
|
.index-nav {
|
|
|
width: 180px;
|
|
|
- position: -webkit-sticky;
|
|
|
+ /* position: -webkit-sticky;
|
|
|
position: sticky;
|
|
|
- top: 80px;
|
|
|
+ top: 80px; */
|
|
|
margin-right: 20px;
|
|
|
height: -webkit-fit-content;
|
|
|
height: -moz-fit-content;
|
|
|
@@ -203,7 +244,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
.index-nav-top {
|
|
|
- top: 20px;
|
|
|
+ /* top: 20px; */
|
|
|
/* max-height: calc(100vh - 40px); */
|
|
|
}
|
|
|
|
|
|
@@ -327,7 +368,7 @@ ul {
|
|
|
}
|
|
|
.hot-list-item .hot-item-body .hot-item {
|
|
|
display: flex;
|
|
|
- flex-direction: row;
|
|
|
+ flex-direction: column;
|
|
|
align-items: center;
|
|
|
padding: 8px;
|
|
|
border-radius: 4px;
|
|
|
@@ -338,12 +379,15 @@ li {
|
|
|
list-style: none;
|
|
|
}
|
|
|
.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;
|
|
|
+ width: 18px;
|
|
|
+ height: 18px;
|
|
|
+ font-size: 16px;
|
|
|
+ border-radius: 50%;
|
|
|
+ background-color: #f64242;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ color: #fff;
|
|
|
}
|
|
|
.hot-list-item .hot-item-body .hot-item .first-index{
|
|
|
background: linear-gradient(180deg, #f64242 20%, rgba(246, 66, 66, .4) 80%);
|
|
|
@@ -363,23 +407,49 @@ li {
|
|
|
background-clip: text;
|
|
|
color: transparent;
|
|
|
}
|
|
|
+.justifyCenter{
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+.justifyBetween{
|
|
|
+ justify-content: space-between;
|
|
|
+}
|
|
|
.hot-list-item .hot-item-body .hot-item .hot-item-text{
|
|
|
+ width: 160px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- color: #252933;
|
|
|
- text-overflow: ellipsis;
|
|
|
- white-space: nowrap;
|
|
|
- overflow: hidden;
|
|
|
- flex: 1;
|
|
|
}
|
|
|
.hot-list-item .hot-item-body .hot-item .title-articles{
|
|
|
- font-size: 0.9rem;
|
|
|
- margin-left: 5px;
|
|
|
- color: #252933;
|
|
|
- display: inline-block;
|
|
|
- width: 100%;
|
|
|
- text-overflow: ellipsis;
|
|
|
- white-space: nowrap;
|
|
|
- overflow: hidden;
|
|
|
+ font-size: 16px;
|
|
|
+ color: red;
|
|
|
+ font-weight: bold;
|
|
|
+}
|
|
|
+::v-deep .el-radio-button__orig-radio:checked+.el-radio-button__inner {
|
|
|
+
|
|
|
+ background-color: red;
|
|
|
+ border-color: red;
|
|
|
+ box-shadow: -1px 0 0 0 red;
|
|
|
+}
|
|
|
+::v-deep .el-radio-button__inner:hover {
|
|
|
+ color: #606266;
|
|
|
+}
|
|
|
+
|
|
|
+.sticky-block {
|
|
|
+ width: 180px;
|
|
|
+ background-color: transparent;
|
|
|
+ box-sizing: border-box;
|
|
|
+ position: fixed;
|
|
|
+ box-shadow: none;
|
|
|
+ opacity: 0;
|
|
|
+ transition: all .2s;
|
|
|
+ z-index: -1;
|
|
|
+ top: 67px;
|
|
|
+ pointer-events: none;
|
|
|
+}
|
|
|
+
|
|
|
+.index-nav.index-nav-top .sticky-block {
|
|
|
+ opacity: 1;
|
|
|
+ top: 20px;
|
|
|
+ z-index: 5;
|
|
|
+ pointer-events: all;
|
|
|
}
|
|
|
</style>
|