hookehuyr

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

......@@ -8,7 +8,7 @@
z-index: 1;
position: absolute;
top: 4rem;
transform: translateX(50%);
transform: translateX(55%);
}
.success-info {
position: absolute;
......
<!--
* @Date: 2022-09-28 11:52:13
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-09-28 15:37:50
* @LastEditTime: 2022-10-20 15:58:00
* @FilePath: /swx/src/pages/joinSuccess/index.vue
* @Description: 文件描述
-->
......@@ -14,14 +14,16 @@
<view class="success-info">
<view class="text">报名成功</view>
<!-- <view @tap="shareJoin" class="join">邀请好友报名</view> -->
<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>
<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>
</view>
</view>
</template>
<script setup>
import { ref } from "vue";
import { ref, onMounted } from "vue";
import Taro from '@tarojs/taro'
import { getCurrentPageParam } from "@/utils/weapp";
import { activityInfoAPI } from '@/api/Host/index';
// 打开朋友圈分享
wx.showShareMenu({
......@@ -35,13 +37,26 @@ import "./index.less";
export default {
name: "joinSuccessPage",
async mounted () {
const { code, data } = await activityInfoAPI({ i: getCurrentPageParam().id });
if (code) {
this.cover = data.activity.cover;
this.name = data.activity.name;
}
},
data () {
return {
name: '',
cover: ''
}
},
// TODO:分享内容待设置
onShareAppMessage(options) {
// 设置菜单中的转发按钮触发转发事件时的转发内容
var shareObj = {
title: "胜文轩-活动报名", // 默认是小程序的名称(可以写slogan等)
path: 'pages/joinActivity/index', // 默认是当前页面,必须是以‘/'开头的完整路径
imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
title: this.name + "-活动报名", // 默认是小程序的名称(可以写slogan等)
path: 'pages/activityDetail/index?id=' + getCurrentPageParam().id, // 默认是当前页面,必须是以‘/'开头的完整路径
imageUrl: this.cover, //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
success: function (res) {
// 转发成功之后的回调
if (res.errMsg == 'shareAppMessage:ok') {
......