Files
tk-mini-program/components/contentList/contentList.vue
pengxiaolong af10ed06db 弹窗
2025-05-21 22:52:33 +08:00

159 lines
3.4 KiB
Vue

<template>
<scroll-view scroll-y="true" class="scroll" lower-threshold="100" @scrolltolower="onScrollToLower" >
<uni-card class="content-list" v-for="(item, index) in list">
<!-- `````````````````````````` -->
<image class="headShot" src="../../static/logo.png" mode="scaleToFill" />
<!-- `````````````````````````````````````` -->
<view class="content-list-title">
<view class="cardname">{{ item.title }}</view>
<view class="content-list-info">
<view :class="{Gendermale:Gender,Genderfemale:!Gender}"><!-- 性别换背景 -->
<image v-if="Gender" class="Genderimg" src="../../static/female.png" mode="scaleToFill" />
<image v-else class="Genderimg" src="../../static/female.png" mode="scaleToFill" />
<view class="age">{{ item.gender }}</view>
</view>
<view class="RoomID">房间ID:{{ item.id }}</view>
<view class="Charm">魅力值</view>
<view class="charmValue"> {{ item.score }}W</view>
</view>
</view>
<!-- `````````````````````````````````````````````````````` -->
</uni-card>
</scroll-view>
</template>
<script>
import request from "../../components/request.js";
export default {
data() {
return {
title: "Hello",
Gender: true,
page: 0,
// 列表数据
list: [
{
title: "极乐世界",
id: "9088",
gender: "男",
score: 8.8,
},
],
// 列表数据结束
};
},
mounted() {
// 页面加载完成后请求数据
this.pkList()
},
methods: {
async pkList(){
const res = await request({
url: "pk/pkList",
method: "GET",
data: {
status: 0,
page: this.page,
Size: 10,
},
userInfo: false,
});
console.log(res);
if (res.code === 200) {
this.list.concat(res.data)
console.log(this.list)
}
},
onScrollToLower() {
this.page++;
this.pkList();
},
},
};
</script>
<style scoped>
.scroll {
height: 90%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.content-list {
display: flex;
align-items: center;
width: 712rpx;
height: 161rpx;
background: #ffffff;
border-radius: 15rpx;
margin-bottom: 12rpx;
margin-left: 20rpx;
}
.headShot {
width: 101rpx;
height: 101rpx;
border-radius: 50rpx;
margin-left: 30rpx;
margin-right: 33rpx;
}
.content-list-info {
display: flex;
align-items: center;
}
.cardname {
font-size: 31rpx;
color: #161616;
line-height: 38rpx;
}
.Genderimg {
width: 15rpx;
height: 15rpx;
margin-left: 10rpx;
margin-right: 10rpx;
}
.age {
color: #ffffff;
font-size: 14rpx;
}
.Gendermale{
background: url(../../static/maleimg.png) no-repeat center;
width: 56.3rpx;
height: 29.58rpx;
background-size: 100% 100%;
display: flex;
align-items: center;
margin-right: 10rpx;
}
.Genderfemale{
background: url(../../static/femaleimg.png) no-repeat center;
width: 56.3rpx;
height: 29.58rpx;
background-size: 100% 100%;
display: flex;
align-items: center;
margin-right: 10rpx;
}
.RoomID {
font-size: 23rpx;
color: #a3a3a3;
line-height: 38rpx;
margin-right: 152rpx;
}
.Charm {
font-size: 23rpx;
color: #a3a3a3;
line-height: 38rpx;
margin-right: 12rpx;
}
.charmValue {
font-size: 23rpx;
color: #161616;
line-height: 38rpx;
font-weight: 600;
}
</style>