farmList.html 14 KB

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