|
@@ -8,6 +8,7 @@
|
|
|
<script setup lang="ts">
|
|
|
import MomentItem from '@/components/moment-item.vue'
|
|
|
import {
|
|
|
+ createBrowseHistory,
|
|
|
deleteCircle,
|
|
|
getCircles,
|
|
|
getDesignerInfo,
|
|
@@ -23,6 +24,7 @@ import NavbarEvo from '@/components/navbar-evo.vue'
|
|
|
import { useMessage } from 'wot-design-uni'
|
|
|
import { requestToast } from '../../../core/utils/common'
|
|
|
import { ComponentExposed } from 'vue-component-type-helpers'
|
|
|
+import dayjs from 'dayjs'
|
|
|
|
|
|
const { alert, confirm } = useMessage()
|
|
|
const router = useRouter()
|
|
@@ -36,6 +38,8 @@ const tabs = ref([
|
|
|
{ label: '动态', value: '1' },
|
|
|
// { label: '视频', value: '0' },
|
|
|
])
|
|
|
+const viewDuration = ref(0)
|
|
|
+const viewStartAt = ref<Date>()
|
|
|
const { data: memberInfo, run: setMemberInfo } = useRequest(() => getUserInfoById(id.value), {
|
|
|
initialData: {},
|
|
|
})
|
|
@@ -63,7 +67,6 @@ const handleMomentDelete = async (id) => {
|
|
|
},
|
|
|
})
|
|
|
}
|
|
|
-onMounted(async () => {})
|
|
|
onLoad(async (query: { id: string }) => {
|
|
|
if (query.id) {
|
|
|
id.value = query.id
|
|
@@ -73,6 +76,19 @@ onLoad(async (query: { id: string }) => {
|
|
|
}
|
|
|
await setMemberInfo()
|
|
|
await setDesignerInfo()
|
|
|
+ if (!isOwn.value) {
|
|
|
+ viewStartAt.value = new Date()
|
|
|
+ }
|
|
|
+})
|
|
|
+onUnload(async () => {
|
|
|
+ if (!isOwn.value) {
|
|
|
+ viewDuration.value = dayjs().diff(viewStartAt.value, 'seconds')
|
|
|
+ const { data, code } = await createBrowseHistory({
|
|
|
+ stylistId: id.value,
|
|
|
+ bizType: '浏览',
|
|
|
+ duration: viewDuration.value.toString(),
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
onShareAppMessage(() => ({ title: `${userInfo.value.nickname}` }))
|
|
|
defineExpose({
|