当前位置:   article > 正文

【7.精选分类】

【7.精选分类】

精选旅游

人气旅游→收藏次数最高

最新旅游→日期最新

主题旅游→主题关键字相同

在首页将精选的内容动态展示的实现

分析

首页中的精选包含“人气旅游”、“最新旅游”、“主题旅游”三个部分

index.html

//页面加载完成,发送ajax请求

根据点击不同分类展示不同内容

人气旅游→收藏次数最高(count)

最新旅游→日期最新(rdate)

主题旅游→主题关键字相同(theme)

index.html

改写前

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>黑马旅游网</title>
  8. <!-- Bootstrap -->
  9. <link href="css/bootstrap.min.css" rel="stylesheet">
  10. <link rel="stylesheet" type="text/css" href="css/common.css">
  11. <link rel="stylesheet" type="text/css" href="css/index.css">
  12. <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
  13. <script src="js/jquery-3.3.1.js"></script>
  14. <!-- Include all compiled plugins (below), or include individual files as needed -->
  15. <script src="js/bootstrap.min.js"></script>
  16. <!--导入布局js,共享header和footer-->
  17. <script type="text/javascript" src="js/include.js"></script>
  18. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  19. <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  20. <!--[if lt IE 9]>
  21. <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  22. <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
  23. <![endif]-->
  24. </head>
  25. <body>
  26. <!--引入头部-->
  27. <div id="header"></div>
  28. <!-- banner start-->
  29. <section id="banner">
  30. <div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="2000">
  31. <!-- Indicators -->
  32. <ol class="carousel-indicators">
  33. <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
  34. <li data-target="#carousel-example-generic" data-slide-to="1"></li>
  35. <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  36. </ol>
  37. <!-- Wrapper for slides -->
  38. <div class="carousel-inner" role="listbox">
  39. <div class="item active">
  40. <img src="images/banner_1.jpg" alt="">
  41. </div>
  42. <div class="item">
  43. <img src="images/banner_2.jpg" alt="">
  44. </div>
  45. <div class="item">
  46. <img src="images/banner_3.jpg" alt="">
  47. </div>
  48. </div>
  49. <!-- Controls -->
  50. <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
  51. <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
  52. <span class="sr-only">Previous</span>
  53. </a>
  54. <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
  55. <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
  56. <span class="sr-only">Next</span>
  57. </a>
  58. </div>
  59. </section>
  60. <!-- banner end-->
  61. <!-- 旅游 start-->
  62. <section id="content">
  63. <!-- 黑马精选start-->
  64. <section class="hemai_jx">
  65. <div class="jx_top">
  66. <div class="jx_tit">
  67. <img src="images/icon_5.jpg" alt="">
  68. <span>黑马精选</span>
  69. </div>
  70. <!-- Nav tabs -->
  71. <ul class="jx_tabs" role="tablist">
  72. <li role="presentation" class="active">
  73. <a id="popular" href="#popularity" aria-controls="popularity" role="tab" data-toggle="tab">人气旅游</a>
  74. <span></span>
  75. </li>
  76. <li role="presentation">
  77. <a id="new" href="#newest" aria-controls="newest" role="tab" data-toggle="tab">最新旅游</a>
  78. <span></span>
  79. </li>
  80. <li role="presentation">
  81. <a id="themes" href="#theme" aria-controls="theme" role="tab" data-toggle="tab">主题旅游</a>
  82. <span></span>
  83. </li>
  84. </ul>
  85. </div>
  86. <div class="jx_content">
  87. <!-- Tab panes -->
  88. <div class="tab-content">
  89. <div role="tabpanel" class="tab-pane active" id="popularity">
  90. <div class="row">
  91. <div class="col-md-3">
  92. <a href="javascript:;">
  93. <img src="images/jiangxuan_4.jpg" alt="">
  94. <div class="has_border">
  95. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  96. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  97. </div>
  98. </a>
  99. </div>
  100. <div class="col-md-3">
  101. <a href="javascript:;">
  102. <img src="images/jiangxuan_4.jpg" alt="">
  103. <div class="has_border">
  104. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  105. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  106. </div>
  107. </a>
  108. </div>
  109. <div class="col-md-3">
  110. <a href="javascript:;">
  111. <img src="images/jiangxuan_4.jpg" alt="">
  112. <div class="has_border">
  113. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  114. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  115. </div>
  116. </a>
  117. </div>
  118. <div class="col-md-3">
  119. <a href="javascript:;">
  120. <img src="images/jiangxuan_4.jpg" alt="">
  121. <div class="has_border">
  122. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  123. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  124. </div>
  125. </a>
  126. </div>
  127. </div>
  128. </div>
  129. <div role="tabpanel" class="tab-pane" id="newest">
  130. <div class="row">
  131. <div class="col-md-3">
  132. <a href="javascript:;">
  133. <img src="images/jiangxuan_1.jpg" alt="">
  134. <div class="has_border">
  135. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  136. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  137. </div>
  138. </a>
  139. </div>
  140. <div class="col-md-3">
  141. <a href="javascript:;">
  142. <img src="images/jiangxuan_1.jpg" alt="">
  143. <div class="has_border">
  144. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  145. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  146. </div>
  147. </a>
  148. </div>
  149. <div class="col-md-3">
  150. <a href="javascript:;">
  151. <img src="images/jiangxuan_1.jpg" alt="">
  152. <div class="has_border">
  153. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  154. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  155. </div>
  156. </a>
  157. </div>
  158. <div class="col-md-3">
  159. <a href="javascript:;">
  160. <img src="images/jiangxuan_1.jpg" alt="">
  161. <div class="has_border">
  162. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  163. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  164. </div>
  165. </a>
  166. </div>
  167. </div>
  168. </div>
  169. <div role="tabpanel" class="tab-pane" id="theme">
  170. <div class="row">
  171. <div class="col-md-3">
  172. <a href="javascript:;">
  173. <img src="images/jiangxuan_2.jpg" alt="">
  174. <div class="has_border">
  175. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  176. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  177. </div>
  178. </a>
  179. </div>
  180. <div class="col-md-3">
  181. <a href="javascript:;">
  182. <img src="images/jiangxuan_2.jpg" alt="">
  183. <div class="has_border">
  184. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  185. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  186. </div>
  187. </a>
  188. </div>
  189. <div class="col-md-3">
  190. <a href="javascript:;">
  191. <img src="images/jiangxuan_2.jpg" alt="">
  192. <div class="has_border">
  193. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  194. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  195. </div>
  196. </a>
  197. </div>
  198. <div class="col-md-3">
  199. <a href="javascript:;">
  200. <img src="images/jiangxuan_2.jpg" alt="">
  201. <div class="has_border">
  202. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  203. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  204. </div>
  205. </a>
  206. </div>
  207. </div>
  208. </div>
  209. </div>
  210. </div>
  211. </section>
  212. <!-- 黑马精选end-->
  213. <!-- 国内游 start-->
  214. <section class="hemai_jx">
  215. <div class="jx_top">
  216. <div class="jx_tit">
  217. <img src="images/icon_6.jpg" alt="">
  218. <span>国内游</span>
  219. </div>
  220. </div>
  221. <div class="heima_gn">
  222. <div class="guonei_l">
  223. <img src="images/guonei_1.jpg" alt="">
  224. </div>
  225. <div class="guone_r">
  226. <div class="row">
  227. <div class="col-md-4">
  228. <a href="route_detail.html">
  229. <img src="images/jiangxuan_4.jpg" alt="">
  230. <div class="has_border">
  231. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  232. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  233. </div>
  234. </a>
  235. </div>
  236. <div class="col-md-4">
  237. <a href="route_detail.html">
  238. <img src="images/jiangxuan_4.jpg" alt="">
  239. <div class="has_border">
  240. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  241. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  242. </div>
  243. </a>
  244. </div>
  245. <div class="col-md-4">
  246. <a href="route_detail.html">
  247. <img src="images/jiangxuan_4.jpg" alt="">
  248. <div class="has_border">
  249. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  250. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  251. </div>
  252. </a>
  253. </div>
  254. <div class="col-md-4">
  255. <a href="route_detail.html">
  256. <img src="images/jiangxuan_4.jpg" alt="">
  257. <div class="has_border">
  258. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  259. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  260. </div>
  261. </a>
  262. </div>
  263. <div class="col-md-4">
  264. <a href="route_detail.html">
  265. <img src="images/jiangxuan_4.jpg" alt="">
  266. <div class="has_border">
  267. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  268. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  269. </div>
  270. </a>
  271. </div>
  272. <div class="col-md-4">
  273. <a href="route_detail.html">
  274. <img src="images/jiangxuan_4.jpg" alt="">
  275. <div class="has_border">
  276. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  277. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  278. </div>
  279. </a>
  280. </div>
  281. </div>
  282. </div>
  283. </div>
  284. </section>
  285. <!-- 国内游 end-->
  286. <!-- 境外游 start-->
  287. <section class="hemai_jx">
  288. <div class="jx_top">
  289. <div class="jx_tit">
  290. <img src="images/icon_7.jpg" alt="">
  291. <span>境外游</span>
  292. </div>
  293. </div>
  294. <div class="heima_gn">
  295. <div class="guonei_l">
  296. <img src="images/jiangwai_1.jpg" alt="">
  297. </div>
  298. <div class="guone_r">
  299. <div class="row">
  300. <div class="col-md-4">
  301. <a href="route_detail.html">
  302. <img src="images/jiangxuan_4.jpg" alt="">
  303. <div class="has_border">
  304. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  305. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  306. </div>
  307. </a>
  308. </div>
  309. <div class="col-md-4">
  310. <a href="route_detail.html">
  311. <img src="images/jiangxuan_4.jpg" alt="">
  312. <div class="has_border">
  313. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  314. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  315. </div>
  316. </a>
  317. </div>
  318. <div class="col-md-4">
  319. <a href="route_detail.html">
  320. <img src="images/jiangxuan_4.jpg" alt="">
  321. <div class="has_border">
  322. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  323. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  324. </div>
  325. </a>
  326. </div>
  327. <div class="col-md-4">
  328. <a href="route_detail.html">
  329. <img src="images/jiangxuan_4.jpg" alt="">
  330. <div class="has_border">
  331. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  332. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  333. </div>
  334. </a>
  335. </div>
  336. <div class="col-md-4">
  337. <a href="route_detail.html">
  338. <img src="images/jiangxuan_4.jpg" alt="">
  339. <div class="has_border">
  340. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  341. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  342. </div>
  343. </a>
  344. </div>
  345. <div class="col-md-4">
  346. <a href="route_detail.html">
  347. <img src="images/jiangxuan_4.jpg" alt="">
  348. <div class="has_border">
  349. <h3>上海直飞三亚54晚自由行(春节预售+亲子/蜜月/休闲游首选+豪华酒店任选+接送机)</h3>
  350. <div class="price">网付价<em>¥</em><strong>889</strong><em>起</em></div>
  351. </div>
  352. </a>
  353. </div>
  354. </div>
  355. </div>
  356. </div>
  357. </section>
  358. <!-- 境外游 end-->
  359. </section>
  360. <!-- 旅游 end-->
  361. <!--导入底部-->
  362. <div id="footer"></div>
  363. <script>
  364. //点击"我的收藏"按钮触发的方法
  365. /* function myFavorite(){
  366. var rid = getParameter("rid");
  367. //1. 判断用户是否登录
  368. $.get("user/findOne",{},function (user) {
  369. if(user){
  370. //用户登录了
  371. //添加功能
  372. $.get("route/addFavorite",{rid:rid},function () {
  373. //代码刷新页面
  374. location.reload();
  375. });
  376. }else{
  377. //用户没有登录
  378. alert("您尚未登录,请登录");
  379. location.href="http://localhost/travel/login.html";
  380. }
  381. })
  382. }*/
  383. </script>
  384. </body>
  385. </html>
