Procházet zdrojové kódy

人流量折线图数据加载优化

wangtao před 3 roky
rodič
revize
324af9cbef

+ 5 - 0
package.json

@@ -8,6 +8,7 @@
         "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
     },
     "dependencies": {
+        "@easydarwin/easyplayer": "^5.0.0",
         "amfe-flexible": "^2.2.1",
         "core-js": "^3.6.5",
         "crypto-js": "^4.1.1",
@@ -26,6 +27,9 @@
         "svg-sprite-loader": "^4.3.0",
         "svgo": "^1.3.2",
         "vant": "^2.12.24",
+        "video.js": "^7.19.2",
+        "videojs-contrib-hls": "^5.15.0",
+        "videojs-flash": "^2.2.1",
         "vue": "^2.6.11",
         "vue-router": "^3.2.0",
         "vuex": "^3.4.0",
@@ -39,6 +43,7 @@
         "@vue/cli-service": "~4.5.0",
         "axios": "^0.18.0",
         "babel-eslint": "^10.1.0",
+        "copy-webpack-plugin": "^5.1.2",
         "eslint": "^6.7.2",
         "eslint-plugin-vue": "^6.2.2",
         "html-webpack-plugin": "^5.5.0",

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
public/EasyPlayer-lib.min.js


binární
public/EasyPlayer.wasm


+ 1 - 0
public/index.html

@@ -8,6 +8,7 @@
     <meta name="format-detection" content="telephone=yes" />
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
     <script type="text/javascript" src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
+    <script src="/EasyPlayer-lib.min.js"></script>
     <title>
         <%= htmlWebpackPlugin.options.title %>
     </title>

+ 8 - 4
src/components/record/flow/index.vue

@@ -1,5 +1,5 @@
 <template>
-    <van-row class="recordList">
+    <van-row class="recordList" v-loading="loading">
       <van-row class="titleWrap">
         <span class="line"></span>
         <span class="title">今日人流量统计</span>
@@ -18,7 +18,7 @@
             </van-row>
           </van-row>
         </van-row>
-        <lineT :resData="data.data"/>
+        <lineT v-if="status" :resData="data.data"/>
       </van-row>
     </van-row>
 </template>
@@ -40,9 +40,10 @@ export default {
           ],
       },
       loading:true,
+      status:false,
     };
   },
-  mounted() {
+  created(){
     this.init()
     this.timing()
   },
@@ -64,7 +65,10 @@ export default {
               total += res.data[i].card_number
             }
             this.data.total = (total.toString()).split("")
-            this.loading = false
+            setTimeout(()=>{
+              this.status = true
+              this.loading = false
+            },20)
           }
       }).catch(err =>{
       })

+ 81 - 84
src/components/record/flow/line.vue

