火车票app首页

This commit is contained in:
tangxinyue 2026-03-03 15:45:32 +08:00
parent e233f84b4d
commit cfce21f87e
2 changed files with 905 additions and 866 deletions

View File

@ -16,7 +16,6 @@
</view> </view>
<view class="content-box" :style="{ height: windowHeight + 'px' }"> <view class="content-box" :style="{ height: windowHeight + 'px' }">
<scroll-view scroll-y="true" class="scroll-view" <scroll-view scroll-y="true" class="scroll-view"
:style="{ height: (windowHeight - statusBarHeight - 44) + 'px', marginTop: (statusBarHeight + 44) + 'px' }" :style="{ height: (windowHeight - statusBarHeight - 44) + 'px', marginTop: (statusBarHeight + 44) + 'px' }"
@scroll="handleScroll"> @scroll="handleScroll">
@ -225,12 +224,13 @@ const menuList = [{
const otherList = [{ const otherList = [{
icon: "/static/image/index/qita/jipiao.png", icon: "/static/image/index/qita/jipiao.png",
name: "机票", name: "机票",
path: "/pages/other/tickets-app/index" path: "/pages/other/tickets-app/index?type=airTicket"
}, },
{ {
icon: "/static/image/index/qita/huochepiao.png", icon: "/static/image/index/qita/huochepiao.png",
name: "火车票", name: "火车票",
path: "/pages/other/train-tickets/12306-tickets/12306-tickets" // path: "/pages/other/train-tickets/12306-tickets/12306-tickets"
path: "/pages/other/tickets-app/index?type=trainTicket"
}, },
{ {
icon: "/static/image/index/qita/gongzidan.png", icon: "/static/image/index/qita/gongzidan.png",

View File

@ -1,9 +1,11 @@
<template> <template>
<view class="container"> <view class="container">
<NavBar title="选择机票" bgColor="#F0F4F9" isBack></NavBar> <NavBar :title="`选择${type=='airTicket'?'机票':'火车票'}`" bgColor="#F0F4F9" isBack></NavBar>
<view class="content"> <view class="content">
<view class="app-card" v-for="(item, index) in appList" :key="index" @click="handleItemClick(item)"> <template v-for="(item, index) in appList" :key="index">
<view class="app-card" v-if="(type=='airTicket'&&item.airPath)||(type=='trainTicket'&&item.trainPath)"
@click="handleItemClick(item)">
<!-- Background Watermark --> <!-- Background Watermark -->
<image class="watermark" :src="item.bgImage" mode="heightFix"></image> <image class="watermark" :src="item.bgImage" mode="heightFix"></image>
@ -22,52 +24,72 @@
<uni-icons type="right" size="18" color="#CCCCCC"></uni-icons> <uni-icons type="right" size="18" color="#CCCCCC"></uni-icons>
</view> </view>
</template>
</view> </view>
</view> </view>
</template> </template>
<script setup> <script setup>
import NavBar from '@/components/nav-bar/nav-bar.vue'; import NavBar from '@/components/nav-bar/nav-bar.vue';
import { reactive, toRefs, getCurrentInstance } from 'vue'; import {
import { onLoad } from '@dcloudio/uni-app'; reactive,
import { util } from '@/utils/common.js'; // Assuming util exists for navigation, similar to previous tasks toRefs,
getCurrentInstance,
ref
} from 'vue';
import {
onLoad
} from '@dcloudio/uni-app';
import {
util
} from '@/utils/common.js'; // Assuming util exists for navigation, similar to previous tasks
const { const {
appContext, appContext,
proxy proxy
} = getCurrentInstance(); } = getCurrentInstance();
const appList = [ let type = ref('airTicket')
{
const appList = [{
name: '去哪儿APP', name: '去哪儿APP',
logo: '/static/image/other/tickets-app/qvnar-logo.png', logo: '/static/image/other/tickets-app/qvnar-logo.png',
bgImage: '/static/image/other/tickets-app/qvnar-bg.png', bgImage: '/static/image/other/tickets-app/qvnar-bg.png',
path: '/pages/other/air-tickets/qunar-air-tickets/qunar-air-tickets', airPath: '/pages/other/air-tickets/qunar-air-tickets/qunar-air-tickets',
trainPath: "",
isHot: false isHot: false
}, },
{ {
name: '飞猪APP', name: '飞猪APP',
logo: '/static/image/other/tickets-app/fliggy-logo.png', logo: '/static/image/other/tickets-app/fliggy-logo.png',
bgImage: '/static/image/other/tickets-app/fliggy-bg.png', bgImage: '/static/image/other/tickets-app/fliggy-bg.png',
path: '/pages/other/air-tickets/fliggy-air-tickets/fliggy-air-tickets', airPath: '/pages/other/air-tickets/fliggy-air-tickets/fliggy-air-tickets',
trainPath: "",
isHot: true isHot: true
}, },
{ {
name: '携程APP', name: '携程APP',
logo: '/static/image/other/tickets-app/trip-com-logo.png', logo: '/static/image/other/tickets-app/trip-com-logo.png',
bgImage: '/static/image/other/tickets-app/trip-com-bg.png', bgImage: '/static/image/other/tickets-app/trip-com-bg.png',
path: '/pages/other/air-tickets/ctrip-air-tickets/ctrip-air-tickets', airPath: '/pages/other/air-tickets/ctrip-air-tickets/ctrip-air-tickets',
trainPath: "",
isHot: false isHot: false
}, },
// { {
// name: '12306', name: '铁路12306',
// logo: '/static/image/other/tickets-app/12306-logo.png', logo: '/static/image/other/tickets-app/12306-logo.png',
// bgImage: '/static/image/other/tickets-app/12306-bg.png', bgImage: '/static/image/other/tickets-app/12306-bg.png',
// path: '/pages/other/train-tickets/12306-tickets/12306-tickets', airPath: '',
// isHot: false trainPath: "/pages/other/train-tickets/12306-tickets/12306-tickets",
// } isHot: false
}
] ]
onLoad((option) => { onLoad((option) => {
const appType = option.type
if (appType == "trainTicket") {
type.value = "trainTicket"
} else {
type.value = "airTicket"
// //
proxy.$apiUserEvent('all', { proxy.$apiUserEvent('all', {
type: 'event', type: 'event',
@ -75,11 +97,27 @@ onLoad((option) => {
prefix: '.uni.other.', prefix: '.uni.other.',
value: "机票" value: "机票"
}) })
}
}) })
/**
* 跳转火车票/飞机票页面
*/
const handleItemClick = (item) => { const handleItemClick = (item) => {
if (item.path) { if (type.value == 'trainTicket') {
util.goPage(item.path) if (item.trainPath) {
util.goPage(item.trainPath)
} else {
uni.showToast({
title: '开发中',
icon: 'none'
})
}
} else {
if (item.airPath) {
util.goPage(item.airPath)
} else { } else {
uni.showToast({ uni.showToast({
title: '开发中', title: '开发中',
@ -88,6 +126,7 @@ const handleItemClick = (item) => {
} }
} }
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.container { .container {