ソースを参照

Merge branch 'master' of http://www.sysuimars.cn:3000/feiniao/feiniao-pc-vue

shuhao 5 ヶ月 前
コミット
642089f4e2

+ 5 - 4
package.json

@@ -19,9 +19,12 @@
     "@iconify/iconify": "^3.1.0",
     "@iconify/json": "^2.2.42",
     "@iconify/vue": "^4.1.0",
+    "@liveqing/liveplayer-v3": "^3.7.35",
     "@turf/turf": "^7.2.0",
     "@vueuse/core": "^8.7.5",
+    "ali-oss": "^6.20.0",
     "axios": "^0.27.2",
+    "copy-webpack-plugin": "^13.0.0",
     "core-js": "^3.23.3",
     "dayjs": "^1.11.3",
     "echarts": "^5.4.1",
@@ -44,6 +47,7 @@
     "run": "^1.4.0",
     "serve": "^14.1.2",
     "svg-sprite-loader": "^4.1.3",
+    "vant": "^4.9.19",
     "videojs-contrib-hls": "^5.15.0",
     "vue": "^3.2.47",
     "vue-echarts": "^6.5.4",
@@ -57,10 +61,7 @@
     "vuex": "^4.0.2",
     "xe-utils": "^3.5.4",
     "yarn": "^1.22.22",
