hookehuyr

refactor(分享功能): 移除分享成功和失败的回调处理逻辑

1 <!-- 1 <!--
2 * @Date: 2025-06-28 10:33:00 2 * @Date: 2025-06-28 10:33:00
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-07-07 15:34:42 4 + * @LastEditTime: 2025-07-07 16:02:49
5 * @FilePath: /jgdl/src/pages/index/index.vue 5 * @FilePath: /jgdl/src/pages/index/index.vue
6 * @Description: 捡个电驴首页 6 * @Description: 捡个电驴首页
7 --> 7 -->
...@@ -397,34 +397,6 @@ useShareAppMessage(() => { ...@@ -397,34 +397,6 @@ useShareAppMessage(() => {
397 title: '捡个电驴-分享给好友', // 默认是小程序的名称(可以写slogan等) 397 title: '捡个电驴-分享给好友', // 默认是小程序的名称(可以写slogan等)
398 path: `pages/index/index`, // 默认是当前页面,必须是以'/'开头的完整路径 398 path: `pages/index/index`, // 默认是当前页面,必须是以'/'开头的完整路径
399 imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 399 imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
400 - success: function (res) {
401 - // 转发成功之后的回调
402 - if (res.errMsg == 'shareAppMessage:ok') {
403 - Taro.showToast({
404 - title: '分享成功',
405 - icon: 'success'
406 - })
407 - }
408 - },
409 - fail: function () {
410 - // 转发失败之后的回调
411 - if (res.errMsg == 'shareAppMessage:fail cancel') {
412 - // 用户取消转发
413 - Taro.showToast({
414 - title: '分享取消',
415 - icon: 'none'
416 - })
417 - } else if (res.errMsg == 'shareAppMessage:fail') {
418 - // 转发失败,其中 detail message 为详细失败信息
419 - Taro.showToast({
420 - title: '分享失败',
421 - icon: 'none'
422 - })
423 - }
424 - },
425 - complete: function () {
426 - // 转发结束之后的回调(转发成不成功都会执行)
427 - }
428 } 400 }
429 // 来自页面内的按钮的转发 401 // 来自页面内的按钮的转发
430 // if (options.from == 'button') { 402 // if (options.from == 'button') {
......
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: 2025-07-07 15:51:00 4 + * @LastEditTime: 2025-07-07 16:03:15
5 * @FilePath: /jgdl/src/pages/productDetail/index.vue 5 * @FilePath: /jgdl/src/pages/productDetail/index.vue
6 * @Description: 商品详情页 6 * @Description: 商品详情页
7 --> 7 -->
...@@ -494,34 +494,6 @@ useShareAppMessage(() => { ...@@ -494,34 +494,6 @@ useShareAppMessage(() => {
494 title: product.value.name, // 默认是小程序的名称(可以写slogan等) 494 title: product.value.name, // 默认是小程序的名称(可以写slogan等)
495 path: `pages/productDetail/index?id=${params.id}`, // 默认是当前页面,必须是以'/'开头的完整路径 495 path: `pages/productDetail/index?id=${params.id}`, // 默认是当前页面,必须是以'/'开头的完整路径
496 imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 496 imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
497 - success: function (res) {
498 - // 转发成功之后的回调
499 - if (res.errMsg == 'shareAppMessage:ok') {
500 - Taro.showToast({
501 - title: '分享成功',
502 - icon: 'success'
503 - })
504 - }
505 - },
506 - fail: function () {
507 - // 转发失败之后的回调
508 - if (res.errMsg == 'shareAppMessage:fail cancel') {
509 - // 用户取消转发
510 - Taro.showToast({
511 - title: '分享取消',
512 - icon: 'none'
513 - })
514 - } else if (res.errMsg == 'shareAppMessage:fail') {
515 - // 转发失败,其中 detail message 为详细失败信息
516 - Taro.showToast({
517 - title: '分享失败',
518 - icon: 'none'
519 - })
520 - }
521 - },
522 - complete: function () {
523 - // 转发结束之后的回调(转发成不成功都会执行)
524 - }
525 } 497 }
526 // 来自页面内的按钮的转发 498 // 来自页面内的按钮的转发
527 // if (options.from == 'button') { 499 // if (options.from == 'button') {
......