🚸 调整参数,处理点击事件

This commit is contained in:
BTMuli
2026-03-14 13:25:34 +08:00
parent 3537751d65
commit d8f4a4c2bf
11 changed files with 64 additions and 41 deletions

View File

@@ -1,3 +1,4 @@
<!-- 头像组件 -->
<template>
<div class="tp-avatar-box">
<div class="tpa-img">
@@ -48,7 +49,7 @@ const levelColor = computed<string>(() => {
return "var(--tgc-od-white)";
});
</script>
<style lang="css" scoped>
<style lang="scss" scoped>
.tp-avatar-box {
display: flex;
overflow: hidden;
@@ -57,6 +58,7 @@ const levelColor = computed<string>(() => {
flex-direction: v-bind("props.position === 'left' ? 'row' : 'row-reverse'");
align-items: center;
justify-content: v-bind("props.position === 'left' ? 'flex-start' : 'flex-end'");
cursor: pointer;
}
.tpa-text {

View File

@@ -11,10 +11,11 @@
<span>加载中...</span>
</div>
<TPostcard
v-for="(item, index) in postList"
v-for="(post, index) in postList"
:key="index"
:class="{ selected: index === props.collection.cur - 1 }"
:model-value="item"
:post
@onUserClick="toUserProfile"
class="tpoc-item"
/>
</div>
@@ -69,6 +70,13 @@ async function refreshPosts(): Promise<void> {
async function toOuterCollect(): Promise<void> {
await openUrl(`https://www.miyoushe.com/ys/collection/${props.collection.collection_id}`);
}
async function toUserProfile(user: TGApp.BBS.Post.User, gid: number): Promise<void> {
// TODO: 专门的个人页面
console.log(user, gid);
const profileUrl = `https://www.miyoushe.com/ys/accountCenter/postList?id=${user.uid}`;
await openUrl(profileUrl);
}
</script>
<style lang="scss" scoped>
.tpoc-box {

View File

@@ -13,9 +13,9 @@
</div>
<div ref="listRef" class="vp-of-list">
<TPostcard
v-for="(item, index) in posts"
:key="index"
:model-value="item"
v-for="post in posts"
:key="post.post.post_id"
:post
class="vp-of-list-item"
@onUserClick="toUserProfile"
/>

View File

@@ -6,7 +6,7 @@
<span>{{ timeStatus }}</span>
</div>
<div class="tpol-info">
<TpAvatar :data="card.creator" position="left" />
<TpAvatar @click="toUserProfile(card.creator.uid)" :data="card.creator" position="left" />
<div>参与方式{{ upWay }}</div>
<div>奖品详情</div>
<div v-for="reward in card.rewards" :key="reward.name" class="tpol-info-reward">
@@ -41,6 +41,7 @@ import showSnackbar from "@comp/func/snackbar.js";
import TpAvatar from "@comp/viewPost/tp-avatar.vue";
import painterReq from "@req/painterReq.js";
import { emit } from "@tauri-apps/api/event";
import { openUrl } from "@tauri-apps/plugin-opener";
import { generateShareImg } from "@utils/TGShare.js";
import { stamp2LastTime } from "@utils/toolFunc.js";
import { onUnmounted, ref, shallowRef, watch } from "vue";
@@ -155,6 +156,12 @@ async function shareLottery(): Promise<void> {
await generateShareImg(fileName, shareDom, 2, true);
}
async function toUserProfile(uid: string): Promise<void> {
// TODO: 专门的个人页面
const profileUrl = `https://www.miyoushe.com/ys/accountCenter/postList?id=${uid}`;
await openUrl(profileUrl);
}
onUnmounted(() => {
if (timer !== undefined) {
clearInterval(timer);

View File

@@ -24,9 +24,10 @@
<div class="tops-divider" />
<div ref="listRef" class="tops-list">
<TPostCard
v-for="item in results"
:key="item.post.post_id"
:model-value="item"
v-for="post in results"
:key="post.post.post_id"
:post
@onUserClick="toUserProfile"
class="tops-item"
/>
</div>
@@ -40,6 +41,7 @@ import showSnackbar from "@comp/func/snackbar.js";
import { useBoxReachBottom } from "@hooks/reachBottom.js";
import postReq from "@req/postReq.js";
import useBBSStore from "@store/bbs.js";
import { openUrl } from "@tauri-apps/plugin-opener";
import { storeToRefs } from "pinia";
import { computed, onMounted, ref, shallowRef, useTemplateRef, watch } from "vue";
@@ -160,6 +162,13 @@ async function searchPosts(): Promise<void> {
if (!visible.value) visible.value = true;
showSnackbar.success(`成功加载${res.posts.length}条数据`);
}
async function toUserProfile(user: TGApp.BBS.Post.User, gid: number): Promise<void> {
// TODO: 专门的个人页面
console.log(user, gid);
const profileUrl = `https://www.miyoushe.com/ys/accountCenter/postList?id=${user.uid}`;
await openUrl(profileUrl);
}
</script>
<style lang="css" scoped>
.tops-box {

View File

@@ -30,9 +30,10 @@
<div class="vp-ou-divider" />
<div ref="listRef" class="vp-ou-list">
<TPostCard
v-for="item in results"
:key="item.post.post_id"
:model-value="item"
@onUserClick="toUserProfile()"
v-for="post in results"
:key="post.post.post_id"
:post
class="vp-ou-item"
/>
</div>