-    "zdog": "^1.1.3",
-    "vant": "^4.9.19",
-    "ali-oss": "^6.20.0"
-
+    "zdog": "^1.1.3"
   },
   "devDependencies": {
     "@babel/eslint-parser": "^7.18.2",

+ 1 - 0
public/index.html

@@ -15,6 +15,7 @@
         <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
         <link rel="icon" href="favicon.ico" />
         <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/qweather-icons@1.3.0/font/qweather-icons.css">
+        <script src="<%= BASE_URL %>js/liveplayer-lib.min.js"></script>
         <title>飞鸟智慧巡园平台</title>
     </head>
     <body>

ファイルの差分が大きいため隠しています
+ 0 - 0
public/js/liveplayer-lib.min.js


+ 8 - 0
src/api/modules/home.js

@@ -1,6 +1,14 @@
 const config = require("../config");
 
 module.exports = {
+  startStreamConverters: {
+    url: config.base_url + "device/startStreamConverters/{farmId}",
+    type: "post",
+  },
+  closeStreamConverters: {
+    url: config.base_url + "device/closeStreamConverters/{farmId}/{converterId}",
+    type: "get",
+  },
   getYellowList: {
     url: config.base_url + "temp_yellow_board/list",
     type: "get",

+ 1 - 0
src/main.js

@@ -25,6 +25,7 @@ import '@/common/rem'
 import Print from 'vue3-print-nb'
 import vue3PhotoPreview from 'vue3-photo-preview'
 import 'vue3-photo-preview/dist/index.css'
+import 'vant/lib/index.css';
 
 const app = createApp(App);
 app.use(mock)

+ 64 - 3
src/views/home/components/homePage.vue

@@ -3,7 +3,10 @@
     <div class="chart-item weather-item">
       <chart-box name="气象预警">
         <template #title-right>
-          <div class="button" @click="gybg">溯源报告</div>
+          <div class="button-group">
+            <div class="button zb" @click="handlePlay">直播</div>
+            <div class="button" @click="gybg">溯源报告</div>
+          </div>
         </template>
         <div class="base-wrap">
           <div class="base-item" v-for="(item, index) in baseData.labels" :key="index">
@@ -118,16 +121,26 @@
     </div>
     <ImageDialog></ImageDialog>
   </div>
+  <popup class="popup-video" v-model:show="showVideo" :close-on-click-overlay="false">
+    <div class="video-cont">
+      <div class="close" @click="handleClose">
+        <el-icon size="28" color="#000"><Close /></el-icon>
+      </div>
+      <LivePlayer class="video" ref="player" :videoUrl="flvURL" live loop autoplay />
+    </div>
+  </popup>
 </template>
-
 <script setup>
 import { ref, onMounted, onUnmounted } from "vue";
+import { ElMessage } from 'element-plus'
 import chartBox from "@/components/chartBox.vue";
 import tabs from "./tabs.vue";
+import LivePlayer from '@liveqing/liveplayer-v3'
 import weatherChart from "./weatherChart.vue";
 import barChart from "@/components/charts/barChart.vue";
 import oneLineChart from "@/components/charts/oneLineChart.vue";
 import eventBus from "@/api/eventBus";
+import { Popup } from 'vant';
 import { useStore } from "vuex";
 import { useRouter } from "vue-router";
 import ImageDialog from "../../../components/ImageDialog";
@@ -276,6 +289,27 @@ const gybg = () => {
     eventBus.emit("homePage:image", { filename: data.path, title: "溯源报告" });
   });
 };
+
+const showVideo = ref(false)
+const flvURL = ref("")
+const converterId = ref('')
+const handlePlay = () =>{
+  VE_API.home.startStreamConverters({farmId:sessionStorage.getItem("farmId")}).then(res =>{
+    if(res.code === 0){
+      showVideo.value = true
+      flvURL.value = res.data.url
+      converterId.value = res.data.converterId
+    }else{
+      ElMessage.warning('暂无直播')
+    }
+  })
+}
+
+const handleClose = () =>{
+  showVideo.value = false
+  flvURL.value = ''
+  VE_API.home.closeStreamConverters({farmId:sessionStorage.getItem("farmId"),converterId:converterId.value})
+}
 </script>
 
 <style lang="scss" scoped>
@@ -295,6 +329,9 @@ const gybg = () => {
     margin-bottom: 10px;
     &.weather-item {
       height: 260px;
+      .button-group{
+        display: flex;
+      }
     }
     .box-flex {
       width: 100%;
@@ -329,8 +366,13 @@ const gybg = () => {
     .button {
       border: 1px solid rgba(255, 255, 255, 0.4);
       border-radius: 4px;
-      padding: 2px 10px;
+      padding: 2px 0;
+      width: 78px;
       cursor: pointer;
+      text-align: center;
+    }
+    .zb{
+      margin-right: 8px;
     }
     &.chart-item:last-child {
       margin: 0;
@@ -457,4 +499,23 @@ const gybg = () => {
     }
   }
 }
+.popup-video{
+  width: 100%;
+  background: transparent;
+  .video-cont{
+    width: 70%;
+    margin: auto;
+    background: #fff;
+    padding: 10px;
+    border-radius: 10px;
+    .close{
+      width: 100%;
+      text-align: right;
+    }
+    .video{
+      width: 100%;
+      height: 100%;
+    }
+  }
+}
 </style>

+ 0 - 1
src/views/home/index.vue

@@ -323,7 +323,6 @@ function areaId({ areaId, farmId }) {
 
 //选项卡子项事件监听
 const handleTabItem = (e) => {
-    console.log('eeeeeeeeee', e, reportData.value);
     // if (reportData.value.blueZoneList) {
     //     const index = reportData.value.blueZoneList.findIndex((item) => item.key === e);
     //     let arr = [];

+ 12 - 3
vue.config.js

@@ -13,6 +13,7 @@ function resolve(dir) {
     return path.join(__dirname, '.', dir)
 }
 const TerserPlugin = require("terser-webpack-plugin");
+const CopyWebpackPlugin = require('copy-webpack-plugin');
 const CompressionWebpackPlugin = require("compression-webpack-plugin");
 let scssVariables = require("./src/styles/variables.scss.js");
 
@@ -67,10 +68,18 @@ module.exports = {
     },
 
     configureWebpack: () => {
+        const plugins = [
+            new CopyWebpackPlugin({
+                patterns: [
+                    { from: 'node_modules/@liveqing/liveplayer-v3/dist/component/crossdomain.xml'},
+                    { from: 'node_modules/@liveqing/liveplayer-v3/dist/component/liveplayer-lib.min.js', to: 'public/js'},
+                    { from: 'node_modules/@liveqing/liveplayer-v3/dist/component/liveplayer.swf'},
+                ],
+            }),
+            Icons({ compiler: 'vue3' }),
+        ]
         let baseConfig = {
-            plugins: [
-                Icons({ compiler: 'vue3' }),
-            ],
+            plugins: plugins,
         };
         let envConfig = {};
         if (process.env.NODE_ENV === "production") {

ファイルの差分が大きいため隠しています
+ 364 - 204
yarn.lock


この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません