| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394 |
- <html>
- <head>
- <style>
- .chatWarp {
- padding: 10px;
- }
- .chatWarp h2 {
- font-size: 16px;
- font-weight: bold;
- margin: 9px 0px;
- color: #666;
- }
- .sevenDayWarp {
- border-radius: 6px;
- background-color: #fff;
- height: 230px;
- border: 1px solid #f2f2f2;
- }
- .website-control {
- padding: 12px;
- }
- .website-control-title {
- margin-bottom: 10px;
- font-size: 16px;
- }
- .website-control-list ul {
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
- }
- .website-control-list li {
- box-sizing: border-box;
- width: 49%;
- margin-bottom: 8px;
- padding: 6px 10px;
- border-radius: 6px;
- background: #fff url(/apps/space/images/mobile/monitoring/count.png) no-repeat 119% center;
- background-size: 40% !important;
- box-shadow: 0px 4px 5px 1px rgba(175, 175, 175, 0.1) !important;
- /* background-color: rgb(229, 250, 255);
- border: 1px solid rgb(0, 208, 255); */
- background-color: #fff;
-
- }
- .website-control-list li h2{
- color: rgb(0, 208, 255);
- }
- .website-control-list li:nth-child(2) {
- background-image: url(/apps/space/images/mobile/monitoring/today.png);
- /* background-color: rgb(250, 233, 221);
- border: 1px solid rgb(255, 177, 119); */
-
- }
- .website-control-list li:nth-child(2) h2{
- color: #14b56b;
- }
- .website-control-list li:nth-child(3) {
- background-image: url(/apps/space/images/mobile/monitoring/read.png);
- /* background-color: rgb(246, 235, 255);
- border: 1px solid rgb(190, 114, 255); */
-
- }
- .website-control-list li:nth-child(3) h2{
- color: rgb(190, 114, 255);
- }
- .website-control-list li:nth-child(4) {
- background-image: url(/apps/space/images/mobile/monitoring/bug.png);
- /* background-color: rgb(252, 236, 236);
- border: 1px solid rgb(230, 65, 65); */
-
- }
- .website-control-list li:nth-child(4) h2{
- color: rgb(230, 65, 65);
- }
- .website-control-list h2 {
- font-family: Georgia;
- font-size: 20px;
- line-height: 40px;
- }
- .website-control-list p {
- color: #373d4d;
- }
- /* 文章排行 */
- .article-ranking,
- .article-ranking ul,
- .article-ranking li {
- width: 100%;
- background-color: #fff;
- border-radius: 6px;
- }
- .article-ranking li {
- height: 38px;
- line-height: 38px;
- box-sizing: border-box;
- padding: 0px 3px 0px 10px;
- overflow: hidden;
- }
- .article-ranking li a{
- display: block;
- width: 100%;
- }
- .article-ranking li:hover {
- background-color: #F2F8FE;
- }
- .article-ranking a:hover {
- color: #333;
- }
- .article-ranking-title {
- float: left;
- width: calc(100% - 82px);
- /* overflow: hidden;
- text-overflow: ellipsis; */
- /* white-space: nowrap; */
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 1;
- overflow: hidden;
- }
- .article-ranking .el-tag {
- float: right;
- margin-top: 3px;
- }
- .article-ranking li:nth-child(1) .article-ranking-title span {
- color: #e64141;
- }
- .article-ranking li:nth-child(2) .article-ranking-title span {
- color: #E6A23C;
- }
- .article-ranking li:nth-child(3) .article-ranking-title span {
- color: #67C23A;
- }
- </style>
- </head>
- <body class="body-bg-gray">
- <div id="space-content">
- <div class="content-wrap">
- <div class="chatWarp" style="padding-top: 6px;padding-bottom: 0px;">
- <div class="website-control-list">
- <ul>
- <li>
- <a href="javascript:;">
- <h2>{{statistics.normalTotal}}</h2>
- <p>网站总访问量</p>
- </a>
- </li>
- <li>
- <a href="javascript:;">
- <h2>{{statistics.todayWebsiteVisitCount}}</h2>
- <p>今日访问量</p>
- </a>
- </li>
- <li>
- <a href="javascript:;">
- <h2>{{statistics.articleReadCount}}</h2>
- <p>文章总阅读量</p>
- </a>
- </li>
- <li>
- <a href="javascript:;">
- <h2>{{statistics.errorTotal}}</h2>
- <p>疑似爬虫攻击</p>
- </a>
- </li>
- </ul>
- </div>
- </div>
- <div class="chatWarp" style="padding-top: 0px;">
- <!-- <h2>近七日网站流量</h2> -->
- <div class="sevenDayWarp">
- <div id="sevenDayChatDom" style="width: 100%; height: 200px;margin-top: 12px;">
- </div>
- </div>
- </div>
- <div style="background-color: #fff;border-radius: 6px;margin: 0px 10px 10px 10px;padding: 0px;">
- <h2 style="color: #333333;font-size: 18px;fill: #333333;text-align: center;padding: 16px 0px 8px 0px;font-weight: normal;">文章阅读排行</h2>
- <ul class="article-ranking">
- <li v-for="(item,index) in articleRanking" :key="index" @click="articleInfo(item.articleid)">
- <a href="javascript:;" rel="noreferrer">
- <p class="article-ranking-title">
- <span>{{index+1}}、</span>
- {{item.title}}
- </p>
- <van-tag plain type="warning">
- {{item.read_count}}次阅读
- </van-tag>
- </a>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </body>
- <!-- <script src="/apps/space/plug-in/echarts/echarts.min.js" type="text/javascript" charset="utf-8"></script> -->
- <script src="/apps/space/plug-in/Highcharts-8.2.2/highcharts.js"></script>
- <script type="text/javascript">
- space.vue = new Vue({
- el: space.appContent,
- data: function () {
- return {
- articleRanking: [],
- statistics: {
- articleReadCount: '-',
- todayWebsiteVisitCount: '-',
- normalTotal: '-',
- errorTotal: '-',
- }
- }
- },
- methods: {
- articleInfo: function(aid) {
- space.plugin.appWindow.show({
- "title": "加载中",
- "url": '@service{ name:`article_info`, page:`article_mobile.article_info` }@',
- "position": "right",
- "param": {
- "articleid": aid
- }
- });
- }
- },
- mounted: function () {
- var _this = this;
- // 顶部的四个统计
- space.utils.ajax({
- url: "@service{ name: 'website.website_visit_getIndexStatistics' }@",
- dataType: 'json',
- loadLayer: false,
- callback: function (resp) {
- _this.statistics = resp.data;
- }
- });
- // 文章排行
- space.utils.ajax({
- url: "@service{ name: 'website_visit_articleHot' }@",
- dataType: 'json',
- callback: function (resp) {
- _this.articleRanking = resp.data;
- }
- });
- // 近七天的访问总量
- space.utils.ajax({
- url: "@service{ name: 'website_visit_getSevenDaysVisit' }@",
- dataType: 'json',
- callback: function (resp) {
- initVisit(resp.data);
- }
- });
-
- }
- })
- </script>
- <script type="text/javascript">
- var sevenDayChart = undefined;
- function initVisit(data) {
- for (let index = 0; index < data.date.length; index++) {
- const element = data.date[index];
- data.date[index] = element.substring(element.indexOf("-") + 1);
- }
- for (let index = 0; index < data.normal.length; index++) {
- const element = data.normal[index];
- data.normal[index] = parseInt(element);
- }
- for (let index = 0; index < data.error.length; index++) {
- const element = data.error[index];
- data.error[index] = parseInt(element);
- }
- var dom = document.getElementById("sevenDayChatDom");
- // sevenDayChart = echarts.init(dom);
- var app = {};
- option = null;
- option = {
- credits: {
- // 去掉官网地址
- enabled: false
- },
- chart: {
- type: 'spline'
- },
- title: {
- text: '网站访问趋势'
- },
- tooltip: {
- split: true,
- backgroundColor: '#FCFFC5', // 背景颜色
- borderColor: 'black', // 边框颜色
- borderRadius: 10, // 边框圆角
- borderWidth: 3, // 边框宽度
- shadow: true, // 是否显示阴影
- animation: true // 是否启用动画效果
- },
- legend: {
- data: ['正常', '异常']
- },
- toolbox: {
- feature: {
- saveAsImage: {}
- }
- },
- grid: {
- left: '3%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
- xAxis: [{
- categories: data.date,
- tickmarkPlacement: 'on',
- title: {
- enabled: false
- }
- }],
- yAxis: [{
- title:{
- text:'访问量'
- },
- labels: {
- formatter: function () {
- return this.value ;
- }
- }
- }],
- series: [{
- name: '正常',
- type: 'line',
- stack: '总量',
- smooth: true,
- color: '#3f85ed',
- data: data.normal
- },
- {
- name: '异常',
- type: 'line',
- stack: '总量',
- smooth: true,
- color: '#F56C6C',
- data: data.error
- },
- ]
- };
- if (option && typeof option === "object") {
- // sevenDayChart.setOption(option, true);
- var chart = Highcharts.chart('sevenDayChatDom', option)
- }
-
- }
- </script>
- </html>
|