hookehuyr

refactor: 清理未使用的首页副本文件并调整路由顺序

移除未使用的首页副本文件(index copy目录下的文件)
将Dashboard页面调整至Welcome页面之前
在Dashboard和ActivitiesCover页面添加家庭加入状态检查逻辑
/*
* @Date: 2025-06-28 10:33:00
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-01 14:31:43
* @LastEditTime: 2025-09-02 15:16:41
* @FilePath: /lls_program/src/app.config.js
* @Description: 文件描述
*/
export default {
pages: [
// 'pages/index/index',
'pages/Dashboard/index',
'pages/Welcome/index',
'pages/auth/index',
'pages/Dashboard/index',
'pages/MyFamily/index',
'pages/CreateFamily/index',
'pages/JoinFamily/index',
......
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-08-29 15:39:47
* @LastEditTime: 2025-09-02 15:27:05
* @FilePath: /lls_program/src/pages/ActivitiesCover/index.vue
* @Description: 活动海报页面 - 展示活动信息并处理定位授权
-->
......@@ -139,7 +139,7 @@ import PosterBuilder from '../../components/PosterBuilder/index.vue'
const hasLocationAuth = ref(false) // 是否已授权定位
const isJoining = ref(false) // 是否正在加入活动
const userLocation = ref({ lng: null, lat: null }) // 用户位置信息
const hasJoinedFamily = ref(false); // TODO: 是否加入家庭
const hasJoinedFamily = ref(false);
// 海报生成相关状态
const show_share = ref(false) // 显示分享弹窗
......@@ -631,6 +631,9 @@ const savePoster = () => {
// 页面挂载时检查定位授权状态
onMounted(() => {
// TODO: 是否加入家庭
hasJoinedFamily.value = Math.random > 0.5 ? true : false;
// 检查定位授权弹窗
checkLocationAuth()
})
</script>
......
......@@ -383,11 +383,11 @@ const initPageData = async () => {
useDidShow(() => {
// TODO: 等待真实接口获取用户是否加入家庭
// const hasJoinedFamily = false; // Change to true to simulate having a family
const hasJoinedFamily = Math.random() > 0.5; // Change to true to simulate having a family
// if (!hasJoinedFamily) {
// Taro.redirectTo({ url: '/pages/Welcome/index' });
// }
if (!hasJoinedFamily) {
Taro.redirectTo({ url: '/pages/Welcome/index' });
}
initPageData();
// TODO: 真实情况下 需要重新获取积分列表, 测试随机积分获取状态
......
export default {
navigationBarTitleText: '首页'
}
/**
* index页面样式
*/
.index {
// padding: 20px;
.nut-button {
margin-bottom: 20px;
}
}
<!--
* @Date: 2025-06-28 10:33:00
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-08-27 17:13:11
* @FilePath: /lls_program/src/pages/index/index.vue
* @Description: 文件描述
-->
<template>
<view class="index">
<PointsCollector ref="pointsCollectorRef" height="30vh" />
<nut-button type="success" @click="handleCollectAll" style="margin-top: 20rpx;">一键收取</nut-button>
</view>
</template>
<script setup>
import Taro from '@tarojs/taro'
import '@tarojs/taro/html.css'
import { ref, onMounted } from 'vue'
import { useDidShow, useReady } from '@tarojs/taro'
import PointsCollector from '@/components/PointsCollector.vue'
import "./index.less";
const pointsCollectorRef = ref(null)
/**
* 触发积分收集组件的一键收取
*/
const handleCollectAll = () => {
if (pointsCollectorRef.value) {
pointsCollectorRef.value.collectAll()
}
}
// 生命周期钩子
useDidShow(() => {
console.warn('index onShow')
})
useReady(async () => {
console.warn('index onReady')
// 版本更新检查
if (!Taro.canIUse("getUpdateManager")) {
Taro.showModal({
title: "提示",
content: "当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试",
showCancel: false,
});
return;
}
// https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html
const updateManager = Taro.getUpdateManager();
updateManager.onCheckForUpdate((res) => {
// 请求完新版本信息的回调
if (res.hasUpdate) {
updateManager.onUpdateReady(function () {
Taro.showModal({
title: "更新提示",
content: "新版本已经准备好,是否重启应用?",
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
},
});
});
updateManager.onUpdateFailed(function () {
// 新版本下载失败
Taro.showModal({
title: "更新提示",
content: "新版本已上线,请删除当前小程序,重新搜索打开",
});
});
}
});
})
onMounted(() => {
console.warn('index mounted')
})
// 分享功能
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
</script>
<script>
import { getCurrentPageParam } from "@/utils/weapp";
export default {
name: "indexPage",
onHide () {
console.warn('index onHide')
},
onShareAppMessage() {
let params = getCurrentPageParam();
// 设置菜单中的转发按钮触发转发事件时的转发内容
var shareObj = {
title: "xxx", // 默认是小程序的名称(可以写slogan等)
path: `pages/detail/index?id=${params.id}&start_date=${params.start_date}&end_date=${params.end_date}&room_type=${params.room_type}`, // 默认是当前页面,必须是以'/'开头的完整路径
imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
success: function (res) {
// 转发成功之后的回调
if (res.errMsg == 'shareAppMessage:ok') {
//
}
},
fail: function () {
// 转发失败之后的回调
if (res.errMsg == 'shareAppMessage:fail cancel') {
// 用户取消转发
} else if (res.errMsg == 'shareAppMessage:fail') {
// 转发失败,其中 detail message 为详细失败信息
}
},
complete: function () {
// 转发结束之后的回调(转发成不成功都会执行)
}
}
// 来自页面内的按钮的转发
// if (options.from == 'button') {
// var eData = options.target.dataset;
// // 此处可以修改 shareObj 中的内容
// shareObj.path = '/pages/goods/goods?goodId=' + eData.id;
// }
// 返回shareObj
return shareObj;
}
};
</script>