dengjie commit :首页和详情页样式初步完成

This commit is contained in:
clay
2022-12-16 01:07:48 +08:00
parent faab99a8ce
commit 9223a1023e
68 changed files with 2866 additions and 7 deletions

View File

@@ -1,33 +1,192 @@
<!-- 首页 -->
<template>
<view>
<view class="input_block">
<view class="input_block_border">
<!-- 搜索框 -->
<view class="search_box">
<view class="search_box_border">
<u-input placeholder="搜索优质产品" placeholder-style="color: #969696" prefixIcon="search"
prefixIconStyle="font-size: 22px;color: #909399;margin-left:30rpx">
</u-input>
</view>
</view>
<view class="content">
<!-- 分类模块 -->
<view class="classify">
<u-grid :border="false" col="5">
<u-grid-item v-for="(listItem,listIndex) in classifyList" :key="listIndex"
@click="click(listIndex)">
<!-- 懒加载 :lazy-load="true" -->
<u--image :src="listItem.src" width="86rpx" height="86rpx" :lazy-load="true">
</u--image>
<text class="grid-text">{{listItem.title}}</text>
</u-grid-item>
</u-grid>
<u-toast ref="uToast" />
</view>
<!-- 分类模块下的轮播图 -->
<view>
<u-swiper :list="swiperList" indicatorMode="line" radius="0" circular></u-swiper>
</view>
<!-- 选项卡: 上架时间和点赞量 -->
<view>
<u-tabs :list="tabList" lineColor="#15CA65" :is-scroll="false"
activeStyle="color:#15CA65;font-weight: bold;">
</u-tabs>
</view>
<!-- 产品 -->
<view class="products_box">
<u-grid :border="false" col="2">
<u-grid-item v-for="(item,index) in productList" :key="index">
<u-image src="/static/products/sy_bb.png" width="354rpx" height="539rpx" :lazy-load="true">
</u-image>
<view class="bgContent">
<view>
<u-image :src="item.src" width="346rpx" height="320rpx" :lazy-load="true"
@click="toDetailPage()">
</u-image>
<view class="img_tag">{{item.img_tag}}</view>
</view>
<view style="padding: 16rpx;">
<view class="title_box">
<text class="title">{{item.title}}</text>
<u-tag :text="item.tag" type="warning" shape="circle"></u-tag>
</view>
<view class="product_desc">
{{item.desc}}
</view>
<view class="releaseDate">
<u-image src="/static/products/sy_icon_sjf.png" width="22rpx" height="22rpx"
:lazy-load="true">
</u-image>
<text class="release">发布日期</text>
<text>{{item.time}}</text>
</view>
</view>
</view>
</u-grid-item>
</u-grid>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
classifyList: [{
src: '/static/classify/sy_icon_hp.png',
title: '烘培宝典'
},
{
src: '/static/classify/sy_icon_ls.png',
title: '零食铺子'
},
{
src: '/static/classify/sy_icon_yp.png',
title: '饮品大全'
},
{
src: '/static/classify/sy_icon_tw.png',
title: '调味菜单'
},
{
src: '/static/classify/sy_icon_rs.png',
title: '肉食荟萃'
},
{
src: '/static/classify/sy_icon_np.png',
title: '乳品手册'
},
{
src: '/static/classify/sy_icon_gs.png',
title: '果蔬地图'
},
{
src: '/static/classify/sy_icon_sj.png',
title: '食界新贵'
},
{
src: '/static/classify/sy_icon_hz.png',
title: '欢喜盒子'
},
{
src: '/static/classify/sy_icon_cy.png',
title: '创意工具'
},
],
tabList: [{
name: '上架时间'
},
{
name: '点赞量'
},
],
swiperList: [
'/static/products/sy_bg.png',
'https://cdn.uviewui.com/uview/swiper/swiper3.png'
],
productList: [{
src: '/static/products/zhanwei_dg.png',
title: '锅巴',
tag: '无添加剂',
img_tag: '零食铺子',
desc: '糯米蟹黄锅巴散装,非油炸绿色健康食品',
time: '2022-12-04'
},
{
src: '/static/products/zhanwei_dg(2).png',
title: '干吃汤圆',
tag: '天然原料',
img_tag: '糕点卷酥',
desc: '休闲食品厂家甜品糯米食品零食闽南特产宵夜好吃糍粑',
time: '2022-12-04'
},
{
src: '/static/products/zhanwei_dg(1).png',
title: '紫薯魔芋人参魔芋人参魔芋人参…',
tag: '天然原料',
img_tag: '健康创新',
desc: '紫薯魔芋人参代餐粉 冲调饮品贴牌加工 五谷杂粮粉代餐',
time: '2022-12-04'
},
{
src: '/static/products/zhanwei_dg(3).png',
title: '焦糖饼干',
tag: '无防腐剂',
img_tag: '饼干曲奇',
desc: '比利时风味焦糖饼干代餐小吃零食品',
time: '2022-12-04'
}
]
}
},
onPullDownRefresh() {
//关闭下拉刷新
uni.stopPullDownRefresh()
},
methods: {
//点击一级分类
click(listIndex) {
this.$refs.uToast.success(`点击了第${listIndex}`)
},
//点击图片跳转到详情页
toDetailPage() {
uni.navigateTo({
url: '/pages/detail/detail'
})
}
}
}
</script>
<style lang="scss">
.input_block {
// 搜索框样式
.search_box {
background: linear-gradient(135deg, #12CA64 0%, #1ACA67 100%);
.input_block_border {
.search_box_border {
width: 94.6%;
height: 124rpx;
background: linear-gradient(320deg, #36E182 0%, #26DD76 100%, #26DD76 100%);
@@ -43,8 +202,152 @@
height: 64rpx;
border-radius: 32rpx;
background-color: #fff;
.u-input__content__field-wrapper__field {
font-size: 26rpx !important;
}
}
}
}
}
.content {
//分类模块
.classify {
height: 350rpx;
background: #FFFFFF;
border-radius: 24rpx;
.u-grid {
padding-top: 30rpx;
.grid-text {
padding-top: 8rpx;
font-size: 24rpx;
}
.u-grid-item {
padding-bottom: 38rpx;
}
}
}
//轮播图
.u-swiper__wrapper__item__wrapper {
margin-top: 20rpx;
height: 290rpx;
}
.u-swiper-indicator__wrapper {
display: none !important;
}
// 选项卡
.u-tabs__wrapper__nav {
background-color: #FFFFFF;
.u-tabs__wrapper__nav__item {
padding: 0 !important;
flex: 1;
}
}
.products_box {
padding: 18rpx;
.u-grid-item {
.bgContent {
position: absolute;
right: 0;
top: 0;
.u-image__image {
margin-left: 3px;
}
.img_tag {
position: absolute;
padding: 2rpx 8rpx;
right: 5px;
top: 30rpx;
border-radius: 54rpx 0px 0px 54rpx;
box-shadow: 0px 2rpx 4rpx 0px #078C42;
background: linear-gradient(135deg, #0DB658 0%, #16DD6D 100%);
font-size: 20rpx;
color: #FFFFFF;
line-height: 28rpx;
}
.title_box {
position: relative;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
.title {
width: 186rpx;
font-size: 26rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: bold;
color: #0EBB5B;
line-height: 37rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.u-tag {
height: 26rpx;
line-height: 26rpx;
background: linear-gradient(124deg, #FEAA19 0%, #FDCF3A 100%);
.u-tag__text {
font-size: 20rpx;
}
}
}
.product_desc {
font-size: 22rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #3E3E3E;
line-height: 26rpx;
margin-top: 24rpx;
margin-bottom: 20rpx;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
.releaseDate {
font-size: 22rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #A3A3A3;
line-height: 26rpx;
display: flex;
align-items: center;
padding-bottom: 25rpx;
image {
margin-left: 0;
}
.release {
padding: 0 10rpx 0 5rpx;
}
}
}
}
}
}
</style>