You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
GenFlightRec/WebContent/default/index.jsp

299 lines
12 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%@page import="javabean.db_conn"%>
<%@page import="java.sql.ResultSet"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page contentType="text/html; charset=UTF-8" import="java.util.Date"%>
<%@page contentType="text/html; charset=UTF-8" import="java.text.SimpleDateFormat"%>
<%
// 检查用户是否已登录
if (session.getAttribute("user_id") == null) {
// 如果未登录,重定向到登录页面
response.sendRedirect("../index/login_reg.jsp");
return;
}
// 添加URL session ,作为用户登录后跳转回来的依据,登录servlet中已经写了判断程序如果有url_cookie就跳转到url_cookie如果没有就跳转到用户中心
session.setAttribute("url", request.getRequestURI());
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
<link rel="icon" href="./images/airplane.ico">
<title>机票推荐系统</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/common.css" rel="stylesheet">
<link href="css/corptravel.css" rel="stylesheet">
<link href="css/enterprise.css" rel="stylesheet">
<link href="css/iconfont.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<%!
String user_name,seat;
Date date = new Date();
//设置要获取到什么样的时间
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//获取String类型的时间
String todaydate = sdf.format(date);
%>
<!-- 日期选择器导入外部库 -->
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css">
<script>
$(function() {
$( "#datepicker" ).datepicker({
dateFormat: 'yy-mm-dd'
});
});
</script>
<!-- 日期选择器导入结束 -->
</head>
<body class="bg-body">
<!-- header -->
<nav class="navbar navbar-default navbar-fixed-top bg-white">
<nav class="navbar navbar-default"
style="min-height: 30px; line-height: 30px; margin-bottom: 0px; border-radius: 0;">
<div class="container font12">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed"
data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<ul class="nav navbar-nav nav-top-small" style="margin-left: -15px;">
<li class="dropdown">
<% if(session.getAttribute("user_id")!=null){
db_conn conn=new db_conn();
String sql="select * from p_inf where p_tel='"+session.getAttribute("user_id")+"'";
ResultSet res=conn.executeQuery(sql);
if(res.next())
user_name=res.getString(1);
%>
<a href="javacript:none" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
您好,<%= user_name %>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="logout.jsp">退出</a></li>
</ul>
<%}else{ %>
<a href="../user_center" class="dropdown-toggle" role="button" aria-haspopup="true" aria-expanded="false">
点击此处登录(登录后可以推荐机票)
</a>
<%} %>
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed"
data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
aria-expanded="false">
<span class="sr-only">Toggle navigation</span> <span
class="icon-bar"></span> <span class="icon-bar"></span> <span
class="icon-bar"></span>
</button>
<a class=" " href="index.jsp"><img src="images/newlogo11.png"
width="420" height="84" alt="系统LOGO" class="pull-left mar-right-30"
style="margin-left: -15px;"></a>
</div>
<!--
<div class="collapse navbar-collapse"
id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="javascript:none"><i
class="icon iconfont icon-nav-block font24">&#xe620;</i> 首页</a></li>
<li><a href="/air_ticket_book/user_center"><i
class="icon iconfont icon-nav-block font24">&#xe61c;</i> 用户中心</a></li>
</ul>
</div>
-->
</div>
</nav>
<!-- header end -->
<!-- 搜索 -->
<!-- 日期选择框的样式信息 -->
<style>
.ui-datepicker {
background-color: #f0f0f0; /* 示例背景颜色 */
}
.ui-datepicker th {
background-color: #414582; /* 示例表头背景颜色 */
color: white; /* 示例表头文字颜色 */
}
.ui-datepicker td a {
background-color: #ffffff; /* 示例日期单元格背景颜色(未选中时) */
color: #000000; /* 示例日期单元格文字颜色(未选中时) */
}
.ui-datepicker td a.ui-state-active {
background-color: #4CAF50; /* 示例选中日期的背景颜色 */
color: red; /* 示例选中日期的文字颜色 */
}
</style>
<div class="index-wall white " style="">
<div class="container"
style="position: relative; margin-left: 25%; width: auto;">
<form class="form-inline" action="/air_ticket_book/search" method="post">
<div class="form-group"><!-- mar-left-10 -->
<label for="" >出发城市</label>
<input type="text" class="form-control" style="width: 95px;" value="" size="15" id="getcity_name" name="departure" mod="address|notice" mod_address_source="hotel" mod_address_suggest="@Beijing|北京|53@Shanghai|上海|321@Shenzhen|深圳|91@Guangzhou|广州|80@Qingdao|青岛|292@Chengdu|成都|324@Hangzhou|杭州|383@Wuhan|武汉|192@Tianjin|天津|343@Dalian|大连|248@Xiamen|厦门|61@Chongqing|重庆|394@" mod_address_reference="getcityid" mod_notice_tip="中文/拼音" />
<input id="getcityid" name="getcityid" type="hidden" value="{$getcityid}" />
</div>
<div class="form-group" style="margin-left:2%">
<label for=""> &nbsp;&nbsp;&nbsp;&nbsp;到达城市</label>
<input type="text" class="form-control" style="width: 95px;" value="" size="15" id="homecity_name" name="destination" mod="address|notice" mod_address_source="hotel" mod_address_suggest="@Beijing|北京|53@Shanghai|上海|321@Shenzhen|深圳|91@Guangzhou|广州|80@Qingdao|青岛|292@Chengdu|成都|324@Hangzhou|杭州|383@Wuhan|武汉|192@Tianjin|天津|343@Dalian|大连|248@Xiamen|厦门|61@Chongqing|重庆|394@" mod_address_reference="cityid" mod_notice_tip="中文/拼音" />
<input id="cityid" name="cityid" type="hidden" value="{$cityid}" />
</div>
<div class="form-group" style="margin-left:2%">
<label for=""> &nbsp;&nbsp;&nbsp;&nbsp;出发日期</label> <input name="date" type="text" class="form-control" id="datepicker"
style="width: 140px;" value="<%=todaydate %>" placeholder="出发日期">
</div>
<button type="submit" class="btn btn-warning mar-left-10"
style= "font-size:18px; border:#FFFFFF; color:#414582; background-color:#FFFFFF;margin-left: 2%;">搜索</button>
</form>
</div>
</div>
<!-- 搜索结束 -->
<!-- 列表开始 -->
<div class="container mar-bottom-30 " style="margin-left: 0%;width:65%">
<div class="hangbanlist">
<div>
<%
db_conn conn=new db_conn();
String sql="select * from flight where f_Date ='"+todaydate+"'";
ResultSet res=conn.executeQuery(sql);
while(res.next()){
String f_i=res.getString(1);
String s_p=res.getString(2);
String a_p=res.getString(3);
String s_a=res.getString(4);
String a_a=res.getString(5);
String s_t=res.getString(6);
String a_t=res.getString(7);
String f_p=res.getString(8);
String f_d=res.getString(9);
String f_delay=res.getString(10);
String f_food=res.getString(11);
String f_wide=res.getString(12);
String f_depcode=res.getString(13);
String f_dstcode=res.getString(14);
/*
String sql2="select sum(t_b) from ticket where f_n='"+f_i+"' and t_d='"+todaydate+"'";
db_conn conn2=new db_conn();
ResultSet res2=conn2.executeQuery(sql2);
if(res2.next()) seat=res2.getString(1);
if(seat=="null") seat="0";
db_conn conn3=new db_conn();
String a_code="";//出发地机场三字码
String d_code="";//到达地机场三字码
String sql3="SELECT code FROM codetoname WHERE airportname = '"+a_a+"'";
String sql4="SELECT code FROM codetoname WHERE airportname = '"+s_a+"'";
ResultSet res3=conn3.executeQuery(sql3);
if(res3.next()) a_code=res3.getString(1);
ResultSet res4=conn3.executeQuery(sql4);
if(res4.next()) d_code=res4.getString(1);
*/
String Domainname="https://flights.ctrip.com/";
//Domainname+="online/list/oneway-"+d_code+"-"+a_code+"?_=1&depdate="+f_d+"&containstax=1";
Domainname+="online/list/oneway-"+f_depcode+"-"+f_dstcode+"?_=1&depdate="+f_d+"&containstax=1";
%>
<!-- 表头 -->
<ul class="list-inline bor-bottom-solid-1 ">
<li class="w-percentage-25" style="font-size:26px;color:#414582;"> <strong><%=f_i %></strong></li>
<li class="w20 time " ><strong><%=s_p %></strong> </li>
<li class="text-right" style= "color:#414582;"><%=s_a %></li>
<li class="">—</li>
<li class="w20 time " ><strong><%=a_p %></strong> </li>
<li class="w150" style= "color:#414582;"><%=a_a %></li>
<li class="time w100"><strong><%=s_t %></strong></li>
<li class="">—</li>
<li class="time w80"><strong><%=a_t %></strong></li>
<%if(session.getAttribute("user_id")!=null){ %>
<li class="pull-right "><button type="button" style= "border:#000000;color:#FFFFFF;background-color:#414582;"
class="btn btn-danger btn-sm" onClick="window.location.href ='<%= Domainname%>';">订票</button></li><%}
if(session.getAttribute("user_id")==null){ %>
<li class="pull-right "><button type="button" style= "border:#000000;color:#FFFFFF;background-color:#414582;"
class="btn btn-danger btn-sm" onClick="window.location.href ='error_login.jsp?flight_id=<%=f_i %>';">订票</button></li><%} %>
</ul>
<!-- 表头结束 -->
<!-- 表BODY -->
<div class="collapse" id="collapseExample" style="display: block;">
<div class="hangbanlist-body " style="background-color: #f4f6f7;">
<ul class="list-inline">
<li class="w-percentage-20">价格:<span class="rmb">¥<%=f_p %></span></li>
<li class="w-percentage-20">平均延误时间:<span class=""><%=f_delay %></span> min</li>
<li class="w-percentage-20">餐食:<span class=""><%=f_food %></span></li>
<li class="w-percentage-20">座位宽度:<span class=""><%=f_wide %></span> cm</li>
</ul>
</div>
</div>
<!-- 表BODY 结束 -->
<%
}
%>
</div>
<div class="clearfix"></div>
</div>
</div>
<!-- AI聊天框 -->
<div class="chat-container">
<div id="chat-history"></div>
<div class="input-area">
<input type="text" id="user-input" placeholder="输入您的问题...">
<button id="send-btn">发送</button>
</div>
</div>
<!-- AI聊天框结束 -->
<!-- 城市选择框触发 -->
<div id="jsContainer" class="jsContainer" style="height:0">
<div id="tuna_alert" style="display:none;position:absolute;z-index:999;overflow:hidden;"></div>
<div id="tuna_jmpinfo" style="visibility:hidden;position:absolute;z-index:120;"></div>
</div>
<!-- 导入AI聊天框和城市选择框对应JS -->
<script src="js/script.js"></script>
<script type="text/javascript" src="js/fixdiv.js"></script>
<script type="text/javascript" src="js/address.js"></script>
</body>
</html>