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.
 
 
 
 

554 lines
27 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8" name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
  5. <title>我的书单 - {$kx.config.sitename}</title>
  6. <meta name="keywords" content="{$tkd.keywords|parseTpl}">
  7. <meta name="description" content="{$tkd.description|parseTpl}">
  8. <link rel="stylesheet" href="{$kx.config.resurl}/template/kxmobileno1/css/global.css"/>
  9. <script src="{$kx.config.resurl}/template/kxmobileno1/js/flexible.min.js"></script>
  10. <link rel="shortcut icon" type="image/ico" href="/favicon.ico" />
  11. <meta name="author" content="www.ptcms.com">
  12. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  13. <meta name="renderer" content="webkit">
  14. <meta name="viewport" content="width=device-width" />
  15. <meta name="applicable-device" content="pc">
  16. <meta http-equiv="mobile-agent" content="format=html5; url={$kx.config.mobileurl}__SELF__">
  17. <meta http-equiv="Cache-Control" content="no-siteapp" />
  18. <meta http-equiv="Cache-Control" content="no-transform" />
  19. <link rel="canonical" href="{$kx.config.pcurl}__SELF__" />
  20. <style>
  21. html,body{
  22. height: 100%;
  23. }
  24. .loading{
  25. position: fixed;
  26. left: 0;
  27. top:0;
  28. width: 100%;
  29. height: 100%;
  30. z-index: 100;
  31. background-color: rgba(0,0,0,0.5) !important;
  32. background: url("{$kx.config.resurl}/template/kxmobileno1/images/loading.webp") no-repeat;
  33. background-position: 50% 50%;
  34. background-size: 32px 32px;
  35. }
  36. .pt-popular-cont{
  37. display: none;
  38. /*min-height: 100%;*/
  39. width: 100%;
  40. height: auto;
  41. }
  42. .pt-popular-cont.active{
  43. display: block;
  44. }
  45. .btn-tag img{
  46. width: .16rem;
  47. height: .16rem;
  48. transform:rotate(180deg);
  49. float: right;
  50. }
  51. .pt-tags{
  52. position: relative;
  53. }
  54. .pt-tags ul{
  55. margin-bottom: 60px;
  56. }
  57. .pt-tags li{
  58. display: inline-block;
  59. padding: 2px 15px;
  60. border: 1px solid #d5d5d5;
  61. border-radius:20px;
  62. margin: 5px 0 15px 0;
  63. }
  64. .pt-tags li.active{
  65. background-color: #f55;
  66. color: #fff;
  67. border-color: #f55;
  68. }
  69. .pt-tags button,
  70. .pt-novel button,
  71. .pt-marks button,
  72. .pt-search button{
  73. box-shadow:0 0 16px 0 rgba(255,85,85,0.92);
  74. border-radius:44px;
  75. }
  76. .pt-tags .btn,
  77. .pt-novel .btn,
  78. .pt-marks .btn,
  79. .pt-search .btn{
  80. position: fixed;
  81. bottom: 0;
  82. left: 0;
  83. background-color: #fff;
  84. width: 100%;
  85. }
  86. .pt-novel ul .pt-novel-del{
  87. height: 16px;
  88. width: 16px;
  89. float: right;
  90. background: url("{$kx.config.resurl}/template/kxmobileno1/images/del.png") no-repeat;
  91. -webkit-background-size: 100% 100%;
  92. background-size: 100% 100%;
  93. }
  94. .pt-novel-comment{
  95. height:63px;
  96. border:1px solid #E9E9E9;
  97. }
  98. .pt-novel-select{
  99. margin-top: 0.35rem;
  100. width: 0.16rem;
  101. height: 0.16rem;
  102. background: url('{$kx.config.resurl}/template/kxmobileno1/images/select.png') no-repeat;
  103. -webkit-background-size: 100% 100% !important;
  104. background-size: 100% 100% !important;
  105. }
  106. li.active .pt-novel-select{
  107. background: url('{$kx.config.resurl}/template/kxmobileno1/images/selected.png') no-repeat;
  108. }
  109. .pt-square{
  110. margin-left: 0;
  111. margin-right: 0;
  112. }
  113. .pt-square.active{
  114. border-color: #f55;
  115. background-color: #f55;
  116. color: #fff;
  117. }
  118. </style>
  119. </head>
  120. <body>
  121. {block method=booklist.info booklistid=$kx.get.id name=info}
  122. <div class="w100 bg-white flex-wrp flex-align-center flex-between lh100 plr15 ptb15">
  123. <img src="{$kx.config.resurl}/template/kxmobileno1/images/return.png" class="pt-return">
  124. <div class="size14 bold color89 pt-labs">{=empty($info)?'创建书单':'修改书单'}</div>
  125. <div><button type="button" class="color2 bold size14 btn-next bg-white">下一步</button></div>
  126. </div>
  127. <form method="post">
  128. {if !empty($info)}
  129. <input type="hidden" name="id" value="{$info.id}">
  130. {/if}
  131. <div data-page="edit" class="pt-popular-cont pt-edit active" style="min-height: 100%">
  132. <input class="bold size18 mt10 mb20 w100" type="text" name="title" placeholder="请输入书单名称" value="{$info.title}">
  133. <div class="border-b size14 ptb10 btn-tag">
  134. <select name="tags[]" class="none" multiple>
  135. {loop=$info.tags}
  136. <option value="{$loop.id}" selected>{$loop.name}</option>
  137. {/loop}
  138. </select>
  139. <input type="text" value="{=empty($info.tags)?'':join(',',array_column($info.tags,'name'))}" placeholder="请选择书单标签" readonly>
  140. <img src="{$kx.config.resurl}/template/kxmobileno1/images/return.png">
  141. </div>
  142. <textarea class="size14 pt10 w100" name="intro" rows="6" placeholder="请输入书单简介">{$info.intro}</textarea>
  143. </div>
  144. <div data-page="tags" class="pt-popular-cont pt-tags">
  145. {~$tags=array_column($info.tags,'id')}
  146. {block method="tag" name=list}
  147. <span class="color32 size18 bold">全部标签</span>
  148. <ul>
  149. {loop}
  150. <li data-value="{$loop.id}" data-name="{$loop.name}" class="{=in_array($loop.id,$tags)?'active':''}">{$loop.name}</li>
  151. {/loop}
  152. </ul>
  153. <div class="text-center ptb10 btn">
  154. <button type="button" class="color1 bg-red ptb15 plr60 size16 bold mtb10">确认选择</button>
  155. </div>
  156. </div>
  157. <div data-page="novel" class="pt-popular-cont pt-novel">
  158. <div class="pt-booklist-title size16 color32 bold mt10">标题</div>
  159. <div class="pt-booklist-tags size12 color32 mt10">标签</div>
  160. <div class="compulsory-row w100 color32 size12 pt-booklist-intro mt10 border-t pt5" style="height: 84px;"></div>
  161. </div>
  162. <div data-page="novel" class="pt-popular-cont pt-novel mt10">
  163. <ul>
  164. {loop=$info.novels}
  165. <li>
  166. <div class="flex-wrp pt-popular-item">
  167. <input type="hidden" name="novels[id][]" value="{$loop.novel.id}">
  168. <input type="hidden" name="novels[star][]" value="{$loop.star}">
  169. <img src="{$loop.novel.cover}" class="mr15" alt="{$loop.novel.name}">
  170. <div class="flex-item pt5">
  171. <div class="flex-wrp flex-between">
  172. <div class="size14">
  173. <span class="color7 bold">{$loop.novel.name}</span>
  174. </div>
  175. <div class="pt-novel-del"></div>
  176. </div>
  177. <div class="size12">
  178. <span class="mr30">{$loop.author.name}</span>
  179. {$loop.category.name} | <span class="color2">{$loop.data.allvisit}</span>人在读
  180. </div>
  181. <div class="mt10">
  182. <span class="color32 size14">推荐指数</span>
  183. <span class="pt-photo">
  184. <span title="不知所云">
  185. <img src="{$kx.config.resurl}/template/kxmobileno1/images/star{=$loop.star>=1?'1':''}.png" class="{=$loop.star>=1?'':'no'}high">
  186. </span>
  187. <span title="随便看看">
  188. <img src="{$kx.config.resurl}/template/kxmobileno1/images/star{=$loop.star>=2?'1':''}.png" class="{=$loop.star>=2?'':'no'}high">
  189. </span>
  190. <span title="值得一读">
  191. <img src="{$kx.config.resurl}/template/kxmobileno1/images/star{=$loop.star>=3?'1':''}.png" class="{=$loop.star>=3?'':'no'}high">
  192. </span>
  193. <span title="不容错过">
  194. <img src="{$kx.config.resurl}/template/kxmobileno1/images/star{=$loop.star>=4?'1':''}.png" class="{=$loop.star>=4?'':'no'}high">
  195. </span>
  196. <span title="经典必读">
  197. <img src="{$kx.config.resurl}/template/kxmobileno1/images/star{=$loop.star>=5?'1':''}.png" class="{=$loop.star>=5?'':'no'}high">
  198. </span>
  199. </span>
  200. </div>
  201. </div>
  202. </div>
  203. <textarea class="pt-novel-comment compulsory-row plr10 ptb10 w100" name="novels[comment][]" readonly>{$loop.comment}</textarea>
  204. </li>
  205. {/loop}
  206. </ul>
  207. <div class="text-center ptb10 btn">
  208. <button type="button" class="color1 bg-red ptb10 plr35 size16 bold mtb10 mr20 pt-mark-add">书架添加</button>
  209. <button type="button" class="color1 bg-red ptb10 plr35 size16 bold mtb10 pt-search-add">书城添加</button>
  210. </div>
  211. </div>
  212. <div data-page="marks" class="pt-popular-cont pt-marks">
  213. <ul>
  214. {block method=mark.list userid=$userinfo.id name=marklist order=$order}
  215. {loop=marklist}
  216. <li data-id="{$loop.novel.id}" data-name="{$loop.novel.name}" data-cover="{$loop.novel.cover}" data-author="{$loop.author.name}" data-category="{$loop.category.name}" data-allvisit="{$loop.data.allvisit}">
  217. <div class="flex-wrp pt-popular-item">
  218. <img src="{$loop.novel.cover}" class="mr15" alt="{$loop.novel.name}">
  219. <div class="flex-item pt5">
  220. <div class="flex-wrp flex-between">
  221. <div class="size14">
  222. <span class="color7 bold">{$loop.novel.name}</span>
  223. </div>
  224. </div>
  225. <div class="size12">
  226. <span class="mr30">{$loop.author.name}</span>
  227. {$loop.category.name}
  228. </div>
  229. <div class="mt10 size12">{$loop.last.name}</div>
  230. </div>
  231. <div class="pt-novel-select"></div>
  232. </div>
  233. </li>
  234. {/loop}
  235. </ul>
  236. <div class="text-center ptb10 btn">
  237. <button type="button" class="color2 bg-white border-red ptb10 plr35 size16 bold mtb10 mr20">取消返回</button>
  238. <button type="button" class="color1 bg-red ptb10 plr35 size16 bold mtb10 btn-success">完成添加 (<span>0</span>)</button>
  239. </div>
  240. </div>
  241. <div data-page="search" class="pt-popular-cont pt-search">
  242. <div class="w100 bg-white flex-wrp flex-between flex-align-center pt-search">
  243. <div class="flex-wrp flex-align-center pt-search-box" style="width: 80vw;">
  244. <img src="{$kx.config.resurl}/template/kxmobileno1/images/search.png" class="mr10 pt-search-icon" >
  245. <input type="text" class="size12 color4 searchkey w100" placeholder="请输入您要搜索的关键书名">
  246. </div>
  247. <div class="btn-search color2 size14 mr5">搜索</div>
  248. </div>
  249. <ul></ul>
  250. <div class="clearfix"></div>
  251. <div class="text-center ptb10 btn">
  252. <button type="button" class="color2 bg-white border-red ptb10 plr35 size16 bold mtb10 mr20">取消返回</button>
  253. <button type="button" class="color1 bg-red ptb10 plr35 size16 bold mtb10 btn-success">完成添加 (<span>0</span>)</button>
  254. </div>
  255. </div>
  256. </form>
  257. <!-- 底部版权 -->
  258. {include file="/system/footer"}
  259. <script id="searchTpl" type="text/html">
  260. {{# $.each(d,function(k,v){ }}
  261. <li data-id="{{v.id}}" data-name="{{v.name}}" data-cover="{{v.cover}}" data-author="{{v.author}}" data-category="{{v.category}}" data-allvisit="{{v.allvisit}}">
  262. <div class="flex-wrp pt-popular-item">
  263. <img src="{{ v.cover }}" class="mr15" alt="{{ v.name }}">
  264. <div class="flex-item pt5">
  265. <div class="flex-wrp flex-between">
  266. <div class="size14"><span class="color7 bold">{{ v.name }}</span></div>
  267. </div>
  268. <div class="size12">
  269. <span class="mr30"{{ v.author }}</span>
  270. <span>{{ v.category }}</span> | <span class="color2">{{ v.allvisit }}</span>人在读
  271. </div>
  272. <div class="mt10 size12">{{ v.last.name }}</div>
  273. </div>
  274. <div class="pt-novel-select"></div>
  275. </div>
  276. </li>
  277. {{# }) }}
  278. </script>
  279. <script id="novelTpl" type="text/html">
  280. <li>
  281. <div class="flex-wrp pt-popular-item">
  282. <input type="hidden" name="novels[id][]" value="{{d.id}}">
  283. <input type="hidden" name="novels[star][]" value="5">
  284. <img src="{{d.cover}}" class="mr15" alt="{{d.name}}">
  285. <div class="flex-item pt5">
  286. <div class="flex-wrp flex-between">
  287. <div class="size14">
  288. <span class="color7 bold">{{d.name}}</span>
  289. </div>
  290. <div class="pt-novel-del"></div>
  291. </div>
  292. <div class="size12">
  293. <span class="mr30">{{d.author}}</span> {{d.category}} | <span class="color2">{{d.allvisit}}</span>人在读
  294. </div>
  295. <div class="mt10">
  296. <span class="color32 size14">推荐指数</span>
  297. <span class="pt-photo">
  298. <span title="不知所云">
  299. <img src="{$kx.config.resurl}/template/kxmobileno1/images/star1.png" class="high">
  300. </span>
  301. <span title="随便看看">
  302. <img src="{$kx.config.resurl}/template/kxmobileno1/images/star1.png" class="high">
  303. </span>
  304. <span title="值得一读">
  305. <img src="{$kx.config.resurl}/template/kxmobileno1/images/star1.png" class="high">
  306. </span>
  307. <span title="不容错过">
  308. <img src="{$kx.config.resurl}/template/kxmobileno1/images/star1.png" class="high">
  309. </span>
  310. <span title="经典必读">
  311. <img src="{$kx.config.resurl}/template/kxmobileno1/images/star1.png" class="high">
  312. </span>
  313. </span>
  314. </div>
  315. </div>
  316. </div>
  317. <textarea class="pt-novel-comment compulsory-row plr10 ptb10 w100" name="novels[comment][]" readonly></textarea>
  318. </li>
  319. </script>
  320. <script id="novelEditTpl" type="text/html">
  321. <div class="flex-wrp flex-flow-row flex-around plr10 mt10">
  322. <div class="flex-wrp flex-center color62 size12 mb15 pt-square {{d.star==1?'active':''}}" data-value="1"><span class="size14">1</span>分</div>
  323. <div class="flex-wrp flex-center color62 size12 mb15 pt-square {{d.star==2?'active':''}}" data-value="2"><span class="size14">2</span>分</div>
  324. <div class="flex-wrp flex-center color62 size12 mb15 pt-square {{d.star==3?'active':''}}" data-value="3"><span class="size14">3</span>分</div>
  325. <div class="flex-wrp flex-center color62 size12 mb15 pt-square {{d.star==4?'active':''}}" data-value="4"><span class="size14">4</span>分</div>
  326. <div class="flex-wrp flex-center color62 size12 mb15 pt-square {{d.star==5?'active':''}}" data-value="5"><span class="size14">5</span>分</div>
  327. </div>
  328. <div style="text-align: center;">
  329. <textarea rows="5" class="border-c9" style="width: 90%;padding: 5px;" placeholder="请输入评价">{{d.comment}}</textarea>
  330. </div>
  331. <div class="flex-wrp flex-center size14 ptb10 bg-red color1 pt-submit w50 mt10" style="margin: auto;border-radius: 20px;">确认提交</div>
  332. </script>
  333. <script src="{$kx.config.resurl}/template/kxmobileno1/js/layer/mobile/layer.js"></script>
  334. <script src="{$kx.config.resurl}/template/kxmobileno1/js/laytpl.js"></script>
  335. <script>
  336. var btn_next = $('.btn-next'),
  337. btn_return = $('.pt-return'),
  338. pt_edit = $('.pt-popular-cont.pt-edit'),
  339. pt_tags = $('.pt-popular-cont.pt-tags'),
  340. pt_novel = $('.pt-popular-cont.pt-novel'),
  341. pt_marks = $('.pt-popular-cont.pt-marks'),
  342. pt_search = $('.pt-popular-cont.pt-search');
  343. //返回按钮事件
  344. btn_return.off('click').click(function () {
  345. switch ($('.pt-popular-cont.active').data('page')) {
  346. case 'edit':
  347. if (confirm('确认离开此页?')) {
  348. window.history.back();
  349. }
  350. break;
  351. case 'tags':
  352. $('.pt-tags button').click();
  353. break;
  354. case 'novel':
  355. pt_novel.removeClass('active');
  356. pt_edit.addClass('active');
  357. btn_next.text('下一步');
  358. break;
  359. case 'marks':
  360. pt_novel.addClass('active');
  361. pt_marks.removeClass('active');
  362. btn_next.show();
  363. break;
  364. case 'search':
  365. pt_novel.addClass('active');
  366. pt_search.removeClass('active');
  367. btn_next.show();
  368. break;
  369. }
  370. });
  371. //下一步按钮事件
  372. btn_next.click(function(){
  373. if ($('.pt-popular-cont.active').data('page') === 'edit'){
  374. if (!($('input[name=title]').val())) {
  375. layer.open({content:'标题不能为空',btn:'我知道了'});
  376. return false;
  377. }
  378. if ($('select[name="tags[]"]').val().length > 3) {
  379. layer.open({content:'标签不能多于3个',btn:'我知道了'});
  380. return false;
  381. }
  382. this.innerHTML = '发布';
  383. pt_edit.removeClass('active');
  384. pt_novel.addClass('active');
  385. $('.pt-booklist-title').html($('input[name=title]').val());
  386. $('.pt-booklist-tags').html($('.pt-popular-cont.pt-edit .btn-tag input').val());
  387. $('.pt-booklist-intro').html($('textarea[name=intro]').val());
  388. }else{
  389. if (!($('input[name=title]').val())) {
  390. layer.open({content:'书单名称不能为空',btn:'我知道了'});
  391. return false;
  392. }
  393. if ($('select[name="tags[]"]').val().length > 3) {
  394. layer.open({content:'标签不能多于3个',btn:'我知道了'});
  395. return false;
  396. }
  397. if (!$('textarea[name=intro]').val().length) {
  398. layer.open({content:'简介不能为空',btn:'我知道了'});
  399. return false;
  400. }
  401. if ($('input[name="novels[id][]"]').length < 3) {
  402. layer.open({content:'书籍不能少于三本',btn:'我知道了'});
  403. return false;
  404. }
  405. for (var i = 0; i < $('input[name="novels[id][]"]').length; i++) {
  406. if (!$('textarea[name="novels[comment][]"]:eq(' + i + ')').val()) {
  407. layer.open({content:'书评不能为空',btn:'我知道了'});
  408. return false;
  409. }
  410. star = parseInt($('input[name="novels[star][]"]:eq(' + i + ')').val());
  411. if (!star || star < 1 || star > 5) {
  412. layer.open({content:'评分必须介于1 - 5之间',btn:'我知道了'});
  413. return false;
  414. }
  415. }
  416. $('form').submit();
  417. }
  418. });
  419. //选择标签事件
  420. $('.btn-tag').click(function () {
  421. $(this).parent().removeClass('active');
  422. pt_tags.addClass('active');
  423. btn_next.hide();
  424. });
  425. //选择标签页面确认按钮事件
  426. $('.pt-tags button').click(function () {
  427. $(this).parents('.pt-popular-cont').removeClass('active');
  428. pt_edit.addClass('active');
  429. var lis = $('.pt-tags li.active'),
  430. select = $('.pt-popular-cont.pt-edit .btn-tag select'),
  431. names = [];
  432. select.html('');
  433. for (i = 0; i < lis.length; i++) {
  434. names.push(lis.eq(i).data('name'));
  435. select.append('<option value="' + lis.eq(i).data('value') + '" selected></option>');
  436. }
  437. $('.pt-popular-cont.pt-edit .btn-tag input').val(names.length ? names.join(',') : '');
  438. btn_next.show();
  439. });
  440. // 选择标签页面标签点击事件
  441. $('.pt-tags li').click(function () {
  442. if ($(this).hasClass('active')) {
  443. $(this).removeClass('active');
  444. } else {
  445. if ($('.pt-tags li.active').length >= 3) {
  446. alert('最多只能选择三个标签');
  447. return false;
  448. }
  449. $(this).addClass('active');
  450. }
  451. });
  452. //书籍页 移除书籍
  453. pt_novel.on('click', 'textarea,.pt-photo', function () {
  454. var othis = $(this).parents('li');
  455. laytpl($('#novelEditTpl').html()).render({
  456. star:parseInt(othis.find('input[name="novels[star][]"]').val()),
  457. comment:othis.find('textarea[name="novels[comment][]"]').val()
  458. }, function (html) {
  459. var index = layer.open({
  460. type: 1,
  461. content: html,
  462. anim: 'up',
  463. style: 'position:fixed; bottom:0; left:0; width: 100%; height: 200px; padding:10px 0; border:none;',
  464. success: function (obj) {
  465. $(obj).on('click', '.pt-square', function () {
  466. $(this).addClass('active').siblings('.active').removeClass('active');
  467. }).on('click', '.pt-submit', function () {
  468. var star = $(obj).find('.pt-square.active').data('value'),
  469. comment = $(obj).find('textarea').val();
  470. othis.find('input[name="novels[star][]"]').val(star);
  471. othis.find('textarea[name="novels[comment][]"]').val(comment);
  472. othis.find('.pt-photo img').attr('src', '{$kx.config.resurl}/template/kxmobileno1/images/star.png');
  473. othis.find('.pt-photo img:lt(' + star + ')').attr('src', '{$kx.config.resurl}/template/kxmobileno1/images/star1.png');
  474. layer.close(index)
  475. })
  476. }
  477. })
  478. });
  479. }).on('click', '.pt-novel-del', function () {
  480. $(this).parents('li').remove();
  481. }).on('click', '.pt-mark-add', function () {
  482. pt_novel.removeClass('active');
  483. pt_marks.addClass('active');
  484. btn_next.hide();
  485. }).on('click', '.pt-search-add', function () {
  486. pt_novel.removeClass('active');
  487. pt_search.addClass('active');
  488. btn_next.hide();
  489. $('.btn-search').click();
  490. });
  491. //书籍添加页 点击事件
  492. $('.pt-marks,.pt-search').on('click', 'li', function () {
  493. var othis = $(this), num = 0;
  494. if (othis.hasClass('active')) {
  495. othis.removeClass('active');
  496. num = $(this).siblings(".active").length;
  497. } else {
  498. othis.addClass('active');
  499. num = $(this).siblings(".active").length + 1;
  500. }
  501. $(this).parents('.pt-popular-cont').find('.btn-success').find('span').html(num)
  502. }).on('click', 'button.bg-white', function () {
  503. btn_return.click();
  504. }).on('click', 'button.btn-success', function () {
  505. $(this).parents('.pt-popular-cont').find('li.active').each(function (l, v) {
  506. v = $(v);
  507. if (!pt_novel.find('input[name="novels[id][]"][value=' + v.data('id') + ']').length) {
  508. laytpl($('#novelTpl').html()).render({
  509. id: v.data('id'),
  510. name: v.data('name'),
  511. cover: v.data('cover'),
  512. category: v.data('category'),
  513. author: v.data('author'),
  514. allvisit: v.data('allvisit')
  515. }, function (html) {
  516. pt_novel.find('ul').append(html);
  517. });
  518. }
  519. });
  520. btn_return.click();
  521. });
  522. $('.btn-search').click(function () {
  523. $.ajax({
  524. url: '{link=novel.search.result responsetype=json}',
  525. method: 'POST',
  526. data: {'searchkey':$('.pt-search input.searchkey').val()},
  527. dataType: 'json',
  528. beforeSend: function () {
  529. $('body').append('<div class="loading"><div>')
  530. },
  531. success: function (res) {
  532. if (res.code) {
  533. alert(res.msg);
  534. } else {
  535. var ul = pt_search.find('ul');
  536. ul.html('');
  537. laytpl($('#searchTpl').html()).render(res.data, function (html) {
  538. ul.append(html);
  539. });
  540. }
  541. },
  542. complete: function () {
  543. $('body div.loading').remove();
  544. },
  545. });
  546. });
  547. </script>
  548. </body>
  549. </html>