hookehuyr

✨ feat(活动详情): 分享朋友功能逻辑调整

...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 "miniprogramRoot": "./dist", 2 "miniprogramRoot": "./dist",
3 "projectname": "swx-weapp", 3 "projectname": "swx-weapp",
4 "description": "胜文轩小程序", 4 "description": "胜文轩小程序",
5 - "appid": "wxa2e50e76487d1d7b", 5 + "appid": "wxbd679e213af89c38",
6 "setting": { 6 "setting": {
7 "urlCheck": true, 7 "urlCheck": true,
8 "es6": false, 8 "es6": false,
...@@ -10,5 +10,7 @@ ...@@ -10,5 +10,7 @@
10 "minified": false, 10 "minified": false,
11 "checkSiteMap": false 11 "checkSiteMap": false
12 }, 12 },
13 - "compileType": "miniprogram" 13 + "compileType": "miniprogram",
14 + "ignoreDevUnusedFiles": false,
15 + "ignoreUploadUnusedFiles": false
14 } 16 }
......
...@@ -2,12 +2,14 @@ ...@@ -2,12 +2,14 @@
2 "miniprogramRoot": "./", 2 "miniprogramRoot": "./",
3 "projectname": "swx-weapp", 3 "projectname": "swx-weapp",
4 "description": "胜文轩小程序", 4 "description": "胜文轩小程序",
5 - "appid": "wxa2e50e76487d1d7b", 5 + "appid": "wxbd679e213af89c38",
6 "setting": { 6 "setting": {
7 "urlCheck": true, 7 "urlCheck": true,
8 "es6": false, 8 "es6": false,
9 "postcss": false, 9 "postcss": false,
10 "minified": false 10 "minified": false
11 }, 11 },
12 - "compileType": "miniprogram" 12 + "compileType": "miniprogram",
13 + "ignoreDevUnusedFiles": false,
14 + "ignoreUploadUnusedFiles": false
13 } 15 }
......
1 <!-- 1 <!--
2 * @Date: 2022-09-26 14:36:57 2 * @Date: 2022-09-26 14:36:57
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-10-20 16:13:03 4 + * @LastEditTime: 2022-10-21 10:27:19
5 * @FilePath: /swx/src/pages/activityDetail/index.vue 5 * @FilePath: /swx/src/pages/activityDetail/index.vue
6 * @Description: 活动详情页 6 * @Description: 活动详情页
7 --> 7 -->
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
108 <view style="height: 6rem;"></view> 108 <view style="height: 6rem;"></view>
109 <activity-bar :user-type="userType" :reg-id="reg_id" :member-role="member_role" /> 109 <activity-bar :user-type="userType" :reg-id="reg_id" :member-role="member_role" />
110 110
111 - <van-action-sheet 111 + <!-- <van-action-sheet
112 :z-index="10" 112 :z-index="10"
113 :show="show_share" 113 :show="show_share"
114 :actions="actions_share" 114 :actions="actions_share"
...@@ -116,6 +116,13 @@ ...@@ -116,6 +116,13 @@
116 :overlay="true" 116 :overlay="true"
117 @cancel="onCancelShare" 117 @cancel="onCancelShare"
118 @select="onSelectShare" 118 @select="onSelectShare"
119 + /> -->
120 + <van-share-sheet
121 + :show="show_share"
122 + title="立即分享给好友"
123 + :options="share_options"
124 + @select="onSelectShare"
125 + @close="onCancelShare"
119 /> 126 />
120 127
121 <van-overlay :show="show_post" :z-index="1"> 128 <van-overlay :show="show_post" :z-index="1">
...@@ -150,11 +157,10 @@ const formatDate = (date) => { ...@@ -150,11 +157,10 @@ const formatDate = (date) => {
150 } 157 }
151 158
152 const show_share = ref(false); 159 const show_share = ref(false);
153 -const actions_share = ref([{ 160 +const share_options = [
154 - name: '分享朋友' 161 + { name: '微信', icon: 'wechat', openType: 'share' },
155 -}, { 162 + { name: '生成海报', icon: 'poster' },
156 - name: '生成海报' 163 +]
157 -}]);
158 const shareActivity = () => { 164 const shareActivity = () => {
159 show_share.value = true; 165 show_share.value = true;
160 } 166 }
...@@ -509,6 +515,40 @@ export default { ...@@ -509,6 +515,40 @@ export default {
509 } 515 }
510 return status 516 return status
511 } 517 }
518 + },
519 + onShareAppMessage(options) {
520 + // 设置菜单中的转发按钮触发转发事件时的转发内容
521 + var shareObj = {
522 + title: this.activity.name + "-活动报名", // 默认是小程序的名称(可以写slogan等)
523 + path: 'pages/activityDetail/index?id=' + this.activity.id, // 默认是当前页面,必须是以‘/'开头的完整路径
524 + imageUrl: this.activity.cover, //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
525 + success: function (res) {
526 + // 转发成功之后的回调
527 + if (res.errMsg == 'shareAppMessage:ok') {
528 + //
529 + }
530 + },
531 + fail: function () {
532 + // 转发失败之后的回调
533 + if (res.errMsg == 'shareAppMessage:fail cancel') {
534 + // 用户取消转发
535 + } else if (res.errMsg == 'shareAppMessage:fail') {
536 + // 转发失败,其中 detail message 为详细失败信息
537 + }
538 + },
539 + complete: function () {
540 + // 转发结束之后的回调(转发成不成功都会执行)
541 + }
542 + }
543 + // 来自页面内的按钮的转发
544 + // if (options.from == 'button') {
545 + // var eData = options.target.dataset;
546 + // console.warn(eData); // shareBtn
547 + // // 此处可以修改 shareObj 中的内容
548 + // // shareObj.path = '/pages/goods/goods?goodId=' + eData.id;
549 + // }
550 + // 返回shareObj
551 + return shareObj;
512 } 552 }
513 }; 553 };
514 </script> 554 </script>
......
...@@ -50,7 +50,6 @@ export default { ...@@ -50,7 +50,6 @@ export default {
50 cover: '' 50 cover: ''
51 } 51 }
52 }, 52 },
53 - // TODO:分享内容待设置
54 onShareAppMessage(options) { 53 onShareAppMessage(options) {
55 // 设置菜单中的转发按钮触发转发事件时的转发内容 54 // 设置菜单中的转发按钮触发转发事件时的转发内容
56 var shareObj = { 55 var shareObj = {
......
1 /* 1 /*
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-09-28 23:23:22 4 + * @LastEditTime: 2022-10-21 10:05:55
5 * @FilePath: /swx/vantComponentConf.js 5 * @FilePath: /swx/vantComponentConf.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -29,6 +29,7 @@ const vantComponentNames = [ ...@@ -29,6 +29,7 @@ const vantComponentNames = [
29 "stepper", 29 "stepper",
30 "dialog", 30 "dialog",
31 "action-sheet", 31 "action-sheet",
32 + "share-sheet",
32 "checkbox", 33 "checkbox",
33 "transition", 34 "transition",
34 "uploader", 35 "uploader",
......