|
@@ -52,6 +52,7 @@ const { userInfo } = storeToRefs(userStore)
|
|
|
const pageHelperRef = ref<ComponentExposed<typeof PageHelper>>()
|
|
|
const id = ref()
|
|
|
const isShared = ref(false)
|
|
|
+const videoNumberShare = ref(false)
|
|
|
const tab = ref('2')
|
|
|
const tabs = ref([
|
|
|
{ label: '案例', value: '2' },
|
|
@@ -60,6 +61,7 @@ const tabs = ref([
|
|
|
])
|
|
|
const viewDuration = ref(0)
|
|
|
const viewStartAt = ref<Date>()
|
|
|
+const shareOptions = ref()
|
|
|
const { data: memberInfo, run: setMemberInfo } = useRequest(() => getUserInfoById(id.value), {
|
|
|
initialData: {},
|
|
|
})
|
|
@@ -110,9 +112,34 @@ const handleLike = async (options) => {
|
|
|
})
|
|
|
await pageHelperRef.value?.refresh()
|
|
|
}
|
|
|
+const handleShare = (options: any) => {
|
|
|
+ console.log('options 分享', options)
|
|
|
+ shareOptions.value = options
|
|
|
+}
|
|
|
const handle2Video = () => {
|
|
|
try {
|
|
|
- uni.openChannelsUserProfile({ finderUserName: designerInfo.value?.videoNumber })
|
|
|
+ uni.openChannelsUserProfile({
|
|
|
+ finderUserName: designerInfo.value?.videoNumber,
|
|
|
+ success: (res) => {
|
|
|
+ console.log('success', res)
|
|
|
+ },
|
|
|
+ fail: (error) => {
|
|
|
+ let { errMsg } = error
|
|
|
+ if (
|
|
|
+ errMsg === 'openChannelsUserProfile:fail cancel' ||
|
|
|
+ errMsg === 'openChannelsUserProfile:fail user cancel'
|
|
|
+ ) {
|
|
|
+ console.log('取消报错')
|
|
|
+ } else if (
|
|
|
+ errMsg === 'openChannelsUserProfile:fail rejected due to no permission currently'
|
|
|
+ ) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '请前往小程序使用完整功能',
|
|
|
+ icon: 'none',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
} catch (e) {
|
|
|
uni.showToast({
|
|
|
title: '打开失败',
|
|
@@ -120,6 +147,9 @@ const handle2Video = () => {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
+const handle2VideoNumber = (share: boolean) => {
|
|
|
+ handle2Video()
|
|
|
+}
|
|
|
const handleUnbundle = async () => {
|
|
|
confirm({
|
|
|
title: '警告',
|
|
@@ -148,6 +178,9 @@ onLoad(async (query: { id: string; isShared?: string }) => {
|
|
|
}
|
|
|
if (query.isShared) {
|
|
|
isShared.value = true
|
|
|
+ videoNumberShare.value = true
|
|
|
+ } else {
|
|
|
+ videoNumberShare.value = false
|
|
|
}
|
|
|
if (!isOwn.value) {
|
|
|
viewStartAt.value = new Date()
|
|
@@ -159,18 +192,19 @@ onLoad(async (query: { id: string; isShared?: string }) => {
|
|
|
dictMemberDesignStyle.value = value2.data
|
|
|
})
|
|
|
onShow(async () => {
|
|
|
+ console.log('onShow')
|
|
|
await setDesignerInfo()
|
|
|
+ await pageHelperRef.value?.refresh()
|
|
|
})
|
|
|
+onShareAppMessage(shareAppMessage)
|
|
|
onUnload(async () => {
|
|
|
- if (!isOwn.value) {
|
|
|
- viewDuration.value = dayjs().diff(viewStartAt.value, 'seconds')
|
|
|
- const { data, code } = await createBrowseHistory({
|
|
|
- stylistId: id.value,
|
|
|
- bizType: 3,
|
|
|
- // bizId: '1',
|
|
|
- duration: viewDuration.value.toString(),
|
|
|
- })
|
|
|
- }
|
|
|
+ viewDuration.value = dayjs().diff(viewStartAt.value, 'seconds')
|
|
|
+ const { data, code } = await createBrowseHistory({
|
|
|
+ stylistId: id.value,
|
|
|
+ bizType: 3,
|
|
|
+ // bizId: '1',
|
|
|
+ duration: viewDuration.value.toString(),
|
|
|
+ })
|
|
|
})
|
|
|
const shareMessage = () => {
|
|
|
const promise = new Promise((resolve, reject) => {
|
|
@@ -184,17 +218,12 @@ const shareMessage = () => {
|
|
|
: memberInfo.value.nickname
|
|
|
res.imageUrl = designerInfo.value.sharePageUrl
|
|
|
res.path = `/pages-sub/mine/homepage/index?id=${id.value}&isShared=true`
|
|
|
+ shareCircle(shareOptions.value?.stylistId)
|
|
|
resolve(res)
|
|
|
}
|
|
|
})
|
|
|
return { promise }
|
|
|
}
|
|
|
-onShareAppMessage(shareMessage)
|
|
|
-// onShareAppMessage(() => ({
|
|
|
-// title: `${userInfo.value?.nickname}: “${designerInfo.value?.designDesc}”`,
|
|
|
-// imageUrl:designerInfo.value.sharePageUrl,
|
|
|
-// path:`/pages-sub/mine/homepage/index?id=${id}&isShared=true`
|
|
|
-// }))
|
|
|
onShareTimeline(() => ({
|
|
|
title: designerInfo.value?.homePageName
|
|
|
? designerInfo.value?.homePageName
|
|
@@ -367,7 +396,7 @@ defineExpose({
|
|
|
<div
|
|
|
v-if="designerInfo?.videoNumber"
|
|
|
class="text-[#e08e38] text-xs font-normal font-['PingFang_SC'] leading-normal"
|
|
|
- @click.stop="router.push('/pages-sub/mine/homepage/index')"
|
|
|
+ @click.stop="handle2VideoNumber(videoNumberShare)"
|
|
|
>
|
|
|
去看看
|
|
|
</div>
|
|
@@ -406,6 +435,7 @@ defineExpose({
|
|
|
:options="it"
|
|
|
:is-own="userInfo.userId === it.stylistId"
|
|
|
:is-shared="isShared"
|
|
|
+ @share="handleShare"
|
|
|
@delete="handleMomentDelete"
|
|
|
@like="handleLike"
|
|
|
></MomentItem>
|
|
@@ -440,7 +470,12 @@ defineExpose({
|
|
|
</button>
|
|
|
<template v-else>
|
|
|
<!-- 1-->
|
|
|
- <wd-button block :round="false" @click="clickByPermission('share', () => {})">
|
|
|
+ <wd-button
|
|
|
+ block
|
|
|
+ :round="false"
|
|
|
+ open-type="share"
|
|
|
+ @click="clickByPermission('share', () => {})"
|
|
|
+ >
|
|
|
分享
|
|
|
</wd-button>
|
|
|
</template>
|