Commit 3c0d6c77 by lijiabin

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

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