房间榜单:增加会话存储加载榜单,样式修改

This commit is contained in:
qf
2023-02-20 18:06:32 +08:00
parent 3ff071780b
commit 09985ea05a
4 changed files with 389 additions and 139 deletions

View File

@@ -157,23 +157,31 @@ body {
}
.wrap .rank_wrap .top_three_wrap .top_three_item .num {
font-size: 0.3733333333rem;
color: #FF7979;
color: #F8FF7B;
}
.wrap .rank_wrap ul {
height: 3.7333333333rem;
margin-top: 0.4533333333rem;
padding-top: 0.4533333333rem;
background: linear-gradient(180deg, #8C6FFA 0%, #7A83F5 100%);
}
.wrap .rank_wrap ul li {
display: flex;
align-items: center;
margin-bottom: 0.4266666667rem;
padding-bottom: 0.4266666667rem;
background: #7A83F5;
}
.wrap .rank_wrap ul li:nth-child(1) {
background: transparent;
}
.wrap .rank_wrap ul li:nth-child(2) {
background: transparent;
}
.wrap .rank_wrap ul li .index {
width: 0.4rem;
text-align: center;
font-size: 0.48rem;
font-weight: bold;
color: #666;
color: #fff;
margin: 0 0.5333333333rem;
}
.wrap .rank_wrap ul li .others_avatar {
@@ -194,7 +202,7 @@ body {
height: 0.9333333333rem;
}
.wrap .rank_wrap ul li .info_wrap .others_nick {
color: #333;
color: #fff;
font-size: 0.3733333333rem;
}
.wrap .rank_wrap ul li .info_wrap .others_nick img {
@@ -206,7 +214,7 @@ body {
color: rgba(102, 102, 102, 0.6);
}
.wrap .rank_wrap ul li .others_num {
color: #FF7979;
color: #F8FF7B;
font-size: 0.3733333333rem;
font-weight: bold;
margin-right: 0.6666666667rem;

View File

@@ -1,15 +1,16 @@
@function px2rem($px, $rem:75) {
@function px2rem($px, $rem: 75) {
@return $px / $rem+rem;
}
@font-face{
@font-face {
font-family: 'pingfang-bold';
src: url('../../../common/fonts/PingFang\ Bold.ttf');
src: url('../../../common/fonts/PingFang\ Bold.ttf') format('woff'),
url('../../../common/fonts/PingFang\ Bold.ttf') format('truetype'),
url('../../../common/fonts/PingFang\ Bold.ttf') format('svg');
}
@font-face{
@font-face {
font-family: 'pingfang-medium';
src: url('../../../common/fonts/PingFang\ Medium.ttf');
src: url('../../../common/fonts/PingFang\ Medium.ttf') format('woff'),
@@ -17,15 +18,16 @@
url('../../../common/fonts/PingFang\ Medium.ttf') format('svg');
}
body{
body {
width: 100%;
font-family: 'pingfang-bold';
background-color: #fff;
}
.wrap{
.wrap {
display: none;
.tab_wrap{
.tab_wrap {
position: fixed;
top: 0;
left: 0;
@@ -34,7 +36,8 @@ body{
height: px2rem(200, );
background: url('../images/top.png') no-repeat 0 0/100% 100%;
overflow: hidden;
.tab_contain{
.tab_contain {
display: flex;
justify-content: space-between;
align-items: center;
@@ -45,31 +48,37 @@ body{
border-radius: px2rem(40, );
color: rgba($color: #fff, $alpha: .6);
font-size: px2rem(30, );
p{
p {
width: px2rem(312, );
height: px2rem(64, );
line-height: px2rem(64, );
margin: 0 px2rem(4, );
text-align: center;
font-weight: bold;
&.active{
&.active {
background-color: #fff;
color: #7898F3;
border-radius: px2rem(40, );
}
}
}
.rank_type{
.rank_type {
display: flex;
margin-left: px2rem(60, );
p{
p {
position: relative;
margin-right: px2rem(32, );
color: rgba($color: #fff, $alpha: .6);
font-size: px2rem(24, );
&.active{
&.active {
color: rgba($color: #fff, $alpha: 1);
&::after{
&::after {
content: '';
position: absolute;
bottom: px2rem(-16, );
@@ -81,65 +90,78 @@ body{
background-color: #fff;
}
}
&:last-child{
&:last-child {
display: none;
}
}
}
}
.rank_wrap{
.rank_wrap {
overflow: auto;
.top_three_wrap{
.top_three_wrap {
position: relative;
width: 100%;
height: px2rem(400, );
background: url('../images/topthree-bg.png') no-repeat 0 0/100% 100%;
margin-top: px2rem(200, );
.top_three_item{
.top_three_item {
position: absolute;
left: 50%;
transform: translateX(-50%);
width: px2rem(174, );
text-align: center;
color: #fff;
&:nth-child(2), &:nth-child(3){
&:nth-child(2),
&:nth-child(3) {
left: px2rem(60, );
transform: translateX(0);
.avatar{
.avatar {
width: px2rem(142, );
height: px2rem(164, );
margin-top: px2rem(112, );
p{
p {
background-image: url('../images/second.png');
}
img{
img {
top: px2rem(-132, );
width: px2rem(116, );
height: px2rem(116, );
}
}
}
&:nth-child(3){
&:nth-child(3) {
left: px2rem(516, );
.avatar{
p{
.avatar {
p {
background-image: url('../images/third.png');
}
}
}
.avatar{
.avatar {
width: px2rem(174, );
height: px2rem(200, );
margin: px2rem(34, ) auto px2rem(24, );
p{
p {
position: relative;
z-index: 99;
width: 100%;
height: 100%;
background: url('../images/first.png') no-repeat 0 0/100% 100%;
}
img{
img {
position: relative;
top: px2rem(-160, );
width: px2rem(144, );
@@ -147,76 +169,98 @@ body{
border-radius: 50%;
}
}
.nick{
.nick {
display: flex;
justify-content: center;
align-items: center;
font-size: px2rem(24, );
img{
img {
width: px2rem(30, );
width: px2rem(30, );
margin-left: px2rem(4, );
}
}
.erbanNo{
.erbanNo {
font-size: px2rem(20, );
color: rgba($color: #fff, $alpha: .6);
margin: px2rem(8, ) 0 px2rem(8, );
}
.num{
.num {
font-size: px2rem(28, );
color: #FF7979;
color: #F8FF7B;
}
}
}
ul{
ul {
height: px2rem(280, );
// overflow: auto;
margin-top: px2rem(34, );
li{
padding-top: px2rem(34, );
background: linear-gradient(180deg, #8C6FFA 0%, #7A83F5 100%);
li {
display: flex;
align-items: center;
margin-bottom: px2rem(32, );
.index{
padding-bottom: px2rem(32, );
background: #7A83F5;
&:nth-child(1){
background: transparent;
}
&:nth-child(2){
background: transparent;
}
.index {
width: px2rem(30, );
text-align: center;
font-size: px2rem(36, );
font-weight: bold;
color: #666;
color: #fff;
margin: 0 px2rem(40, );
}
.others_avatar{
.others_avatar {
width: px2rem(100, );
height: px2rem(100, );
margin-right: px2rem(32, );
img{
img {
width: 100%;
height: 100%;
border-radius: 50%;
}
}
.info_wrap{
.info_wrap {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-around;
height: px2rem(70, );
.others_nick{
color: #333;
.others_nick {
color: #fff;
font-size: px2rem(28, );
img{
img {
width: px2rem(30, );
height: px2rem(30, );
vertical-align: bottom;
}
}
.others_erbanNo{
.others_erbanNo {
color: rgba($color: #666, $alpha: .6);
}
}
.others_num{
color: #FF7979;
.others_num {
color: #F8FF7B;
font-size: px2rem(28, );
font-weight: bold;
margin-right: px2rem(50, );
@@ -226,7 +270,6 @@ body{
}
}
::-webkit-scrollbar{
::-webkit-scrollbar {
display: none;
}
}

View File

@@ -7,7 +7,7 @@
<title>房间榜单</title>
<link rel="stylesheet" href="../../common/css/reset.css">
<link rel="stylesheet" href="./css/index.css?v=1.5">
<link rel="stylesheet" href="./css/index.css?v=1.6">
</head>
<body>
<div class="wrap">
@@ -34,6 +34,6 @@
<script src="../../common/js/common2.js"></script>
<script src="../../common/js/layer.js"></script>
<script src="../../common/js/vconsole.min.js"></script>
<script src="./js/index.js?v=1.7"></script>
<script src="./js/index.js?v=1.9"></script>
</body>
</html>

View File

@@ -9,7 +9,7 @@ const showLoading = () => {
type: 2,
shadeClose: false,
content: '加載中...',
success (e) {
success(e) {
layerIndex = $(e).attr('index')
}
})
@@ -35,7 +35,7 @@ const getShowInfo = () => {
data: {
roomUid: queryObj.roomUid
},
success (res) {
success(res) {
if (res.code === 200) {
showReceiveRankTotal = res.data.showReceiveRankTotal
showMonthList = res.data.showMonthList
@@ -63,7 +63,7 @@ const getShowInfo = () => {
toastMsg(res.message)
}
},
error (err) {
error(err) {
toastMsg('網絡錯誤')
}
})
@@ -72,8 +72,15 @@ const getShowInfo = () => {
let page = 1
let pageSize = 10
let rankList = []
let canNext = true
let isLock = true
let dayListNext = true
let weekListNext = true
let monthListNext = true
let totalListNext = true
let dayCharmListNext = true
let weekCharmListNext = true
let monthCharmListNext = true
let totalCharmListNext = true
// 获取财富榜数据
const getList = (type, page = 1) => {
@@ -88,22 +95,60 @@ const getList = (type, page = 1) => {
pageSize,
roomUid: queryObj.roomUid
},
success (res) {
success(res) {
if (res.code === 200) {
if (res.data.rankings.length === pageSize) {
// 能够继续请求下一页
canNext = true
if (type == 'day') {
dayListNext = true
} else if (type == 'week') {
weekListNext = true
} else if (type == 'month') {
monthListNext = true
} else {
totalListNext = true
}
} else {
canNext = false
if (type == 'day') {
dayListNext = false
} else if (type == 'week') {
weekListNext = false
} else if (type == 'month') {
monthListNext = false
} else {
totalListNext = false
}
}
rankList.push(...res.data.rankings)
renderList()
if (showMonthList) {
if (type == 'day') {
sessionStorage.setItem('dayList', JSON.stringify(rankList))
renderList(sessionStorage.getItem('dayList'))
} else if (type == 'week') {
sessionStorage.setItem('weekList', JSON.stringify(rankList))
renderList(sessionStorage.getItem('weekList'))
} else if (type == 'month') {
sessionStorage.setItem('monthList', JSON.stringify(rankList))
renderList(sessionStorage.getItem('monthList'))
}
} else {
if (type == 'day') {
sessionStorage.setItem('dayList', JSON.stringify(rankList))
renderList(sessionStorage.getItem('dayList'))
} else if (type == 'week') {
sessionStorage.setItem('weekList', JSON.stringify(rankList))
renderList(sessionStorage.getItem('weekList'))
} else if (type == 'total') {
sessionStorage.setItem('totalList', JSON.stringify(rankList))
renderList(sessionStorage.getItem('totalList'))
}
}
isLock = true
} else {
toastMsg(res.message)
}
},
error (err) {
error(err) {
toastMsg('網絡錯誤')
}
})
@@ -122,31 +167,73 @@ const getCharmList = (type, page = 1) => {
pageSize,
roomUid: queryObj.roomUid
},
success (res) {
success(res) {
if (res.code === 200) {
if (res.data.rankings.length === pageSize) {
// 能够继续请求下一页
canNext = true
if (type == 'day') {
dayCharmListNext = true
} else if (type == 'week') {
weekCharmListNext = true
} else if (type == 'month') {
monthCharmListNext = true
} else {
totalCharmListNext = true
}
} else {
canNext = false
if (type == 'day') {
dayCharmListNext = false
} else if (type == 'week') {
weekCharmListNext = false
} else if (type == 'month') {
monthCharmListNext = false
} else {
totalCharmListNext = false
}
}
rankList.push(...res.data.rankings)
renderList()
if (showMonthList) {
if (type == 'day') {
sessionStorage.setItem('dayCharmList', JSON.stringify(rankList))
renderList(sessionStorage.getItem('dayCharmList'))
} else if (type == 'week') {
sessionStorage.setItem('weekCharmList', JSON.stringify(rankList))
renderList(sessionStorage.getItem('weekCharmList'))
} else if (type == 'month') {
sessionStorage.setItem('monthCharmList', JSON.stringify(rankList))
renderList(sessionStorage.getItem('monthCharmList'))
}
} else {
if (type == 'day') {
sessionStorage.setItem('dayCharmList', JSON.stringify(rankList))
renderList(sessionStorage.getItem('dayCharmList'))
} else if (type == 'week') {
sessionStorage.setItem('weekCharmList', JSON.stringify(rankList))
renderList(sessionStorage.getItem('weekCharmList'))
} else if (type == 'total') {
sessionStorage.setItem('totalCharmList', JSON.stringify(rankList))
renderList(sessionStorage.getItem('totalCharmList'))
}
}
// renderList()
isLock = true
} else {
toastMsg(res.message)
}
},
error (err) {
error(err) {
toastMsg('網絡錯誤')
}
})
}
const renderList = () => {
let topThreeArr = rankList.slice(0, 3)
if (rankList.length < 3) {
let len = 3 - rankList.length
const renderList = (List) => {
let list = JSON.parse(List)
rankList = list
let topThreeArr = list.slice(0, 3)
if (list.length < 3) {
let len = 3 - list.length
let arr = new Array(len).fill({
nick: '',
erbanNo: '',
@@ -188,7 +275,7 @@ const renderList = () => {
// 渲染非前3
let othersArr = rankList.slice(3)
let othersArr = list.slice(3)
let others = ''
othersArr.map((item, index) => {
let tostr = item.goldAmount.toString()
@@ -240,19 +327,43 @@ $(function () {
if (showMonthList) {
$('.wrap .tab_wrap .rank_type p:last-child').show();
if (currentCharmRankType == 0) {
getCharmList('day')
if (sessionStorage.getItem('dayCharmList')) {
renderList(sessionStorage.getItem('dayCharmList'))
} else {
getCharmList('day')
}
} else if (currentCharmRankType == 1) {
getCharmList('week')
if (sessionStorage.getItem('weekCharmList')) {
renderList(sessionStorage.getItem('weekCharmList'))
} else {
getCharmList('week')
}
} else if (currentCharmRankType == 2) {
getCharmList('month')
if (sessionStorage.getItem('monthCharmList')) {
renderList(sessionStorage.getItem('monthCharmList'))
} else {
getCharmList('month')
}
}
} else {
if (currentCharmRankType == 0) {
getCharmList('day')
if (sessionStorage.getItem('dayCharmList')) {
renderList(sessionStorage.getItem('dayCharmList'))
} else {
getCharmList('day')
}
} else if (currentCharmRankType == 1) {
getCharmList('week')
if (sessionStorage.getItem('weekCharmList')) {
renderList(sessionStorage.getItem('weekCharmList'))
} else {
getCharmList('week')
}
} else if (currentCharmRankType == 2) {
getCharmList('total')
if (sessionStorage.getItem('totalCharmList')) {
renderList(sessionStorage.getItem('totalCharmList'))
} else {
getCharmList('total')
}
}
}
} else {
@@ -264,20 +375,44 @@ $(function () {
$('.wrap .tab_wrap .rank_type p:last-child').show();
$('.rank_type p').eq(currentRankType).addClass('active').siblings('p').removeClass('active')
if (currentRankType == 0) {
getList('day')
if (sessionStorage.getItem('dayList')) {
renderList(sessionStorage.getItem('dayList'))
} else {
getList('day')
}
} else if (currentRankType == 1) {
getList('week')
if (sessionStorage.getItem('weekList')) {
renderList(sessionStorage.getItem('weekList'))
} else {
getList('week')
}
} else if (currentRankType == 2) {
getList('month')
if (sessionStorage.getItem('monthList')) {
renderList(sessionStorage.getItem('monthList'))
} else {
getList('month')
}
}
} else {
$('.rank_type p').eq(currentRankType).addClass('active').siblings('p').removeClass('active')
if (currentRankType == 0) {
getList('day')
if (sessionStorage.getItem('dayList')) {
renderList(sessionStorage.getItem('dayList'))
} else {
getList('day')
}
} else if (currentRankType == 1) {
getList('week')
if (sessionStorage.getItem('weekList')) {
renderList(sessionStorage.getItem('weekList'))
} else {
getList('week')
}
} else if (currentRankType == 2) {
getList('total')
if (sessionStorage.getItem('totalList')) {
renderList(sessionStorage.getItem('totalList'))
} else {
getList('total')
}
}
}
}
@@ -299,19 +434,45 @@ $(function () {
if (showMonthList) {
if (index == 0) {
getCharmList('day')
if (sessionStorage.getItem('dayCharmList')) {
renderList(sessionStorage.getItem('dayCharmList'))
} else {
getCharmList('day')
}
} else if (index == 1) {
getCharmList('week')
if (sessionStorage.getItem('weekCharmList')) {
renderList(sessionStorage.getItem('weekCharmList'))
} else {
getCharmList('week')
}
} else if (index == 2) {
getCharmList('month')
if (sessionStorage.getItem('monthCharmList')) {
renderList(sessionStorage.getItem('monthCharmList'))
} else {
getCharmList('month')
}
}
} else {
if (index == 0) {
getCharmList('day')
if (sessionStorage.getItem('dayCharmList')) {
renderList(sessionStorage.getItem('dayCharmList'))
} else {
getCharmList('day')
}
} else if (index == 1) {
getCharmList('week')
if (sessionStorage.getItem('weekCharmList')) {
renderList(sessionStorage.getItem('weekCharmList'))
} else {
getCharmList('week')
}
} else if (index == 2) {
getCharmList('total')
if (sessionStorage.getItem('totalCharmList')) {
renderList(sessionStorage.getItem('totalCharmList'))
} else {
getCharmList('total')
}
}
}
} else {
@@ -323,19 +484,45 @@ $(function () {
rankList = []
if (showMonthList) {
if (index == 0) {
getList('day')
if (sessionStorage.getItem('dayList')) {
renderList(sessionStorage.getItem('dayList'))
} else {
getList('day')
}
} else if (index == 1) {
getList('week')
if (sessionStorage.getItem('weekList')) {
renderList(sessionStorage.getItem('weekList'))
} else {
getList('week')
}
} else if (index == 2) {
getList('month')
if (sessionStorage.getItem('monthList')) {
renderList(sessionStorage.getItem('monthList'))
} else {
getList('month')
}
}
} else {
if (index == 0) {
getList('day')
if (sessionStorage.getItem('dayList')) {
renderList(sessionStorage.getItem('dayList'))
} else {
getList('day')
}
} else if (index == 1) {
getList('week')
if (sessionStorage.getItem('weekList')) {
renderList(sessionStorage.getItem('weekList'))
} else {
getList('week')
}
} else if (index == 2) {
getList('total')
if (sessionStorage.getItem('totalList')) {
renderList(sessionStorage.getItem('totalList'))
} else {
getList('total')
}
}
}
}
@@ -349,52 +536,64 @@ $(function () {
if (scrollTop + ulHeight + 100 >= scrollHeight) {
if (isLock) {
// 请求下一页
if (canNext) {
if (showMonthList) {
if (currentTabIndex) {
if (currentCharmRankType == 0) {
getCharmList('day', ++page)
} else if (currentCharmRankType == 1) {
getCharmList('week', ++page)
} else if (currentCharmRankType == 2) {
getCharmList('month', ++page)
}
} else {
if (currentRankType == 0) {
getList('day', ++page)
} else if (currentRankType == 1) {
getList('week', ++page)
} else if (currentRankType == 2) {
getList('month', ++page)
}
// if (canNext) {
if (showMonthList) {
if (currentTabIndex) {
if (currentCharmRankType == 0) {
if (!dayCharmListNext) return
getCharmList('day', ++page)
} else if (currentCharmRankType == 1) {
if (!weekCharmListNext) return
getCharmList('week', ++page)
} else if (currentCharmRankType == 2) {
if (!monthCharmListNext) return
getCharmList('month', ++page)
}
} else {
if (currentTabIndex) {
if (currentCharmRankType == 0) {
getCharmList('day', ++page)
} else if (currentCharmRankType == 1) {
getCharmList('week', ++page)
} else if (currentCharmRankType == 2) {
getCharmList('total', ++page)
}
} else {
if (currentRankType == 0) {
getList('day', ++page)
} else if (currentRankType == 1) {
getList('week', ++page)
} else if (currentRankType == 2) {
getList('total', ++page)
}
if (currentRankType == 0) {
if (!dayListNext) return
getList('day', ++page)
} else if (currentRankType == 1) {
if (!weekListNext) return
getList('week', ++page)
} else if (currentRankType == 2) {
if (!monthListNext) return
getList('month', ++page)
}
}
} else {
if (currentTabIndex) {
if (currentCharmRankType == 0) {
if (!dayCharmListNext) return
getCharmList('day', ++page)
} else if (currentCharmRankType == 1) {
if (!weekCharmListNext) return
getCharmList('week', ++page)
} else if (currentCharmRankType == 2) {
if (!totalCharmListNext) return
getCharmList('total', ++page)
}
} else {
if (currentRankType == 0) {
if (!dayListNext) return
getList('day', ++page)
} else if (currentRankType == 1) {
if (!weekListNext) return
getList('week', ++page)
} else if (currentRankType == 2) {
if (!totalListNext) return
getList('total', ++page)
}
}
isLock = false
}
isLock = false
// }
}
}
})
//跳转个人主页
function openPerson (document, dom) {
function openPerson(document, dom) {
$(document).on('click', dom, function () {
let erbanUid = $(this).data('uid')
if (!browser.app) return