kevin.T пре 2 недеља
родитељ
комит
4311353cb9

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

@@ -3,30 +3,7 @@ import { messages } from '@/core/libs/messages'
 
 export const useShare = () => {
   const shareAppMessage = async ({ from, target }) => {
-    // const res: Page.CustomShareContent = {}
-    // if (from === 'button') {
-    //   console.log(target)
-    //
-    //   if (target.dataset.type === 'homepage') {
-    //     res.title = `${userInfo.value.nickname}: “${designerInfo.value.designDesc}”`
-    //     res.imageUrl = designerInfo.value?.sharePageUrl
-    //     res.path = `/pages-sub/mine/homepage/index?id=${id.value}&isShared=true`
-    //   } else {
-    //     await shareCircle(target.dataset.options.id)
-    //     res.path = `/pages-sub/home/moment/index?id=${target.dataset.options.id}&isShared=true`
-    //     res.imageUrl = target.dataset.options.bannerUrls[0]
-    //     res.title = `${target.dataset.options.stylistName}: ${target.dataset.options.circleDesc}`
-    //   }
-    // }
-    // if (from === 'menu') {
-    //   res.title = `${userInfo.value.nickname}: “${designerInfo.value.designDesc}”`
-    //   res.imageUrl = designerInfo.value?.sharePageUrl
-    //   res.path = `/pages-sub/mine/homepage/index?id=${id.value}&isShared=true`
-    // }
-    // return res
-
-    // console.log('from', from)
-    console.log('target', target)
+    console.log('target', from, target)
     const res: Page.CustomShareContent = {}
     if (from === 'button') {
       if (target.dataset.type === 'homepage') {

+ 1 - 1
packages/app/src/core/libs/requests.ts

@@ -205,7 +205,7 @@ export const getCircle = (id: string) =>
  * 删除个人圈子
  */
 export const deleteCircle = (id: string) => httpDelete('/app-api/member/circle/delete', { id })
-export const shareCircle = (id: string) => httpGet('/app-api/member/circle/share', { id })
+export const shareCircle = (id: string | number) => httpGet('/app-api/member/circle/share', { id })
 /**
  * /app-api/member/designer/shareHomeHistory 分享设计师主页
  */

+ 9 - 6
packages/app/src/pages-sub/home/moment/index.vue

@@ -195,18 +195,21 @@ onLoad(async (query?: { id: string; isShared?: boolean; circleType?: string }) =
     })
   }
 })
