home.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. @Name:layuiAdmin 主页控制台
  3. @Author:贤心
  4. @Site:http://www.layui.com/admin/
  5. @License:GPL-2
  6. */
  7. layui.define(function(exports){
  8. /*
  9. 下面通过 layui.use 分段加载不同的模块,实现不同区域的同时渲染,从而保证视图的快速呈现
  10. */
  11. //区块轮播切换
  12. layui.use(['admin', 'carousel'], function(){
  13. var $ = layui.$
  14. ,admin = layui.admin
  15. ,carousel = layui.carousel
  16. ,element = layui.element
  17. ,device = layui.device();
  18. //轮播切换
  19. $('.layadmin-carousel').each(function(){
  20. var othis = $(this);
  21. carousel.render({
  22. elem: this
  23. ,width: '100%'
  24. ,arrow: 'none'
  25. ,interval: othis.data('interval')
  26. ,autoplay: othis.data('autoplay') === true
  27. ,trigger: (device.ios || device.android) ? 'click' : 'hover'
  28. ,anim: othis.data('anim')
  29. });
  30. });
  31. element.render('progress');
  32. });
  33. //数据概览
  34. layui.use(['carousel', 'echarts'], function(){
  35. var $ = layui.$
  36. ,carousel = layui.carousel;
  37. });
  38. //最新订单
  39. layui.use('table', function(){
  40. var $ = layui.$
  41. ,table = layui.table;
  42. //今日热搜
  43. table.render({
  44. elem: '#LAY-index-topSearch'
  45. ,url: '/account/userinfo/'
  46. ,page: true
  47. ,cols: [[
  48. {type: 'numbers', fixed: 'left'}
  49. ,{field: 'keywords', title: '关键词', minWidth: 300, templet: '<div><a href="https://www.baidu.com/s?wd={{ d.keywords }}" target="_blank" class="layui-table-link">{{ d.keywords }}</div>'}
  50. ,{field: 'frequency', title: '搜索次数', minWidth: 120, sort: true}
  51. ,{field: 'userNums', title: '用户数', sort: true}
  52. ]]
  53. ,skin: 'line'
  54. });
  55. });
  56. exports('home', {})
  57. });