hookehuyr

✨ feat(活动分享): 分享信息调整优化

...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
8 z-index: 1; 8 z-index: 1;
9 position: absolute; 9 position: absolute;
10 top: 4rem; 10 top: 4rem;
11 - transform: translateX(50%); 11 + transform: translateX(55%);
12 } 12 }
13 .success-info { 13 .success-info {
14 position: absolute; 14 position: absolute;
......
1 <!-- 1 <!--
2 * @Date: 2022-09-28 11:52:13 2 * @Date: 2022-09-28 11:52:13
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-09-28 15:37:50 4 + * @LastEditTime: 2022-10-20 15:58:00
5 * @FilePath: /swx/src/pages/joinSuccess/index.vue 5 * @FilePath: /swx/src/pages/joinSuccess/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -14,14 +14,16 @@ ...@@ -14,14 +14,16 @@
14 <view class="success-info"> 14 <view class="success-info">
15 <view class="text">报名成功</view> 15 <view class="text">报名成功</view>
16 <!-- <view @tap="shareJoin" class="join">邀请好友报名</view> --> 16 <!-- <view @tap="shareJoin" class="join">邀请好友报名</view> -->
17 - <button id="share" data-name="shareBtn" open-type="share" style="font-size: 1.15rem; padding: 0; margin: 1.5rem 3rem; border: 1px solid #199A74; color: #199A74; border-radius: 2rem; background-color: white;">邀请好友报名</button> 17 + <button id="share" data-name="shareBtn" open-type="share" style="font-size: 1.15rem; padding: 0; margin: 1.5rem 3rem; border: 1px solid #199A74; color: #199A74; border-radius: 2rem; background-color: white; width: 12rem;">邀请好友报名</button>
18 </view> 18 </view>
19 </view> 19 </view>
20 </template> 20 </template>
21 21
22 <script setup> 22 <script setup>
23 -import { ref } from "vue"; 23 +import { ref, onMounted } from "vue";
24 import Taro from '@tarojs/taro' 24 import Taro from '@tarojs/taro'
25 +import { getCurrentPageParam } from "@/utils/weapp";
26 +import { activityInfoAPI } from '@/api/Host/index';
25 27
26 // 打开朋友圈分享 28 // 打开朋友圈分享
27 wx.showShareMenu({ 29 wx.showShareMenu({
...@@ -35,13 +37,26 @@ import "./index.less"; ...@@ -35,13 +37,26 @@ import "./index.less";
35 37
36 export default { 38 export default {
37 name: "joinSuccessPage", 39 name: "joinSuccessPage",
40 + async mounted () {
41 + const { code, data } = await activityInfoAPI({ i: getCurrentPageParam().id });
42 + if (code) {
43 + this.cover = data.activity.cover;
44 + this.name = data.activity.name;
45 + }
46 + },
47 + data () {
48 + return {
49 + name: '',
50 + cover: ''
51 + }
52 + },
38 // TODO:分享内容待设置 53 // TODO:分享内容待设置
39 onShareAppMessage(options) { 54 onShareAppMessage(options) {
40 // 设置菜单中的转发按钮触发转发事件时的转发内容 55 // 设置菜单中的转发按钮触发转发事件时的转发内容
41 var shareObj = { 56 var shareObj = {
42 - title: "胜文轩-活动报名", // 默认是小程序的名称(可以写slogan等) 57 + title: this.name + "-活动报名", // 默认是小程序的名称(可以写slogan等)
43 - path: 'pages/joinActivity/index', // 默认是当前页面,必须是以‘/'开头的完整路径 58 + path: 'pages/activityDetail/index?id=' + getCurrentPageParam().id, // 默认是当前页面,必须是以‘/'开头的完整路径
44 - imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 59 + imageUrl: this.cover, //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
45 success: function (res) { 60 success: function (res) {
46 // 转发成功之后的回调 61 // 转发成功之后的回调
47 if (res.errMsg == 'shareAppMessage:ok') { 62 if (res.errMsg == 'shareAppMessage:ok') {
......