guhongwei 4 years ago
parent
commit
3dff608e84

+ 22 - 1
src/views/adminCenter/dockInfo/index.vue

@@ -4,7 +4,14 @@
       <el-col :span="24">
         <el-col :span="24" class="leftTop"> <span>|</span> <span>展会管理</span> </el-col>
         <el-col :span="24" class="info">
-          <dockInfo :form="form" @submitForm="submitForm" @submitStatus="submitStatus"></dockInfo>
+          <dockInfo
+            :form="form"
+            @submitForm="submitForm"
+            @submitStatus="submitStatus"
+            :videoform="videoform"
+            :videodata="videodata"
+            @addvideoSubmit="addvideoSubmit"
+          ></dockInfo>
         </el-col>
       </el-col>
     </el-row>
@@ -27,6 +34,8 @@ export default {
   data: function() {
     return {
       form: {},
+      videoform: {},
+      videodata: [],
     };
   },
   created() {
@@ -38,11 +47,13 @@ export default {
     async search() {
       let res = await this.fetch(this.user.uid);
       if (this.$checkRes(res)) {
+        this.$set(this, `videodata`, res.data.videodata);
         this.$set(this, `form`, res.data);
       }
     },
     // 展会信息修改
     async submitForm({ data }) {
+      data.videodata = this.videodata;
       let res = await this.update(data);
       if (this.$checkRes(res)) {
         let authdata = {};
@@ -60,6 +71,7 @@ export default {
     },
     // 展会开启&结束修改
     async submitStatus({ data }) {
+      data.videodata = this.videodata;
       let res = await this.update(data);
       if (this.$checkRes(res)) {
         this.$message({
@@ -69,6 +81,15 @@ export default {
         this.search();
       }
     },
+    // 视频信息提交
+    addvideoSubmit({ data }) {
+      this.videoform = {};
+      this.videodata.push(data);
+      this.$message({
+        message: '视频信息添加成功',
+        type: 'success',
+      });
+    },
   },
   computed: {
     ...mapState(['user']),

+ 65 - 17
src/views/adminCenter/dockInfo/parts/dockInfo.vue

@@ -62,23 +62,9 @@
             <el-input v-model="form.organizer" placeholder="请输入承办方"></el-input>
           </el-form-item>
           <el-form-item label="对接会视频">
-            <upload
-              :limit="1"
-              :data="form.file_path"
-              type="file_path"
-              listType=""
-              :url="'/files/imgpath/upload'"
-              @upload="uploadSuccess"
-              @delete="uploadDelete"
-            ></upload>
+            <el-button type="primary" size="mini" @click="addDialog = true">添加视频</el-button>
+            <el-button type="primary" size="mini" @click="videDialog = true">查看视频</el-button>
           </el-form-item>
-          <el-form-item label="视频文件标题">
-            <el-input v-model="form.videointro" placeholder="请输入视频文件标题"></el-input>
-          </el-form-item>
-          <!-- <el-form-item label="视频文件简介">
-            <el-input v-model="form.videointroinfo" type="textarea" placeholder="请输入视频文件简介"></el-input>
-          </el-form-item> -->
-
           <el-form-item label="状态">
             <el-radio v-model="form.status" label="1">开始</el-radio>
             <el-radio v-model="form.status" label="2">结束</el-radio>
@@ -90,6 +76,43 @@
         </el-form>
       </el-col>
     </el-row>
+    <el-dialog title="添加视频信息" :visible.sync="addDialog" width="40%" :before-close="videoclose">
+      <el-form ref="videoform" :model="videoform" label-width="80px" class="videoform">
+        <el-form-item label="名称">
+          <el-input v-model="videoform.videointro" placeholder="请输入名称"></el-input>
+        </el-form-item>
+        <el-form-item label="简介">
+          <el-input v-model="videoform.videointroinfo" type="textarea" placeholder="请输入简介"></el-input>
+        </el-form-item>
+        <el-form-item label="视频路径">
+          <upload
+            :limit="1"
+            :data="videoform.file_path"
+            type="file_path"
+            listType=""
+            :url="'/files/imgpath/upload'"
+            @upload="uploadSuccess"
+            @delete="uploadDelete"
+          ></upload>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" @click="addvideoSubmit">保存</el-button>
+        </el-form-item>
+      </el-form>
+    </el-dialog>
+    <el-dialog title="查看视频信息" :visible.sync="videDialog" width="40%" :before-close="videoclose">
+      <el-table :data="videodata" style="width: 100%" border>
+        <el-table-column prop="videointro" label="名称" align="center" show-overflow-tooltip> </el-table-column>
+        <el-table-column prop="videointroinfo" label="简介" align="center" show-overflow-tooltip> </el-table-column>
+        <el-table-column prop="file_path" label="视频路径" align="center" show-overflow-tooltip> </el-table-column>
+        <el-table-column label="操作" align="center">
+          <template v-slot="scoped">
+            <!-- <el-button type="text" @click="editAttend(scoped.$index, scoped.row)" size="small">修改</el-button> -->
+            <el-button type="text" @click="delAttend(scoped.$index, scoped.row)" size="small">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-dialog>
   </div>
 </template>
 
@@ -101,6 +124,8 @@ export default {
   name: 'dockInfo',
   props: {
     form: null,
+    videoform: { type: Object },
+    videodata: { type: Array },
   },
   components: {
     upload,
@@ -110,6 +135,10 @@ export default {
       rules: {},
       option: [],
       options: [],
+      // 添加
+      addDialog: false,
+      // 查看
+      videDialog: false,
     };
   },
   created() {
@@ -150,11 +179,30 @@ export default {
       this.$set(this, `options`, res.data);
     },
     uploadSuccess({ type, data }) {
-      this.$set(this.form, `${type}`, data.uri);
+      this.$set(this.videoform, `${type}`, data.uri);
     },
     uploadDelete(index) {
       this.$set(this.form, `file_path`, 'video');
     },
+    // 视频保存
+    addvideoSubmit() {
+      this.$emit('addvideoSubmit', { data: this.videoform });
+      this.videoclose();
+    },
+    // 取消
+    videoclose() {
+      this.addDialog = false;
+      this.videDialog = false;
+    },
+    // 删除
+    delAttend(index, val) {
+      this.videodata.splice(index, 1);
+      this.$message({
+        message: '删除专利信息成功',
+        type: 'success',
+      });
+      this.videoclose();
+    },
   },
   computed: {
     ...mapState(['user']),

+ 110 - 32
src/views/halltwo/directTwo.vue

@@ -103,12 +103,36 @@
           <div class="w_1200">
             <el-col :span="24" class="three1">
               <el-col :span="12" class="left">
-                <video :src="dockInfo.file_path" autoplay="autoplay" controls="controls" v-if="dockInfo.file_path != 'video'" loop="loop">
-                  您的浏览器不支持 video 标签。
-                </video>
-                <div class="videointro" v-else>
-                  <p>{{ dockInfo.videointro }}</p>
-                </div>
+                <el-col :span="24" class="top">
+                  <video :src="videoPath" autoplay="autoplay" controls="controls" v-if="dockInfo.videodata != ''" loop="loop">
+                    您的浏览器不支持 video 标签。
+                  </video>
+                  <div class="videointro" v-else>
+                    <p>{{ dockInfo.title }}</p>
+                  </div>
+                </el-col>
+                <el-col :span="24" class="down">
+                  <el-carousel :interval="4000" type="card" height="50px" :autoplay="false">
+                    <el-carousel-item
+                      v-for="(item, index) in videoData"
+                      :key="index"
+                      :class="menuIndex == index ? 'indexClass' : 'videodata'"
+                      @click.native="changeMenu(index, item)"
+                    >
+                      {{ item.videointro }}
+                    </el-carousel-item>
+                  </el-carousel>
+                  <!-- <el-col
+                    :span="6"
+                    class=""
+                    v-for="(item, index) in dockInfo.videodata"
+                    :key="index"
+                    @click.native="changeMenu(index, item)"
+                    :class="menuIndex == index ? 'indexClass' : 'videodata'"
+                  >
+                    {{ item.videointro }}
+                  </el-col> -->
+                </el-col>
               </el-col>
               <el-col :span="12" class="right">
                 <el-tabs v-model="activeName">
@@ -281,6 +305,7 @@ const { mapActions: transaction } = createNamespacedHelpers('transaction');
 const { mapActions: market } = createNamespacedHelpers('market');
 const { mapActions: flower } = createNamespacedHelpers('flower');
 var moment = require('moment');
+var _ = require('loadsh');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -352,10 +377,15 @@ export default {
       // 倒计时
       djs: '',
       countDown: true,
+      // 视频
+      menuIndex: '0',
+      videoData: [],
+      videoPath: '',
     };
   },
   async created() {
     await this.searchInfo();
+    await this.seachtVideo();
   },
   mounted() {
     this.channel();
@@ -496,13 +526,29 @@ export default {
     liveCenBtn() {
       this.$router.push({ path: '/halltwo/liveCenter', query: { dock_id: this.id } });
     },
+    // 查找视频
+    async seachtVideo() {
+      let res = await this.dockFetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `videoData`, res.data.videodata);
+        this.changeMenu('0', this.videoData[0]);
+      }
+    },
     channel() {
       this.$stomp({
         [`/exchange/dock_video/${this.id}`]: this.onMessage,
       });
     },
     onMessage(message) {
-      this.$set(this.dockInfo, `file_path`, message.body);
+      let arr = JSON.parse(message.body);
+      this.$set(this, `videoData`, arr);
+      let num = this.videoData.length - 1;
+      let newarr = _.last(arr);
+      this.changeMenu(num, newarr);
+    },
+    changeMenu(index, item) {
+      this.menuIndex = index;
+      this.$set(this, `videoPath`, item.file_path);
     },
   },
   computed: {
@@ -686,34 +732,66 @@ export default {
       height: 440px;
       margin: 0 0 50px 0;
       .left {
-        height: 440px;
-        background: url('~@a/dock1.png');
-        background-size: 100% 100%;
-        background-repeat: no-repeat;
         margin: 0 15px 0 0;
-        video {
-          width: 100%;
-          height: 100%;
-          background-color: #000;
-        }
-        .videointro {
-          background: url(/img/dock1.bb2d84ec.png);
-          text-align: center;
-          color: #fff;
-          font-size: 30px;
+        .top {
+          height: 390px;
+          overflow: hidden;
+          background: url('~@a/dock1.png');
           background-size: 100% 100%;
           background-repeat: no-repeat;
-          height: 440px;
-          padding: 0 10px;
-          p {
-            height: 240px;
-            padding: 15% 0;
-            overflow: hidden;
-            text-overflow: ellipsis;
-            -webkit-line-clamp: 8;
-            word-break: break-all;
-            display: -webkit-box;
-            -webkit-box-orient: vertical;
+          video {
+            width: 100%;
+            height: 100%;
+            background-color: #000;
+          }
+          .videointro {
+            background: url(/img/dock1.bb2d84ec.png);
+            text-align: center;
+            color: #fff;
+            font-size: 30px;
+            background-size: 100% 100%;
+            background-repeat: no-repeat;
+            height: 440px;
+            padding: 0 10px;
+            p {
+              height: 240px;
+              padding: 15% 0;
+              overflow: hidden;
+              text-overflow: ellipsis;
+              -webkit-line-clamp: 8;
+              word-break: break-all;
+              display: -webkit-box;
+              -webkit-box-orient: vertical;
+            }
+          }
+        }
+        .down {
+          height: 50px;
+          overflow: hidden;
+          border: 1px solid #ccc;
+          .videodata {
+            border-radius: 10px;
+            background: #cccccc8f;
+            height: 50px;
+            line-height: 50px;
+            text-align: center;
+            margin: 0 5px;
+            font-weight: bold;
+          }
+          .videodata:hover {
+            cursor: pointer;
+            color: #fff;
+            background: #409eff;
+          }
+          .indexClass {
+            border-radius: 10px;
+            height: 50px;
+            line-height: 50px;
+            text-align: center;
+            margin: 0 5px;
+            font-weight: bold;
+            color: #fff;
+            background: #409eff;
           }
         }
       }