鸿宇研学生前端代码
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.
 
 
 

309 lines
6.2 KiB

<template>
<view class="page__view">
<!-- <view class="bg">
<image class="img" src="@/static/image/bg.png" mode="widthFix"></image>
</view> -->
<bgSwiperView></bgSwiperView>
<view class="main">
<!-- 搜索栏 -->
<view :class="['flex', 'search', searchStyle.class]">
<uv-search
v-model="keyword"
placeholder="输入关键词搜索"
:color="searchStyle.color"
bgColor="transparent"
:showAction="searchStyle.showAction"
@custom="search"
@search="search"
@focus="isFocusSearch = true"
@blur="isFocusSearch = false"
>
<template #prefix>
<image class="search-icon" :src="searchStyle.icon" mode="widthFix"></image>
</template>
</uv-search>
<view class="border">
<view class="border-left"></view>
</view>
</view>
<view class="section">
<categoryView></categoryView>
</view>
<view class="section">
<recommendView></recommendView>
</view>
<view class="section">
<swiperView></swiperView>
</view>
<view class="section">
<pictureLiveView></pictureLiveView>
</view>
<view class="section reason">
<image class="img" src="@/static/image/temp-19.png" mode="widthFix"></image>
</view>
<view class="section">
<productView :list="list" @categoryChange="onCategoryChange"></productView>
</view>
</view>
<!-- todo: 联系客服 -->
<tabber select="home" />
</view>
</template>
<script>
import mixinsList from '@/mixins/list.js'
import tabber from '@/components/base/tabbar.vue'
import bgSwiperView from '@/components/home/bgSwiperView.vue'
import categoryView from '@/components/home/categoryView.vue'
import recommendView from '@/components/home/recommendView.vue'
import swiperView from '@/components/home/swiperView.vue'
import pictureLiveView from '@/components/home/pictureLiveView.vue'
import productView from '@/components/home/productView.vue'
export default {
mixins: [mixinsList],
components: {
tabber,
bgSwiperView,
categoryView,
recommendView,
swiperView,
pictureLiveView,
productView,
},
data() {
return {
keyword: '',
isFocusSearch: false,
// todo
mixinsListApi: '',
}
},
onLoad() {
// let id = '1948353988875821058'
// uni.navigateTo({
// url: `/pages_order/thesis/createPdf?id=${id}`
// })
// return
},
computed: {
searchStyle() {
let focusStyle = {
class: 'focus',
color: '#181818',
icon: '/static/image/icon-search-dark.png',
showAction: true,
}
let blurStyle = {
class: 'blur',
color: '#FFFFFF',
icon: '/static/image/icon-search-light.png',
showAction: false,
}
return this.isFocusSearch ? focusStyle : blurStyle
},
},
methods: {
search() {
console.log('search', this.keyword)
uni.navigateTo({
url: '/pages_order/product/search?search=' + this.keyword
})
// this.keyword = ''
},
// todo: delete
getData() {
this.list = [
{
id: '001',
image: '/static/image/temp-20.png',
name: '新疆天山行7/9日丨醉美伊犁&吐鲁番双套餐',
desc: '国内游·7-9天·12岁+',
currentPrice: 688.99,
originalPrice: 1200,
registered: 4168,
},
{
id: '002',
image: '/static/image/temp-21.png',
name: '新疆天山行7/9日丨醉美伊犁&吐鲁番双套餐',
desc: '国内游·7-9天·12岁+',
currentPrice: 688.99,
originalPrice: 1200,
registered: 4168,
},
{
id: '003',
image: '/static/image/temp-22.png',
name: '新疆天山行7/9日丨醉美伊犁&吐鲁番双套餐',
desc: '国内游·7-9天·12岁+',
currentPrice: 688.99,
originalPrice: 1200,
registered: 4168,
},
{
id: '004',
image: '/static/image/temp-23.png',
name: '新疆天山行7/9日丨醉美伊犁&吐鲁番双套餐',
desc: '国内游·7-9天·12岁+',
currentPrice: 688.99,
originalPrice: 1200,
registered: 4168,
},
]
this.total = this.list.length
},
onCategoryChange(e) {
const { classId } = e || {}
if (classId) {
this.queryParams.classId = classId
} else {
delete this.queryParams.classId
}
this.queryParams.pageNo = 1
this.queryParams.pageSize = 10
this.getData()
},
},
}
</script>
<style scoped lang="scss">
.bg {
width: 100%;
height: auto;
border-bottom-left-radius: 40rpx;
border-bottom-right-radius: 40rpx;
font-size: 0;
overflow: hidden;
.img {
width: 100%;
height: auto;
}
}
.main {
position: absolute;
top: 0;
left: 0;
width: 100%;
padding: 100rpx 32rpx calc(120rpx + env(safe-area-inset-bottom) + 100rpx) 32rpx;
box-sizing: border-box;
}
.search {
$w: 474rpx;
$h: 64rpx;
$radius: 32rpx;
$borderWidth: 4rpx;
width: $w;
height: $h;
position: relative;
border-radius: $radius;
&-icon {
margin: 0 13rpx 0 26rpx;
width: 30rpx;
height: auto;
}
/deep/ .uv-search__content {
padding: 12rpx 0;
border: 4rpx solid transparent;
}
&.blur {
background: #FFFFFF66;
&:before,
&:after {
width: calc(#{$w} - #{$radius});
height: $borderWidth;
position: absolute;
left: $radius;
content: ' ';
background: linear-gradient(to right, #FFFFFF, #FFFFFF00);
}
&:before {
top: 0;
}
&:after {
bottom: 0;
}
.border {
width: $radius;
overflow: hidden;
position: absolute;
top: 0;
left: 0;
&-left {
width: calc(#{$radius} * 2 - #{$borderWidth} * 2);
height: calc(#{$h} - #{$borderWidth} * 2);
border: $borderWidth solid #FFFFFF;
border-radius: $radius;
}
}
}
&.focus {
/deep/ .uv-search__content {
background: #FFFFFF !important;
border-color: #CFEFFF !important;
}
/deep/ .uv-search__action {
padding: 19rpx 24rpx;
font-size: 26rpx;
font-weight: 500;
line-height: 1;
color: #FFFFFF;
background: #00A9FF;
border-radius: 32rpx;
}
}
}
.section {
& + & {
margin-top: 32rpx;
}
}
.reason {
width: 100%;
font-size: 0;
border-radius: 32rpx;
overflow: hidden;
.img {
width: 100%;
height: auto;
}
}
</style>