feat: 景区详情页优化 + 代码质量修复 + 首页适配
- 详情页:地图按钮改为复制地址,电话点击直接拨号 - 详情页:移除免X次/年徽章,增加信息卡片与卡种卡片间距 - 详情页:运营状态实时判断(根据营业时间自动显示营业中/已闭园) - 详情页:轮播圆点仅多图时显示,加大尺寸+投影,z-index置顶 - 详情页:景区电话箭头靠右对齐 - 首页:热门景点两列布局改用padding方案,修复小屏手机单列显示 - 代码质量:card/order API移入分包,消除主包未使用JS文件 - 代码质量:manifest启用minified和lazyCodeLoading - 构建:vite配置静默Sass弃用警告 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Generated
+8559
File diff suppressed because it is too large
Load Diff
+3
-2
@@ -6,7 +6,8 @@
|
|||||||
"urlCheck": false,
|
"urlCheck": false,
|
||||||
"es6": true,
|
"es6": true,
|
||||||
"postcss": false,
|
"postcss": false,
|
||||||
"minified": false
|
"minified": true
|
||||||
}
|
},
|
||||||
|
"lazyCodeLoading": "requiredComponents"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { get, post } from './request'
|
import { get, post } from '../../../api/request'
|
||||||
import type { CardInfo, CardDetail, MyCard, ActivateParams, QrCodeInfo } from './types'
|
import type { CardInfo, CardDetail, MyCard, ActivateParams, QrCodeInfo } from '../../../api/types'
|
||||||
|
|
||||||
/** 获取年卡列表 */
|
/** 获取年卡列表 */
|
||||||
export function getCardList(params?: { keyword?: string; category?: string }): Promise<CardInfo[]> {
|
export function getCardList(params?: { keyword?: string; category?: string }): Promise<CardInfo[]> {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { get, post } from './request'
|
import { get, post } from '../../../api/request'
|
||||||
import type { OrderInfo, CreateOrderParams, MockPayResult } from './types'
|
import type { OrderInfo, CreateOrderParams, MockPayResult } from '../../../api/types'
|
||||||
|
|
||||||
/** 创建订单 */
|
/** 创建订单 */
|
||||||
export function createOrder(data: CreateOrderParams): Promise<OrderInfo> {
|
export function createOrder(data: CreateOrderParams): Promise<OrderInfo> {
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive } from 'vue'
|
import { ref, reactive } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { activateCard } from '../../../../api/card'
|
import { activateCard } from '../../api/card'
|
||||||
import { showToast } from '../../../../utils'
|
import { showToast } from '../../../../utils'
|
||||||
|
|
||||||
const cardId = ref('')
|
const cardId = ref('')
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { bindCard } from '../../../../api/card'
|
import { bindCard } from '../../api/card'
|
||||||
import { showToast } from '../../../../utils'
|
import { showToast } from '../../../../utils'
|
||||||
|
|
||||||
const cardNo = ref('')
|
const cardNo = ref('')
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { createOrder, mockPay } from '../../../../api/order'
|
import { createOrder, mockPay } from '../../api/order'
|
||||||
import { showToast } from '../../../../utils'
|
import { showToast } from '../../../../utils'
|
||||||
|
|
||||||
const cardId = ref('')
|
const cardId = ref('')
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { getCardDetail } from '../../../../api/card'
|
import { getCardDetail } from '../../api/card'
|
||||||
import type { CardDetail } from '../../../../api/types'
|
import type { CardDetail } from '../../../../api/types'
|
||||||
|
|
||||||
const card = ref<CardDetail | null>(null)
|
const card = ref<CardDetail | null>(null)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { getCardList } from '../../../../api/card'
|
import { getCardList } from '../../api/card'
|
||||||
import CardItem from '../../../../components/card-item.vue'
|
import CardItem from '../../../../components/card-item.vue'
|
||||||
import type { CardInfo } from '../../../../api/types'
|
import type { CardInfo } from '../../../../api/types'
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onBeforeUnmount } from 'vue'
|
import { ref, onBeforeUnmount } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { getEntryQrCode } from '../../../../api/card'
|
import { getEntryQrCode } from '../../api/card'
|
||||||
import { showToast } from '../../../../utils'
|
import { showToast } from '../../../../utils'
|
||||||
import type { QrCodeInfo } from '../../../../api/types'
|
import type { QrCodeInfo } from '../../../../api/types'
|
||||||
|
|
||||||
|
|||||||
+22
-16
@@ -107,21 +107,22 @@
|
|||||||
:key="spot.id"
|
:key="spot.id"
|
||||||
class="spot animate-fade-in-up"
|
class="spot animate-fade-in-up"
|
||||||
:class="`stagger-${Math.min(idx + 4, 10)}`"
|
:class="`stagger-${Math.min(idx + 4, 10)}`"
|
||||||
@click="goSpot(spot)"
|
|
||||||
>
|
>
|
||||||
<view class="spot-cover">
|
<view class="spot-inner" @click="goSpot(spot)">
|
||||||
<image class="spot-img" :src="spot.image" mode="aspectFill" />
|
<view class="spot-cover">
|
||||||
<view class="spot-region">
|
<image class="spot-img" :src="spot.image" mode="aspectFill" />
|
||||||
<view class="pin-dot" />
|
<view class="spot-region">
|
||||||
<text>{{ spot.region }}</text>
|
<view class="pin-dot" />
|
||||||
|
<text>{{ spot.region }}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="spot-body">
|
||||||
<view class="spot-body">
|
<text class="spot-name">{{ spot.name }}</text>
|
||||||
<text class="spot-name">{{ spot.name }}</text>
|
<view class="spot-meta">
|
||||||
<view class="spot-meta">
|
<text class="spot-price">¥{{ spot.price }}</text>
|
||||||
<text class="spot-price">¥{{ spot.price }}</text>
|
<view class="spot-benefit">
|
||||||
<view class="spot-benefit">
|
<text>{{ spot.benefit }}</text>
|
||||||
<text>{{ spot.benefit }}</text>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -588,15 +589,20 @@ function goMore() {
|
|||||||
color: $color-muted-foreground;
|
color: $color-muted-foreground;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Spots grid — 2 column */
|
/* Spots grid — 2 column (避免 gap 兼容问题,用 padding 模拟间距) */
|
||||||
.spots-grid {
|
.spots-grid {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: $spacing-2;
|
margin: 0 (-$spacing-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.spot {
|
.spot {
|
||||||
width: calc(50% - #{$spacing-1});
|
width: 50%;
|
||||||
|
padding: $spacing-1;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spot-inner {
|
||||||
background: $color-card;
|
background: $color-card;
|
||||||
border-radius: $radius-lg;
|
border-radius: $radius-lg;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
<!-- 模块1:轮播大图 -->
|
<!-- 模块1:轮播大图 -->
|
||||||
<swiper
|
<swiper
|
||||||
class="hero-swiper"
|
class="hero-swiper"
|
||||||
:indicator-dots="true"
|
:indicator-dots="scenic.images.length > 1"
|
||||||
indicator-color="rgba(255,255,255,0.4)"
|
indicator-color="rgba(255,255,255,0.4)"
|
||||||
indicator-active-color="#ffffff"
|
indicator-active-color="#ffffff"
|
||||||
autoplay
|
:autoplay="scenic.images.length > 1"
|
||||||
circular
|
circular
|
||||||
:interval="4000"
|
:interval="4000"
|
||||||
>
|
>
|
||||||
@@ -20,9 +20,6 @@
|
|||||||
<!-- 标题行 -->
|
<!-- 标题行 -->
|
||||||
<view class="title-row">
|
<view class="title-row">
|
||||||
<text class="scenic-name">{{ scenic.name }}</text>
|
<text class="scenic-name">{{ scenic.name }}</text>
|
||||||
<view v-if="scenic.freeCount > 0" class="free-badge">
|
|
||||||
<text>免{{ scenic.freeCount }}次/年</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 预约提醒横幅 -->
|
<!-- 预约提醒横幅 -->
|
||||||
@@ -43,25 +40,29 @@
|
|||||||
<text class="text-assist">{{ scenic.bookingDeadline }}</text>
|
<text class="text-assist">{{ scenic.bookingDeadline }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 开放时间 -->
|
<!-- 开放时间 + 运营状态 -->
|
||||||
<view class="info-line" @click="onHoursClick">
|
<view class="info-line" @click="onHoursClick">
|
||||||
<view class="icon-wrap icon-clock" />
|
<view class="icon-wrap icon-clock" />
|
||||||
<text class="text-body">{{ scenic.hours }}</text>
|
<text class="text-body">{{ scenic.hours }}</text>
|
||||||
|
<view class="status-tag" :class="isOpen ? 'open' : 'closed'">
|
||||||
|
<view class="status-dot" />
|
||||||
|
<text>{{ isOpen ? '营业中' : '已闭园' }}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 联系电话 -->
|
<!-- 联系电话 -->
|
||||||
<view class="info-line clickable" @click="onPhoneClick">
|
<view class="info-line clickable" @click="onPhoneClick">
|
||||||
<view class="icon-wrap icon-phone" />
|
<view class="icon-wrap icon-phone" />
|
||||||
<text class="text-body">{{ scenic.phone }}</text>
|
<text class="text-body">{{ scenic.phone }}</text>
|
||||||
<view class="icon-wrap icon-chevron" />
|
<view class="icon-wrap icon-chevron chevron-right" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 地址 -->
|
<!-- 地址 -->
|
||||||
<view class="info-line clickable" @click="onMapClick">
|
<view class="info-line clickable" @click="onCopyAddress">
|
||||||
<view class="icon-wrap icon-map-pin" />
|
<view class="icon-wrap icon-map-pin" />
|
||||||
<text class="text-body address-text">{{ scenic.address }}</text>
|
<text class="text-body address-text">{{ scenic.address }}</text>
|
||||||
<view class="map-btn" @click.stop="onMapClick">
|
<view class="map-btn" @click.stop="onCopyAddress">
|
||||||
<text>地图</text>
|
<text>复制</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -131,7 +132,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
|
||||||
interface NoticeItem { title: string; content: string }
|
interface NoticeItem { title: string; content: string }
|
||||||
@@ -146,6 +147,19 @@ interface ScenicDetail {
|
|||||||
const scenic = ref<ScenicDetail>({ tags: [], images: [], cards: [], bookingNotice: [] } as unknown as ScenicDetail)
|
const scenic = ref<ScenicDetail>({ tags: [], images: [], cards: [], bookingNotice: [] } as unknown as ScenicDetail)
|
||||||
const activeTab = ref<'notice' | 'intro'>('notice')
|
const activeTab = ref<'notice' | 'intro'>('notice')
|
||||||
|
|
||||||
|
/** 根据营业时间判断运营状态 */
|
||||||
|
const isOpen = computed(() => {
|
||||||
|
const h = scenic.value.hours
|
||||||
|
if (!h || h.includes('暂停') || h.includes('闭')) return false
|
||||||
|
const match = h.match(/(\d{2}):(\d{2})\s*-\s*(\d{2}):(\d{2})/)
|
||||||
|
if (!match) return true
|
||||||
|
const now = new Date()
|
||||||
|
const current = now.getHours() * 60 + now.getMinutes()
|
||||||
|
const open = parseInt(match[1]) * 60 + parseInt(match[2])
|
||||||
|
const close = parseInt(match[3]) * 60 + parseInt(match[4])
|
||||||
|
return current >= open && current <= close
|
||||||
|
})
|
||||||
|
|
||||||
// 双卡种数据:超级玩家卡 remaining 与 freeCount 一致,年卡 remaining 稍多
|
// 双卡种数据:超级玩家卡 remaining 与 freeCount 一致,年卡 remaining 稍多
|
||||||
function buildCards(freeCount: number): CardBenefit[] {
|
function buildCards(freeCount: number): CardBenefit[] {
|
||||||
if (freeCount <= 0) return []
|
if (freeCount <= 0) return []
|
||||||
@@ -182,10 +196,15 @@ function onHoursClick() {
|
|||||||
uni.showToast({ title: '营业时间仅供参考', icon: 'none' })
|
uni.showToast({ title: '营业时间仅供参考', icon: 'none' })
|
||||||
}
|
}
|
||||||
function onPhoneClick() {
|
function onPhoneClick() {
|
||||||
uni.showToast({ title: '联系电话功能开发中', icon: 'none' })
|
uni.makePhoneCall({ phoneNumber: scenic.value.phone })
|
||||||
}
|
}
|
||||||
function onMapClick() {
|
function onCopyAddress() {
|
||||||
uni.showToast({ title: '地图导航开发中', icon: 'none' })
|
uni.setClipboardData({
|
||||||
|
data: scenic.value.address,
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({ title: '地址已复制', icon: 'success' })
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
function onBookClick(cardType: string) {
|
function onBookClick(cardType: string) {
|
||||||
const label = cardType === 'super' ? '超级玩家卡' : '赣湘全域旅游年卡'
|
const label = cardType === 'super' ? '超级玩家卡' : '赣湘全域旅游年卡'
|
||||||
@@ -221,6 +240,7 @@ $icon-crown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' w
|
|||||||
.icon-clock { background-image: $icon-clock; }
|
.icon-clock { background-image: $icon-clock; }
|
||||||
.icon-phone { background-image: $icon-phone; }
|
.icon-phone { background-image: $icon-phone; }
|
||||||
.icon-chevron { background-image: $icon-chevron; }
|
.icon-chevron { background-image: $icon-chevron; }
|
||||||
|
.chevron-right { margin-left: auto; }
|
||||||
.icon-map-pin { background-image: $icon-map-pin; }
|
.icon-map-pin { background-image: $icon-map-pin; }
|
||||||
.icon-crown { background-image: $icon-crown; }
|
.icon-crown { background-image: $icon-crown; }
|
||||||
|
|
||||||
@@ -251,6 +271,24 @@ $icon-crown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' w
|
|||||||
.hero-swiper {
|
.hero-swiper {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 480rpx;
|
height: 480rpx;
|
||||||
|
|
||||||
|
:deep(.uni-swiper-dots) {
|
||||||
|
z-index: 10;
|
||||||
|
bottom: 64rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.uni-swiper-dot) {
|
||||||
|
width: 16rpx;
|
||||||
|
height: 16rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin: 0 8rpx !important;
|
||||||
|
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.uni-swiper-dot-active) {
|
||||||
|
width: 32rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.hero-img {
|
.hero-img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -278,25 +316,6 @@ $icon-crown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' w
|
|||||||
.scenic-name {
|
.scenic-name {
|
||||||
@extend .text-title;
|
@extend .text-title;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
margin-right: $spacing-2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.free-badge {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 6rpx 16rpx;
|
|
||||||
background: $uv-primary;
|
|
||||||
border-radius: $radius-sm;
|
|
||||||
flex-shrink: 0;
|
|
||||||
min-height: 40rpx;
|
|
||||||
|
|
||||||
text {
|
|
||||||
font-size: 22rpx;
|
|
||||||
color: #fff;
|
|
||||||
font-weight: $font-weight-semibold;
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-banner {
|
.notice-banner {
|
||||||
@@ -363,6 +382,32 @@ $icon-crown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' w
|
|||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 运营状态标签 */
|
||||||
|
.status-tag {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8rpx;
|
||||||
|
margin-left: auto;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: $font-weight-medium;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.open text { color: $uv-success; }
|
||||||
|
&.closed text { color: $uv-error; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-dot {
|
||||||
|
width: 12rpx;
|
||||||
|
height: 12rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
|
||||||
|
.open & { background: $uv-success; }
|
||||||
|
.closed & { background: $uv-error; }
|
||||||
|
}
|
||||||
|
|
||||||
.map-btn {
|
.map-btn {
|
||||||
padding: 8rpx 20rpx;
|
padding: 8rpx 20rpx;
|
||||||
background: $uv-primary-light;
|
background: $uv-primary-light;
|
||||||
@@ -381,7 +426,7 @@ $icon-crown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' w
|
|||||||
/* ====== 模块3:卡种权益卡片 ====== */
|
/* ====== 模块3:卡种权益卡片 ====== */
|
||||||
.benefit-card {
|
.benefit-card {
|
||||||
background: $color-card;
|
background: $color-card;
|
||||||
margin: 0 $spacing-3 $spacing-2;
|
margin: $spacing-3 $spacing-3 $spacing-2;
|
||||||
padding: $spacing-3;
|
padding: $spacing-3;
|
||||||
border-radius: $radius-lg;
|
border-radius: $radius-lg;
|
||||||
box-shadow: $shadow-sm;
|
box-shadow: $shadow-sm;
|
||||||
|
|||||||
@@ -197,8 +197,8 @@ const stickyHeaderHeight = ref(96) // 预估,onMounted 后精确测量
|
|||||||
// 页面加载时获取系统信息
|
// 页面加载时获取系统信息
|
||||||
;(function initNavBar() {
|
;(function initNavBar() {
|
||||||
try {
|
try {
|
||||||
const sysInfo = uni.getSystemInfoSync()
|
const windowInfo = uni.getWindowInfo()
|
||||||
statusBarHeight.value = sysInfo.statusBarHeight || 20
|
statusBarHeight.value = windowInfo.statusBarHeight || 20
|
||||||
} catch {
|
} catch {
|
||||||
statusBarHeight.value = 20
|
statusBarHeight.value = 20
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,11 @@ import uni from "@dcloudio/vite-plugin-uni";
|
|||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [uni()],
|
plugins: [uni()],
|
||||||
|
css: {
|
||||||
|
preprocessorOptions: {
|
||||||
|
scss: {
|
||||||
|
silenceDeprecations: ['legacy-js-api'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user