feat(排行榜): 对接跳转app页面功能

This commit is contained in:
hzj 2025-10-24 20:13:02 +08:00
parent 33fc99af0f
commit 10ec5c4322
4 changed files with 28 additions and 3 deletions

View File

@ -69,7 +69,7 @@ export function gotoPrivateChat(userId) {
/** /**
* 查看个人页面 * 查看个人页面
*/ */
export function gotoUserInfo(userId) { export function viewUserInfo(userId) {
try { try {
window.FlutterPageControl.postMessage(`view_user_info:${userId}`) window.FlutterPageControl.postMessage(`view_user_info:${userId}`)
} catch (error) { } catch (error) {

View File

@ -115,6 +115,7 @@
:name="RankingTop3[0].nickname || ''" :name="RankingTop3[0].nickname || ''"
:distributionValue="RankingTop3[0].quantityFormat || ''" :distributionValue="RankingTop3[0].quantityFormat || ''"
style="width: 40%" style="width: 40%"
@click="gotoAppPage(RankingTop3[0].id)"
/> />
</div> </div>
<!-- 第二三 --> <!-- 第二三 -->
@ -126,6 +127,7 @@
:name="RankingTop3[1].nickname || ''" :name="RankingTop3[1].nickname || ''"
:distributionValue="RankingTop3[1].quantityFormat || ''" :distributionValue="RankingTop3[1].quantityFormat || ''"
style="width: 30%" style="width: 30%"
@click="gotoAppPage(RankingTop3[1].id)"
/> />
<TopUser <TopUser
:isRoom="rankingType === 'Room'" :isRoom="rankingType === 'Room'"
@ -134,6 +136,7 @@
:name="RankingTop3[2].nickname || ''" :name="RankingTop3[2].nickname || ''"
:distributionValue="RankingTop3[2].quantityFormat || ''" :distributionValue="RankingTop3[2].quantityFormat || ''"
style="width: 30%" style="width: 30%"
@click="gotoAppPage(RankingTop3[2].id)"
/> />
</div> </div>
</div> </div>
@ -153,6 +156,7 @@
align-items: center; align-items: center;
" "
:style="{ background: rankItemBackground, border: '1px ' + rankItemBorder }" :style="{ background: rankItemBackground, border: '1px ' + rankItemBorder }"
@click="gotoAppPage(userInfo.id)"
> >
<div style="display: flex; align-items: center; width: 70%"> <div style="display: flex; align-items: center; width: 70%">
<div style="font-weight: 700">{{ index + 4 }}</div> <div style="font-weight: 700">{{ index + 4 }}</div>
@ -269,7 +273,7 @@
</template> </template>
<script setup> <script setup>
import { isInApp, closePage } from '@/utils/appBridge.js' import { isInApp, closePage, viewUserInfo, gotoRoom } from '@/utils/appBridge.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 TopUser from '@/components/Ranking/topUser.vue'
import { getWealthRanking, getCharmRanking, getRoomRanking, getMyRanking } from '@/api/ranking' import { getWealthRanking, getCharmRanking, getRoomRanking, getMyRanking } from '@/api/ranking'
@ -454,6 +458,17 @@ const observer = new IntersectionObserver((entries) => {
}) })
}) })
// app
const gotoAppPage = (item) => {
if (isInAppEnvironment.value) {
if (rankingType.value == 'Room') {
gotoRoom(item.id)
} else {
viewUserInfo(item.id)
}
}
}
// //
const getRanking = async () => { const getRanking = async () => {
console.log('获取榜单') console.log('获取榜单')

View File

@ -193,6 +193,7 @@
style="margin: -2px 0; position: relative" style="margin: -2px 0; position: relative"
v-for="(listItem, index) in topList" v-for="(listItem, index) in topList"
:key="index" :key="index"
@click="viewUserInfo(listItem.userId)"
> >
<img :src="images['border-item-user']" alt="" style="width: 100%; display: block" /> <img :src="images['border-item-user']" alt="" style="width: 100%; display: block" />
<div <div
@ -617,6 +618,7 @@ import {
parseHeader, parseHeader,
setHttpHeaders, setHttpHeaders,
isInApp, isInApp,
viewUserInfo,
} from '@/utils/appBridge.js' } from '@/utils/appBridge.js'
import { import {
appConnectionManager, appConnectionManager,

View File

@ -115,6 +115,7 @@
:name="RankingHasTop3[0].userNickname" :name="RankingHasTop3[0].userNickname"
:distributionValue="RankingHasTop3[0].quantity" :distributionValue="RankingHasTop3[0].quantity"
style="width: 70%" style="width: 70%"
@click="viewUserInfo(RankingHasTop3[0].userId)"
/> />
</div> </div>
<!-- 第二三 --> <!-- 第二三 -->
@ -126,6 +127,7 @@
:name="RankingHasTop3[1].userNickname" :name="RankingHasTop3[1].userNickname"
:distributionValue="RankingHasTop3[1].quantity" :distributionValue="RankingHasTop3[1].quantity"
style="width: 35%" style="width: 35%"
@click="viewUserInfo(RankingHasTop3[1].userId)"
/> />
<TopUser <TopUser
:isTopOne="false" :isTopOne="false"
@ -134,12 +136,17 @@
:name="RankingHasTop3[2].userNickname" :name="RankingHasTop3[2].userNickname"
:distributionValue="RankingHasTop3[2].quantity" :distributionValue="RankingHasTop3[2].quantity"
style="width: 35%" style="width: 35%"
@click="viewUserInfo(RankingHasTop3[2].userId)"
/> />
</div> </div>
</div> </div>
<!-- 第四名开始 --> <!-- 第四名开始 -->
<div v-for="listItem in showRanking" style="margin-top: 3%; position: relative"> <div
v-for="listItem in showRanking"
style="margin-top: 3%; position: relative"
@click="viewUserInfo(listItem.userId)"
>
<img :src="images.itemUser" alt="" width="100%;" style="display: block" /> <img :src="images.itemUser" alt="" width="100%;" style="display: block" />
<div <div
style=" style="
@ -753,6 +760,7 @@ import {
parseHeader, parseHeader,
setHttpHeaders, setHttpHeaders,
isInApp, isInApp,
viewUserInfo,
} from '@/utils/appBridge.js' } from '@/utils/appBridge.js'
import { import {
appConnectionManager, appConnectionManager,