u
This commit is contained in:
1 parent
2f8a815c62
commit
c76581d8cb
34 files changed
+539
-277
No files matched your search
@@ -0,0 +1,74 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
|
||||
defineOptions({ inheritAttrs: false })
|
||||
|
||||
const props = defineProps<{
|
||||
url?: string
|
||||
size?: number
|
||||
width?: number
|
||||
height?: number
|
||||
round?: boolean
|
||||
}>()
|
||||
|
||||
const fallback = '/no-avatar.png'
|
||||
const currentSrc = ref(props.url?.trim() || fallback)
|
||||
|
||||
// 监听 url 变化
|
||||
watch(
|
||||
() => props.url,
|
||||
(newUrl) => {
|
||||
currentSrc.value = newUrl?.trim() || fallback
|
||||
},
|
||||
)
|
||||
|
||||
// 加载失败兜底
|
||||
function onError() {
|
||||
currentSrc.value = fallback
|
||||
}
|
||||
|
||||
// 尺寸样式
|
||||
const sizeStyle = computed(() => {
|
||||
// width / height 优先
|
||||
if (props.width || props.height) {
|
||||
return {
|
||||
width: props.width ? `${props.width}px` : undefined,
|
||||
height: props.height ? `${props.height}px` : undefined,
|
||||
}
|
||||
}
|
||||
|
||||
// size(正方形)
|
||||
if (typeof props.size === 'number') {
|
||||
return {
|
||||
width: `${props.size}px`,
|
||||
height: `${props.size}px`,
|
||||
}
|
||||
}
|
||||
|
||||
return {}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<img
|
||||
v-bind="$attrs"
|
||||
:src="currentSrc"
|
||||
alt="图片"
|
||||
class="base-img"
|
||||
:class="{ 'is-round': round }"
|
||||
:style="sizeStyle"
|
||||
@error="onError"
|
||||
>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.base-img {
|
||||
display: block;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
/* 圆形 */
|
||||
.is-round {
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
@@ -4,6 +4,8 @@ import {
|
||||
User,
|
||||
} from '@element-plus/icons-vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import SafeImage from '@/components/SafeImage.vue'
|
||||
|
||||
import { useUserStore } from '@/store/user'
|
||||
|
||||
const route = useRoute()
|
||||
@@ -63,7 +65,7 @@ function isActive(path: string) {
|
||||
|
||||
<el-dropdown>
|
||||
<div class="user">
|
||||
<el-avatar :size="36" :src="userStore.userInfo.company.logo ? userStore.userInfo.company.logo : '/no-avatar.png'" />
|
||||
<SafeImage :size="36" :url="userStore.userInfo.user.avatar || userStore.userInfo.company.logo" />
|
||||
<div class="info">
|
||||
<span class="name">{{ userStore.userInfo.user.name }}</span>
|
||||
<span class="company">{{ userStore.userInfo.company.name }}</span>
|
||||
|
||||
@@ -37,7 +37,7 @@ const router = createRouter({
|
||||
},
|
||||
{
|
||||
path: '/company/detail',
|
||||
component: () => import('@/views/company/detail/index.vue'),
|
||||
component: () => import('@/views/company/detail.vue'),
|
||||
},
|
||||
{
|
||||
path: '/settings',
|
||||
|
||||
@@ -7,6 +7,7 @@ interface IUserInfo {
|
||||
name: string
|
||||
position: string
|
||||
role: number
|
||||
avatar: string
|
||||
}
|
||||
company: {
|
||||
id: number
|
||||
@@ -25,6 +26,7 @@ export const useUserStore = defineStore(
|
||||
name: '',
|
||||
position: '',
|
||||
role: 0,
|
||||
avatar: '',
|
||||
},
|
||||
company: {
|
||||
id: 0,
|
||||
@@ -45,6 +47,7 @@ export const useUserStore = defineStore(
|
||||
name: '',
|
||||
position: '',
|
||||
role: 0,
|
||||
avatar: '',
|
||||
},
|
||||
company: {
|
||||
id: 0,
|
||||
|
||||
@@ -9,14 +9,18 @@ export interface LoginEmailCodeApiParams {
|
||||
}
|
||||
|
||||
export interface LoginApiResult {
|
||||
companyId: number
|
||||
companyLogo: string
|
||||
companyName: string
|
||||
|
||||
userId: number
|
||||
userRole: number
|
||||
userName: string
|
||||
userPosition: string
|
||||
company: {
|
||||
id: number
|
||||
logo: string
|
||||
name: string
|
||||
}
|
||||
user: {
|
||||
id: number
|
||||
role: number
|
||||
name: string
|
||||
position: string
|
||||
avatar: string
|
||||
}
|
||||
|
||||
token: string
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ export interface CompanyUser {
|
||||
email: string
|
||||
phone: string
|
||||
canuse: string
|
||||
avatar: string
|
||||
}
|
||||
|
||||
export interface CompanyUserForm extends CompanyUser {
|
||||
@@ -34,6 +35,8 @@ export interface AddCompanyUserParams {
|
||||
position: string
|
||||
phone: string
|
||||
canuse: string
|
||||
|
||||
avatar: string
|
||||
}
|
||||
export interface UpdateCompanyUserParams {
|
||||
id: number
|
||||
@@ -46,6 +49,8 @@ export interface UpdateCompanyUserParams {
|
||||
position: string
|
||||
phone: string
|
||||
canuse: string
|
||||
|
||||
avatar: string
|
||||
}
|
||||
|
||||
export interface DeleteCompanyUserParams {
|
||||
|
||||
@@ -58,7 +58,6 @@ export interface PublicPostDetail {
|
||||
activeTime: string
|
||||
|
||||
viewCount: number
|
||||
commentCount: number
|
||||
|
||||
companyId: number
|
||||
}
|
||||
@@ -68,6 +67,7 @@ export interface PostCompany {
|
||||
name: string
|
||||
logo: string
|
||||
profile: string
|
||||
establishmentDate: string
|
||||
|
||||
areas: string[]
|
||||
industries: string[]
|
||||
|
||||
@@ -44,3 +44,69 @@ export function formatPostTime(input?: dayjs.ConfigType): string {
|
||||
// 非本年
|
||||
return time.format('YYYY年MM月DD日')
|
||||
}
|
||||
export function formatCommentTime(input?: dayjs.ConfigType): string {
|
||||
if (!input)
|
||||
return ''
|
||||
|
||||
const time = dayjs(input)
|
||||
if (!time.isValid())
|
||||
return ''
|
||||
|
||||
const now = dayjs()
|
||||
const diffSeconds = now.diff(time, 'second')
|
||||
|
||||
// 未来时间兜底
|
||||
if (diffSeconds < 0) {
|
||||
return time.format('YYYY-MM-DD HH:mm')
|
||||
}
|
||||
|
||||
// 1 分钟内
|
||||
if (diffSeconds < 60) {
|
||||
return '刚刚'
|
||||
}
|
||||
|
||||
const diffMinutes = now.diff(time, 'minute')
|
||||
if (diffMinutes < 60) {
|
||||
return `${diffMinutes}分钟前`
|
||||
}
|
||||
|
||||
const diffHours = now.diff(time, 'hour')
|
||||
if (diffHours < 24) {
|
||||
return `${diffHours}小时前`
|
||||
}
|
||||
|
||||
const diffDays = now.diff(time, 'day')
|
||||
if (diffDays < 7) {
|
||||
return `${diffDays}天前`
|
||||
}
|
||||
|
||||
// 本年
|
||||
if (time.year() === now.year()) {
|
||||
return time.format('MM-DD HH:mm')
|
||||
}
|
||||
|
||||
// 非本年
|
||||
return time.format('YYYY-MM-DD HH:mm')
|
||||
}
|
||||
export type DateFormat
|
||||
= | 'YYYY'
|
||||
| 'MM'
|
||||
| 'DD'
|
||||
| 'YYYY-MM-DD'
|
||||
| 'YYYY-MM-DD HH:mm'
|
||||
| 'YYYY-MM-DD HH:mm:ss'
|
||||
| 'YYYY年MM月DD日'
|
||||
|
||||
export function formatDate(
|
||||
input?: dayjs.ConfigType,
|
||||
format: DateFormat = 'YYYY-MM-DD',
|
||||
): string {
|
||||
if (!input)
|
||||
return ''
|
||||
|
||||
const date = dayjs(input)
|
||||
if (!date.isValid())
|
||||
return ''
|
||||
|
||||
return date.format(format)
|
||||
}
|
||||
@@ -133,20 +133,7 @@ async function submitForm(formEl: FormInstance | undefined) {
|
||||
if (res.isSuccess) {
|
||||
ElMessage.success('登录成功')
|
||||
|
||||
userStore.setUserInfo({
|
||||
user: {
|
||||
id: res.data.userId,
|
||||
name: res.data.userName,
|
||||
position: res.data.userPosition,
|
||||
role: res.data.userRole,
|
||||
},
|
||||
company: {
|
||||
id: res.data.companyId,
|
||||
logo: res.data.companyLogo,
|
||||
name: res.data.companyName,
|
||||
},
|
||||
token: res.data.token,
|
||||
})
|
||||
userStore.setUserInfo(res.data)
|
||||
|
||||
router.push('/')
|
||||
}
|
||||
|
||||
+9
-4
@@ -8,6 +8,7 @@ import AnchorMenu from '@/components/anchor-menu/index.vue'
|
||||
|
||||
import WangEditor from '@/components/wang-editor/index.vue'
|
||||
import { getCompanyDetailApi } from '@/request/api/company'
|
||||
import { formatDate } from '@/utils/time'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
@@ -110,14 +111,11 @@ function handleUpdateEditorDirectory(menus: AnchorMenuItem[]) {
|
||||
{{ companyDetail.email || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="成立日期">
|
||||
-
|
||||
{{ formatDate(companyDetail.establishmentDate, 'YYYY-MM-DD') || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="区域">
|
||||
{{ companyDetail.areas.join('/') || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="详细地址" :span="2">
|
||||
-
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
|
||||
@@ -135,6 +133,13 @@ function handleUpdateEditorDirectory(menus: AnchorMenuItem[]) {
|
||||
<span class="info-title">公司成员</span>
|
||||
</div>
|
||||
<el-table :data="companyDetail.users" style="width: 100%" stripe border>
|
||||
<el-table-column prop="avatar" label="头像" align="center" width="120">
|
||||
<template #default="scope">
|
||||
<div style="display: flex;align-items: center;justify-content: center;">
|
||||
<SafeImage :url="scope.row.avatar" :size="64" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="姓名" width="180" />
|
||||
<el-table-column prop="position" label="职务" width="180" />
|
||||
<el-table-column prop="phone" label="手机号" width="180" />
|
||||
@@ -4,6 +4,7 @@ import { ElMessage } from 'element-plus'
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import QueryCompany from '@/components/QueryCompany.vue'
|
||||
import SafeImage from '@/components/SafeImage.vue'
|
||||
import { queryCompanyApi } from '@/request/api/company'
|
||||
import { useCommonStore } from '@/store/common'
|
||||
|
||||
@@ -77,21 +78,22 @@ function toDetail(data: Company) {
|
||||
</div>
|
||||
<div class="company-list">
|
||||
<div v-for="item in companyList" :key="item.id" class="company-item">
|
||||
<el-avatar shape="square" :src="item.logo || '/no-avatar.png'" :size="70" class="company-logo" />
|
||||
<SafeImage :url="item.logo" :size="70" class="company-logo" />
|
||||
|
||||
<div class="company-info">
|
||||
<div class="company-header">
|
||||
<div class="company-name">
|
||||
<div class="company-name" @click="toDetail(item)">
|
||||
{{ item.name }}
|
||||
</div>
|
||||
<div class="company-tags">
|
||||
<el-tag v-for="tag in item.industries" :key="tag" type="primary" effect="dark">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="company-tags">
|
||||
<el-tag v-for="tag in item.industries" :key="tag" type="primary" effect="dark">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<p class="company-profile">
|
||||
{{ item.profile || '-' }}
|
||||
|
||||
<p v-if="item.profile" class="company-profile">
|
||||
{{ item.profile }}
|
||||
</p>
|
||||
<div class="company-footer">
|
||||
<div class="company-details">
|
||||
@@ -109,7 +111,7 @@ function toDetail(data: Company) {
|
||||
</div>
|
||||
</div>
|
||||
<div class="company-actions">
|
||||
<el-button @click="toDetail(item)">
|
||||
<!-- <el-button @click="toDetail(item)">
|
||||
<i-ri:information-2-line />
|
||||
<span class="button-text">
|
||||
详细
|
||||
@@ -121,7 +123,7 @@ function toDetail(data: Company) {
|
||||
<span class="button-text">
|
||||
发起聊天
|
||||
</span>
|
||||
</el-button>
|
||||
</el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -202,7 +204,7 @@ function toDetail(data: Company) {
|
||||
|
||||
.company-info {
|
||||
flex: 1;
|
||||
|
||||
min-height: 70px;
|
||||
.company-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -219,7 +221,8 @@ function toDetail(data: Company) {
|
||||
|
||||
.company-tags {
|
||||
margin-bottom: 6px;
|
||||
> * {
|
||||
|
||||
> *:not(:last-child) {
|
||||
margin-right: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
import type { PostComment, PublicPostDetail } from '@/types/post'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { nextTick, ref, watch } from 'vue'
|
||||
import SafeImage from '@/components/SafeImage.vue'
|
||||
|
||||
import SvgIcon from '@/components/SvgIcon.vue'
|
||||
import { createPostCommentApi } from '@/request/api/post'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { formatCommentTime } from '@/utils/time'
|
||||
import CommentInput from './comment-input.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -12,6 +15,11 @@ const props = defineProps<{
|
||||
postDetail: PublicPostDetail
|
||||
}>()
|
||||
|
||||
const emits = defineEmits<{
|
||||
(e: 'update:modelValue', value: PostComment[]): void
|
||||
(e: 'change'): void
|
||||
}>()
|
||||
|
||||
const commentList = ref<PostComment[]>([])
|
||||
const userStore = useUserStore()
|
||||
|
||||
@@ -29,19 +37,36 @@ watch(
|
||||
},
|
||||
)
|
||||
|
||||
function handleReplyComment(commentId: number) {
|
||||
if (replyCommentId.value === commentId) {
|
||||
replyCommentId.value = null
|
||||
}
|
||||
else {
|
||||
replyCommentId.value = commentId
|
||||
}
|
||||
function handleReplyComment(commentId: number, e: MouseEvent) {
|
||||
const isOpen = replyCommentId.value !== commentId
|
||||
replyCommentId.value = isOpen ? commentId : null
|
||||
|
||||
if (!isOpen)
|
||||
return
|
||||
|
||||
nextTick(() => {
|
||||
window.scrollTo({
|
||||
top: document.documentElement.scrollHeight,
|
||||
behavior: 'smooth',
|
||||
})
|
||||
const el = e.currentTarget as HTMLElement
|
||||
if (!el)
|
||||
return
|
||||
|
||||
const rect = el.getBoundingClientRect()
|
||||
const viewportHeight = window.innerHeight
|
||||
const scrollOffset = 70 // 👈 可调:40~70
|
||||
|
||||
// 点击点在视口上半部分 → 往上滚
|
||||
if (rect.top < viewportHeight / 2) {
|
||||
window.scrollBy({
|
||||
top: -scrollOffset,
|
||||
behavior: 'smooth',
|
||||
})
|
||||
}
|
||||
// 点击点在视口下半部分 → 往下滚
|
||||
else {
|
||||
window.scrollBy({
|
||||
top: scrollOffset,
|
||||
behavior: 'smooth',
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -129,6 +154,9 @@ function handleReplyCommentSubmit(content: string) {
|
||||
replyUser: null,
|
||||
})
|
||||
}
|
||||
|
||||
emits('update:modelValue', commentList.value)
|
||||
emits('change')
|
||||
})
|
||||
|
||||
.finally(() => {
|
||||
@@ -141,7 +169,7 @@ function handleReplyCommentSubmit(content: string) {
|
||||
<template>
|
||||
<div v-for="item in commentList" :key="item.id" class="custom-comment">
|
||||
<div class="custom-comment-left">
|
||||
<el-avatar class="custom-comment-avatar" :src="item.publishUser.avatar || '/no-avatar.png'" :size="70" />
|
||||
<SafeImage :url="item.publishUser.avatar" :size="32" round />
|
||||
</div>
|
||||
<div class="custom-comment-right">
|
||||
<div class="custom-comment-meta">
|
||||
@@ -149,33 +177,36 @@ function handleReplyCommentSubmit(content: string) {
|
||||
<div class="custom-comment-author">
|
||||
{{ item.publishUser.name }}
|
||||
</div>
|
||||
<div v-if="item.publishUser.companyId === postDetail.companyId" class="custom-comment-author-tag">
|
||||
<!-- <div v-if="item.publishUser.companyId === postDetail.companyId" class="custom-comment-author-tag">
|
||||
作者
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="custom-comment-time">
|
||||
{{ item.createTime }}
|
||||
{{ formatCommentTime(item.createTime) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="custom-comment-content" v-html="item.content" />
|
||||
<div class="custom-comment-actions">
|
||||
<div class="custom-comment-action" :style="{ color: replyCommentId === item.id ? '#165dff' : '#1d2129' }" @click="handleReplyComment(item.id)">
|
||||
<SvgIcon icon="mingcute:message-3-line" />
|
||||
<div
|
||||
class="custom-comment-action" :style="{ color: replyCommentId === item.id ? '#165dff' : '#8A919F' }"
|
||||
@click="handleReplyComment(item.id, $event)"
|
||||
>
|
||||
<SvgIcon icon="mingcute:message-3-line" :size="16" />
|
||||
<div>{{ replyCommentId === item.id ? "取消回复" : "回复" }}</div>
|
||||
</div>
|
||||
<div class="custom-comment-action flex ml-auto">
|
||||
<SvgIcon icon="akar-icons:more-horizontal-fill" />
|
||||
<div class="custom-comment-action" style="margin-left: auto;">
|
||||
<SvgIcon icon="mingcute:more-1-fill" :size="16" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 父级评论输入框 -->
|
||||
<CommentInput v-if="replyCommentId === item.id" :loading="replyCommentLoading" @submit="handleReplyCommentSubmit" />
|
||||
<CommentInput v-if="replyCommentId === item.id" :loading="replyCommentLoading" style="margin-top: 8px;" @submit="handleReplyCommentSubmit" />
|
||||
|
||||
<!-- 子评论 -->
|
||||
<div v-if="item.children && item.children.length > 0" class="custom-comment-children">
|
||||
<div v-for="child in item.children" :key="child.id" class="custom-comment">
|
||||
<div class="custom-comment-left">
|
||||
<el-avatar class="custom-comment-avatar" :src="item.publishUser.avatar || '/no-avatar.png'" :size="70" />
|
||||
<SafeImage :url="item.publishUser.avatar" :size="32" round />
|
||||
</div>
|
||||
<div class="custom-comment-right">
|
||||
<div class="custom-comment-meta">
|
||||
@@ -183,33 +214,36 @@ function handleReplyCommentSubmit(content: string) {
|
||||
<div class="custom-comment-author">
|
||||
{{ child.publishUser.name }}
|
||||
</div>
|
||||
<div v-if="child.publishUser.companyId === postDetail.companyId" class="custom-comment-author-tag">
|
||||
<!-- <div v-if="child.publishUser.companyId === postDetail.companyId" class="custom-comment-author-tag">
|
||||
作者
|
||||
</div>
|
||||
</div> -->
|
||||
<template v-if="child.replyUser && child.fatherId !== item.id">
|
||||
<div>回复</div>
|
||||
<div style="margin: 0px 4px;">
|
||||
回复
|
||||
</div>
|
||||
<div class="custom-comment-author">
|
||||
{{ child.replyUser.name }}
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="custom-comment-time">
|
||||
{{ child.createTime }}
|
||||
{{ formatCommentTime(child.createTime) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="custom-comment-content">
|
||||
{{ child.content }}
|
||||
</div>
|
||||
<div class="custom-comment-actions">
|
||||
<div class="custom-comment-action" :style="{ color: replyCommentId === child.id ? '#165dff' : '#1d2129' }" @click="handleReplyComment(child.id)">
|
||||
<SvgIcon icon="mingcute:message-3-line" />
|
||||
<div class="custom-comment-action" :style="{ color: replyCommentId === child.id ? '#165dff' : '#8A919F' }" @click="handleReplyComment(child.id, $event)">
|
||||
<SvgIcon icon="mingcute:message-3-line" :size="16" />
|
||||
<div>{{ replyCommentId === child.id ? "取消回复" : "回复" }}</div>
|
||||
</div>
|
||||
<div class="custom-comment-action flex ml-auto">
|
||||
<SvgIcon icon="akar-icons:more-horizontal-fill" />
|
||||
<div class="custom-comment-action" style="margin-left: auto;">
|
||||
<SvgIcon icon="akar-icons:more-horizontal-fill" :size="16" />
|
||||
</div>
|
||||
</div>
|
||||
<CommentInput v-if="replyCommentId === child.id" :loading="replyCommentLoading" @submit="handleReplyCommentSubmit" />
|
||||
|
||||
<CommentInput v-if="replyCommentId === child.id" :loading="replyCommentLoading" style="margin-top: 8px;" @submit="handleReplyCommentSubmit" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -238,21 +272,17 @@ function handleReplyCommentSubmit(content: string) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
gap: 8px;
|
||||
}
|
||||
.custom-comment-avatar {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
}
|
||||
.custom-comment-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 4px;
|
||||
.custom-comment-title {
|
||||
font-size: 14px;
|
||||
color: #4e5969;
|
||||
color: #515767;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
@@ -274,14 +304,15 @@ function handleReplyCommentSubmit(content: string) {
|
||||
}
|
||||
}
|
||||
.custom-comment-content {
|
||||
font-size: 14px;
|
||||
color: #1d2129;
|
||||
font-size: 16px;
|
||||
color: #252933;
|
||||
word-break: break-all;
|
||||
white-space: pre-wrap;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.custom-comment-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
gap: 12px;
|
||||
.custom-comment-action {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
@@ -289,7 +320,7 @@ function handleReplyCommentSubmit(content: string) {
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
line-height: 14px;
|
||||
color: #1d2129;
|
||||
color: #8a919f;
|
||||
}
|
||||
.custom-comment-action:hover {
|
||||
color: #165dff;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
import type { AnchorMenuItem } from '@/components/anchor-menu/type'
|
||||
import type { PostComment, PostCompany, PublicPostDetail } from '@/types/post'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import AnchorMenu from '@/components/anchor-menu/index.vue'
|
||||
import CustomEmpty from '@/components/CustomEmpty.vue'
|
||||
import WandEditor from '@/components/wang-editor/index.vue'
|
||||
import { createPostCommentApi, getPostCompanyById, getPublicPostDetailApi, listPostCommentApi } from '@/request/api/post'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { formatPostTime } from '@/utils/time'
|
||||
import { formatDate, formatPostTime } from '@/utils/time'
|
||||
import CommentInput from './components/comment-input.vue'
|
||||
import CommentList from './components/comment-list.vue'
|
||||
|
||||
@@ -25,6 +25,7 @@ const postCompany = ref<PostCompany>({
|
||||
name: '',
|
||||
logo: '',
|
||||
profile: '',
|
||||
establishmentDate: '',
|
||||
areas: [],
|
||||
industries: [],
|
||||
})
|
||||
@@ -37,7 +38,6 @@ const postDetail = ref<PublicPostDetail>({
|
||||
activeTime: '',
|
||||
|
||||
viewCount: 0,
|
||||
commentCount: 0,
|
||||
|
||||
companyId: 0,
|
||||
})
|
||||
@@ -92,6 +92,22 @@ onMounted(async () => {
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
function getTotalCommentCount(list: PostComment[]): number {
|
||||
let count = 0
|
||||
|
||||
for (const comment of list) {
|
||||
count += 1 // 一级评论
|
||||
if (comment.children && comment.children.length > 0) {
|
||||
count += comment.children.length // 所有子评论(已扁平)
|
||||
}
|
||||
}
|
||||
|
||||
return count
|
||||
}
|
||||
|
||||
const totalCommentCount = computed(() => {
|
||||
return getTotalCommentCount(postComments.value)
|
||||
})
|
||||
|
||||
function handleUpdateEditorDirectory(menus: AnchorMenuItem[]) {
|
||||
anchorMenu.value = anchorMenu.value.concat(menus)
|
||||
@@ -161,7 +177,7 @@ function handleSubmitRootComment(content: string) {
|
||||
</div>
|
||||
<div class="post-meta-item">
|
||||
<SvgIcon icon="mdi:comment-outline" :size="16" />
|
||||
<span>{{ postDetail.commentCount }} </span>
|
||||
<span>{{ totalCommentCount }} </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -185,7 +201,10 @@ function handleSubmitRootComment(content: string) {
|
||||
|
||||
<div class="reply-comment">
|
||||
<div v-if="postComments.length > 0" class="reply-comment-list">
|
||||
<CommentList v-model="postComments" :post-detail="postDetail" />
|
||||
<CommentList
|
||||
v-model="postComments"
|
||||
:post-detail="postDetail"
|
||||
/>
|
||||
</div>
|
||||
<CustomEmpty v-else title="暂时没有评论 🤔" :in-container="true" />
|
||||
</div>
|
||||
@@ -200,10 +219,11 @@ function handleSubmitRootComment(content: string) {
|
||||
<h3 class="company-name">
|
||||
{{ postCompany.name }}
|
||||
</h3>
|
||||
|
||||
<div v-if="postCompany.areas.length > 0" class="company-meta">
|
||||
<!-- 成立于 2012 年 · 上海 -->
|
||||
{{ postCompany.areas.join("/") }}
|
||||
<template v-if="postCompany.establishmentDate">
|
||||
成立于 {{ formatDate(postCompany.establishmentDate, 'YYYY') }} 年 ·
|
||||
</template>
|
||||
{{ postCompany.areas.join('/') }}
|
||||
</div>
|
||||
|
||||
<div class="company-desc">
|
||||
|
||||
@@ -3,7 +3,6 @@ import type { DashboardData } from '@/types/post'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import CustomLoading from '@/components/CustomLoading.vue'
|
||||
import { getDashboardDataApi } from '@/request/api/post'
|
||||
import PostNumberChart from './components/post-number-chart.vue'
|
||||
import PostTypeChart from './components/post-type-chart.vue'
|
||||
import PostViewChart from './components/post-view-chart.vue'
|
||||
@@ -25,22 +24,22 @@ const activeCollapseNames = ref(['1', '2'])
|
||||
onMounted(() => {
|
||||
loading.value = true
|
||||
|
||||
getDashboardDataApi().then((res) => {
|
||||
if (res.isSuccess) {
|
||||
// dashboradData.value = res.data
|
||||
dashboradData.value.typeChart = [...res.data.typeChart]
|
||||
// getDashboardDataApi().then((res) => {
|
||||
// if (res.isSuccess) {
|
||||
// // dashboradData.value = res.data
|
||||
// dashboradData.value.typeChart = [...res.data.typeChart]
|
||||
|
||||
console.log(dashboradData.value)
|
||||
}
|
||||
else {
|
||||
ElMessage.error(res.message || '加载失败,请稍后再试')
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.log(err)
|
||||
ElMessage.error('加载失败,请稍后再试')
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
// console.log(dashboradData.value)
|
||||
// }
|
||||
// else {
|
||||
// ElMessage.error(res.message || '加载失败,请稍后再试')
|
||||
// }
|
||||
// }).catch((err) => {
|
||||
// console.log(err)
|
||||
// ElMessage.error('加载失败,请稍后再试')
|
||||
// }).finally(() => {
|
||||
// loading.value = false
|
||||
// })
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -190,6 +190,7 @@ watch(searchKey, async (val) => {
|
||||
}
|
||||
|
||||
.right-view {
|
||||
padding:0px 120px;
|
||||
flex: 1;
|
||||
flex-shrink: 0;
|
||||
border-radius: 0px;
|
||||
|
||||
@@ -155,6 +155,7 @@ const activeCollapseNames = ref(['1', '2', '3'])
|
||||
:rules="formRules"
|
||||
label-width="auto"
|
||||
label-position="top"
|
||||
style="width: 700px;"
|
||||
>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="24">
|
||||
@@ -214,6 +215,7 @@ const activeCollapseNames = ref(['1', '2', '3'])
|
||||
:model="companyDetail"
|
||||
:rules="formRules"
|
||||
label-width="auto"
|
||||
style="width: 700px;"
|
||||
>
|
||||
<el-form-item prop="profile">
|
||||
<el-input v-model="companyDetail.profile" type="textarea" />
|
||||
@@ -284,9 +286,6 @@ const activeCollapseNames = ref(['1', '2', '3'])
|
||||
}
|
||||
.form-footer {
|
||||
width: 100%;
|
||||
box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.08);
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
align-self: flex-end;
|
||||
height: 56px;
|
||||
display: flex;
|
||||
|
||||
@@ -5,6 +5,7 @@ import type { CompanyUser, CompanyUserForm } from '@/types/company/user'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import EmailCodeInput from '@/components/EmailCodeInput.vue'
|
||||
import ImageUploadCard from '@/components/ImageUploadCard.vue'
|
||||
import { authCodeVerifyApi } from '@/request/api/auth/code'
|
||||
import { addCompanyUserApi, updateCompanyUserApi } from '@/request/api/company/user'
|
||||
import { useUserStore } from '@/store/user'
|
||||
@@ -44,6 +45,7 @@ const form = ref<CompanyUserForm>({
|
||||
canuse: '1',
|
||||
password: '',
|
||||
emailCode: '',
|
||||
avatar: '',
|
||||
})
|
||||
watch(
|
||||
() => props.user,
|
||||
@@ -172,6 +174,7 @@ async function handleSubmit(formEl: FormInstance | undefined) {
|
||||
position: form.value.position,
|
||||
phone: form.value.phone,
|
||||
canuse: form.value.canuse,
|
||||
avatar: form.value.avatar,
|
||||
})
|
||||
|
||||
if (response.isSuccess) {
|
||||
@@ -220,6 +223,9 @@ async function handleSubmit(formEl: FormInstance | undefined) {
|
||||
label-width="auto"
|
||||
label-position="right"
|
||||
>
|
||||
<el-form-item label="头像" prop="name">
|
||||
<ImageUploadCard v-model="form.avatar" :auto-upload-aliyun="true" />
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" />
|
||||
</el-form-item>
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { CompanyUser, QueryCompanyUserParams } from '@/types/company/user'
|
||||
import { Delete, Plus, Refresh, Search } from '@element-plus/icons-vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import SafeImage from '@/components/SafeImage.vue'
|
||||
import { deleteCompanyUserApi, queryCompanyUserApi } from '@/request/api/company/user'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import EditDrawer from './components/EditDrawer.vue'
|
||||
@@ -251,6 +252,13 @@ function handleDelteRows(val?: CompanyUser) {
|
||||
align="center"
|
||||
:selectable="selectable"
|
||||
/>
|
||||
<el-table-column prop="avatar" label="头像" align="center" width="120">
|
||||
<template #default="scope">
|
||||
<div style="display: flex;align-items: center;justify-content: center;">
|
||||
<SafeImage :url="scope.row.avatar" :size="64" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="名称" align="center">
|
||||
<template #default="scope">
|
||||
<template v-if="scope.row.role === 1">
|
||||
|
||||
Reference in new issue
Block a user