console.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. /** layuiAdmin-v1.0.0-beta6 LPPL License By http://www.layui.com/admin/ */
  2. ;
  3. layui.define(function (e) {
  4. layui.use(["admin", "carousel"],
  5. function() {
  6. var e = layui.$,
  7. t = (layui.admin, layui.carousel),
  8. a = layui.element,
  9. i = layui.device();
  10. e(".layadmin-carousel")
  11. .each(function() {
  12. var a = e(this);
  13. t.render({
  14. elem: this,
  15. width: "100%",
  16. arrow: "none",
  17. interval: a.data("interval"),
  18. autoplay: a.data("autoplay") === true,
  19. trigger: i.ios || i.android ? "click" : "hover",
  20. anim: a.data("anim")
  21. });
  22. }),
  23. a.render("progress");
  24. }),
  25. layui.use(["carousel", "echarts"],
  26. function() {
  27. var e = layui.$,
  28. t = layui.carousel,
  29. a = layui.echarts,
  30. i = [],
  31. l = [
  32. {
  33. title: {
  34. text: "今日流量趋势",
  35. x: "center",
  36. textStyle: {
  37. fontSize: 14
  38. }
  39. },
  40. tooltip: {
  41. trigger: "axis"
  42. },
  43. legend: {
  44. data: ["", ""]
  45. },
  46. xAxis: [
  47. {
  48. type: "category",
  49. boundaryGap: false,
  50. data: [
  51. "06:00", "06:30", "07:00", "07:30", "08:00", "08:30", "09:00", "09:30", "10:00", "11:30", "12:00", "12:30",
  52. "13:00", "13:30", "14:00", "14:30", "15:00", "15:30", "16:00", "16:30", "17:00", "17:30", "18:00", "18:30",
  53. "19:00", "19:30", "20:00", "20:30", "21:00", "21:30", "22:00", "22:30", "23:00", "23:30"
  54. ]
  55. }
  56. ],
  57. yAxis: [
  58. {
  59. type: "value"
  60. }
  61. ],
  62. series: [
  63. {
  64. name: "PV",
  65. type: "line",
  66. smooth: true,
  67. itemStyle: {
  68. normal: {
  69. areaStyle: {
  70. type: "default"
  71. }
  72. }
  73. },
  74. data: [
  75. 111, 222, 333, 444, 555, 666, 3333, 33333, 55555, 66666, 33333, 3333, 6666, 11888, 26666, 38888, 56666, 42222,
  76. 39999, 28888, 17777, 9666, 6555, 5555, 3333, 2222, 3111, 6999, 5888, 2777, 1666, 999, 888, 777
  77. ]
  78. },
  79. {
  80. name: "UV",
  81. type: "line",
  82. smooth: true,
  83. itemStyle: {
  84. normal: {
  85. areaStyle: {
  86. type: "default"
  87. }
  88. }
  89. },
  90. data: [
  91. 11, 22, 33, 44, 55, 66, 333, 3333, 5555, 12666, 3333, 333, 666, 1188, 2666, 3888, 6666, 4222, 3999, 2888,
  92. 1777, 966, 655, 555, 333, 222, 311, 699, 588, 277, 166, 99, 88, 77
  93. ]
  94. }
  95. ]
  96. },
  97. {
  98. title: {
  99. text: "访客浏览器分布",
  100. x: "center",
  101. textStyle: {
  102. fontSize: 14
  103. }
  104. },
  105. tooltip: {
  106. trigger: "item",
  107. formatter: "{a} <br/>{b} : {c} ({d}%)"
  108. },
  109. legend: {
  110. orient: "vertical",
  111. x: "left",
  112. data: ["Chrome", "Firefox", "IE 8.0", "Safari", "其它浏览器"]
  113. },
  114. series: [
  115. {
  116. name: "访问来源",
  117. type: "pie",
  118. radius: "55%",
  119. center: ["50%", "50%"],
  120. data: [
  121. {
  122. value: 9052,
  123. name: "Chrome"
  124. },
  125. {
  126. value: 1610,
  127. name: "Firefox"
  128. },
  129. {
  130. value: 3200,
  131. name: "IE 8.0"
  132. },
  133. {
  134. value: 535,
  135. name: "Safari"
  136. },
  137. {
  138. value: 1700,
  139. name: "其它浏览器"
  140. }
  141. ]
  142. }
  143. ]
  144. },
  145. {
  146. title: {
  147. text: "最近一周新增的用户量",
  148. x: "center",
  149. textStyle: {
  150. fontSize: 14
  151. }
  152. },
  153. tooltip: {
  154. trigger: "axis",
  155. formatter: "{b}<br>新增用户:{c}"
  156. },
  157. xAxis: [
  158. {
  159. type: "category",
  160. data: ["11-07", "11-08", "11-09", "11-10", "11-11", "11-12", "11-13"]
  161. }
  162. ],
  163. yAxis: [
  164. {
  165. type: "value"
  166. }
  167. ],
  168. series: [
  169. {
  170. type: "line",
  171. data: [200, 300, 400, 610, 150, 270, 380]
  172. }
  173. ]
  174. }
  175. ],
  176. n = e("#LAY-index-dataview").children("div"),
  177. r = function(e) {
  178. i[e] = a.init(n[e], layui.echartsTheme),
  179. i[e].setOption(l[e]),
  180. window.onresize = i[e].resize;
  181. };
  182. if (n[0]) {
  183. r(0);
  184. var o = 0;
  185. t.on("change(LAY-index-dataview)",
  186. function(e) {
  187. r(o = e.index);
  188. }),
  189. layui.admin.on("side",
  190. function() {
  191. setTimeout(function() {
  192. r(o);
  193. },
  194. 300);
  195. }),
  196. layui.admin.on("hash(tab)",
  197. function() {
  198. layui.router().path.join("") || r(o);
  199. });
  200. }
  201. }),
  202. layui.use("table",
  203. function() {
  204. var e = (layui.$, layui.table);
  205. e.render({
  206. elem: "#LAY-index-topSearch",
  207. url: "./json/console/top-search.js",
  208. page: true,
  209. cols: [
  210. [
  211. {
  212. type: "numbers",
  213. fixed: "left"
  214. },
  215. {
  216. field: "keywords",
  217. title: "关键词",
  218. minWidth: 300,
  219. templet:
  220. '<div><a href="https://www.baidu.com/s?wd={{ d.keywords }}" target="_blank" class="layui-table-link">{{ d.keywords }}</div>'
  221. },
  222. {
  223. field: "frequency",
  224. title: "搜索次数",
  225. minWidth: 120,
  226. sort: true
  227. },
  228. {
  229. field: "userNums",
  230. title: "用户数",
  231. sort: true
  232. }
  233. ]
  234. ],
  235. skin: "line"
  236. }),
  237. e.render({
  238. elem: "#LAY-index-topCard",
  239. url: "./json/console/top-card.js",
  240. page: true,
  241. cellMinWidth: 120,
  242. cols: [
  243. [
  244. {
  245. type: "numbers",
  246. fixed: "left"
  247. },
  248. {
  249. field: "title",
  250. title: "标题",
  251. minWidth: 300,
  252. templet: '<div><a href="{{ d.href }}" target="_blank" class="layui-table-link">{{ d.title }}</div>'
  253. },
  254. {
  255. field: "username",
  256. title: "发帖者"
  257. },
  258. {
  259. field: "channel",
  260. title: "类别"
  261. },
  262. {
  263. field: "crt",
  264. title: "点击率",
  265. sort: true
  266. }
  267. ]
  268. ],
  269. skin: "line"
  270. });
  271. }),
  272. e("console", {});
  273. });