refactor: move pages to subpackages to reduce main package size

This commit is contained in:
jacobxu666
2026-06-26 11:59:59 +08:00
parent 4b7c540343
commit 4acb2e6a9c
18 changed files with 113 additions and 108 deletions
@@ -34,7 +34,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import AnnouncementModal from '../../components/AnnouncementModal.vue' import AnnouncementModal from '../../../components/AnnouncementModal.vue'
interface NoticeItem { interface NoticeItem {
id: number id: number
@@ -207,7 +207,7 @@ function onCopyAddress() {
}) })
} }
function onBookClick(cardType: string) { function onBookClick(cardType: string) {
uni.navigateTo({ url: '/pages/reserve/reserve-index' }) uni.navigateTo({ url: '/packages/user/pages/reserve/index' })
} }
</script> </script>
@@ -401,7 +401,7 @@ function goBack() {
function onCardClick(scenic: ScenicItem) { function onCardClick(scenic: ScenicItem) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/scenic-detail/scenic-detail?id=${scenic.id}`, url: `/packages/content/pages/scenic-detail?id=${scenic.id}`,
}) })
} }
</script> </script>
@@ -194,7 +194,7 @@ function copyCode() {
function goActivate() { function goActivate() {
uni.navigateTo({ uni.navigateTo({
url: `/pages/card-bind/card-bind?redeemCode=${order.value.redeemCode}` url: `/packages/user/pages/bind?redeemCode=${order.value.redeemCode}`
}) })
} }
@@ -213,7 +213,7 @@ function handleRefund() {
} }
function goFaq() { function goFaq() {
uni.navigateTo({ url: '/pages/faq/faq' }) uni.navigateTo({ url: '/packages/content/pages/faq' })
} }
function goHome() { function goHome() {
@@ -176,12 +176,12 @@ function onLoadMore() {
} }
function goDetail(orderId: string) { function goDetail(orderId: string) {
uni.navigateTo({ url: `/pages/order/order-detail?orderId=${orderId}` }) uni.navigateTo({ url: `/packages/user/pages/order/detail?orderId=${orderId}` })
} }
function goActivate(order: OrderItem) { function goActivate(order: OrderItem) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/card-bind/card-bind?redeemCode=${order.redeemCode}` url: `/packages/user/pages/bind?redeemCode=${order.redeemCode}`
}) })
} }
@@ -205,7 +205,7 @@ function submitRefund() {
} }
function goBuy() { function goBuy() {
uni.navigateTo({ url: '/pages/card-buy/card-buy' }) uni.navigateTo({ url: '/packages/user/pages/buy' })
} }
</script> </script>
@@ -220,12 +220,12 @@ function handleSubmit() {
const sessionTime = session ? session.time : '' const sessionTime = session ? session.time : ''
const sessionParam = sessionTime ? `&session=${encodeURIComponent(sessionTime)}` : '' const sessionParam = sessionTime ? `&session=${encodeURIComponent(sessionTime)}` : ''
uni.navigateTo({ uni.navigateTo({
url: `/pages/reserve/reserve-success?reserveId=${reserveId}&date=${selectedDate.value}&scenic=${encodeURIComponent(scenic.value.name)}${sessionParam}` url: `/packages/user/pages/reserve/success?reserveId=${reserveId}&date=${selectedDate.value}&scenic=${encodeURIComponent(scenic.value.name)}${sessionParam}`
}) })
} }
function goFaq() { function goFaq() {
uni.navigateTo({ url: '/pages/faq/faq' }) uni.navigateTo({ url: '/packages/content/pages/faq' })
} }
</script> </script>
@@ -298,7 +298,7 @@ function onLoadMore() {
} }
function goReserve() { function goReserve() {
uni.navigateTo({ url: '/pages/reserve/reserve-index' }) uni.navigateTo({ url: '/packages/user/pages/reserve/index' })
} }
function previewPhoto(url: string) { function previewPhoto(url: string) {
@@ -107,7 +107,7 @@ onLoad((query: any) => {
// 拦截返回,跳转预约记录页 // 拦截返回,跳转预约记录页
onBackPress(() => { onBackPress(() => {
uni.redirectTo({ url: '/pages/reserve/reserve-list' }) uni.redirectTo({ url: '/packages/user/pages/reserve/list' })
return true return true
}) })
@@ -116,7 +116,7 @@ function showCode() {
} }
function goRecord() { function goRecord() {
uni.redirectTo({ url: '/pages/reserve/reserve-list' }) uni.redirectTo({ url: '/packages/user/pages/reserve/list' })
} }
function goHome() { function goHome() {
+84 -79
View File
@@ -41,85 +41,6 @@
"style": { "style": {
"navigationBarTitleText": "个人中心" "navigationBarTitleText": "个人中心"
} }
},
{
"path": "pages/scenic-list/scenic-list",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": ""
}
},
{
"path": "pages/scenic-detail/scenic-detail",
"style": {
"navigationBarTitleText": "景区详情"
}
},
{
"path": "pages/notice-list/notice-list",
"style": {
"navigationBarTitleText": "通知公告"
}
},
{
"path": "pages/card-bind/card-bind",
"style": {
"navigationBarTitleText": "绑卡激活"
}
},
{
"path": "pages/card-buy/card-buy",
"style": {
"navigationBarTitleText": "超级玩家卡"
}
},
{
"path": "pages/usage-guide/usage-guide",
"style": {
"navigationBarTitleText": "使用说明"
}
},
{
"path": "pages/faq/faq",
"style": {
"navigationBarTitleText": "常见问题"
}
},
{
"path": "pages/union-buy/union-buy",
"style": {
"navigationBarTitleText": "工会购买"
}
},
{
"path": "pages/order/order-list",
"style": {
"navigationBarTitleText": "我的订单"
}
},
{
"path": "pages/order/order-detail",
"style": {
"navigationBarTitleText": "订单详情"
}
},
{
"path": "pages/reserve/reserve-index",
"style": {
"navigationBarTitleText": "景区预约"
}
},
{
"path": "pages/reserve/reserve-success",
"style": {
"navigationBarTitleText": "预约成功"
}
},
{
"path": "pages/reserve/reserve-list",
"style": {
"navigationBarTitleText": "预约/使用记录"
}
} }
], ],
"subPackages": [ "subPackages": [
@@ -161,6 +82,90 @@
"style": { "style": {
"navigationBarTitleText": "绑定年卡" "navigationBarTitleText": "绑定年卡"
} }
},
{
"path": "pages/bind",
"style": {
"navigationBarTitleText": "绑卡激活"
}
},
{
"path": "pages/buy",
"style": {
"navigationBarTitleText": "超级玩家卡"
}
},
{
"path": "pages/union-buy",
"style": {
"navigationBarTitleText": "工会购买"
}
},
{
"path": "pages/order/list",
"style": {
"navigationBarTitleText": "我的订单"
}
},
{
"path": "pages/order/detail",
"style": {
"navigationBarTitleText": "订单详情"
}
},
{
"path": "pages/reserve/index",
"style": {
"navigationBarTitleText": "景区预约"
}
},
{
"path": "pages/reserve/success",
"style": {
"navigationBarTitleText": "预约成功"
}
},
{
"path": "pages/reserve/list",
"style": {
"navigationBarTitleText": "预约/使用记录"
}
}
]
},
{
"root": "packages/content",
"pages": [
{
"path": "pages/scenic-list",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": ""
}
},
{
"path": "pages/scenic-detail",
"style": {
"navigationBarTitleText": "景区详情"
}
},
{
"path": "pages/notice-list",
"style": {
"navigationBarTitleText": "通知公告"
}
},
{
"path": "pages/usage-guide",
"style": {
"navigationBarTitleText": "使用说明"
}
},
{
"path": "pages/faq",
"style": {
"navigationBarTitleText": "常见问题"
}
} }
] ]
} }
+8 -8
View File
@@ -155,11 +155,11 @@ const quickActions = [
function onQuickAction(item: { label: string }) { function onQuickAction(item: { label: string }) {
if (item.label === '我要绑卡') { if (item.label === '我要绑卡') {
uni.navigateTo({ url: '/pages/card-bind/card-bind' }) uni.navigateTo({ url: '/packages/user/pages/bind' })
return return
} }
if (item.label === '我要预约') { if (item.label === '我要预约') {
uni.navigateTo({ url: '/pages/scenic-list/scenic-list' }) uni.navigateTo({ url: '/packages/content/pages/scenic-list' })
return return
} }
if (item.label === '我要入园') { if (item.label === '我要入园') {
@@ -167,7 +167,7 @@ function onQuickAction(item: { label: string }) {
return return
} }
if (item.label === '常见问题') { if (item.label === '常见问题') {
uni.navigateTo({ url: '/pages/faq/faq' }) uni.navigateTo({ url: '/packages/content/pages/faq' })
return return
} }
uni.showToast({ title: `${item.label}功能开发中`, icon: 'none' }) uni.showToast({ title: `${item.label}功能开发中`, icon: 'none' })
@@ -207,7 +207,7 @@ function openNotice(item: { typeLabel: string; content: string; body?: string })
} }
function goMoreNotice() { function goMoreNotice() {
uni.navigateTo({ url: '/pages/notice-list/notice-list' }) uni.navigateTo({ url: '/packages/content/pages/notice-list' })
} }
/** 热门景点数据 */ /** 热门景点数据 */
@@ -221,19 +221,19 @@ const hotSpots = mockScenicList.slice(0, 6).map(s => ({
})) }))
function goCardDetail() { function goCardDetail() {
uni.navigateTo({ url: '/pages/card-buy/card-buy' }) uni.navigateTo({ url: '/packages/user/pages/buy' })
} }
function goUnionBuy() { function goUnionBuy() {
uni.navigateTo({ url: '/pages/union-buy/union-buy' }) uni.navigateTo({ url: '/packages/user/pages/union-buy' })
} }
function goSpot(spot: { id: number }) { function goSpot(spot: { id: number }) {
uni.navigateTo({ url: `/pages/scenic-detail/scenic-detail?id=${spot.id}` }) uni.navigateTo({ url: `/packages/content/pages/scenic-detail?id=${spot.id}` })
} }
function goMore() { function goMore() {
uni.navigateTo({ url: '/pages/scenic-list/scenic-list' }) uni.navigateTo({ url: '/packages/content/pages/scenic-list' })
} }
</script> </script>
+3 -3
View File
@@ -90,11 +90,11 @@ function handleLogout() {
function showComingSoon() { uni.showToast({ title: '即将上线,敬请期待', icon: 'none' }) } function showComingSoon() { uni.showToast({ title: '即将上线,敬请期待', icon: 'none' }) }
function goFaq() { uni.navigateTo({ url: '/pages/faq/faq' }) } function goFaq() { uni.navigateTo({ url: '/packages/content/pages/faq' }) }
function goUsageGuide() { uni.navigateTo({ url: '/pages/usage-guide/usage-guide' }) } function goUsageGuide() { uni.navigateTo({ url: '/packages/content/pages/usage-guide' }) }
function goOrders() { uni.navigateTo({ url: '/pages/order/order-list' }) } function goOrders() { uni.navigateTo({ url: '/packages/user/pages/order/list' }) }
function callService() { uni.makePhoneCall({ phoneNumber: '400-123-0101' }) } function callService() { uni.makePhoneCall({ phoneNumber: '400-123-0101' }) }
</script> </script>
+5 -5
View File
@@ -211,7 +211,7 @@ function copyCardNo() {
} }
function goBindCard() { function goBindCard() {
uni.navigateTo({ url: '/pages/card-bind/card-bind' }) uni.navigateTo({ url: '/packages/user/pages/bind' })
} }
const featureActions = [ const featureActions = [
@@ -223,19 +223,19 @@ const featureActions = [
function onFeatureClick(item: { label: string }) { function onFeatureClick(item: { label: string }) {
if (item.label === '我要绑定') { if (item.label === '我要绑定') {
uni.navigateTo({ url: '/pages/card-bind/card-bind' }) uni.navigateTo({ url: '/packages/user/pages/bind' })
return return
} }
if (item.label === '我要预约') { if (item.label === '我要预约') {
uni.navigateTo({ url: '/pages/scenic-list/scenic-list' }) uni.navigateTo({ url: '/packages/content/pages/scenic-list' })
return return
} }
if (item.label === '使用说明') { if (item.label === '使用说明') {
uni.navigateTo({ url: '/pages/usage-guide/usage-guide' }) uni.navigateTo({ url: '/packages/content/pages/usage-guide' })
return return
} }
if (item.label === '使用记录') { if (item.label === '使用记录') {
uni.navigateTo({ url: '/pages/reserve/reserve-list' }) uni.navigateTo({ url: '/packages/user/pages/reserve/list' })
return return
} }
uni.showToast({ title: `${item.label}功能开发中`, icon: 'none' }) uni.showToast({ title: `${item.label}功能开发中`, icon: 'none' })
Binary file not shown.

Before

Width:  |  Height:  |  Size: 485 KiB

After

Width:  |  Height:  |  Size: 16 KiB