Files
ClassContent/历届学生/逯帅帅/项目开发/上课项目/医点医滴/components/homeTabs.vue
2024-09-27 02:06:13 +08:00

183 lines
3.9 KiB
Vue

<template>
<view class="alarmList">
<view class="switchHead">
<view v-for="(item,index) in tabTitleData" class="boxList" :class="{activeCss:activeIndex==index}" :key="index">
<text @click="clickTab(index)">{{item.name}}</text>
</view>
</view>
<view class="content">
<view v-if="current === 0">
<ul>
<view class="scroll">
<view class="box" v-for="(i,j) in 6" :key="j" @click="togo(j)">
<img src="/static/home/renzheng.jpg" alt="">
<view class="info">
<p class="ling">零</p>
<p class="jieshao">安神补脑液安神补脑液安神补脑液</p>
</view>
<p class="gs">吉林药业股份有限公司吉林药业股份有限公司</p>
<p class="zhi">10ml*10支</p>
<p class="jiage">¥16.99</p>
</view>
</view>
</ul>
</view>
<view v-else>
<ul>
<view class="scroll">
<view class="box" v-for="(i,j) in 6" :key="j" @click="togo(j)" >
<img src="/static/home/renzheng.jpg" alt="">
<view class="info">
<p class="ling">零</p>
<p class="jieshao">安神补脑液安神补脑液安神补脑液</p>
</view>
<p class="gs">吉林药业股份有限公司吉林药业股份有限公司</p>
<p class="zhi">10ml*10支</p>
<p class="jiage">¥16.99</p>
</view>
</view>
</ul>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
current:0,
index:0,
activeIndex:'0',
tabTitleData:[
{
name:'为您推荐'
},
{
name:'走量订购'
}
]
}
},
created(){
this.getAct()
console.log(111)
},
methods: {
clickTab(index){
this.activeIndex=index;
this.current=index;
},
async getAct(){
let res = await this.$http.index.getActivity({});
console.log(res)
},
togo(j) {
// console.log(this.hot[j].keyword);
uni.navigateTo({
//加上id
url: `/pages/index/search`,
});
},
}
}
</script>
<style scoped lang="less">
.alarmList {
margin-top: 12px;
height: 100%;
.switchHead {
line-height: 29px;
display: flex;
justify-content: space-around;
font-size: 16px;
font-weight: bold;
.activeCss {
border-bottom: 2px solid #018EEA;
color: #018EEA;
}
}
}
.scroll {
display: flex;
flex-flow: row;
flex-wrap: wrap;
}
.box {
margin-top: 30rpx;
margin-left: 8px;
box-sizing: border-box;
width: 173px;
height: 438rpx;
background-color: #fff;
border-radius: 20rpx;
img{
padding-right: 20rpx;
margin: 30rpx auto;
display: block;
width: 280rpx;
height: 174rpx;
}
.info{
display: flex;
align-items: center;
font-size: 20rpx;
width: 95%;
.ling{
width: 30rpx;
height: 30rpx;
text-align: center;
line-height: 30rpx;
border-radius: 6rpx;
margin-right: 16rpx;
color: #fff;
background: linear-gradient(top ,#86fead,#3ad423);
}
.hot{
width: 30rpx;
height: 30rpx;
text-align: center;
line-height: 30rpx;
color: #fff;
border-radius: 6rpx;
background: linear-gradient(top ,#db577c,#d71c5e);
}
.jieshao{
margin-left: 4rpx;
font-weight: 800;
line-height: 36rpx;
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.gs{
margin-top: 10rpx;
font-size: 20rpx;
width: 95.5%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.zhi{
margin-top: 15rpx;
font-size: 20rpx;
}
.jiage{
margin-top: 20rpx;
font-size: 30rpx;
font-weight: 800;
color: red;
}
}
.box:last-child{
margin-right: 0;
}
</style>