首先index.html中的标签添加id

【问题】人气旅游不显示&选中格式也错位了

【原因】选中发现“人气旅游”是存在的,只是字体颜色和背景色都是白色所以看不见

index.html

改之前

  1. <div class="jx_tit">
  2. <img src="images/icon_5.jpg" alt="">
  3. <span>黑马精选</span>
  4. </div>
  5. <!-- Nav tabs -->
  6. <ul class="jx_tabs" role="tablist">
  7. <li role="presentation" class="active">
  8. <span></span>
  9. <a href="#popularity" aria-controls="popularity" role="tab" data-toggle="tab">人气旅游</a>
  10. </li>
  11. <li role="presentation">
  12. <span></span>
  13. <a href="#newest" aria-controls="newest" role="tab" data-toggle="tab">最新旅游</a>
  14. </li>
  15. <li role="presentation">
  16. <span></span>
  17. <a href="#theme" aria-controls="theme" role="tab" data-toggle="tab">主题旅游</a>
  18. </li>
  19. </ul>
  20. </div>

改之后

  1. <div class="jx_tit">
  2. <img src="images/icon_5.jpg" alt="">
  3. <span>黑马精选</span>
  4. </div>
  5. <!-- Nav tabs -->
  6. <ul class="jx_tabs" role="tablist">
  7. <li role="presentation" class="active">
  8. <a href="#popularity" aria-controls="popularity" role="tab" data-toggle="tab">人气旅游</a>
  9. <span></span>
  10. </li>
  11. <li role="presentation">
  12. <a href="#newest" aria-controls="newest" role="tab" data-toggle="tab">最新旅游</a>
  13. <span></span>
  14. </li>
  15. <li role="presentation">
  16. <a href="#theme" aria-controls="theme" role="tab" data-toggle="tab">主题旅游</a>
  17. <span></span>
  18. </li>
  19. </ul>
  20. </div>

修改之后即可

【出现报错】

前端是404,找不到/travel/css/bootstrap.min.css.map

解决方法见:http://t.csdn.cn/dockY

导入了/travel/css/bootstrap.min.css,但是一直404,找不到/travel/css/bootstrap.min.css.map,找不到对应的路径(真没有.map这个文件啊),怪哉!

后台报的是testWhileIdle is true, validationQuery not set

浏览器访问Maven项目时报testWhileIdle is true, validationQuery not set

原因:

开启空闲检测,但是没有设置对应的检测语句

解决方法

在druid配置文件加上

  1. #如果指定,则查询必须是一个SQL SELECT并且必须返回至少一行记录
  2. validation-query: select 1

好像没什么用 ̄□ ̄||

【出现问题】人气旅游分页没有内容展示

原因RouteDaoImpl中查询语句返回有误,

更正一下

前端页面展示

【问题】但是一看,最新旅游和主题旅游还是写死的界面

【出现原因】index.html中id选择器没有对应id

加上以后运行结果:

成了鸭,好耶!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/运维做开发/article/detail/925842
推荐阅读
相关标签
  

闽ICP备14008679号