style(总排行榜及其组件): 样式更新

This commit is contained in:
hzj 2025-11-20 16:00:27 +08:00
parent 5d195a8069
commit 39b9ad3e4f
12 changed files with 173 additions and 204 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

After

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 MiB

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 KiB

After

Width:  |  Height:  |  Size: 429 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 KiB

After

Width:  |  Height:  |  Size: 454 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 KiB

After

Width:  |  Height:  |  Size: 397 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 KiB

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 KiB

After

Width:  |  Height:  |  Size: 270 KiB

View File

@ -10,7 +10,6 @@
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 999; z-index: 999;
padding-bottom: 10px;
border-radius: 0 0 12px 12px; border-radius: 0 0 12px 12px;
transition: all 0.3s; transition: all 0.3s;
" "
@ -48,6 +47,7 @@
<!-- 推出键 --> <!-- 推出键 -->
<img <img
v-smart-img
src="../../../assets/icon/arrowBack.png" src="../../../assets/icon/arrowBack.png"
alt="" alt=""
style="position: absolute; left: 0; top: 50%; transform: translateY(-50%)" style="position: absolute; left: 0; top: 50%; transform: translateY(-50%)"
@ -108,7 +108,7 @@
<!-- 第一 --> <!-- 第一 -->
<div style="display: flex; justify-content: center"> <div style="display: flex; justify-content: center">
<TopUser <TopUser
:isRoom="rankingType === 'Room'" :Type="rankingType"
:isTopOne="true" :isTopOne="true"
:BorderImgUrl="topBorderBg" :BorderImgUrl="topBorderBg"
:avatarUrl="RankingTop3[0].avatar || ''" :avatarUrl="RankingTop3[0].avatar || ''"
@ -119,23 +119,23 @@
/> />
</div> </div>
<!-- 第二三 --> <!-- 第二三 -->
<div style="display: flex; justify-content: space-between; margin-top: -20%"> <div style="display: flex; justify-content: space-between; margin-top: -45%">
<TopUser <TopUser
:isRoom="rankingType === 'Room'" :Type="rankingType"
:BorderImgUrl="top2BorderBg" :BorderImgUrl="top2BorderBg"
:avatarUrl="RankingTop3[1].avatar || ''" :avatarUrl="RankingTop3[1].avatar || ''"
:name="RankingTop3[1].nickname || ''" :name="RankingTop3[1].nickname || ''"
:distributionValue="RankingTop3[1].quantityFormat || ''" :distributionValue="RankingTop3[1].quantityFormat || ''"
style="width: 30%" style="width: 32%"
@click="gotoAppPage(RankingTop3[1].id)" @click="gotoAppPage(RankingTop3[1].id)"
/> />
<TopUser <TopUser
:isRoom="rankingType === 'Room'" :Type="rankingType"
:BorderImgUrl="top3BorderBg" :BorderImgUrl="top3BorderBg"
:avatarUrl="RankingTop3[2].avatar || ''" :avatarUrl="RankingTop3[2].avatar || ''"
:name="RankingTop3[2].nickname || ''" :name="RankingTop3[2].nickname || ''"
:distributionValue="RankingTop3[2].quantityFormat || ''" :distributionValue="RankingTop3[2].quantityFormat || ''"
style="width: 30%" style="width: 32%"
@click="gotoAppPage(RankingTop3[2].id)" @click="gotoAppPage(RankingTop3[2].id)"
/> />
</div> </div>
@ -150,32 +150,49 @@
border-radius: 12px; border-radius: 12px;
backdrop-filter: blur(32px); backdrop-filter: blur(32px);
margin: 5px 0; margin: 5px 0;
padding: 12px; padding: 3%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
gap: 4px;
" "
:style="{ background: rankItemBackground, border: '1px ' + rankItemBorder }" :style="{ background: rankItemBackground, border: '1px ' + rankItemBorder }"
@click="gotoAppPage(userInfo.id)" @click="gotoAppPage(userInfo.id)"
> >
<div style="display: flex; align-items: center; width: 70%"> <!-- 基本信息 -->
<div style="font-weight: 700">{{ index + 4 }}</div> <div
style="
width: 75%;
min-width: 0;
display: flex;
justify-content: space-around;
align-items: center;
gap: 4px;
"
>
<!-- 排名 -->
<div style="width: 10%; display: flex; justify-content: center; align-items: center">
<div style="font-weight: 700">{{ index + 4 }}</div>
</div>
<!-- 头像 -->
<img <img
:src="userInfo.avatar || ''" :src="userInfo.avatar || ''"
alt="" alt=""
width="20%"
style=" style="
display: block; display: block;
width: 15%;
aspect-ratio: 1/1;
border-radius: 50%; border-radius: 50%;
object-fit: cover; object-fit: cover;
aspect-ratio: 1/1;
margin: 0 4px;
" "
:style="{ borderRadius: rankingType === 'Room' ? '10%' : '50%' }" :style="{ borderRadius: rankingType === 'Room' ? '10%' : '50%' }"
@error="defaultAvatarUrl" @error="defaultAvatarUrl"
/> />
<div <div
style=" style="
min-width: 0;
width: calc(100% - 10% - 15% - 8px);
font-weight: 700; font-weight: 700;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
@ -185,22 +202,16 @@
{{ userInfo.nickname }} {{ userInfo.nickname }}
</div> </div>
</div> </div>
<div style="display: flex; align-items: center; width: 30%">
<!-- 贡献值 -->
<div style="flex: 1; min-width: 0; display: flex; align-items: center; width: 30%">
<img <img
v-smart-img
src="/src/assets/icon/coin.png" src="/src/assets/icon/coin.png"
alt="" alt=""
width="20%" style="display: block; width: 25%; aspect-ratio: 1/1"
style="display: block; aspect-ratio: 1/1"
/> />
<div <div style="font-weight: 500; color: rgba(248, 182, 45, 1)">
style="
font-weight: 500;
color: rgba(248, 182, 45, 1);
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
"
>
{{ userInfo.quantityFormat }} {{ userInfo.quantityFormat }}
</div> </div>
</div> </div>
@ -217,14 +228,12 @@
<div <div
style=" style="
border-radius: 12px 12px 0 0; border-radius: 12px 12px 0 0;
border-top: 2px solid #ffa166;
border-right: 1px solid #ffa166;
border-left: 1px solid #ffa166;
backdrop-filter: blur(32px); backdrop-filter: blur(32px);
padding: 12px; padding: 2%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
gap: 4px;
" "
:style="{ :style="{
background: rankItemBackground, background: rankItemBackground,
@ -233,38 +242,54 @@
borderRight: '1px ' + rankItemBorder, borderRight: '1px ' + rankItemBorder,
}" }"
> >
<div style="display: flex; align-items: center; width: 70%"> <!-- 基本信息 -->
<div style="font-weight: 700">{{ myRanking.rank || 0 }}</div> <div
style="
width: 80%;
min-width: 0;
display: flex;
justify-content: space-around;
align-items: center;
gap: 4px;
"
>
<!-- 排名 -->
<div style="width: 10%; display: flex; justify-content: center; align-items: center">
<div style="font-weight: 700">{{ myRanking.rank || 999 }}</div>
</div>
<!-- 头像 -->
<img <img
v-smart-img
:src="myRanking.avatar || ''" :src="myRanking.avatar || ''"
alt="" alt=""
width="20%" style="display: block; width: 15%; aspect-ratio: 1/1"
style="display: block; aspect-ratio: 1/1; margin: 0 4px" :style="{ borderRadius: rankingType === 'Room' ? '10%' : '50%' }"
:style="{ borderRadius: rankingType === 'Room' ? '0' : '50%' }"
@error="defaultAvatarUrl" @error="defaultAvatarUrl"
/> />
<div <!-- 名称 -->
style="font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis"
>
{{ myRanking.nickname || '' }}
</div>
</div>
<div style="display: flex; align-items: center; width: 30%">
<img
src="/src/assets/icon/coin.png"
alt=""
width="20%"
style="display: block; aspect-ratio: 1/1"
/>
<div <div
style=" style="
font-weight: 500; min-width: 0;
color: rgba(248, 182, 45, 1); width: calc(100% - 10% - 15% - 8px);
font-weight: 700;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
" "
> >
{{ myRanking.nickname || '' }}
</div>
</div>
<!-- 贡献值 -->
<div style="flex: 1; min-width: 0; display: flex; align-items: center">
<img
v-smart-img
src="/src/assets/icon/coin.png"
alt=""
style="display: block; width: 30%; aspect-ratio: 1/1"
/>
<div style="font-weight: 500; color: rgba(248, 182, 45, 1)">
{{ myRanking.quantityFormat || 0 }} {{ myRanking.quantityFormat || 0 }}
</div> </div>
</div> </div>
@ -273,25 +298,15 @@
</template> </template>
<script setup> <script setup>
import {
connectApplication,
parseAccessOrigin,
parseHeader,
setHttpHeaders,
isInApp,
closePage,
viewUserInfo,
gotoRoom,
} from '@/utils/appBridge.js'
import {
appConnectionManager,
isAppConnected,
getAppHeaderInfo,
} from '@/utils/appConnectionManager.js'
import { computed, onMounted, ref, watch, watchEffect } from 'vue' import { computed, onMounted, ref, watch, watchEffect } from 'vue'
import TopUser from '@/components/Ranking/topUser.vue'
import { getWealthRanking, getCharmRanking, getRoomRanking, getMyRanking } from '@/api/ranking'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { isInApp, closePage, viewUserInfo, gotoRoom } from '@/utils/appBridge.js'
import { connectToApp } from '@/utils/appConnector.js'
import { getWealthRanking, getCharmRanking, getRoomRanking, getMyRanking } from '@/api/ranking'
import TopUser from './components/topUser.vue'
const route = useRoute() const route = useRoute()
//vite //vite
@ -316,8 +331,9 @@ const totalRanking = ref({})
const showRanking = ref([]) const showRanking = ref([])
const myRanking = ref({}) // const myRanking = ref({}) //
//
const updateTimeRanking = () => { const updateTimeRanking = () => {
console.log('updateTimeRanking()') console.log('updateTimeRanking()//筛选展示榜单')
if (selectedTimeTab.value == 'Hourly' && totalRanking.value.hourly) { if (selectedTimeTab.value == 'Hourly' && totalRanking.value.hourly) {
showRanking.value = totalRanking.value.hourly showRanking.value = totalRanking.value.hourly
@ -338,6 +354,7 @@ const changeType = (type) => {
rankingType.value = type rankingType.value = type
selectedTimeTab.value = 'Hourly' selectedTimeTab.value = 'Hourly'
params_dateType.value = 'HOUR' params_dateType.value = 'HOUR'
if (type == 'Wealth') { if (type == 'Wealth') {
params_type.value = 'GIFTS_SEND' params_type.value = 'GIFTS_SEND'
} else if (type == 'Charm') { } else if (type == 'Charm') {
@ -345,9 +362,12 @@ const changeType = (type) => {
} else if (type == 'Room') { } else if (type == 'Room') {
params_type.value = 'ROOM_GIFTS' params_type.value = 'ROOM_GIFTS'
} }
//
totalRanking.value = {} totalRanking.value = {}
showRanking.value = [] showRanking.value = []
myRanking.value = {} myRanking.value = {}
getRanking() // getRanking() //
getMyRankingInfo() // getMyRankingInfo() //
} }
@ -358,6 +378,7 @@ const changeDateType = (dateType) => {
if (selectedTimeTab.value != dateType) { if (selectedTimeTab.value != dateType) {
console.log('改变rankingType') console.log('改变rankingType')
selectedTimeTab.value = dateType selectedTimeTab.value = dateType
if (dateType == 'Hourly') { if (dateType == 'Hourly') {
params_dateType.value = 'HOUR' params_dateType.value = 'HOUR'
} else if (dateType == 'Daily') { } else if (dateType == 'Daily') {
@ -367,9 +388,12 @@ const changeDateType = (dateType) => {
} else if (dateType == 'Monthly') { } else if (dateType == 'Monthly') {
params_dateType.value = 'MONTH' params_dateType.value = 'MONTH'
} }
//
showRanking.value = [] showRanking.value = []
myRanking.value = {} myRanking.value = {}
updateTimeRanking() //
updateTimeRanking() //
getMyRankingInfo() // getMyRankingInfo() //
} }
} }
@ -497,7 +521,7 @@ const getRanking = async () => {
} }
if (resRanking.status && resRanking.body) { if (resRanking.status && resRanking.body) {
totalRanking.value = resRanking.body totalRanking.value = resRanking.body
updateTimeRanking() updateTimeRanking() //
} }
} }
@ -512,134 +536,25 @@ const getMyRankingInfo = async () => {
} }
} }
const appConnected = ref(false) //
const headerInfo = ref({}) const initData = () => {
getRanking() //
getMyRankingInfo() //
}
/** // 使APP
* 连接APP并获取认证信息优化版 - 仅专注连接 const connectToAppHandler = async () => {
*/ await connectToApp(() => {
const connectToApp = async () => { //
console.group('🔗 APP Connection Process') initData() //
console.debug('🚀 Starting APP connection...') })
try {
// APP
if (!isInApp()) {
console.debug('🌐 Browser environment detected')
appConnected.value = true
console.groupEnd()
//
// getUserInfo()
return { success: true, environment: 'browser' }
}
//
if (isAppConnected()) {
console.debug('✅ APP already connected and valid')
appConnected.value = true
// 使
const cachedHeaderInfo = getAppHeaderInfo()
if (cachedHeaderInfo) {
headerInfo.value = cachedHeaderInfo
console.debug('🔧 Using cached HTTP headers')
}
console.groupEnd()
//
// getUserInfo()
return { success: true, environment: 'app', fromCache: true }
}
//
if (appConnectionManager.isConnecting()) {
console.debug('⏳ Connection already in progress, waiting...')
await appConnectionManager.getConnectionPromise()
appConnected.value = true
console.debug('✅ Connected via existing process')
console.groupEnd()
//
// getUserInfo()
return { success: true, environment: 'app', fromCache: true }
}
// APP
console.debug('📱 Establishing new APP connection...')
const connectionResult = await new Promise((resolve, reject) => {
const connectionPromise = new Promise((connectResolve, connectReject) => {
connectApplication(async (access) => {
try {
const result = parseAccessOrigin(access)
if (result.success) {
//
headerInfo.value = parseHeader(result.data)
// HTTP
console.debug('🔧 Setting HTTP headers...')
await setHttpHeaders(headerInfo.value)
//
appConnected.value = true
appConnectionManager.setConnected(headerInfo.value)
console.debug('🎉 APP connection established successfully')
connectResolve({ success: true, environment: 'app', fromCache: false })
} else {
console.error('❌ Failed to parse access origin:', result.error)
appConnectionManager.reset()
connectReject(new Error(result.error))
}
} catch (error) {
console.error('❌ Connection process failed:', error)
appConnectionManager.reset()
connectReject(error)
}
})
})
//
appConnectionManager.setConnecting(connectionPromise)
connectionPromise.then(resolve).catch(reject)
})
console.debug('✅ Connection completed successfully')
console.groupEnd()
//
// getUserInfo()
return connectionResult
} catch (error) {
console.error('❌ Connection failed:', error)
appConnected.value = false
console.groupEnd()
//
if (error.message && error.message.includes('parse access')) {
router.push({ path: '/not_app', query: { message: error.message } })
}
return { success: false, error: error.message }
}
} }
onMounted(() => { onMounted(() => {
connectToApp() connectToAppHandler()
isInAppEnvironment.value = isInApp() isInAppEnvironment.value = isInApp()
observer.observe(sentinel.value) observer.observe(sentinel.value)
getRanking() //
getMyRankingInfo() //
}) })
</script> </script>
@ -693,7 +608,7 @@ onMounted(() => {
@media screen and (min-width: 360px) { @media screen and (min-width: 360px) {
* { * {
font-size: 16px; font-size: 14px;
} }
} }

View File

@ -2,6 +2,7 @@
<div style="width: 100%"> <div style="width: 100%">
<div style="position: relative"> <div style="position: relative">
<img <img
v-smart-img
:src="BorderImgUrl" :src="BorderImgUrl"
alt="" alt=""
width="100%" width="100%"
@ -19,20 +20,20 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
" "
:style="{ height: isTopOne ? '55%' : '60%' }" :style="avatarBoxHeight"
> >
<div style="width: 75%"> <div style="width: 70%">
<img <img
v-if="avatarUrl"
:src="avatarUrl || ''" :src="avatarUrl || ''"
alt="" alt=""
width="100%" width="100%"
style="aspect-ratio: 1/1; object-fit: cover" style="display: block; aspect-ratio: 1/1; object-fit: cover"
:style="{ borderRadius: isRoom ? '0' : '50%' }" :style="{ borderRadius: Type == 'Room' ? '0' : '50%' }"
@error="defaultAvatarUrl" @error="defaultAvatarUrl"
/> />
</div> </div>
</div> </div>
<!-- 用户名和贡献值 --> <!-- 用户名和贡献值 -->
<div <div
style=" style="
@ -40,13 +41,13 @@
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
height: 40%;
z-index: 3; z-index: 3;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
" "
:style="InfoBoxHeight"
> >
<div <div
style=" style="
@ -63,6 +64,7 @@
</div> </div>
<div style="width: 60%; position: relative"> <div style="width: 60%; position: relative">
<img <img
v-smart-img
src="/src/assets/images/Ranking/coinNumBg.png" src="/src/assets/images/Ranking/coinNumBg.png"
alt="" alt=""
width="100%" width="100%"
@ -71,7 +73,13 @@
<div <div
style="position: absolute; inset: 0; display: flex; align-items: center; padding: 3% 5%" style="position: absolute; inset: 0; display: flex; align-items: center; padding: 3% 5%"
> >
<img src="/src/assets/icon/coin.png" alt="" width="25%" style="display: block" /> <img
v-smart-img
src="/src/assets/icon/coin.png"
alt=""
width="25%"
style="display: block"
/>
<div <div
style=" style="
font-weight: 700; font-weight: 700;
@ -93,12 +101,12 @@
</template> </template>
<script setup> <script setup>
import { watch } from 'vue' import { computed, watch } from 'vue'
const props = defineProps({ const props = defineProps({
isRoom: { Type: {
type: Boolean, type: Boolean,
default: false, default: '',
}, },
isTopOne: { isTopOne: {
@ -128,12 +136,58 @@ const props = defineProps({
}) })
watch( watch(
() => props.isRoom, () => props.Type,
(newVal, oldVal) => { (newVal, oldVal) => {
console.log('isRoom 变化 =>', '新值:', newVal, '旧值:', oldVal) console.log('Type 变化 =>', '新值:', newVal, '旧值:', oldVal)
} }
) )
//
const avatarBoxHeight = computed(() => {
if (props.Type == 'Wealth') {
if (props.isTopOne) {
return `height:60%`
} else {
return `height:60%`
}
} else if (props.Type == 'Charm') {
if (props.isTopOne) {
return `height:55%`
} else {
return `height:60%`
}
} else if (props.Type == 'Room') {
if (props.isTopOne) {
return `height:50%`
} else {
return `height:55%`
}
}
})
//
const InfoBoxHeight = computed(() => {
if (props.Type == 'Wealth') {
if (props.isTopOne) {
return `height:40%`
} else {
return `height:40%`
}
} else if (props.Type == 'Charm') {
if (props.isTopOne) {
return `height:42%`
} else {
return `height:41%`
}
} else if (props.Type == 'Room') {
if (props.isTopOne) {
return `height:45%`
} else {
return `height:42%`
}
}
})
const defaultAvatarUrl = (e) => { const defaultAvatarUrl = (e) => {
console.log('头像资源出错') console.log('头像资源出错')
e.target.onerror = null // e.target.onerror = null //
@ -171,7 +225,7 @@ const defaultAvatarUrl = (e) => {
@media screen and (min-width: 360px) { @media screen and (min-width: 360px) {
* { * {
font-size: 14px; font-size: 12px;
} }
} }