-// onShareAppMessage(async () => {
-//   await shareCircle(id.value)
-//   return { title: data.value?.circleDesc }
-// })
-onShareAppMessage(({ from, target }) => {
+onShow(async () => {
+  await run()
+})
+onShareAppMessage(async ({ from, target }) => {
   if (from === 'button') {
-    return shareAppMessage({ from, target })
+    return await shareAppMessage({ from, target })
   } else if (from === 'menu') {
+    await shareCircle(data.value?.stylistId)
     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}`,
       imageUrl: data.value?.bannerUrls[0],
+      success: async () => {
+        await run()
+      },
     }
   }
 })

+ 23 - 62
packages/app/src/pages-sub/home/study-tour/index.vue

@@ -27,15 +27,23 @@ import { useRouter } from '../../../core/utils/router'
 import PageHelper from '@/components/page-helper.vue'
 import RegisterCard from './components/register-card.vue'
 import { ComponentExposed } from 'vue-component-type-helpers'
+import ShareActionSheet from './components/share-action-sheet.vue'
+import { useShare } from '@/composables/share'
+import { getByDictType } from '@/core/libs/requests'
+import { DictType } from '@/core/libs/models'
 const pageHelperRef = ref<ComponentExposed<typeof PageHelper>>()
 const currentBanner = ref(0)
+const dictMemberDesignStyle = ref<any[]>()
+const dictCircleSpaceType = ref<any[]>()
 const handleSwiperChange = ({ detail: { current } }) => {
   currentBanner.value = current
 }
 const userStore = useUserStore()
 const { userInfo } = storeToRefs(userStore)
 const shareOptions = ref()
+const shareActionState = ref(false)
 const router = useRouter()
+const { shareAppMessage } = useShare()
 const { data: studyTours, run: setStudyTours } = useRequest(() =>
   getStudyTours({ headRecommend: 1 }),
 )
@@ -58,6 +66,10 @@ const handleLike = async (options) => {
   })
   await pageHelperRef.value?.refresh()
 }
+const handleShare = (options: any) => {
+  shareOptions.value = options
+  shareActionState.value = true
+}
 const levelsByMemberLevel = computed(() =>
   levels.value.reduce((acc, item) => {
     acc[item.memberLevel] = item
@@ -66,10 +78,15 @@ const levelsByMemberLevel = computed(() =>
 )
 onMounted(async () => {
   await Promise.all([setLevels(), setStudyTours(), setClassmates(), setBanners()])
+  let value1 = await getByDictType(DictType.circleSpaceType)
+  dictCircleSpaceType.value = value1.data
+  let value2 = await getByDictType(DictType.memberDesignStyle)
+  dictMemberDesignStyle.value = value2.data
 })
 onShow(async () => {
   await pageHelperRef.value?.reload()
 })
+onShareAppMessage(shareAppMessage)
 </script>
 <template>
   <view class="flex-grow flex flex-col gap-6 p-3.5">
@@ -111,67 +128,6 @@ onShow(async () => {
         </template>
       </div>
     </div>
-    <!-- </template>
-    </PageHelper> -->
-    <!-- <card custom-class="p-0!">
-      <view class="relative">
-        <wd-img
-          custom-class="vertical-bottom"
-          width="100%"
-          height="275"
-          src="https://via.placeholder.com/347x464"
-        ></wd-img>
-        <div
-          class="w-[63px] h-[29px] bg-black/60 rounded-[20px] backdrop-blur-[15px] absolute top-5 right-3.5 flex items-center justify-center"
-        >
-          <div class="text-white text-sm font-normal font-['PingFang_SC'] leading-relaxed">
-            报名中
-          </div>
-        </div>
-        <view class="absolute left-3.5 bottom-2.5 flex items-center">
-          <avatar-group-casual
-            :show-number="3"
-            :urls="[
-              'https://via.placeholder.com/20x20',
-              'https://via.placeholder.com/20x20',
-              'https://via.placeholder.com/20x20',
-            ]"
-          ></avatar-group-casual>
-          <div
-            class="ml-1 text-white/60 text-sm font-normal font-['PingFang_SC'] leading-[10.18px]"
-          >
-            40人已报名
-          </div>
-        </view>
-      </view>
-      <div class="bg-[#27130d]/50 rounded-bl-2xl rounded-br-2xl backdrop-blur-[20px] p-3.5">
-        <div class="w-[293px] text-white text-xl font-normal font-['PingFang_SC'] leading-relaxed">
-          日本研学·东京艺术大学设计游学
-        </div>
-        <view class="flex items-center">
-          <div class="text-white/60 text-sm font-normal font-['PingFang_SC'] leading-[34px]">
-            游学时间:
-          </div>
-          <div class="text-white/60 text-base font-normal font-['PingFang_SC'] leading-[34px]">
-            07.15 08.10
-          </div>
-        </view>
-        <div
-          class="text-justify text-white/60 text-sm font-normal font-['PingFang_SC'] leading-relaxed"
-        >
-          等级限制:黄金会员以上
-        </div>
-        <view class="flex items-center justify-between">
-          <view class="flex items-end">
-            <div class="text-white text-3xl font-bold font-['D-DIN_Exp'] leading-normal">16000</div>
-            <div class="ml-1 text-white/60 text-sm font-normal font-['PingFang_SC'] leading-[34px]">
-              积分
-            </div>
-          </view>
-          <tilted-button custom-class="" size="large" color="white">立即报名</tilted-button>
-        </view>
-      </div>
-    </card> -->
     <card custom-class="">
       <div class="my-10px text-black text-xl fw-500 font-['PingFang_SC'] leading-[10.18px]">
         筑巢荟-设计游学
@@ -207,7 +163,12 @@ onShow(async () => {
       <template #default="{ source }">
         <div class="flex-grow flex flex-col gap-6">
           <template v-for="(it, i) in source.list" :key="i">
-            <MomentItem :options="it" @like="handleLike"></MomentItem>
+            <MomentItem
+              :dict="{ spaceType: dictCircleSpaceType, designStyle: dictMemberDesignStyle }"
+              :options="it"
+              @like="handleLike"
+              @share="handleShare"
+            ></MomentItem>
           </template>
         </div>
       </template>

+ 53 - 18
packages/app/src/pages-sub/mine/homepage/index.vue

@@ -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>

+ 3 - 1
packages/app/src/pages/home/index.vue

@@ -235,7 +235,9 @@ onShareAppMessage(shareAppMessage)
         <Card>
           <div class="flex items-center gap-2">
             <wd-img width="28" height="28" :src="logo"></wd-img>
-            <div class="text-black/90 text-base font-normal font-['PingFang_SC'] leading-[10.18px]">
+            <div
+              class="text-black/90 text-base font-normal font-['PihandleSharengFang_SC'] leading-[10.18px]"
+            >
               1分钟快速了解筑巢荟
             </div>
             <div class="flex-1"></div>

+ 5 - 4
packages/merchant/src/pages/agent/designer/index.vue

@@ -69,7 +69,7 @@ const wxGetAddress = (longitude: number, latitude: number) => {
   })
 }
 const getCurrentLocation = () => {
-  console.log('点击地址')
+  uni.showToast({ icon: 'loading', title: '正在获取位置...' })
   uni.getLocation({
     type: 'gcj02',
     success: async (success: any) => {
@@ -78,7 +78,7 @@ const getCurrentLocation = () => {
       followUpForm.value.address.address = name
       followUpForm.value.address.latitude = latitude
       followUpForm.value.address.longitude = longitude
-      console.log('提交信息:::', followUpForm.value)
+      uni.hideToast()
     },
     fail: (err) => {
       console.log('获取地址失败', err)
@@ -96,15 +96,16 @@ const getCurrentLocation = () => {
                 followUpForm.value.address.address = name
                 followUpForm.value.address.latitude = latitude
                 followUpForm.value.address.longitude = longitude
-                console.log('提交信息:::', followUpForm.value)
+                uni.hideToast()
               },
               fail: function (err) {
+                uni.hideToast()
                 console.log('获取位置失败:', err)
               },
             })
           },
           fail: function () {
-            console.log('用户拒绝授权,不再提示')
+            uni.hideToast()
             // 用户拒绝授权,可以选择记录下来,不再提示
             uni.showToast({
               title: '您拒绝了位置授权',