You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

328 lines
6.4 KiB

<template>
1 year ago
<view :class="[{oh: !per}]">
1 year ago
<view class="banner">
<image class="pic" src="@/static/image/index/banner.png" mode="widthFix"></image>
<image class="bg1" src="@/static/image/index/banner1.png"></image>
<view class="texts">
<view class="title">
<image class="logo" src="@/static/image/logo1.png" mode="widthFix"></image>
职站商城
</view>
<view class="text">您的一站式实验教学产品采购平台</view>
</view>
<view class="rect"></view>
</view>
1 year ago
<view class="page">
<view class="search-wrap">
<uni-search-bar class="search" radius="30" placeholder="请输入" v-model="keyword" clearButton="auto" cancelButton="none" @confirm="toLogin" />
1 year ago
<view>
<button class="all" type="primary" @click.stop="toLogin">全部产品</button>
1 year ago
</view>
</view>
1 year ago
<view class="block" style="margin-top: 0">
<view class="title-wrap">
<view class="title">热门标签</view>
</view>
<ul class="tags">
<li v-for="(tag, i) in tags" :key="i" @click="toLogin">
1 year ago
<view class="icon">
<image :src="require('@/static/image/index/' + (i + 1) + '.png')"></image>
</view>
1 year ago
<view class="text ell">{{ tag.tagsName }}</view>
</li>
</ul>
3 years ago
</view>
1 year ago
<view class="block">
<view class="title-wrap">
<view class="title">热销产品</view>
</view>
<view class="list">
<view v-for="(item, i) in hotProducts" :key="i" class="item" @click="toLogin">
1 year ago
<image class="pic" :src="$util.getIcon(item)"></image>
<view class="texts">
<view class="name ell">{{ item.productName }}</view>
1 year ago
<view class="des ell">{{ item.tagsName }}</view>
1 year ago
<view class="meta">{{ item.marketUnitPrice }}/</view>
</view>
3 years ago
</view>
</view>
</view>
1 year ago
<view class="block" style="margin-top: 40rpx">
<view class="title-wrap">
<view class="title">官方推荐</view>
</view>
<view class="list">
<view v-for="(item, i) in offcialProducts" :key="i" class="item" @click="toLogin">
1 year ago
<image class="pic" :src="$util.getIcon(item)"></image>
<view class="texts">
<view class="name ell">{{ item.productName }}</view>
1 year ago
<view class="des ell">{{ item.tagsName }}</view>
1 year ago
<view class="meta">{{ item.marketUnitPrice }}/</view>
</view>
3 years ago
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { tagsList, listOfGoods } from '@/apis/modules/product.js'
export default {
data() {
return {
list: [],
keyword: '',
tags: [],
hotProducts: [],
offcialProducts: [],
1 year ago
total: 0,
}
},
onShow() {
6 months ago
if (uni.getStorageSync('token')) {
uni.reLaunch({
url: '../home/home'
})
6 months ago
}
this.keyword = ''
this.getTags()
this.getProducts()
},
methods: {
// 热门标签
getTags() {
tagsList().then(res => {
this.tags = res.tagsList.slice(0, 8)
}).catch(e => {})
},
// 产品
getProducts() {
// 热销产品
listOfGoods({
pageNum: 1,
pageSize: 5,
sort: 1,
isShelves: 0,
hotTag: 1
}).then(({ page }) => {
1 year ago
page.records.forEach(e => {
e.productIntroduction = this.$util.removeTag(e.productIntroduction)
})
this.hotProducts = page.records
}).catch(e => {})
// 官方推荐
listOfGoods({
2 years ago
pageNum: 1,
pageSize: 5,
sort: 0,
isShelves: 0,
hotTag: 1,
selection: 1
2 years ago
}).then(({ page }) => {
1 year ago
page.records.forEach(e => {
e.productIntroduction = this.$util.removeTag(e.productIntroduction)
})
this.offcialProducts = page.records
2 years ago
}).catch(e => {})
},
// 前往登录界面
toLogin() {
uni.redirectTo({
url: '../login/login'
})
3 years ago
},
}
}
</script>
<style scoped lang="scss">
.page {
3 years ago
position: relative;
1 year ago
padding: 10rpx 22rpx;
1 year ago
margin-top: -61rpx;
2 years ago
box-sizing: border-box;
background-color: #fff;
1 year ago
border-top-left-radius: 16px;
border-top-right-radius: 16px;
}
.banner {
1 year ago
position: relative;
.pic {
width: 100%;
}
.bg1 {
position: absolute;
top: -120rpx;
left: -380rpx;
width: 100%;
transform: rotate(20deg);
}
.logo {
width: 70rpx;
margin-right: 14rpx;
}
.texts {
position: absolute;
top: 230rpx;
left: 0;
width: 100%;
text-align: center;
color: #fff;
}
.title {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 22rpx;
font-size: 48rpx;
font-family: AlimamaShuHeiTi-Bold, AlimamaShuHeiTi;
font-weight: 600;
}
.text {
font-size: 30rpx;
}
.rect {
position: absolute;
bottom: 90rpx;
left: -12rpx;
width: 55rpx;
height: 61rpx;
border-radius: 7px 10px 7px 10px;
opacity: 0.63;
border: 1px solid #FFFFFF;
transform: rotate(54deg);
}
1 year ago
}
.search-wrap {
display: flex;
justify-content: space-between;
align-items: center;
.search {
flex: 1;
}
}
1 year ago
.all {
font-size: 24rpx;
1 year ago
border-radius: 20px;
6 months ago
&::after {
border: none;
}
1 year ago
}
.block {
1 year ago
margin: 20rpx 0;
.title-wrap {
3 years ago
display: flex;
justify-content: space-between;
margin-bottom: 34rpx;
3 years ago
}
.title {
display: inline-flex;
3 years ago
align-items: center;
font-size: 28rpx;
1 year ago
font-weight: 600;
3 years ago
color: #333;
&:before {
content: '';
width: 10rpx;
height: 26rpx;
margin-right: 14rpx;
background: #007FFF;
border-radius: 5px;
3 years ago
}
}
}
.tags {
display: flex;
flex-wrap: wrap;
li {
width: 25%;
margin-bottom: 24rpx;
text-align: center;
1 year ago
&:last-child {
image {
width: 50rpx;
height: 50rpx;
}
}
}
3 years ago
.icon {
1 year ago
display: flex;
justify-content: center;
align-items: center;
width: 90rpx;
height: 90rpx;
margin: 0 auto 18rpx;
background-color: rgb(228,239,255);
border-radius: 50%;
}
image {
width: 60rpx;
height: 60rpx;
3 years ago
}
.text {
1 year ago
width: 165rpx;
margin: 0 auto;
font-size: 24rpx;
color: #333;
3 years ago
}
}
.list {
.item {
display: flex;
1 year ago
align-items: center;
margin-bottom: 28rpx;
3 years ago
}
.pic {
1 year ago
width: 100rpx;
height: 100rpx;
margin-right: 20rpx;
1 year ago
border-radius: 8px;
3 years ago
}
.texts {
width: calc(100% - 156rpx);
3 years ago
}
.name {
font-size: 28rpx;
1 year ago
font-weight: 600;
color: #333;
3 years ago
}
.des {
1 year ago
margin: 10rpx 0;
1 year ago
font-size: 22rpx;
color: #666;
3 years ago
}
.meta {
display: flex;
align-items: center;
font-size: 24rpx;
color: #2E2D31;
.icon {
width: 32rpx;
height: 32rpx;
margin-right: 12rpx;
2 years ago
}
text {
width: 330rpx;
2 years ago
}
}
2 years ago
}
1 year ago
.plus {
bottom: 140rpx;
right: 60rpx;
.icon {
width: 106rpx;
1 year ago
}
.uni-badge {
font-size: 32rpx;
1 year ago
}
}
</style>