截流自动化的商城平台
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

visit.html 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. {layout name="layout1" /}
  2. <div class="wrapper">
  3. <div class="layui-form">
  4. <div class="layui-card">
  5. <div class="layui-card-body">
  6. <div class="layui-inline">
  7. <label class="layui-form-label">汇总时间:</label>
  8. <div class="layui-input-inline">
  9. <div class="layui-input-inline">
  10. <input type="text" name="start_time" class="layui-input" id="start_time"
  11. placeholder="" autocomplete="off">
  12. </div>
  13. </div>
  14. <div class="layui-input-inline" style="margin-right: 5px;width: 20px;">
  15. <label class="layui-form-mid">至</label>
  16. </div>
  17. <div class="layui-input-inline">
  18. <input type="text" name="end_time" class="layui-input" id="end_time"
  19. placeholder="" autocomplete="off">
  20. </div>
  21. </div>
  22. <div class="layui-inline">
  23. <button class="layui-btn layui-btn-sm layuiadmin-btn-ad {$view_theme_color}" lay-submit
  24. lay-filter="menber-search">查询
  25. </button>
  26. <button class="layui-btn layui-btn-sm layuiadmin-btn-ad layui-btn-primary " lay-submit
  27. lay-filter="menber-clear-search">重置
  28. </button>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="layui-row layui-col-space15">
  33. <div class="layui-col-sm6 layui-col-md3">
  34. <div class="layui-card">
  35. <div class="layui-card-header">
  36. 会员访问量(人)
  37. </div>
  38. <div class="layui-card-body layuiadmin-card-list">
  39. <p class="layuiadmin-big-font" id="user_count">0</p>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. <!--会员访问量分析图-->
  45. <div class="layui-card" style="margin-top:20px">
  46. <div class="layui-card-body">
  47. <div class="layui-form-item">
  48. <div class="layui-input-inline layui-card-header" style="">近15天会员访问量(人)</div>
  49. </div>
  50. <div class="layui-form-item">
  51. <div id="memberCharts" style="width: 100%;height: 80vh;"></div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. <script>
  58. layui.config({
  59. version: "{$front_version}",
  60. base: '/static/plug/layui-admin/dist/layuiadmin/' //静态资源所在路径
  61. }).extend({
  62. index: 'lib/index' //主入口模块
  63. }).use(['index', 'table', 'like', 'echarts', 'form'], function () {
  64. var $ = layui.$
  65. , form = layui.form
  66. , like = layui.like
  67. , echarts = layui.echarts
  68. , laydate = layui.laydate;
  69. //日期时间范围
  70. laydate.render({
  71. elem: '#start_time'
  72. , type: 'datetime'
  73. });
  74. laydate.render({
  75. elem: '#end_time'
  76. , type: 'datetime'
  77. });
  78. //监听搜索
  79. form.on('submit(menber-search)', function (data) {
  80. graphData();
  81. });
  82. //清空查询
  83. form.on('submit(menber-clear-search)', function () {
  84. $('#start_time').val('');
  85. $('#end_time').val('');
  86. graphData();
  87. });
  88. const colorList = ["#9E87FF", '#73DDFF', '#fe9a8b', '#F56948', '#9E87FF'];
  89. graphData();
  90. function graphData() {
  91. var start_time = $('#start_time').val();
  92. var end_time = $('#end_time').val();
  93. like.ajax({
  94. url: '{:url("statistics/visit")}',
  95. data: {'start_time': start_time, 'end_time': end_time},
  96. type: "post",
  97. success: function (res) {
  98. $('#user_count').text(res.data.user_count);
  99. // 默认选中7天内时间
  100. $('#start_time').val(res.data.start_time);
  101. $('#end_time').val(res.data.end_time);
  102. start_time = res.data.start_time;
  103. end_time = res.data.end_time;
  104. var memberNum = res.data.echarts_count;
  105. var newMember = res.data.echarts_add;
  106. var xData = res.data.days;
  107. var option = setOption(memberNum, newMember, xData);
  108. let chart = document.getElementById('memberCharts');
  109. let memberChart = echarts.init(chart);
  110. memberChart.setOption(option, true);
  111. window.addEventListener('resize', function () {
  112. memberChart.resize()
  113. });
  114. }
  115. });
  116. }
  117. //会员访问量-图标设置
  118. function setOption(memberNum, newMember, xData) {
  119. option = {
  120. backgroundColor: '#fff',
  121. legend: {
  122. icon: 'circle',
  123. top: '5%',
  124. right: '5%',
  125. itemWidth: 6,
  126. itemGap: 20,
  127. textStyle: {
  128. color: '#556677'
  129. }
  130. },
  131. tooltip: {
  132. trigger: 'axis',
  133. backgroundColor: '#fff',
  134. textStyle: {
  135. color: '#5c6c7c'
  136. },
  137. padding: [10, 10],
  138. extraCssText: 'box-shadow: 1px 0 2px 0 rgba(163,163,163,0.5)'
  139. },
  140. grid: {
  141. top: '15%'
  142. },
  143. xAxis: [{
  144. type: 'category',
  145. name: '(日期)',
  146. data: xData,
  147. axisLine: {
  148. lineStyle: {
  149. color: 'rgba(107,107,107,0.37)', //x轴颜色
  150. }
  151. },
  152. axisTick: {
  153. show: false
  154. },
  155. axisLabel: {
  156. interval: 0,
  157. textStyle: {
  158. color: '#999' //坐标轴字颜色
  159. },
  160. margin: 15
  161. },
  162. axisPointer: {
  163. label: {
  164. padding: [11, 5, 7],
  165. backgroundColor: {
  166. type: 'linear',
  167. x: 0,
  168. y: 0,
  169. x2: 0,
  170. y2: 1,
  171. colorStops: [{
  172. offset: 0,
  173. color: '#fff' // 0% 处的颜色
  174. }, {
  175. offset: 0.9,
  176. color: '#fff' // 0% 处的颜色
  177. }, {
  178. offset: 0.9,
  179. color: '#33c0cd' // 0% 处的颜色
  180. }, {
  181. offset: 1,
  182. color: '#33c0cd' // 100% 处的颜色
  183. }],
  184. global: false // 缺省为 false
  185. }
  186. }
  187. },
  188. boundaryGap: false
  189. }],
  190. yAxis: [{
  191. type: 'value',
  192. name: '(人)',
  193. axisTick: {
  194. show: false
  195. },
  196. axisLine: {
  197. show: true,
  198. lineStyle: {
  199. color: 'rgba(107,107,107,0.37)', //y轴颜色
  200. }
  201. },
  202. axisLabel: {
  203. textStyle: {
  204. color: '#999'
  205. }
  206. },
  207. splitLine: {
  208. show: false
  209. }
  210. }],
  211. series: [{
  212. name: '会员访问量',
  213. type: 'line',
  214. data: newMember,
  215. symbolSize: 1,
  216. symbol: 'circle',
  217. smooth: true,
  218. yAxisIndex: 0,
  219. showSymbol: false,
  220. lineStyle: {
  221. width: 5,
  222. color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{
  223. offset: 0,
  224. color: '#73DD39'
  225. },
  226. {
  227. offset: 1,
  228. color: '#73DDFF'
  229. }
  230. ]),
  231. shadowColor: 'rgba(115,221,255, 0.3)',
  232. shadowBlur: 10,
  233. shadowOffsetY: 20
  234. },
  235. itemStyle: {
  236. normal: {
  237. color: colorList[1],
  238. borderColor: colorList[1]
  239. }
  240. }
  241. }]
  242. };
  243. return option;
  244. }
  245. });
  246. </script>
  247. <script type="text/javascript">
  248. (function () {
  249. var tab_tit = document.getElementById('think_page_trace_tab_tit').getElementsByTagName('span');
  250. var tab_cont = document.getElementById('think_page_trace_tab_cont').getElementsByTagName('div');
  251. var open = document.getElementById('think_page_trace_open');
  252. var close = document.getElementById('think_page_trace_close').children[0];
  253. var trace = document.getElementById('think_page_trace_tab');
  254. var cookie = document.cookie.match(/thinkphp_show_page_trace=(\d\|\d)/);
  255. var history = (cookie && typeof cookie[1] != 'undefined' && cookie[1].split('|')) || [0, 0];
  256. open.onclick = function () {
  257. trace.style.display = 'block';
  258. this.style.display = 'none';
  259. close.parentNode.style.display = 'block';
  260. history[0] = 1;
  261. document.cookie = 'thinkphp_show_page_trace=' + history.join('|')
  262. }
  263. close.onclick = function () {
  264. trace.style.display = 'none';
  265. this.parentNode.style.display = 'none';
  266. open.style.display = 'block';
  267. history[0] = 0;
  268. document.cookie = 'thinkphp_show_page_trace=' + history.join('|')
  269. }
  270. for (var i = 0; i < tab_tit.length; i++) {
  271. tab_tit[i].onclick = (function (i) {
  272. return function () {
  273. for (var j = 0; j < tab_cont.length; j++) {
  274. tab_cont[j].style.display = 'none';
  275. tab_tit[j].style.color = '#999';
  276. }
  277. tab_cont[i].style.display = 'block';
  278. tab_tit[i].style.color = '#000';
  279. history[1] = i;
  280. document.cookie = 'thinkphp_show_page_trace=' + history.join('|')
  281. }
  282. })(i)
  283. }
  284. parseInt(history[0]) && open.click();
  285. tab_tit[history[1]].click();
  286. })();
  287. </script>
  288. </body>
  289. </html>