抖音小程序端
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.

158 lines
3.2 KiB

<template>
<view class="container">
<view class="top">
<image class="back-img" src="../../static/img/start.gif" mode=""></image>
<view class="top-bottom">
</view>
<uni-search-bar class="uni-mt-10" placeholder="请输入喜欢的艺术家代号吧~" clearButton="auto" cancelButton="none"
@confirm="search" />
<text>大家都在搜</text>
<view class="user-list">
<view class="user-list-box" v-for="(item,index) in userList" :key='item.id'>
<image :src="item.img" mode=""></image>
<text>{{item.tiktokNumber}}</text>
</view>
<view class="user-list-box" v-for="(item,index) in userList" :key='item.id'>
<image :src="item.img" mode=""></image>
<text>{{item.tiktokNumber}}</text>
</view>
<view class="user-list-box" v-for="(item,index) in userList" :key='item.id'>
<image :src="item.img" mode=""></image>
<text>{{item.tiktokNumber}}</text>
</view>
</view>
</view>
<view class="middle">
<text>近期精选</text>
<image src="../../static/img/slide-top.svg" mode=""></image>
</view>
</view>
</template>
<script>
import {
tiktokUserImgs
} from '@/api/index.js'
export default {
data() {
return {
userList: []
}
},
created() {
this.getUserList()
},
onPageScroll(e) {
// 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
console.log('e.scrollTop', e.scrollTop)
if (e.scrollTop > 200) {
uni.redirectTo({
url: './choiceness'
})
}
},
methods: {
search(res) {
uni.showToast({
title: '搜索:' + res.value,
icon: 'none'
})
},
// 获取推荐用户列表
async getUserList() {
const res = await tiktokUserImgs()
if (res.data.code === 200) {
this.userList = res.data.data
} else {
uni.showToast({
title: res.data.msg,
icon: 'error'
})
}
console.log('getUserList', res)
},
// 滚动监听
handleScroll() {
let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
console.log(scrollTop)
},
},
}
</script>
<style lang="less">
.container {
.top {
width: 100vw;
image {
width: 100vw;
height: 400rpx;
}
.uni-searchbar {
border: 1px solid #11A8FD;
margin: 0 40rpx;
border-radius: 16rpx;
padding: 0;
.uni-searchbar__box {
padding: 0;
border-radius: 16rpx!important;
}
}
>text {
font-weight: bold;
font-size: 14px;
display: block;
text-align: center;
padding-top: 40rpx;
padding-bottom: 20rpx;
}
.user-list {
display: flex;
justify-content: flex-start;
align-items: center;
overflow-x: auto;
.user-list-box {
width: 140rpx;
padding: 20rpx;
text-align: center;
image {
width: 100rpx;
height: 100rpx;
border-radius: 100rpx;
}
text {
font-size: 24rpx;
color: #1E1E1E;
text-align: center;
}
}
}
}
.middle {
text-align: center;
height: calc(100vh - 248rpx);
padding-top: 40rpx;
text {
font-weight: bold;
font-size: 14px;
display: block;
}
image {
width: 40rpx;
height: 40rpx;
}
}
}
</style>