hookehuyr

feat(分享功能): 为Welcome和Dashboard页面添加分享功能支持

添加enableShareAppMessage和enableShareTimeline配置
实现分享页面授权处理和分享内容配置
移除ActivitiesCover页面中冗余的分享提示
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-09-15 16:20:15 4 + * @LastEditTime: 2025-09-16 20:11:36
5 * @FilePath: /lls_program/src/pages/ActivitiesCover/index.vue 5 * @FilePath: /lls_program/src/pages/ActivitiesCover/index.vue
6 * @Description: 活动海报页面 - 展示活动信息并处理定位授权 6 * @Description: 活动海报页面 - 展示活动信息并处理定位授权
7 --> 7 -->
...@@ -495,11 +495,11 @@ const handleJoinActivity = async () => { ...@@ -495,11 +495,11 @@ const handleJoinActivity = async () => {
495 const onShareActivity = () => { 495 const onShareActivity = () => {
496 console.log('分享活动海报') 496 console.log('分享活动海报')
497 // 分享给朋友 497 // 分享给朋友
498 - Taro.showToast({ 498 + // Taro.showToast({
499 - title: '请点击右上角分享给朋友', 499 + // title: '请点击右上角分享给朋友',
500 - icon: 'none', 500 + // icon: 'none',
501 - duration: 2000 501 + // duration: 2000
502 - }); 502 + // });
503 } 503 }
504 504
505 /** 505 /**
......
1 +/*
2 + * @Date: 2025-08-27 18:25:14
3 + * @LastEditors: hookehuyr hookehuyr@gmail.com
4 + * @LastEditTime: 2025-09-16 21:41:31
5 + * @FilePath: /lls_program/src/pages/Dashboard/index.config.js
6 + * @Description: 文件描述
7 + */
1 export default { 8 export default {
2 - navigationBarTitleText: '首页' 9 + navigationBarTitleText: '首页',
10 + enableShareAppMessage: true,
11 + enableShareTimeline: true
3 } 12 }
......
...@@ -162,6 +162,8 @@ ...@@ -162,6 +162,8 @@
162 import "./index.less"; 162 import "./index.less";
163 import { ref, computed, onMounted } from 'vue'; 163 import { ref, computed, onMounted } from 'vue';
164 import Taro, { useDidShow, useReady, useLoad } from '@tarojs/taro'; 164 import Taro, { useDidShow, useReady, useLoad } from '@tarojs/taro';
165 +import { handleSharePageAuth, addShareFlag } from '@/utils/authRedirect';
166 +
165 import { Setting, Photograph, Category, IconFont } from '@nutui/icons-vue-taro'; 167 import { Setting, Photograph, Category, IconFont } from '@nutui/icons-vue-taro';
166 import BottomNav from '../../components/BottomNav.vue'; 168 import BottomNav from '../../components/BottomNav.vue';
167 import TotalPointsDisplay from '@/components/TotalPointsDisplay.vue'; 169 import TotalPointsDisplay from '@/components/TotalPointsDisplay.vue';
...@@ -447,4 +449,28 @@ useReady(async () => { ...@@ -447,4 +449,28 @@ useReady(async () => {
447 } 449 }
448 }); 450 });
449 }) 451 })
452 +
453 +useLoad((options) => {
454 + // 处理分享页面的授权逻辑
455 + handleSharePageAuth(options);
456 +});
457 +
458 +/**
459 + * 定义分享给朋友的内容
460 + * @returns {Object} 分享配置对象
461 + */
462 +const onShareAppMessage = (res) => {
463 + const shareData = {
464 + title: '欢迎加入老来赛',
465 + path: addShareFlag(`/pages/Dashboard/index`),
466 + imageUrl: ''
467 + };
468 +
469 + return shareData;
470 +}
471 +
472 +// 使用Taro的useShareAppMessage Hook来处理分享
473 +Taro.useShareAppMessage((res) => {
474 + return onShareAppMessage(res);
475 +});
450 </script> 476 </script>
......
...@@ -8,5 +8,7 @@ ...@@ -8,5 +8,7 @@
8 export default { 8 export default {
9 navigationBarTitleText: '老来赛', 9 navigationBarTitleText: '老来赛',
10 navigationBarBackgroundColor: '#fff', 10 navigationBarBackgroundColor: '#fff',
11 - navigationBarTextStyle: 'black' 11 + navigationBarTextStyle: 'black',
12 + enableShareAppMessage: true,
13 + enableShareTimeline: true
12 } 14 }
......
1 <!-- 1 <!--
2 * @Date: 2025-08-27 17:43:45 2 * @Date: 2025-08-27 17:43:45
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-09-13 08:58:04 4 + * @LastEditTime: 2025-09-16 21:52:46
5 * @FilePath: /lls_program/src/pages/Welcome/index.vue 5 * @FilePath: /lls_program/src/pages/Welcome/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -144,7 +144,9 @@ ...@@ -144,7 +144,9 @@
144 144
145 <script setup> 145 <script setup>
146 import { ref } from 'vue'; 146 import { ref } from 'vue';
147 -import Taro, { useDidShow } from '@tarojs/taro'; 147 +import Taro, { useDidShow, useLoad } from '@tarojs/taro';
148 +import { handleSharePageAuth, addShareFlag } from '@/utils/authRedirect';
149 +
148 import BottomNav from '../../components/BottomNav.vue'; // 假设BottomNav组件已转换 150 import BottomNav from '../../components/BottomNav.vue'; // 假设BottomNav组件已转换
149 import AdOverlay from '@/components/AdOverlay.vue' 151 import AdOverlay from '@/components/AdOverlay.vue'
150 // 获取接口信息 152 // 获取接口信息
...@@ -253,4 +255,28 @@ const onPrivacyConfirm = () => { ...@@ -253,4 +255,28 @@ const onPrivacyConfirm = () => {
253 const onAgeConfirm = () => { 255 const onAgeConfirm = () => {
254 showAgeDialog.value = false; 256 showAgeDialog.value = false;
255 }; 257 };
258 +
259 +useLoad((options) => {
260 + // 处理分享页面的授权逻辑
261 + handleSharePageAuth(options);
262 +});
263 +
264 +/**
265 + * 定义分享给朋友的内容
266 + * @returns {Object} 分享配置对象
267 + */
268 +const onShareAppMessage = (res) => {
269 + const shareData = {
270 + title: '欢迎加入老来赛',
271 + path: addShareFlag(`/pages/Welcome/index`),
272 + imageUrl: ''
273 + };
274 +
275 + return shareData;
276 +}
277 +
278 +// 使用Taro的useShareAppMessage Hook来处理分享
279 +Taro.useShareAppMessage((res) => {
280 + return onShareAppMessage(res);
281 +});
256 </script> 282 </script>
......