@@ -25,101 +25,98 @@ export default {
     getData() {
       let myChart = echarts.init(document.getElementById("line"));
       let data = this.resData;
-      setTimeout(() => {
-        let series = []; //定义一个数组变量用于存放配置
-        let colorShown = [
-          {
-            opacity: 0.8,
-            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
-              {
-                offset: 0,
-                color: "#4DB5EB",
-              },
-              {
-                offset: 1,
-                color: "#FBFEFF",
-              },
-            ]),
-          },
-        ];
-        series.push(
-          {
-            name: "人流量",
-            type: "line",
-            stack: "Total",
-            smooth: true,
-            lineStyle: {
-              width: 2,
+      let series = []; //定义一个数组变量用于存放配置
+      let colorShown = [
+        {
+          opacity: 0.8,
+          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
+            {
+              offset: 0,
+              color: "#4DB5EB",
             },
-            showSymbol: false,
-            areaStyle: colorShown[0],
-            emphasis: {
-              focus: "series",
+            {
+              offset: 1,
+              color: "#FBFEFF",
             },
-          data: data[1],
-        });
-        let option = {
-          color: "#4DB5EB",
-          grid: {
-            bottom: "0",
-            right: "10",
-            left: "10",
-            top: "35",
-            containLabel: true,
+          ]),
+        },
+      ];
+      series.push(
+        {
+          name: "人流量",
+          type: "line",
+          stack: "Total",
+          smooth: true,
+          lineStyle: {
+            width: 2,
           },
-          tooltip: {
-            trigger: "axis",
-            confine: true,
-            textStyle: {
-              fontSize: 10,
-            },
+          showSymbol: false,
+          areaStyle: colorShown[0],
+          emphasis: {
+            focus: "series",
           },
-          xAxis: {
-            type: "category",
-            boundaryGap: false,
-            data: data[0],
-            axisLabel: {
+        data: data[1],
+      });
+      let option = {
+        color: "#4DB5EB",
+        grid: {
+          bottom: "0",
+          right: "10",
+          left: "10",
+          top: "35",
+          containLabel: true,
+        },
+        tooltip: {
+          trigger: "axis",
+          confine: true,
+          textStyle: {
+            fontSize: 10,
+          },
+        },
+        xAxis: {
+          type: "category",
+          boundaryGap: false,
+          data: data[0],
+          axisLabel: {
+            color: "#DDDDDD",
+          },
+          axisLine: {
+            lineStyle: {
               color: "#DDDDDD",
             },
-            axisLine: {
-              lineStyle: {
-                color: "#DDDDDD",
-              },
-            },
-            axisTick: {
-              show: false,
-            },
-            textStyle: {
-              fontSize: 10,
-            },
           },
-          yAxis: {
-            type: "value",
-            axisLabel: {
+          axisTick: {
+            show: false,
+          },
+          textStyle: {
+            fontSize: 10,
+          },
+        },
+        yAxis: {
+          type: "value",
+          axisLabel: {
+            color: "#DDDDDD",
+          },
+          axisTick: {
+            show: false,
+          },
+          axisLine: {
+            lineStyle: {
               color: "#DDDDDD",
             },
-            axisTick: {
-              show: false,
-            },
-            axisLine: {
-              lineStyle: {
-                color: "#DDDDDD",
-              },
-            },
-            splitLine: {
-              lineStyle: {
-                color: "rgba(255,255,255,.1)",
-              },
-            },
-            textStyle: {
-              fontSize: 10,
+          },
+          splitLine: {
+            lineStyle: {
+              color: "rgba(255,255,255,.1)",
             },
           },
-          series: series,
-        };
-        option && myChart.setOption(option);
-      }, 1000);
-
+          textStyle: {
+            fontSize: 10,
+          },
+        },
+        series: series,
+      };
+      option && myChart.setOption(option);
       setTimeout(function() {
         window.onresize = function() {
           myChart.resize();

+ 10 - 3
src/components/record/index.vue

@@ -6,7 +6,7 @@
         <parking alt="停车位" />
         <flow alt="人流量" />
         <meeting alt="会议" />
-        <videoSS alt="实时视频" />
+        <videoSS alt="实时视频" @videoMsg="videoMsg" v-if="videoStatus" :info = "info"/>
         <networkCard alt="互联网卡" />
         <intrusion alt="入侵告警" />
         <equipment alt="设备告警" />
@@ -37,7 +37,8 @@ export default {
   },
   data() {
     return {
-        
+        videoStatus:true,
+        info:undefined,
     };
   },
 
@@ -45,7 +46,13 @@ export default {
     
   },
   methods: {
-    
+    videoMsg(id){
+        this.videoStatus = false
+        setTimeout(()=>{
+            this.videoStatus = true
+            this.info = id
+        })
+    }
   }
 };
 </script>

+ 168 - 0
src/components/record/restaurant/index copy.vue

@@ -0,0 +1,168 @@
+<template>
+    <van-row class="recordList">
+      <van-row class="titleWrap">
+        <span class="line"></span>
+        <span class="title">餐饮管理</span>
+      </van-row>
+      <van-row class="type">
+        <van-col span="11" class="bgc5">
+          <van-row class="textTop">{{data.nowIncome || 0}}</van-row>
+          <van-row class="textBottom">今日营业额(元)</van-row>
+        </van-col>
+        <van-col span="11" class="bgc6" offset="2">
+          <van-row class="textTop">{{data.consumerNowNumber || 0}}</van-row>
+          <van-row class="textBottom">今日销售人/次(份)</van-row>
+        </van-col>
+      </van-row>
+      <van-row class="dishes">
+        <van-col span="5" class="bgc7 left">
+          <van-row class="text">最受欢迎菜品</van-row>
+        </van-col>
+        <van-col span="19" class="dishesList right" >
+          <van-row class="one">
+              <van-col span="4" class="img" >
+                    <el-image
+                    :src="img1"
+                    ></el-image>
+              </van-col>
+              <!-- <van-col span="20" class="name" >{{data.countTheTopThree.length>0 ? 1 : "1111"}}<span class="color1 num">{{list[0].num}}份</span></van-col> -->
+          </van-row>
+           <van-row class="two">
+              <van-col span="4" class="img" >
+                    <el-image
+                    :src="img2"
+                    ></el-image>
+              </van-col>
+              <van-col span="20" class="name" >{{list[1].name}}<span class="color2 num">{{list[1].num}}份</span></van-col>
+          </van-row>
+           <van-row class="three">
+              <van-col span="4" class="img" >
+                    <el-image
+                    :src="img3"
+                    ></el-image>
+              </van-col>
+              <van-col span="20" class="name" >{{list[2].name}}<span class="color3 num">{{list[2].num}}份</span></van-col>
+          </van-row>
+        </van-col>
+      </van-row>
+      
+    </van-row>
+</template>
+<script>
+import { getWeekDate } from "@/assets/js/dataFormate.js";
+import Cookies from "js-cookie";
+export default {
+  data() {
+    return {
+        img1:require('@/assets/image/组41@3x.png'),
+        img2:require('@/assets/image/组41拷贝@3x.png'),
+        img3:require('@/assets/image/组41拷贝2@3x.png'),
+        list:[
+          {name:"清炒时蔬",num:412},
+          {name:"柠檬鸭",num:315},
+          {name:"番茄炒蛋",num:267},
+        ],
+        num:[38155,15642],
+        data:[]//真实数据
+    };
+  },
+  created(){
+    this.init()
+    // if(getWeekDate() == "周一" || getWeekDate() == "周日"){
+    //   this.list = [
+    //     {name:"未营业",num:0},
+    //     {name:"未营业",num:0},
+    //     {name:"未营业",num:0},
+    //   ]
+    //   this.tapNo = true
+    // }
+    // if(getWeekDate() == "周六" || getWeekDate() == "周日"){
+    //   this.num = [0,0]
+    // }
+  },
+  mounted() {},
+  methods: {
+    init(){
+      axios({
+        method: 'get',
+        url: 'https://smartpark.caih.com/zhcy/api/thirdparty/v1/open/getCanYinData',
+        timeout: 100000,
+      }).then(res =>{
+        this.data = res.data.data
+          console.log(res.data.data)
+      }).catch(err =>{
+      })
+      // axios.post(`https://smartpark.caih.com/ykt/api/thirdparty/v1/open/getCanYinData`, 
+      //   {
+      //     "nonce": Cookies.get("nonce58"),
+      //     "timestamp": Cookies.get("timestamp58"),
+      //     "query": {
+      //       "userNumber":Cookies.get("userId58"),
+      //     }
+      //   },
+      //   {headers: {
+      //       "XYTACCESSTOKEN":Cookies.get("token58")
+      //     }
+      //   }).then(res => {
+      //       if(res?.data?.data?.content){
+      //         this.adminList1 = res.data.data.content.slice(0,5)
+      //         this.loading1 = false
+      //       }else{
+      //         this.loading1 = false
+      //       }
+      //     }).catch(err =>{
+      //       Toast(err.response.data.message)
+      //   })
+
+    }
+
+
+
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.dishes{
+    font-size: 14px;
+    margin-top:15px;
+    .left{
+        height:100px;
+        border-radius: 6px;
+        color:#fff;
+        .text{
+            width:50%;
+            text-align: center;
+            letter-spacing: 2px;
+            display: block;
+            line-height: 25px;
+            margin: 0 auto; /*水平居中*/
+            position: relative;
+            top: 50%; /*偏移*/
+            margin-top: -40px;
+        }
+    }
+    .right{
+        height:100px;
+        border:1px solid #F0F0F0;
+        .van-row{
+            margin: -6px 0 15px 15px;
+            .img{
+                width:18px;
+                vertical-align: middle;
+            }
+            .name{
+                color:#000;
+                margin-left:15px;
+                margin-top:-2px;
+                .num{
+                    margin-left:15px;
+                }
+            }
+        }
+        .van-row:nth-child(1){
+            margin-top:10px;
+        }
+    }
+}
+</style>

+ 41 - 48
src/components/record/restaurant/index.vue

@@ -6,42 +6,26 @@
       </van-row>
       <van-row class="type">
         <van-col span="11" class="bgc5">
-          <van-row class="textTop">{{num[0]}}</van-row>
+          <van-row class="textTop" v-loading="loading">{{ data.nowIncome || 0 }}</van-row>
           <van-row class="textBottom">今日营业额(元)</van-row>
         </van-col>
         <van-col span="11" class="bgc6" offset="2">
-          <van-row class="textTop">{{num[1]}}</van-row>
-          <van-row class="textBottom">今日销售人/次(份)</van-row>
+          <van-row class="textTop" v-loading="loading">{{ data.consumerNowNumber || 0 }}</van-row>
+          <van-row class="textBottom">今日销售人/次</van-row>
         </van-col>
       </van-row>
       <van-row class="dishes">
         <van-col span="5" class="bgc7 left">
           <van-row class="text">最受欢迎菜品</van-row>
         </van-col>
-        <van-col span="19" class="dishesList right" >
-          <van-row class="one">
+        <van-col span="19" class="dishesList right" v-loading="loading">
+          <van-row class="one" v-for="(item,index) in data.countTheTopThree" :key="index">
               <van-col span="4" class="img" >
                     <el-image
-                    :src="img1"
+                    :src="item.img"
                     ></el-image>
               </van-col>
-              <van-col span="20" class="name" >{{list[0].name}}<span class="color1 num">{{list[0].num}}份</span></van-col>
-          </van-row>
-           <van-row class="two">
-              <van-col span="4" class="img" >
-                    <el-image
-                    :src="img2"
-                    ></el-image>
-              </van-col>
-              <van-col span="20" class="name" >{{list[1].name}}<span class="color2 num">{{list[1].num}}份</span></van-col>
-          </van-row>
-           <van-row class="three">
-              <van-col span="4" class="img" >
-                    <el-image
-                    :src="img3"
-                    ></el-image>
-              </van-col>
-              <van-col span="20" class="name" >{{list[2].name}}<span class="color3 num">{{list[2].num}}份</span></van-col>
+              <van-col span="20" class="name" >{{item.name}}<span :class=" index == '0' ? 'color1' : index == '1' ? 'color2' : 'color3' " id="num">{{item.countPid}}份</span></van-col>
           </van-row>
         </van-col>
       </van-row>
@@ -50,36 +34,47 @@
 </template>
 <script>
 import { getWeekDate } from "@/assets/js/dataFormate.js";
+import Cookies from "js-cookie";
 export default {
   data() {
     return {
-        img1:require('@/assets/image/组41@3x.png'),
-        img2:require('@/assets/image/组41拷贝@3x.png'),
-        img3:require('@/assets/image/组41拷贝2@3x.png'),
-        list:[
-          {name:"清炒时蔬",num:412},
-          {name:"柠檬鸭",num:315},
-          {name:"番茄炒蛋",num:267},
-        ],
-        num:[38155,15642],
+        loading:true,
+        num1:require('@/assets/image/组41@3x.png'),
+        num2:require('@/assets/image/组41拷贝@3x.png'),
+        num3:require('@/assets/image/组41拷贝2@3x.png'),
+        data:[]//真实数据
     };
   },
   created(){
-    if(getWeekDate() == "周一" || getWeekDate() == "周日"){
-      this.list = [
-        {name:"未营业",num:0},
-        {name:"未营业",num:0},
-        {name:"未营业",num:0},
-      ]
-      this.tapNo = true
-    }
-    if(getWeekDate() == "周六" || getWeekDate() == "周日"){
-      this.num = [0,0]
-    }
+    this.init()
   },
   mounted() {},
   methods: {
-
+    init(){
+      this.loading = true
+      axios({
+        method: 'get',
+        url: 'https://smartpark.caih.com/zhcy/api/thirdparty/v1/open/getCanYinData',
+        timeout: 3000,
+      }).then(res =>{
+        this.data = res.data.data
+        if(this.data.countTheTopThree.length>0){
+          this.data.countTheTopThree[0].img= this.num1
+          this.data.countTheTopThree[1].img= this.num2
+          this.data.countTheTopThree[2].img= this.num3
+        }else{
+          this.data.countTheTopThree[0] = {img:this.num1,name:"暂未营业",countPid:0}
+          this.data.countTheTopThree[1] = {img:this.num2,name:"暂未营业",countPid:0}
+          this.data.countTheTopThree[2] = {img:this.num3,name:"暂未营业",countPid:0}
+        }
+        this.loading= false
+      })
+    },
+    timing(){
+      setInterval(() =>{
+        this.init()
+      },1000 * 60 * 5)
+    },
   },
 };
 </script>
@@ -107,6 +102,7 @@ export default {
     .right{
         height:100px;
         border:1px solid #F0F0F0;
+        padding-top:15px;
         .van-row{
             margin: -6px 0 15px 15px;
             .img{
@@ -117,14 +113,11 @@ export default {
                 color:#000;
                 margin-left:15px;
                 margin-top:-2px;
-                .num{
+                #num{
                     margin-left:15px;
                 }
             }
         }
-        .van-row:nth-child(1){
-            margin-top:10px;
-        }
     }
 }
 </style>

+ 330 - 79
src/components/record/videoSS/index.vue

@@ -4,31 +4,52 @@
         <span class="line"></span>
         <span class="title">实时视频</span>
         <div  class="videoSelect" v-if="videoSelect">
-        <el-select @change="videoSelect1" v-model="video1" placeholder="请选择摄像头1" class="videoSelect1">
-            <el-option
-            v-for="item in videoSelect"
-            :key="item.url"
-            :label="item.name"
-            :value="item.url"
-            >
-            </el-option>
-        </el-select>
-        
-        <el-select @change="videoSelect2" v-model="video2" placeholder="请选择摄像头2" class="videoSelect2">
-            <el-option
-            v-for="item in videoSelect"
-            :key="item.url"
-            :label="item.name"
-            :value="item.url"
-            >
-            </el-option>
-        </el-select>
-    </div>
-      </van-row>
-      
+          <el-select @change="videoSelect1" v-model="video1" placeholder="请选择摄像头" class="videoSelect1">
+              <el-option
+              v-for="item in videoSelect"
+              :key="item.url"
+              :label="item.name"
+              :value="item.url"
+              >
+              </el-option>
+          </el-select>
+          <!-- <el-select @change="videoSelect2" v-model="video2" placeholder="请选择摄像头2" class="videoSelect2">
+              <el-option
+              v-for="item in videoSelect"
+              :key="item.url"
+              :label="item.name"
+              :value="item.url"
+              >
+              </el-option>
+          </el-select> -->
+      </div>
+    </van-row>
     <el-row class="videoList" :gutter="20">
-        <el-col class="video" :span="12">
-            <video 
+      <el-col class="video" :span="24" v-if="isIos">
+        <div id="videobox" ref="video">
+          <easyPlayer :videoUrl="url" autoplay :live="true" :poster="poster" ></easyPlayer>
+          <div class="videoTitle">{{name1}}</div>
+          <!-- <video id="videoPlayer" class="video-js" style="width: 100%; height: 100%;"></video> -->
+          <!-- <video id="my-video" class="video-js vjs-default-skin" controls="" preload="none" x5-playsinline="" playsinline="" webkit-playsinline="" poster="" x-webkit-airplay="allow" >
+            <source src="" type="application/x-mpegURL">
+          </video> -->
+          <!-- <video ref="videoPlayer" class="video-js"></video> -->
+         <!-- <video id="myVideo" class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" :poster="poster" width="100%"  ref="video" >
+            <source id="source" :src="url" type="application/x-mpegURL">
+          </video> -->
+          <!-- <div class="videoTitle">{{name1}}</div> -->
+            <!-- <video id="myVideo" 
+                
+                class="hlsVideo monitor-height"
+                ref="hlsvideo"
+                style="width: 100%"
+                :poster="poster"
+                controls
+                >
+                <source id="source" src="http://videocdn.didano.com/school765class0channelId2761namedingdangm/playlist.m3u8" type="application/x-mpegURL">
+            </video> -->
+        </div>
+            <!-- <video id="myVideo1" 
                 preload="true"
                 autoplay="autoplay" 
                 class="hlsVideo monitor-height"
@@ -36,30 +57,41 @@
                 style="width: 100%"
                 :poster="poster"
                 controls
-                muted
-            ></video>
-             <div class="videoTitle">{{name1}}</div>
+                muted>
+               <source id="source" :src="url1" type="application/x-mpegURL">
+              </video> -->
+             <!-- <div class="videoTitle">{{name1}}</div> -->
         </el-col>
-        <el-col class="video" :span="12">
+        <el-col class="video" :span="24" v-if="isAndroid">
             <video 
                 preload="true"
                 autoplay="autoplay" 
                 class="hlsVideo monitor-height"
-                ref="hlsVideo2"
+                ref="hlsVideo1"
                 style="width: 100%"
+                :poster="poster"
                 controls
                 muted
-                :poster="poster"
             ></video>
-            <div class="videoTitle">{{name2}}</div>
+             <div class="videoTitle">{{name1}}</div>
         </el-col>
     </el-row>
     </van-row>
 </template>
 <script>
+import "videojs-flash";
+import EasyPlayer from '@easydarwin/easyplayer'
+
 import poster from "@/assets/image/poster.jpg";
+import 'video.js/dist/video-js.css'
 import Hls from "hls.js";
+import videojs from 'video.js'
+import 'videojs-contrib-hls'
 export default {
+  props:['info'],
+  components: {
+    EasyPlayer
+  },
   data() {
     return {
       videoSelect:true,
@@ -69,15 +101,191 @@ export default {
       video2:undefined,
       name1:undefined,
       name2:undefined,
-      poster:poster
+      poster:poster,
+      url:"http://10.208.64.8:7086/live/cameraid/1000001%240/substream/1.m3u8",
+      // url:"http://10.208.64.8:7086/live/cameraid/1000001%240/substream/1.m3u8",
+      url2:"https://video.hua.com/publicity_video_2020_m.mp4",
+      isAndroid:false,
+      isIos:false,
+      options: {
+        playsInline:true,
+        poster: poster,//封面图
+        fluid: true, // 自适应宽高
+        autoplay: true, // 设置自动播放
+        muted: true, // 设置了它为true,才可实现自动播放,同时视频也被静音(Chrome66及以上版本,禁止音视频的自动播放)
+        preload: 'auto', // 预加载
+        controls: true, // 显示播放的控件
+        aspectRatio: '16:9', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
+      },
+      player: null,
     };
   },
-
-  mounted() {
+  created(){
     this.init()
+    //this.isTerminal()
+  },
+  
+  mounted() {
+    videojs.addLanguage('zh-CN', {
+      "You aborted the media playback": "视频播放被终止",
+      "A network error caused the media download to fail part-way.": "网络错误导致视频下载中途失败。",
+      "The media could not be loaded, either because the server or network failed or because the format is not supported.": "视频因格式不支持或者服务器或网络的问题无法加载。",
+      "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.": "由于视频文件损坏或是该视频使用了你的浏览器不支持的功能,播放终止。",
+      "No compatible source was found for this media.": "无法找到此视频兼容的源。",
+    });
   },
   methods: {
-    init(){
+ 
+     // 销毁
+    beforeDestroy () {
+      if (this.player) {
+        this.player.dispose()
+      }
+    },
+    creatVideo() {
+      this.options = {
+        poster: this.poster, // 视频封面图地址
+        autoplay: true, // 如果true,浏览器准备好时开始播放。
+        muted: true, // 默认情况下将会消除任何音频。
+        loop: true, // 导致视频一结束就重新开始。
+        preload: 'auto', // auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
+        language: 'zh-CN',  //汉化
+        fluid: true, // 当true时,播放器将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
+        sources: [{
+            type: 'application/x-mpegURL',
+            src: this.url  //视频播放地址
+        }],
+        notSupportedMessage: '此视频暂无法播放,请稍后再试', // 无法播放媒体源时显示的默认信息。
+        controlBar: {
+          timeDivider: true,
+          durationDisplay: true,  //视频时长时间显示
+          remainingTimeDisplay: false,  //剩余时间显示
+          fullscreenToggle: true // 全屏按钮
+        },
+        errorDisplay: false,  //错误显示
+        posterImage: false,  //视频的预览海报图片显示
+        bigPlayButton: true,  //视频中间的播放按钮显示
+        textTrackDisplay: false
+      }
+      
+      // 视频初始化
+      setTimeout(()=>{
+        this.player = this.$video(this.$refs.videoPlayer, this.options);
+        this.player.play();
+      },1000)
+        
+      
+      // let video = document.createElement('video');
+      // video.id = 'video';
+      // video.style = 'width: 100%; height: 100%;';
+      // video.controls = true;
+      // // video.autoplay = true;
+      // // video.setAttribute('playsinline', true) //IOS微信浏览器支持小窗内播放
+      // // video.setAttribute('webkit-playsinline',true) //这个bai属性是ios 10中设置可以让视频在小du窗内播放,也就是不是全zhi屏播放的video标签的一个属性
+      // // video.setAttribute('x5-video-player-type', 'h5') //安卓 声明启用同层H5播放器 可以在video上面加东西
+      // let source = document.createElement('source');
+      // source.src =  this.url; // 视频地址
+      // source.type = 'application/x-mpegURL';
+      // this.$nextTick(()=>{  
+      //   let that = this;
+      //   video.appendChild(source);
+      //   this.$refs.video1.appendChild(video);
+      //   //setTimeout(()=>{
+      //       this.player = videojs('video', {
+      //       poster: this.poster, // 视频封面图地址
+      //       title: '',
+      //       playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
+      //       autoDisable: true,
+      //       preload: 'none', //auto - 当页面加载后载入整个视频 meta - 当页面加载后只载入元数据 none - 当页面加载后不载入视频
+      //       language: 'zh-CN',
+      //       fluid: true, // 自适应宽高
+      //       muted: false, //  是否静音
+      //       //aspectRatio: '16:9', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
+      //       controls: true, //是否拥有控制条 【默认true】,如果设为false ,那么只能通过api进行控制了。也就是说界面上不会出现任何控制按钮
+      //       autoplay: 'muted', //如果true,浏览器准备好时开始回放。 autoplay: "muted", // //自动播放属性,muted:静音播放
+      //       loop: true, // 导致视频一结束就重新开始。 视频播放结束后,是否循环播放
+      //       techOrder: ["html5", "flash"], //播放顺序
+      //       sources: [{
+	    //        src: this.url
+	    //       }],
+      //       //screenshot: true,
+      //       controlBar: {
+      //         // volumePanel: { //声音样式
+      //         //   inline: false // 不使用水平方式
+      //         // },
+      //         // timeDivider: true, // 时间分割线
+      //         // durationDisplay: true, // 总时间
+      //         // progressControl: false, // 进度条
+      //         // remainingTimeDisplay: true, //当前以播放时间
+      //         // fullscreenToggle: true, //全屏按钮
+      //         // pictureInPictureToggle: false, //画中画
+      //       }
+      //     }, function (){
+      //       this.play()
+
+      //       this.on("waiting", function ()
+      //       {	
+      //           this.addClass("vjs-custom-waiting");
+      //       });
+      //       this.on("playing", function ()
+      //       {
+      //           this.removeClass("vjs-custom-waiting");
+      //       });
+      //       this.on('loadeddata',function () {
+      //       });
+      //       this.on('error', function(err) {
+      //         this.errorDisplay.close(); //不显示错误信息
+      //         // 报错之后自动重新加载
+      //         that.player.src([
+      //           {
+      //             src: that.url, //播放视频地址
+      //             type: "application/x-mpegURL", // 告诉videojs,这是一个hls流
+      //           },
+      //         ]);
+      //       })
+      //     });
+      //   //})
+        
+      // }) 
+      
+    },
+    videoPlay(){
+      setTimeout(()=>{
+        var myvideo = document.getElementsByTagName("video")[0]
+        var setTimeFlag = 1;//currentTime属性赋值次数
+
+        this.$refs.video.play();
+        //当目前的播放位置已更改时触发
+        myvideo.timeupdate = 2
+
+        myvideo.addEventListener("timeupdate", function(){
+          // this.$refs.video.play();
+          //   if(setTimeFlag == 1){
+          //   //获取localStorage中记录的currentTime值,并给currentTime属性进行赋值
+          //       if (localStorage.getItem('currentTime' + '{$study->study_id}') != null) {
+          //           var time = localStorage.getItem('currentTime' + '{$study->study_id}');
+          //           myvideo.currentTime = time;
+            
+          //       }
+          //   setTimeFlag = 2;
+          //   }
+          //   //获取当前播放位置的秒数,并设置localStorage
+          //   var currentTime = myvideo.currentTime;
+          // localStorage.setItem('currentTime' + '{$study->study_id}', currentTime)
+          
+          //this.$refs.video.play();
+        });
+        
+      },0)
+
+    },
+    isTerminal() {//终端判断
+      
+    },
+
+
+    init(){ //初始化数据
+      
         axios({
             method: 'post',
             url: 'http://10.21.39.1:8082/dhController/getLocalChannel',
@@ -91,23 +299,45 @@ export default {
             if(res.data.data.pageList){
                 let data = res.data.data.pageList
                 this.videoSelect = data
+                this.isTerminal()
                 for(let i = 0; i<data.length; i++){
                     this.videoSelect[i].url = "http://" + data[i].nvr_ip + ":" + data[i].hls_port + "/live/cameraid/" + data[i].deviceId + "%24" + data[i].id.split("$")[(data[i].id.split("$")).length-1]  + "/substream/1.m3u8"
                     this.videoSelect[i].url = this.videoSelect[i].url +  ',' + data[i].name
                 }
-                this.videoSelect1(this.videoSelect[0].url)
-                this.videoSelect2(this.videoSelect[1].url)
+                this.video1 = this.videoSelect[0].url
+                let u = navigator.userAgent;
+                let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android终端
+                let isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //
+                setTimeout(()=>{
+                  if (isIOS) {
+                    this.isIos = true
+                    
+                    this.videoSelect1(this.videoSelect[0].url)
+                    
+                    
+                    
+                  } else {
+                    this.isAndroid = true
+                    this.videoSelect1(this.videoSelect[0].url)
+                  }
+                },1000)
+                
             }
         }).catch(err =>{
         })
         
       },
-      
       videoSelect1(value){
-        this.destroyHls(1)
         let arr = value.split(',')
         this.name1 = arr[1]
-        this.loadVideoFn(1,arr[0])
+        if(this.isIos){
+          this.url = arr[0]
+          this.beforeDestroy()
+        }else{
+          this.destroyHls(1)
+          this.loadVideoFn(1,arr[0])
+        }
+        
       },
       videoSelect2(value){
         this.destroyHls(2)
@@ -116,45 +346,45 @@ export default {
         this.loadVideoFn(2,arr[0])
       },
 
-        destroyHls(id){//关闭视频拉取
-            if (this.hls) {
-                if(id=="1"){
-                    this.$refs.hlsVideo1.pause();
-                    this.hls1.destroy();
-                    this.hls1 = null;
-                }else{
-                    this.$refs.hlsVideo2.pause();
-                    this.hls2.destroy();
-                    this.hls2 = null;
-                }
-                
-            }
-        },
-        loadVideoFn(id,url) {//视频播放
-            setTimeout(() =>{
-                if (Hls.isSupported()) {
-                    if(id == "1"){
-                        this.hls1 = new Hls();
-                        this.hls1.loadSource(url);
-                        this.hls1.attachMedia(this.$refs.hlsVideo1);
-                        this.hls1.on(Hls.Events.MANIFEST_PARSED, () => {
-                            this.$refs.hlsVideo1.play();
-                        });
-                        this.hls1.on(Hls.Events.ERROR, (event, data) => {
-                        });
-                    }else{
-                        this.hls2 = new Hls();
-                        this.hls2.loadSource(url);
-                        this.hls2.attachMedia(this.$refs.hlsVideo2);
-                        this.hls2.on(Hls.Events.MANIFEST_PARSED, () => {
-                            this.$refs.hlsVideo2.play();
-                        });
-                        this.hls2.on(Hls.Events.ERROR, (event, data) => {
-                        });
-                    }
-                }
-            },1000)
-        },
+      destroyHls(id){//关闭视频拉取
+          if (this.hls) {
+              if(id=="1"){
+                  this.$refs.hlsVideo1.pause();
+                  this.hls1.destroy();
+                  this.hls1 = null;
+              }else{
+                  this.$refs.hlsVideo2.pause();
+                  this.hls2.destroy();
+                  this.hls2 = null;
+              }
+              
+          }
+      },
+      loadVideoFn(id,url) {//视频播放
+          setTimeout(() =>{
+              if (Hls.isSupported()) {
+                  if(id == "1"){
+                      this.hls1 = new Hls();
+                      this.hls1.loadSource(url);
+                      this.hls1.attachMedia(this.$refs.hlsVideo1);
+                      this.hls1.on(Hls.Events.MANIFEST_PARSED, () => {
+                          this.$refs.hlsVideo1.play();
+                      });
+                      this.hls1.on(Hls.Events.ERROR, (event, data) => {
+                      });
+                  }else{
+                      this.hls2 = new Hls();
+                      this.hls2.loadSource(url);
+                      this.hls2.attachMedia(this.$refs.hlsVideo2);
+                      this.hls2.on(Hls.Events.MANIFEST_PARSED, () => {
+                          this.$refs.hlsVideo2.play();
+                      });
+                      this.hls2.on(Hls.Events.ERROR, (event, data) => {
+                      });
+                  }
+              }
+          },1000)
+      },
   },
 };
 </script>
@@ -252,5 +482,26 @@ export default {
   .el-input__icon{
     line-height: 0;
   }
+.video-js{
+  width:100%;
+  height:auto;
+}
+.vjs-big-play-button{
+left:50% !important;
+top: 50% !important;
+margin-top: -1em ;
+margin-left: -1.5em ;
+
+}
+#videobox{
+  width:100%;
+  height:200px;
+}
+.easy-player-loading{
+  display: none !important;
+}
+.el-input__prefix, .el-input__suffix{
+margin-top:-3px !important;
+}
 </style>
 

+ 3 - 5
src/components/weather/index.vue

@@ -13,7 +13,7 @@
                 ></el-image>
                 <el-row class="addName">广西</el-row>
             </el-row>
-            <el-row class="weather">
+            <el-row class="weather" v-if="data">
                 <div class="weatherImg">
                     <el-image
                     class="img2"
@@ -22,7 +22,6 @@
                 </div>
                 <div class="wd">
                     <el-row class="wdDX">{{data.temperature}}℃ <span class="weatherText">{{data.weather}}</span></el-row>
-                    <!-- <el-row class="wdD-wdG">22℃  /   30℃ </el-row> -->
                 </div>
             </el-row>
         </el-row>
@@ -30,7 +29,7 @@
             <span class="sd">
                 湿度:{{data.sd}}RH
             </span>
-            <span class="ph">
+            <span class="ph" v-if="data.aqiDetail">
                 PM2.5:{{data.aqiDetail.pm2_5}}ug/m3
             </span>
         </el-row>
@@ -58,11 +57,10 @@ export default {
       axios({
             method: 'get',
             url: 'https://smartpark.caih.com/dxapi/aliWeather?area=广西',
-            
             timeout: 3000,
         }).then(res =>{
             this.data = res.data.showapi_res_body.now
-            
+            console.log(this.data.weather_pic)
         }).catch(err =>{
         })
     },

+ 3 - 1
src/main.js

@@ -12,7 +12,9 @@ import './assets/iconfont/iconfont.css'
 import querystring from 'querystring';
 import './plugins/element.js'
 import './plugins/common';
-
+import videojs from 'video.js';
+import 'video.js/dist/video-js.css';
+Vue.prototype.$video = videojs;
 
 import './assets/icons'
 

+ 2 - 12
src/views/index/index.vue

@@ -103,7 +103,7 @@ body {
 .mianBox {
   height: 100%;
   width: 100%;
-  background-color: rgba(0, 0, 0, 0.05);
+  background-color: rgba(0, 0, 0, 0.01);
   padding-top: 40px;
   // box-sizing: border-box;
   position: fixed;
@@ -146,17 +146,7 @@ body {
 .el-loading-mask {
   background-color: transparent !important;
 }
-.upload {
-  position: absolute;
-  width: 100px;
-  height: 50px;
-  overflow: hidden;
-  top: 0px;
-  right: 0;
-  opacity: 0;
-  z-index: 10;
-  background-color: blue;
-}
+
 .el-table .cell {
   padding-right: 0;
 }

+ 6 - 0
src/views/login/index.vue

@@ -153,7 +153,10 @@ export default {
                   Cookies.set("username58", this.loginForm.username, { expires: 300 });
                   Cookies.set("rememberMe58", this.loginForm.rememberMe, { expires: 300 });
                   Cookies.set("password58", encrypt(this.loginForm.password), { expires: 300 });
+                  Cookies.set("userId58", data.user.id, { expires: 300 });
                   Cookies.set("token58", data.cipher, { expires: 300 });
+                  Cookies.set("nonce58", data.nonce, { expires: 300 });
+                  Cookies.set("timestamp58", data.timestamp, { expires: 300 });
                   this.$router.push({ path: "/index"})
 
               }else if(data.user.dmUser.type == "01"){
@@ -164,7 +167,10 @@ export default {
                   Cookies.set("username58", this.loginForm.username, { expires: 300 });
                   Cookies.set("rememberMe58", this.loginForm.rememberMe, { expires: 300 });
                   Cookies.set("password58", encrypt(this.loginForm.password), { expires: 300 });
+                  Cookies.set("userId58", data.user.id, { expires: 300 });
                   Cookies.set("token58", data.token, { expires: 300 });
+                  Cookies.set("nonce58", data.nonce, { expires: 300 });
+                  Cookies.set("timestamp58", data.timestamp, { expires: 300 });
                   this.$router.push({ path: "/index"})
                 }
               }else if(data.user.dmUser.type == "02"){

+ 23 - 3
vue.config.js

@@ -1,5 +1,23 @@
 'use strict'
 const path = require('path')
+const CopyWebpackPlugin = require('copy-webpack-plugin')
+configureWebpack: {
+    plugins: [
+        new CopyWebpackPlugin([{
+                from: 'node_modules/@easydarwin/easyplayer/dist/component/EasyPlayer.swf',
+                to: './libs/EasyPlayer/'
+            },
+            {
+                from: 'node_modules/@easydarwin/easyplayer/dist/component/crossdomain.xml',
+                to: './libs/EasyPlayer/'
+            },
+            {
+                from: 'node_modules/@easydarwin/easyplayer/dist/component/EasyPlayer-lib.min.js',
+                to: './libs/EasyPlayer/'
+            }
+        ])
+    ]
+}
 
 function resolve(dir) {
     return path.join(__dirname, dir)
@@ -42,9 +60,9 @@ module.exports = {
         performance: {
             hints: 'warning',
             // 入口起点的最大体积
-            maxEntrypointSize: 50000000,
+            maxEntrypointSize: 150000000,
             // 生成文件的最大体积
-            maxAssetSize: 30000000,
+            maxAssetSize: 130000000,
             // 只给出 js 文件的性能提示
             assetFilter: function(assetFilename) {
                 return assetFilename.endsWith('.js')
@@ -145,6 +163,8 @@ module.exports = {
                     config.optimization.runtimeChunk('single')
                 }
             )
-    }
+    },
+
+
 
 };

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů