Commit 3c0d6c77 by lijiabin

【需求 20331】 feat: 修改为 实践、专访、问吧都是实名

parent 824dd21f
......@@ -2,7 +2,7 @@
<div
class="p-6 bg-white backdrop-blur-sm rounded-lg shadow-sm border border-white/50 overflow-hidden"
>
<el-skeleton :rows="5" animated :loading="loading" :throttle="{ leading: 0, trailing: 1500 }">
<el-skeleton :rows="5" animated :loading="loading" :throttle="{ leading: 0, trailing: 300 }">
<template #template>
<!-- 发布者信息 -->
<div class="border-b border-gray-100 pb-0">
......@@ -94,11 +94,8 @@
class="w-12 h-12 rounded-full object-cover cursor-pointer"
@click="
jumpToUserHomePage({
userId: articleDetail?.createUserId,
isReal:
articleDetail.type === 'practice' || articleDetail.type === 'interview'
? 1
: 0,
userId: articleDetail.createUserId,
type: articleDetail.type,
})
"
/>
......@@ -253,6 +250,7 @@ const { articleDetail } = defineProps<{
articleDetail: ArticleItemDto
isAudit: boolean // 是否是审核页面
}>()
console.log(typeof articleDetail, 111)
const articleType = computed(() => {
return articleTypeListOptions.find((item) => item.value === articleDetail.type)?.label
})
......
......@@ -64,7 +64,7 @@
:src="userAvatar"
alt=""
class="w-10 h-10 rounded-full object-cover cursor-pointer"
@click="jumpToUserHomePage({ userId: userInfo.userId, isReal: 0 })"
@click="jumpToUserHomePage({ userId: userInfo.userId, type })"
/>
<CommentBox
v-model:inputText="myComment"
......@@ -99,7 +99,7 @@
<div class="p-4 transition-colors">
<div class="flex gap-3">
<img
@click="jumpToUserHomePage({ userId: item.userId, isReal: isReal })"
@click="jumpToUserHomePage({ userId: item.userId, type })"
:src="item.avatar"
alt=""
class="w-10 h-10 rounded-full object-cover cursor-pointer"
......@@ -176,7 +176,7 @@
class="flex gap-2 p-3 rounded-lg"
>
<img
@click="jumpToUserHomePage({ userId: child.userId, isReal: isReal })"
@click="jumpToUserHomePage({ userId: child.userId, type })"
:src="child.avatar"
alt=""
class="w-8 h-8 rounded-full object-cover cursor-pointer"
......@@ -299,7 +299,7 @@
:src="userAvatar"
alt=""
class="w-10 h-10 rounded-full object-cover cursor-pointer"
@click="jumpToUserHomePage({ userId: userInfo.userId, isReal: isReal })"
@click="jumpToUserHomePage({ userId: userInfo.userId, type })"
/>
<CommentBox
v-model:inputText="commentToOther"
......@@ -347,7 +347,7 @@
<CommentListDialog ref="commentListDialogRef" :articleId="id" :pid="currentDialogCommentPid" />
</div>
</template>
<script lang="ts" setup>
<script setup lang="ts">
import {
getCommentList,
addOrCancelCommentLike,
......@@ -356,7 +356,7 @@ import {
getSecondCommentList,
} from '@/api'
import { usePageSearch, useScrollTop } from '@/hooks'
import { BooleanFlag } from '@/constants'
import { ArticleTypeEnum, BooleanFlag } from '@/constants'
import type { CommentItemDto } from '@/api'
import { useUserStore } from '@/stores'
import { storeToRefs } from 'pinia'
......@@ -369,17 +369,17 @@ import dayjs from 'dayjs'
const {
id,
defaultSize = 10,
isReal,
immediate = true,
isQuestion = false,
commentId = 0,
type,
} = defineProps<{
id: number // 文章ID
defaultSize?: number
isReal: BooleanFlag
isQuestion?: boolean // 如果是问题的话 展示有点不一样
immediate?: boolean
commentId?: number // 如果是问题的话 需要传入评论id
type: ArticleTypeEnum
}>()
const emit = defineEmits<{
......@@ -390,7 +390,15 @@ const total = defineModel<number>('total', { required: true, default: 0 })
const userStore = useUserStore()
const { userInfo } = storeToRefs(userStore)
const userAvatar = computed(() => (isReal ? userInfo.value.avatar : userInfo.value.hiddenAvatar))
const isReal = computed(
() =>
type === ArticleTypeEnum.PRACTICE ||
type === ArticleTypeEnum.INTERVIEW ||
type === ArticleTypeEnum.QUESTION,
)
const userAvatar = computed(() =>
isReal.value ? userInfo.value.avatar : userInfo.value.hiddenAvatar,
)
const commentRef = useTemplateRef<HTMLElement | null>('commentRef')
const commentListDialogRef = useTemplateRef<typeof CommentListDialog>('commentListDialogRef')
const replyToOtherBoxRefList = ref<HTMLElement[]>([])
......
......@@ -133,21 +133,16 @@ import { ArticleTypeEnum, ReleaseStatusTypeEnum, SendTypeEnum } from '@/constant
import { useTagsStore } from '@/stores'
import { addOrUpdatePractice, addOrUpdateArticle } from '@/api'
import type { AddOrUpdatePracticeDto } from '@/api'
import type { BooleanFlag } from '@/constants'
import type { ElButton } from 'element-plus'
import { useAnimate } from '@vueuse/core'
import RichTextarea from '../RichTextarea/index.vue'
import UploadImgIcon from '../UploadImgIcon/index.vue'
// 暂时只有 问吧 和 实践 需要发布框 这俩都需要实名
type ArticleType = ArticleTypeEnum.QUESTION | ArticleTypeEnum.PRACTICE
const {
type,
isReal,
maxLength = 500,
} = defineProps<{
const { type, maxLength = 500 } = defineProps<{
type: ArticleType
isReal: BooleanFlag
maxLength?: number
}>()
......@@ -174,7 +169,14 @@ const { tagList } = storeToRefs(tagsStore)
const userStore = useUserStore()
const { userInfo } = storeToRefs(userStore)
const userAvatar = computed(() => (isReal ? userInfo.value.avatar : userInfo.value.hiddenAvatar))
// 问吧 和 实践 需要实名 后续如果要改在这里改
const isReal = computed(
() => type === ArticleTypeEnum.PRACTICE || type === ArticleTypeEnum.QUESTION,
)
const userAvatar = computed(() =>
isReal.value ? userInfo.value.avatar : userInfo.value.hiddenAvatar,
)
const selectTagsDialogRef =
useTemplateRef<InstanceType<typeof SelectTagsDialog>>('selectTagsDialogRef')
......
import { ArticleTypeEnum, BooleanFlag } from '@/constants'
import { ArticleTypeEnum } from '@/constants'
import { useUserStore } from '@/stores'
import { storeToRefs } from 'pinia'
/**
......@@ -63,14 +63,22 @@ export function isCulturePath() {
return path.includes('/culture')
}
// 点击头像跳转用户首页
export function jumpToUserHomePage({ userId, isReal }: { userId: string; isReal: BooleanFlag }) {
// 点击头像跳转用户首页 【实践 专访 问吧】 是 1 实名 其他是 0 匿名
export function jumpToUserHomePage({ userId, type }: { userId: string; type: ArticleTypeEnum }) {
const userStore = useUserStore()
const { userInfo } = storeToRefs(userStore)
const isSelf = userInfo.value.userId === userId
if (isSelf) {
window.open(`/userPage/selfPublish`)
} else {
let isReal = 0
if (
type === ArticleTypeEnum.PRACTICE ||
type === ArticleTypeEnum.INTERVIEW ||
type === ArticleTypeEnum.QUESTION
) {
isReal = 1
}
window.open(`/otherUserPage/${userId}/${isReal}`)
}
}
......
......@@ -15,7 +15,7 @@
ref="commentRef"
:id="id"
v-model:total="articleDetail.replyCount"
:isReal="isReal"
:type="articleDetail.type"
/>
</div>
</div>
......@@ -26,18 +26,11 @@ import { getArticleDetail, type ArticleItemDto } from '@/api'
import ActionButtons from './components/actionButtons.vue'
import Comment from '@/components/common/Comment/index.vue'
import ArticleContent from '@/components/common/ArticleContent/index.vue'
import { ArticleTypeEnum } from '@/constants'
const commentRef = useTemplateRef<typeof Comment | null>('commentRef')
const route = useRoute()
const id = Number(route.params.id)
const isReal = computed(() => {
return +(
articleDetail.value.type === ArticleTypeEnum.PRACTICE ||
articleDetail.value.type === ArticleTypeEnum.INTERVIEW
)
})
const articleDetail = ref({} as ArticleItemDto)
const initPage = () => {
......
......@@ -13,7 +13,7 @@
<!-- 主要内容区域 -->
<div class="mx-auto pt-6">
<PublishBox :type="ArticleTypeEnum.QUESTION" ref="publishBoxRef" :isReal="0" />
<PublishBox :type="ArticleTypeEnum.QUESTION" ref="publishBoxRef" />
<div v-loading="loading" v-if="list.length">
<!-- 问题列表 -->
<div class="space-y-4">
......@@ -177,7 +177,7 @@
:id="item.id"
:total="item.cultureCommentListVo?.childNum || 0"
:defaultSize="5"
:isReal="0"
:type="ArticleTypeEnum.QUESTION"
:immediate="false"
:isQuestion="true"
:commentId="item.cultureCommentListVo?.id"
......
<template>
<div>
<!-- 发布区域 -->
<PublishPractice :type="ArticleTypeEnum.PRACTICE" :isReal="1" :maxLength="2000" />
<PublishPractice :type="ArticleTypeEnum.PRACTICE" :maxLength="2000" />
<!-- 筛选面板 -->
<div class="bg-white rounded-xl shadow-sm border border-gray-100/50 overflow-hidden mb-6">
<div class="p-6">
......
......@@ -9,7 +9,7 @@
:rows="5"
animated
:loading="loading"
:throttle="{ leading: 0, trailing: 1500 }"
:throttle="{ leading: 0, trailing: 300 }"
>
<template #template>
<!-- 顶部标签行 -->
......@@ -106,7 +106,12 @@
:src="questionDetail.createUserAvatar"
:size="40"
class="flex-shrink-0 cursor-pointer"
@click="jumpToUserHomePage({ userId: questionDetail.createUserId, isReal: 0 })"
@click="
jumpToUserHomePage({
userId: questionDetail.createUserId,
type: ArticleTypeEnum.QUESTION,
})
"
>
{{ questionDetail.createUserName }}
</el-avatar>
......@@ -254,7 +259,7 @@
:src="answer.avatar"
:size="36"
class="flex-shrink-0 cursor-pointer"
@click="jumpToUserHomePage({ userId: answer.userId, isReal: 0 })"
@click="jumpToUserHomePage({ userId: answer.userId, type: ArticleTypeEnum.QUESTION })"
/>
<div>
<div class="text-slate-900 text-sm flex items-center gap-2">
......@@ -350,7 +355,7 @@
:id="questionId"
:total="answer.childrenNum"
:defaultSize="5"
:isReal="0"
:type="ArticleTypeEnum.QUESTION"
:immediate="false"
:isQuestion="true"
:commentId="answer.id"
......@@ -392,6 +397,7 @@ import { useUserStore } from '@/stores/user'
import { storeToRefs } from 'pinia'
import { jumpToUserHomePage } from '@/utils'
import { parseEmoji } from '@/utils/emoji'
import { ArticleTypeEnum } from '@/constants'
const userStore = useUserStore()
const { userInfo } = storeToRefs(userStore)
......
......@@ -4,7 +4,7 @@
<!-- 整体页面容器:浅灰背景 -->
<!-- 卡片1: 视频播放器区域 -->
<div class="bg-white rounded-lg shadow-sm overflow-hidden">
<el-skeleton :rows="5" animated :loading="loading" :throttle="{ leading: 0, trailing: 500 }">
<el-skeleton :rows="5" animated :loading="loading" :throttle="{ leading: 0, trailing: 300 }">
<template #template>
<!-- 标题区 -->
<div class="p-4 pb-3">
......@@ -91,11 +91,11 @@
</div>
<!-- 视频 16/ 9 -->
<div class="aspect-video mx-4">
<div class="mx-4">
<video
ref="videoRef"
:src="videoDetail?.videoUrl"
class="aspect-video object-contain"
class="aspect-video w-100%"
controls
@play="handlePlay"
@pause="handlePause"
......@@ -106,7 +106,12 @@
<!-- 左侧:UP主信息 -->
<div class="flex items-center gap-3">
<img
@click="jumpToUserHomePage({ userId: videoDetail?.createUserId, isReal: 0 })"
@click="
jumpToUserHomePage({
userId: videoDetail?.createUserId,
type: ArticleTypeEnum.VIDEO,
})
"
:src="videoDetail?.createUserAvatar"
class="w-12 h-12 rounded-full object-cover cursor-pointer hover:opacity-80 transition-opacity ring-2 ring-gray-100"
/>
......@@ -297,7 +302,7 @@
ref="commentRef"
:id="videoId"
v-model:total="videoDetail.replyCount"
:isReal="0"
:type="ArticleTypeEnum.VIDEO"
class="mt-5"
/>
<RewardDialog ref="rewardDialogRef" v-model:rewardNum="videoDetail.rewardNum" />
......@@ -319,6 +324,7 @@ import Comment from '@/components/common/Comment/index.vue'
import RewardDialog from './components/rewardDialog.vue'
import ActionMore from '@/components/common/ActionMore/index.vue'
import { jumpToUserHomePage } from '@/utils'
import { ArticleTypeEnum } from '@/constants'
const route = useRoute()
const videoId = Number(route.params.id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment