|
|
@@ -2,7 +2,7 @@
|
|
|
<n-thing @click="goDetail">
|
|
|
<template #avatar>
|
|
|
<n-avatar
|
|
|
- @click.prevent="goAgent"
|
|
|
+ @click.stop="goAgent"
|
|
|
v-if="chatRole.pic"
|
|
|
class="!block"
|
|
|
round
|
|
|
@@ -65,10 +65,13 @@ import { LikeBtn } from '@/components/common'
|
|
|
import { formatDistanceToNow, isToday, format } from 'date-fns'
|
|
|
import zhCN from 'date-fns/locale/zh-CN'
|
|
|
import { getColor } from '@/plugins/TabColors'
|
|
|
+import { fetchLikeMoments } from '@/api'
|
|
|
+import { useUserStore } from '@/store'
|
|
|
|
|
|
interface Emit {
|
|
|
(ev: 'goDetail', id: number | null): void
|
|
|
(ev: 'goAgent', id: number | null): void
|
|
|
+ (ev: 'update:info', data: any): void
|
|
|
}
|
|
|
|
|
|
const props = defineProps({
|
|
|
@@ -116,7 +119,15 @@ function goAgent() {
|
|
|
emit('goAgent', props.info.userId)
|
|
|
}
|
|
|
|
|
|
-function like() {}
|
|
|
+const userStore = useUserStore()
|
|
|
+function like() {
|
|
|
+ fetchLikeMoments(userStore.userInfo.id, props.info.id).then(res => {
|
|
|
+ emit('update:info', {
|
|
|
+ ...props.info,
|
|
|
+ momentsLikeCount: props.info.momentsLikeCount + 1
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
:deep(.n-thing-header-wrapper) {
|