فهرست منبع

merge-21点29分

kevin.T 3 هفته پیش
والد
کامیت
23db8b5c6d

+ 0 - 2
packages/app/src/components/moment-item.vue

@@ -11,8 +11,6 @@ import { NetImages } from '../core/libs/net-images'
 import { currRoute } from '../utils'
 import { usePermissions } from '../composables/permissions'
 import { useMemberLevelsStore } from '../store/member-levles'
-import { useDictStore } from '../store'
-import { DictType } from '../core/libs/models'
 import { CircleRes } from '../core/libs/requests'
 
 const props = withDefaults(

+ 6 - 1
packages/app/src/composables/share.ts

@@ -3,10 +3,14 @@ import { messages } from '@/core/libs/messages'
 
 export const useShare = () => {
   const shareAppMessage = async ({ from, target }) => {
-    console.log('target', from, target)
+    console.log('target::::::::', from, target)
     const res: Page.CustomShareContent = {}
     if (from === 'button') {
       if (target.dataset.type === 'homepage') {
+        if (target.dataset.level && target.dataset.level < 2) {
+          uni.showToast({ title: '普通会员无法分享', icon: 'none' })
+          throw new Error('禁止分享')
+        }
         await shareDesignerHome({
           stylistId: target.dataset.options.homepageId,
           bizId: target.dataset.options.userId,
@@ -28,6 +32,7 @@ export const useShare = () => {
       }
     }
     if (from === 'menu') {
+      console.log('menu::::::::', from, target)
       res.title = messages.home.shareTitle
     }
     return res

+ 1 - 4
packages/app/src/pages-sub/home/moment/index.vue

@@ -164,9 +164,6 @@ const handleUpvote = async (index?: number) => {
   await runGetReviews()
 }
 const toDesignerHomepage = () => {
-  console.log(
-    `/pages-sub/mine/homepage/index?id=${data.value?.stylistId}${isShared.value ? '&isShared=true' : ''}`,
-  )
   if (['1', '2'].includes(String(data.value?.circleType)) && data.value?.levelId >= 2) {
     router.push(
       `/pages-sub/mine/homepage/index?id=${data.value?.stylistId}${isShared.value ? '&isShared=true' : ''}`,
@@ -202,7 +199,7 @@ onShareAppMessage(async ({ from, target }) => {
   if (from === 'button') {
     return await shareAppMessage({ from, target })
   } else if (from === 'menu') {
-    await shareCircle(data.value?.stylistId)
+    await shareCircle(data.value?.id)
     return {
       title: `${data.value?.stylistName}: ${data.value?.circleType === '2' ? '设计案例-' + data.value?.caseName : data.value?.circleDesc}`,
       path: `/pages-sub/home/moment/index?id=${data.value?.id}&isShared=true&circleType=${data.value?.circleType}`,

+ 32 - 24
packages/app/src/pages-sub/mine/homepage/index.vue

@@ -38,6 +38,7 @@ import { useShare } from '@/composables/share'
 import { useMemberLevelsStore } from '../../../store/member-levles'
 import { getByDictType } from '@/core/libs/requests'
 import { DictType } from '@/core/libs/models'
+import { title } from 'radash'
 
 const memberLevelsStore = useMemberLevelsStore()
 const { getMemberAvatarFrame } = memberLevelsStore
@@ -89,6 +90,32 @@ const skills = computed(() =>
     },
   ].filter(({ show }) => show),
 )
+const shareContent = computed(() => {
+  return {
+    title: designerInfo.value?.homePageName
+      ? designerInfo.value?.homePageName
+      : memberInfo.value.nickname,
+    imageUrl: designerInfo.value?.sharePageUrl,
+    path: `/pages-sub/mine/homepage/index?id=${id.value}&isShared=true`,
+  }
+})
+const shareMessage = () => {
+  const promise = new Promise((resolve, reject) => {
+    if (userInfo.value?.level?.level < 2) {
+      uni.showToast({ title: '普通会员无法分享', icon: 'none' })
+      reject()
+    } else {
+      const res: Page.CustomShareContent = {}
+      res.title = designerInfo.value?.homePageName
+        ? designerInfo.value?.homePageName
+        : memberInfo.value.nickname
+      res.imageUrl = designerInfo.value.sharePageUrl
+      res.path = `/pages-sub/mine/homepage/index?id=${id.value}&isShared=true`
+      resolve(res)
+    }
+  })
+  return { promise }
+}
 const query = computed(() => ({
   circleType: tab.value,
   stylistId: id.value,
@@ -206,24 +233,6 @@ onUnload(async () => {
     duration: viewDuration.value.toString(),
   })
 })
-const shareMessage = () => {
-  const promise = new Promise((resolve, reject) => {
-    if (userInfo.value?.level?.level < 2) {
-      uni.showToast({ title: '普通会员无法分享', icon: 'none' })
-      reject()
-    } else {
-      const res: Page.CustomShareContent = {}
-      res.title = designerInfo.value?.homePageName
-        ? designerInfo.value?.homePageName
-        : 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 }
-}
 onShareTimeline(() => ({
   title: designerInfo.value?.homePageName
     ? designerInfo.value?.homePageName
@@ -463,19 +472,18 @@ defineExpose({
             class="p-0 after:b-none"
             block
             :round="false"
+            data-type="homepage"
+            :data-share-content="shareContent"
             :open-type="features.shareMoment ? 'share' : ''"
+            :data-options="{ userId: userInfo.userId, homepageId: id }"
+            :data-level="userInfo.level"
             @click="clickByPermission('share', () => {})"
           >
             <wd-button block :round="false">分享</wd-button>
           </button>
           <template v-else>
             <!--            1-->
-            <wd-button
-              block
-              :round="false"
-              open-type="share"
-              @click="clickByPermission('share', () => {})"
-            >
+            <wd-button block :round="false" @click="clickByPermission('share', () => {})">
               分享
             </wd-button>
           </template>