feat: click avatar

This commit is contained in:
KUN1007 2023-10-13 19:13:46 +08:00
parent 288c428a48
commit 480685d6d2
20 changed files with 76 additions and 74 deletions

View file

@ -74,9 +74,9 @@ onBeforeRouteLeave(() => {
<ul> <ul>
<!-- 顶部单个板块 --> <!-- 顶部单个板块 -->
<li v-for="kun in topBarItem" :key="kun.index"> <li v-for="kun in topBarItem" :key="kun.index">
<router-link :to="{ path: kun.router }"> <RouterLink :to="{ path: kun.router }">
{{ $tm(`header['${kun.name}']`) }} {{ $tm(`header['${kun.name}']`) }}
</router-link> </RouterLink>
</li> </li>
<!-- 顶部板块下部的 hover 效果 --> <!-- 顶部板块下部的 hover 效果 -->
<div class="box"></div> <div class="box"></div>

View file

@ -1,3 +1,7 @@
/**
*
*/
import { type App } from 'vue' import { type App } from 'vue'
// 图片点击放大指令 // 图片点击放大指令
import { zoom } from './zoom/zoom' import { zoom } from './zoom/zoom'

View file

@ -10,8 +10,6 @@ import i18n from '@/language/i18n'
import { setupRouterGuard } from '@/router/guard' import { setupRouterGuard } from '@/router/guard'
// 引入 pinia // 引入 pinia
import { setupPinia } from '@/store/index' import { setupPinia } from '@/store/index'
// directives
// import { setupKUNGalgameDirectives } from '@/directives'
// 引入样式 // 引入样式
import '@/styles/index.scss' import '@/styles/index.scss'
@ -22,7 +20,5 @@ const app = createApp(App)
setupRouterGuard(router) setupRouterGuard(router)
// 使用 pinia // 使用 pinia
setupPinia(app) setupPinia(app)
// 自定义指令
// setupKUNGalgameDirectives(app)
app.use(router).use(i18n).mount('#app') app.use(router).use(i18n).mount('#app')

View file

@ -7,7 +7,7 @@
<div class="container"> <div class="container">
<p>403</p> <p>403</p>
<p>您没有权限访问该界面</p> <p>您没有权限访问该界面</p>
<button><router-link to="/kun">点击返回主页</router-link></button> <button><RouterLink to="/kun">点击返回主页</RouterLink></button>
</div> </div>
</div> </div>
</template> </template>

View file

@ -7,7 +7,7 @@
<div class="container"> <div class="container">
<p>404</p> <p>404</p>
<p>您访问了一个不存在的页面</p> <p>您访问了一个不存在的页面</p>
<button><router-link to="/kun">点击返回主页</router-link></button> <button><RouterLink to="/kun">点击返回主页</RouterLink></button>
</div> </div>
</div> </div>
</template> </template>

View file

@ -13,9 +13,9 @@ const props = defineProps<{
<div class="topic"> <div class="topic">
<UserPart :user="props.topic.user" /> <UserPart :user="props.topic.user" />
<!-- 进入指定话题的路由 --> <!-- 进入指定话题的路由 -->
<router-link :to="`/topic/${props.topic.tid}`"> <RouterLink :to="`/topic/${props.topic.tid}`">
<TopicPart :topic="props.topic" /> <TopicPart :topic="props.topic" />
</router-link> </RouterLink>
</div> </div>
</template> </template>

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
defineProps<{ const props = defineProps<{
user: { user: {
uid: number uid: number
avatar: string avatar: string
@ -14,38 +14,35 @@ defineProps<{
<!-- 发布者头像 --> <!-- 发布者头像 -->
<div class="avatar"> <div class="avatar">
<!-- TODO: 这里换成后端的用户图片接口我不想用 express 雕花了 --> <!-- TODO: 这里换成后端的用户图片接口我不想用 express 雕花了 -->
<!-- <a href="#"><img :src="$props.kungalgamer.avatar" alt="鲲" /></a> --> <RouterLink :to="`/kungalgamer/${props.user.uid}/info`">
<a href="#"><img src="@/assets/images/topic.jpg" alt="鲲" /></a> <img src="@/assets/images/topic.jpg" :alt="props.user.name" />
</RouterLink>
</div> </div>
<!-- 发布者姓名 --> <!-- 发布者姓名 -->
<div class="name"> <div class="name">
<a href="#" <span>{{ props.user.name }}</span>
><span>{{ $props.user.name }}</span></a
>
</div> </div>
</div> </div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
/* 发帖人信息 */
.kungalgamer { .kungalgamer {
width: 60px; width: 60px;
height: 100%; height: 100%;
/* 单个话题左右两部分发布人信息和话题概览均为竖向弹性盒 */
display: flex; display: flex;
flex-shrink: 0; flex-shrink: 0;
flex-direction: column; flex-direction: column;
/* 发帖人信息距离话题概览的距离 */
margin: 0 5px; margin: 0 5px;
} }
.avatar, .avatar,
.name { .name {
width: 100%; width: 100%;
height: 1px; height: calc(100% - 20px);
} }
/* 头像图片容器设置 */
.avatar { .avatar {
/* 头像部分占发布人信息区域的比例 */ flex-grow: 1;
flex-grow: 3;
display: flex; display: flex;
justify-content: center; justify-content: center;
a { a {
@ -64,25 +61,19 @@ defineProps<{
/* 发帖人昵称位置设置 */ /* 发帖人昵称位置设置 */
.name { .name {
flex-grow: 1; height: 10px;
display: flex; display: flex;
}
.name a {
display: flex;
width: 1px;
flex-grow: 1;
align-items: center;
justify-content: center; justify-content: center;
} align-items: center;
/* 发帖人昵称样式设置 */ span {
.name span { /* 页面缩小时省略不换行 */
/* 页面缩小时省略不换行 */ display: inline-block;
display: inline-block; overflow: hidden;
overflow: hidden; white-space: nowrap;
white-space: nowrap; text-overflow: ellipsis;
text-overflow: ellipsis; /* 颜色和字体大小 */
/* 颜色和字体大小 */ color: var(--kungalgame-font-color-3);
color: var(--kungalgame-font-color-3); font-size: x-small;
font-size: x-small; }
} }
</style> </style>

View file

@ -7,9 +7,9 @@ import asideItem from './asideItem'
<div class="aside"> <div class="aside">
<!-- 顶部单个板块 --> <!-- 顶部单个板块 -->
<span v-for="kun in asideItem" :key="kun.index"> <span v-for="kun in asideItem" :key="kun.index">
<router-link :to="{ path: kun.router }">{{ <RouterLink :to="{ path: kun.router }">{{
$tm(`mainPage.asideActive['${kun.name}']`) $tm(`mainPage.asideActive['${kun.name}']`)
}}</router-link> }}</RouterLink>
</span> </span>
</div> </div>
</template> </template>

View file

@ -13,19 +13,19 @@ const props = defineProps(['isActive'])
<!-- 发布新文章 --> <!-- 发布新文章 -->
<div class="new-article"> <div class="new-article">
<!-- 发布新文章的按钮 --> <!-- 发布新文章的按钮 -->
<router-link to="/edit/index"> <RouterLink to="/edit/index">
<button class="btn-new-article"> <button class="btn-new-article">
{{ $tm('mainPage.asideActive.create') }} {{ $tm('mainPage.asideActive.create') }}
</button> </button>
</router-link> </RouterLink>
</div> </div>
<!-- 功能盒子容器 --> <!-- 功能盒子容器 -->
<div class="item-box-container"> <div class="item-box-container">
<!-- 侧边栏单个项目 --> <!-- 侧边栏单个项目 -->
<span v-for="kun in asideItem" :key="kun.index"> <span v-for="kun in asideItem" :key="kun.index">
<router-link :to="{ path: kun.router }">{{ <RouterLink :to="{ path: kun.router }">{{
$tm(`mainPage.asideActive['${kun.name}']`) $tm(`mainPage.asideActive['${kun.name}']`)
}}</router-link> }}</RouterLink>
</span> </span>
</div> </div>
</div> </div>

View file

@ -37,7 +37,7 @@ onMounted(async () => {
<!-- 热门话题的目录 --> <!-- 热门话题的目录 -->
<!-- 这里使用了父组件传过来的 isHotTopic 数据 --> <!-- 这里使用了父组件传过来的 isHotTopic 数据 -->
<span class="topic-content hot-bg" v-for="kun in navHotTopic"> <span class="topic-content hot-bg" v-for="kun in navHotTopic">
<router-link :to="{ path: `/topic/${kun.tid}` }"> <RouterLink :to="{ path: `/topic/${kun.tid}` }">
<div class="topic"> <div class="topic">
<div class="title">{{ kun.title }}</div> <div class="title">{{ kun.title }}</div>
<div class="hot"> <div class="hot">
@ -46,7 +46,7 @@ onMounted(async () => {
<span>{{ Math.ceil(kun.popularity) }}</span> <span>{{ Math.ceil(kun.popularity) }}</span>
</div> </div>
</div> </div>
</router-link> </RouterLink>
</span> </span>
<!-- 今日最新话题 --> <!-- 今日最新话题 -->
@ -54,7 +54,7 @@ onMounted(async () => {
{{ $tm(`mainPage.asideActive.new`) }} {{ $tm(`mainPage.asideActive.new`) }}
</div> </div>
<span class="topic-content new-bg" v-for="kun in navNewTopic"> <span class="topic-content new-bg" v-for="kun in navNewTopic">
<router-link :to="{ path: `/topic/${kun.tid}` }"> <RouterLink :to="{ path: `/topic/${kun.tid}` }">
<div class="topic"> <div class="topic">
<div class="title">{{ kun.title }}</div> <div class="title">{{ kun.title }}</div>
<div class="new"> <div class="new">
@ -67,7 +67,7 @@ onMounted(async () => {
}}</span> }}</span>
</div> </div>
</div> </div>
</router-link> </RouterLink>
</span> </span>
</div> </div>
</template> </template>

View file

@ -10,8 +10,8 @@ import KUNGalgameFooter from '@/components/KUNGalgameFooter.vue'
赞助我们<span>没有任何的萌萌点奖励</span>不过可以帮我们缓解一部分服务器的费用您确定要赞助吗 赞助我们<span>没有任何的萌萌点奖励</span>不过可以帮我们缓解一部分服务器的费用您确定要赞助吗
</p> </p>
<div class="btn"> <div class="btn">
<router-link to="/">确定赞助</router-link> <RouterLink to="/">确定赞助</RouterLink>
<router-link to="/">返回主页</router-link> <RouterLink to="/">返回主页</RouterLink>
</div> </div>
</div> </div>
<!-- 版权 --> <!-- 版权 -->

View file

@ -27,9 +27,9 @@ const asideBarItem: asideBar[] = [
<li>运营理念</li> <li>运营理念</li>
<li>论坛规定</li> <li>论坛规定</li>
<li class="skip" v-for="kun in asideBarItem" :key="kun.index"> <li class="skip" v-for="kun in asideBarItem" :key="kun.index">
<router-link style="color: #218bff" :to="{ path: kun.router }">{{ <RouterLink style="color: #218bff" :to="{ path: kun.router }">{{
kun.name kun.name
}}</router-link> }}</RouterLink>
</li> </li>
</ul> </ul>
</div> </div>

View file

@ -39,9 +39,9 @@ onMounted(() => {
:class="activeClass(currentPageUid, kun.router)" :class="activeClass(currentPageUid, kun.router)"
v-show="isShowNavItem(kun.permission)" v-show="isShowNavItem(kun.permission)"
> >
<router-link :to="`/kungalgamer/${currentPageUid}/${kun.router}`"> <RouterLink :to="`/kungalgamer/${currentPageUid}/${kun.router}`">
<span>{{ kun.name }}</span> <span>{{ kun.name }}</span>
</router-link> </RouterLink>
</div> </div>
</div> </div>
</template> </template>

View file

@ -181,13 +181,13 @@ const handleRegister = async () => {
<!-- 用户协议和隐私政策 --> <!-- 用户协议和隐私政策 -->
<div class="licence"> <div class="licence">
<router-link to="/agreement"> <RouterLink to="/agreement">
<span>{{ $tm('login.register.agreement') }}</span> <span>{{ $tm('login.register.agreement') }}</span>
</router-link> </RouterLink>
{{ $tm('login.register.and') }} {{ $tm('login.register.and') }}
<router-link to="/privacy"> <RouterLink to="/privacy">
<span>{{ $tm('login.register.privacy') }}</span> <span>{{ $tm('login.register.privacy') }}</span>
</router-link> </RouterLink>
</div> </div>
</span> </span>
</div> </div>

View file

@ -54,13 +54,15 @@ import { onMounted, watch } from 'vue'
<!-- 话题的状态 --> <!-- 话题的状态 -->
<div class="status"> <div class="status">
<!-- 浏览数 --> <!-- 浏览数 -->
<span <span>
><Icon icon="ic:outline-remove-red-eye" />{{ props.data.view }}</span <Icon icon="ic:outline-remove-red-eye" />
> {{ props.data.view }}
</span>
<!-- 点赞数 --> <!-- 点赞数 -->
<span <span>
><Icon icon="line-md:thumbs-up-twotone" />{{ props.data.like }}</span <Icon icon="line-md:thumbs-up-twotone" />
> {{ props.data.like }}
</span>
</div> </div>
<!-- 发帖时间 --> <!-- 发帖时间 -->
<div class="time"> <div class="time">

View file

@ -12,9 +12,9 @@ import { tagsList } from './tags'
<ul class="tags"> <ul class="tags">
<!-- 单个标签最大输入文字为 10 --> <!-- 单个标签最大输入文字为 10 -->
<li v-for="kun in tagsList" :key="kun.index"> <li v-for="kun in tagsList" :key="kun.index">
<Icon class="icon" icon="ant-design:tag-twotone" /><router-link <Icon class="icon" icon="ant-design:tag-twotone" /><RouterLink
:to="kun.router" :to="kun.router"
>{{ kun.data }}</router-link >{{ kun.data }}</RouterLink
> >
</li> </li>
</ul> </ul>

View file

@ -38,7 +38,7 @@ onMounted(async () => {
{{ $tm('topic.aside.master') }} {{ $tm('topic.aside.master') }}
</div> </div>
<div class="topic" v-for="(kun, index) in topicData" :key="index"> <div class="topic" v-for="(kun, index) in topicData" :key="index">
<router-link :to="`/topic/${kun.tid}`">{{ kun.title }}</router-link> <RouterLink :to="`/topic/${kun.tid}`">{{ kun.title }}</RouterLink>
</div> </div>
</div> </div>
</template> </template>

View file

@ -43,7 +43,7 @@ onMounted(async () => {
{{ $tm('topic.aside.tags') }} {{ $tm('topic.aside.tags') }}
</div> </div>
<div class="topic" v-for="(kun, index) in topicData" :key="index"> <div class="topic" v-for="(kun, index) in topicData" :key="index">
<router-link :to="`/topic/${kun.tid}`">{{ kun.title }}</router-link> <RouterLink :to="`/topic/${kun.tid}`">{{ kun.title }}</RouterLink>
</div> </div>
</div> </div>
</template> </template>

View file

@ -1,5 +1,6 @@
<!-- 这个部分为发帖人的个人信息展示部分 --> <!-- 这个部分为发帖人的个人信息展示部分 -->
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'
const props = defineProps<{ const props = defineProps<{
user: { user: {
uid: number uid: number
@ -8,6 +9,8 @@ const props = defineProps<{
moemoepoint: number moemoepoint: number
} }
}>() }>()
const user = computed(() => props.user)
</script> </script>
<template> <template>
@ -16,11 +19,15 @@ const props = defineProps<{
<!-- 头像 --> <!-- 头像 -->
<div class="avatar"> <div class="avatar">
<!-- 头像图片 TODO: --> <!-- 头像图片 TODO: -->
<img src="@/assets/images/KUN.jpg" alt="KUN" /> <RouterLink :to="`/kungalgamer/${user.uid}/info`">
<img src="@/assets/images/KUN.jpg" alt="KUN" />
</RouterLink>
</div> </div>
<div class="info"> <div class="info">
<!-- 名字 --> <!-- 名字 -->
<div class="name">{{ user.name }}</div> <div class="name">
{{ user.name }}
</div>
<!-- 萌萌点 --> <!-- 萌萌点 -->
<div class="moemoepoint">{{ user.moemoepoint }}</div> <div class="moemoepoint">{{ user.moemoepoint }}</div>
</div> </div>

View file

@ -104,7 +104,9 @@ const handleClickComment = (
:key="index" :key="index"
> >
<!-- 用户头像 TODO: --> <!-- 用户头像 TODO: -->
<img src="@/assets/images/KUN.jpg" alt="KUN" /> <RouterLink :to="`/kungalgamer/${comment.c_user.uid}/info`">
<img src="@/assets/images/KUN.jpg" alt="KUN" />
</RouterLink>
<!-- 单个评论的内容区 --> <!-- 单个评论的内容区 -->
<div class="content"> <div class="content">
<!-- 单个评论内容区顶部 --> <!-- 单个评论内容区顶部 -->