farmList.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. {% load staticfiles %}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8. <title>农场列表页</title>
  9. <link rel="stylesheet" href="{% static '/lib/font/fontIcon/iconfont.css' %}">
  10. <link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css">
  11. <link rel="stylesheet" href="{% static '/lib/css/reset.css' %}">
  12. <link rel="stylesheet" href="{% static '/lib/layui/css/layui.css' %}">
  13. <link rel="stylesheet" href="{% static '/css/common.css' %}">
  14. <link rel="stylesheet" href="{% static '/css/module.css' %}">
  15. <!-- <link rel="stylesheet" href="{% static '/css/hotelList.css' %}"> -->
  16. <style>
  17. /* 内容模块 */
  18. .hacienda .haciendaList{
  19. display: flex;
  20. flex-flow: wrap;
  21. }
  22. .hacienda .haciendaList{
  23. padding: 20px 20px 0 20px;
  24. }
  25. .hacienda .haciendaItem{
  26. display: flex;
  27. margin-bottom: 20px;
  28. }
  29. .hacienda .haciendaImg{
  30. width: 195px;
  31. height: 165px;
  32. position: relative;
  33. }
  34. .hacienda .haciendaImg .haciendaImg1{
  35. width: 100%;
  36. height: 100%;
  37. }
  38. .hacienda .haciendaImg .haciendaImg2{
  39. position: absolute;
  40. top: 0;
  41. left: 10px;
  42. }
  43. .hacienda .haciendaItem .haciendaTxt{
  44. width: 147px;
  45. padding: 10px 10px;
  46. }
  47. .hacienda .haciendaItem .haciendaTxt h2{
  48. font-size: 14px;
  49. font-weight: bold;
  50. line-height: 33px;
  51. white-space: nowrap;
  52. overflow: hidden;
  53. text-overflow: ellipsis;
  54. }
  55. .hacienda .haciendaItem .haciendaTxt .desc{
  56. letter-spacing: 2px;
  57. height: 100px;
  58. overflow: hidden;
  59. }
  60. .hacienda .haciendaItem .haciendaTxt button{
  61. color: #fff;
  62. padding: 5px 6px;
  63. border-radius: 5px;
  64. }
  65. .hacienda .haciendaItem .haciendaTxt button.btn1{
  66. background-color: #00aeed;
  67. }
  68. .hacienda .haciendaItem .haciendaTxt button.btn2{
  69. background-color: #3bb852;
  70. }
  71. /* 弹出观光样式 */
  72. .tourismShow{
  73. position: relative;
  74. z-index: 999;
  75. opacity: 0;
  76. display: none;
  77. position: fixed;
  78. top: 25%;
  79. left: 50%;
  80. margin-left: -300px;
  81. width: 600px;
  82. min-height: 400px;
  83. background-color: #fff;
  84. border: 1px solid #f1f1f1;
  85. -webkit-box-shadow: 2px 4px 10px rgba(0,0,0,.15);
  86. -moz-box-shadow: 2px 4px 10px rgba(0,0,0,.15);
  87. -o-box-shadow: 2px 4px 10px rgba(0,0,0,.15);
  88. box-shadow: 2px 4px 10px rgba(0,0,0,.15);
  89. padding: 20px;
  90. border-radius: 12px;
  91. z-index: 9;
  92. border-top-left-radius: 0;
  93. cursor: default;
  94. border-top-right-radius: 0;
  95. transition: all .5s;
  96. }
  97. .tourismShow .title{
  98. border-left: 3px solid #ff6a28;
  99. padding-left: 8px;
  100. font-size: 16px;
  101. }
  102. .tourismShow .line{
  103. border-bottom: 1px solid #ddd;
  104. margin-top: 10px;
  105. }
  106. .tourismShow .content{
  107. height: 430px;
  108. padding-top: 20px;
  109. }
  110. .tourismShow .tourismShowCloseBtn{
  111. position: absolute;
  112. right: 15px;
  113. top: 11px;
  114. border-radius: 50%;
  115. border: 2px solid #ddd;
  116. width: 25px;
  117. height: 25px;
  118. line-height: 25px;
  119. text-align: center;
  120. cursor: pointer;
  121. }
  122. .tourismShow .content .guideForm>input{
  123. width: 40%;
  124. }
  125. .tourismShow .content .guideForm>button{
  126. color: #fff;
  127. padding: 5px 6px;
  128. border-radius: 5px;
  129. vertical-align: middle;
  130. margin-left: 10px;
  131. background: #1eaeed;
  132. }
  133. .tourismShow .content .guideForm>button{
  134. color: #fff;
  135. padding: 5px 6px;
  136. border-radius: 5px;
  137. vertical-align: middle;
  138. margin-left: 10px;
  139. background: #1eaeed;
  140. }
  141. .tourismShow .content #map{
  142. height: 373px;
  143. margin-top: 10px;
  144. }
  145. .tourismShow .loadDiv{
  146. position: absolute;
  147. left: 45%;
  148. top: 45%;
  149. }
  150. </style>
  151. </head>
  152. <body>
  153. <div class="header">
  154. <div class="headerTxt">
  155. <div class="wrapper">
  156. <p class="logoNameCn">休闲农业旅游网</p>
  157. <p class="logoNameEn">Leisure agricultural tourism network</p>
  158. </div>
  159. </div>
  160. <!-- 广告 -->
  161. <div class="bjColor advImg"></div>
  162. </div>
  163. <!-- 主体部分 -->
  164. <div class="content">
  165. <div class="wrapper">
  166. <div class="newsDiv">
  167. <!-- 面包屑导航 -->
  168. <div class="breadcrumb">
  169. <span class="layui-breadcrumb">
  170. <a href="home">首页</a>
  171. <a>
  172. <cite>农场导览</cite>
  173. </a>
  174. </span>
  175. <div class="searchDiv">
  176. <input type="text" id="searchTitlt" value="{{con|default:''}}" placeholder="请输入标题" autocomplete="off" class="layui-input" >
  177. <button type="button" onclick="searchCon()" class="layui-btn layui-btn-ms"><i class="layui-icon">&#xe615;</i></button>
  178. </div>
  179. </div>
  180. <!-- 新闻列表 -->
  181. <div class="innerDiv">
  182. <div class="hacienda">
  183. <ul class="haciendaList">
  184. {% if hotel|length %} {% for hotelItem in hotel %}
  185. <li class="haciendaItem">
  186. <div class="haciendaImg">
  187. <img class="haciendaImg1" src="{% static 'imgs/1.jpg'%}" alt="">
  188. </div>
  189. <div class="haciendaTxt">
  190. <h2>云飞农场</h2>
  191. <div class="desc">位于和南沙鞥周三水电费,杀敌欧福布斯后撒粉红色的。阿时候发货萨芬,是大法师。</div>
  192. <div>
  193. <button class="btn1">观光路线</button>
  194. <button class="btn2">导游导览</button>
  195. </div>
  196. </div>
  197. </li>
  198. {% endfor %} {% else %}
  199. <li class="videoItem" style=" width: 100%;">
  200. <div style="text-align:center;line-height:200px;font-size:18px">暂无数据</div>
  201. </li>
  202. {% endif %}
  203. </ul>
  204. </div>
  205. {% if hotel|length %}
  206. <div id="page"></div>
  207. <input type="hidden" value="{{nums}}" id="nums">
  208. <input type="hidden" value="{{page}}" id="currPage">
  209. {% else %}
  210. {% endif %}
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. <!-- 底部版权 -->
  216. <div class="footer bjColor">
  217. <div class="wrapper">
  218. <div class="floatDiv">
  219. <div class="copyrightTxt">
  220. <div>休闲农业旅游网</div>
  221. <div>联系人:李四  联系电话:13811111111</div>
  222. <div>地址:河南省郑州市XXXXXXXXXXXXXXXXXXXXXXXXXX</div>
  223. </div>
  224. <div class="WeChatCode">
  225. <img src="{% static '/imgs/WeChatCode.jpg' %}" alt="">
  226. <p>关注公众号</p>
  227. </div>
  228. </div>
  229. <div class="copyright">
  230. 版权所有XXXXXXXXXXXXXXXXXXXXXX
  231. </div>
  232. </div>
  233. </div>
  234. <div class="tourismShow">
  235. <div class="title">
  236. <span>观光路线</span>
  237. <div class="tourismShowCloseBtn"><i class="layui-icon layui-icon-close"></i></div>
  238. </div>
  239. <div class="line"></div>
  240. <div class="content"></div>
  241. </div>
  242. <script src="{% static '/lib/js/jquery-2.1.4.min.js'%}"></script>
  243. <script src="https://webapi.amap.com/maps?v=1.4.15&key=3939967b919a8003377dd113fc445a3d&plugin=AMap.Driving"></script>
  244. <script src="{% static '/lib/layui/layui.js'%}"></script>
  245. <script>
  246. //注意:导航 依赖 element 模块,否则无法进行功能性操作
  247. layui.use(['element', 'laypage'], function () {
  248. var element = layui.element;
  249. //…
  250. var laypage = layui.laypage;
  251. var currPage = $('#currPage').val();
  252. //执行一个laypage实例
  253. laypage.render({
  254. elem: 'page' //注意,这里的 test1 是 ID,不用加 # 号
  255. , count: $('#nums').val() //数据总数,从服务端得到
  256. // , limit: 5
  257. , curr: currPage
  258. , jump: function (obj, first) {
  259. //obj包含了当前分页的所有参数,比如:
  260. console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
  261. console.log(obj.limit); //得到每页显示的条数
  262. var searchTitlt = $('#searchTitlt').val();
  263. //首次不执行
  264. if (!first) {
  265. window.location.href = 'farm_list?page=' + obj.curr + '&condition=' + searchTitlt;
  266. }
  267. }
  268. });
  269. });
  270. $('#searchTitlt').on('keypress', function (e) {
  271. if (e && e.keyCode == 13) { // 按 Esc
  272. searchCon()
  273. }
  274. })
  275. function searchCon() {
  276. var searchTitlt = $('#searchTitlt').val();
  277. window.location.href = 'farm_list?page=1' + '&condition=' + searchTitlt;
  278. }
  279. $('.haciendaTxt .btn1').on('click',function(){
  280. $('.tourismShow .title span').html('观光路线')
  281. $('.tourismShow .content').html('<div style="text-align:center;width:100%;height:100%"><img style="width:100%;height:100%" src="http://127.0.0.1:8000/static/imgs/banner2.jpg">')
  282. $('.tourismShow').show();
  283. $('.tourismShow').css('opacity',1)
  284. })
  285. $('.tourismShowCloseBtn').on('click',function(){
  286. $('.tourismShow .content').html('')
  287. $('.tourismShow').css('opacity',0)
  288. setTimeout(function(){
  289. $('.tourismShow').hide();
  290. },500)
  291. })
  292. var map;
  293. $('.haciendaTxt .btn2').on('click',function(){
  294. $('.tourismShow .title span').html('导游导览');
  295. var html = '<div class="">'+
  296. '<div class="guideForm">起始地点:<input type="text" id="startPath"><button onclick="searchWay()">确定</button></div>'+
  297. '<div id="map">地图</div>'+
  298. '</div>'
  299. $('.tourismShow .content').html(html);
  300. map = new AMap.Map('map', {
  301. resizeEnable: true, //是否监控地图容器尺寸变化
  302. zoom: 11, //初始化地图层级
  303. center: [113.397428, 39.90923] //初始化地图中心点
  304. });
  305. var startIcon = new AMap.Icon({
  306. // 图标尺寸
  307. size: new AMap.Size(25, 34),
  308. // 图标的取图地址
  309. image: '//a.amap.com/jsapi_demos/static/demo-center/icons/dir-marker.png',
  310. // 图标所用图片大小
  311. imageSize: new AMap.Size(135, 40),
  312. // 图标取图偏移量
  313. imageOffset: new AMap.Pixel(-9, -3)
  314. });
  315. var endIcon = new AMap.Icon({
  316. size: new AMap.Size(25, 34),
  317. image: '//a.amap.com/jsapi_demos/static/demo-center/icons/dir-marker.png',
  318. imageSize: new AMap.Size(135, 40),
  319. imageOffset: new AMap.Pixel(-95, -3)
  320. });
  321. var marker = new AMap.Marker({
  322. icon:endIcon,
  323. position: new AMap.LngLat(113.397428, 39.90923), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
  324. title: '北京'
  325. });
  326. map.add(marker);
  327. $('.tourismShow').show();
  328. $('.tourismShow').css('opacity',1)
  329. })
  330. function searchWay() {
  331. map.clearMap();
  332. var startPath = $("#startPath").val();
  333. var endPath = '北京';
  334. if (!startPath) {
  335. $("#startPath").focus();
  336. return;
  337. }
  338. $('.tourismShow .content').append('<div class="loadDiv"><img src="../static/imgs/timg.gif" /></div>')
  339. //构造路线导航类
  340. var driving = new AMap.Driving({
  341. map: map,
  342. // panel: "panel"
  343. });
  344. // 根据起终点名称规划驾车导航路线
  345. driving.search([
  346. { keyword: startPath, city: '' },
  347. { keyword: endPath, city: '' }
  348. ], function (status, result) {
  349. if (status === 'complete') {
  350. // log.success('绘制驾车路线完成');
  351. $('.loadDiv').remove();
  352. } else {
  353. alert('获取驾车数据失败:' + result)
  354. $('.loadDiv').remove();
  355. }
  356. });
  357. }
  358. </script>
  359. </body>
  360. </html>