jwyu %!s(int64=3) %!d(string=hai) anos
pai
achega
08b7975c1f
Modificáronse 1 ficheiros con 30 adicións e 22 borrados
  1. 30 22
      src/views/activity/Detail.vue

+ 30 - 22
src/views/activity/Detail.vue

@@ -1,5 +1,5 @@
 <script setup>
-import { computed, reactive, ref } from "vue";
+import { computed, reactive, ref,onMounted } from "vue";
 import { useRoute, useRouter } from "vue-router";
 import { formatActivityTime } from "./utils";
 import { ElMessage } from 'element-plus'
@@ -66,6 +66,7 @@ const getDetail = async () => {
                 infoList.value.push({ label: "网络参会", text: res.data.linkParticipants, color: "yellow", type: "copy" });
             }
         }
+        handleShareMsg()
     }else if(res.code===403){//无权限
         noAuth.show=true
         noAuth.data=res.data
@@ -73,6 +74,32 @@ const getDetail = async () => {
 };
 getDetail();
 
+// 处理分享数据
+const handleShareMsg=()=>{
+    //向小程序发送消息
+    let title=''
+    if(info.value.firstActivityTypeId==1){
+        title=info.value.reportName.split('】')[1]||info.value.activityName
+    }else{
+        title=info.value.activityName
+    }
+
+    let shareImg=`${import.meta.env.VITE_APP_API_URL}/activity/getActivityShareImg?activity_id=${info.value.activityId}`//分享海报
+
+    let postData = {
+        path: "/pages-activity/detail",
+        params:{
+            name:"研报详情",
+            type:'activityDetail',
+            id:info.value.activityId,
+            shareImg:shareImg,
+            h5Url:'/activity/detail'
+        },
+        title: title,
+    };
+    wx.miniProgram.postMessage({ data: postData });
+}
+
 // 获取活动音频
 import {apiActivityAudios} from '@/api/activity.js'
 let audioList=ref([])
@@ -240,29 +267,10 @@ const cancelRegister=async ()=>{
 }
 
 
-onMounted(() => {
-  //向小程序发送消息
-    let title=''
-    if(info.value.firstActivityTypeId==1){
-        title=info.value.reportName.split('】')[1]||info.value.activityName
-    }else{
-        title=info.value.activityName
-    }
 
-    let shareImg=`${import.meta.env.VITE_APP_API_URL}/activity/getActivityShareImg?activity_id=${info.value.activityId}`//分享海报
 
-    let postData = {
-        path: "/pages-activity/detail",
-        params:{
-            name:"研报详情",
-            type:'activityDetail',
-            id:info.value.activityId,
-            shareImg:shareImg,
-            h5Url:'/activity/detail'
-        },
-        title: title,
-    };
-    wx.miniProgram.postMessage({ data: postData });
+onMounted(() => {
+    
 });
 
 </script>