wxy hace 4 años
padre
commit
eed07f28ea

+ 7 - 0
src/router/index.js

@@ -19,6 +19,13 @@ const routes = [
     meta: { title: '直播大厅', isleftarrow: true },
     component: () => import('../views/live/index.vue'),
   },
+  // 直播详情
+  {
+    path: '/live/detail',
+    name: 'live_detail',
+    meta: { title: '直播详情', isleftarrow: true },
+    component: () => import('../views/live/detail.vue'),
+  },
   // // 绑定
   // {
   //   path: '/bind',

+ 3 - 2
src/store/index.js

@@ -2,6 +2,7 @@ import Vue from 'vue';
 import Vuex from 'vuex';
 //直播大厅
 import dock from './live/dock';
+import chat from './live/chat';
 import place from './place';
 // import login from '@common/store/login';
 // import marketproduct from '@common/store/market/marketproduct';
@@ -21,7 +22,6 @@ import place from './place';
 // import onliveUser from './onlive/user';
 // import gensign from './onlive/gensign';
 // import room from './onlive/room';
-// import chat from './chat';
 import * as ustate from '@/store/common/state';
 import * as umutations from '@/store/common/mutations';
 
@@ -34,6 +34,7 @@ export default new Vuex.Store({
   modules: {
     dock,
     place,
+    chat,
     // login,
     // market,
     // marketproduct,
@@ -53,6 +54,6 @@ export default new Vuex.Store({
     // onliveUser,
     // room,
     // gensign,
-    // chat,
+    //chat,
   },
 });

src/store/chat.js → src/store/live/chat.js


+ 41 - 23
src/views/live/index.vue

@@ -7,10 +7,16 @@
         </el-col>
         <el-col :span="24" class="main">
           <!-- <liveList></liveList> -->
-          <el-tabs v-model="activeName" @tab-click="handleClick" stretch>
-            <el-tab-pane label="正在直播" name="first">正在直播</el-tab-pane>
-            <el-tab-pane label="下期预告" name="second">下期预告</el-tab-pane>
-            <el-tab-pane label="往期直播" name="third">往期直播</el-tab-pane>
+          <el-tabs v-model="activeName" stretch>
+            <el-tab-pane label="正在直播" name="first">
+              <liveList :list="listNow" :total="nowTotal" status="1" @query="searchList"></liveList>
+            </el-tab-pane>
+            <el-tab-pane label="下期预告" name="second">
+              <liveList :list="listPre" :total="nowTotal" status="0" @query="searchList"></liveList>
+            </el-tab-pane>
+            <el-tab-pane label="往期直播" name="third">
+              <liveList :list="listPast" :total="nowTotal" status="2" @query="searchList"></liveList>
+            </el-tab-pane>
           </el-tabs>
         </el-col>
         <el-col :span="24" class="foot">
@@ -26,14 +32,14 @@ import { mapState, mapMutations, createNamespacedHelpers } from 'vuex';
 import NavBar from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
 import liveList from './parts/liveList.vue';
-const jwt = require('jsonwebtoken');
+const { mapActions: dock } = createNamespacedHelpers('dock');
 export default {
   name: 'index',
   props: {},
   components: {
     NavBar,
     footInfo,
-    // liveList, //直播列表
+    liveList, //直播列表
   },
   data: function() {
     return {
@@ -43,31 +49,43 @@ export default {
       isleftarrow: '',
       // 返回
       navShow: true,
-      activeName: 'second',
+      activeName: 'first',
+      // 下期预告
+      listPre: [],
+      preTotal: 0,
+      // 正在直播
+      listNow: [],
+      nowTotal: 0,
+      // 往期直播
+      listPast: [],
+      pastTotal: 0,
     };
   },
-  created() {
-    if (this.token) {
-      this.sesstoken();
-    }
+  async created() {
+    await this.searchList({ status: '0' });
+    await this.searchList({ status: '1' });
+    await this.searchList({ status: '2' });
   },
   methods: {
-    ...mapMutations(['setUser']),
-    sesstoken() {
-      sessionStorage.setItem('token', this.token);
-      let user = jwt.decode(this.token);
-      console.log(user);
-      this.setUser(user);
-    },
-    handleClick(tab, event) {
-      console.log(tab, event);
+    ...dock({ dockQuery: 'query' }),
+    async searchList({ skip = 0, limit = 10, status, ...info } = {}) {
+      let res = await this.dockQuery({ is_allowed: 1, skip, status, ...info });
+      if (res.errcode === 0) {
+        if (status == '0') {
+          this.$set(this, `preTotal`, res.total);
+          this.$set(this, `listPre`, res.data);
+        } else if (status == '1') {
+          this.$set(this, `nowTotal`, res.total);
+          this.$set(this, `listNow`, res.data);
+        } else if (status == '2') {
+          this.$set(this, `pastTotal`, res.total);
+          this.$set(this, `listPast`, res.data);
+        }
+      }
     },
   },
   computed: {
     ...mapState(['user']),
-    token() {
-      return this.$route.query.token;
-    },
   },
   mounted() {
     this.title = this.$route.meta.title;

+ 6 - 3
src/views/live/parts/liveList.vue

@@ -31,11 +31,14 @@ const { mapActions: dock } = createNamespacedHelpers('dock');
 const { mapActions: place } = createNamespacedHelpers('place');
 export default {
   name: 'liveList',
-  props: {},
+  props: {
+    list: { type: Array },
+    status: { type: String, default: '0' },
+  },
   components: {},
   data: function() {
     return {
-      list: [],
+      // list: [],
     };
   },
   created() {
@@ -51,7 +54,7 @@ export default {
           val.province = await this.provinceSearch(val.province);
           val.places = await this.placeSearch(val.place);
         }
-        this.$set(this, `list`, res.data);
+        // this.$set(this, `list`, res.data);
       }
     },
     // 省份

+ 74 - 1
src/views/live/parts/videoDetail.vue

@@ -21,6 +21,34 @@
           </el-col> -->
           <chat></chat>
         </el-col>
+        <el-col :span="24" class="tab">
+          <el-tabs v-model="activeName" stretch type="border-card">
+            <el-tab-pane label="技术成果" name="first">
+              <el-col :span="24" class="two">
+                <el-col :span="24" class="twoList" v-for="(item, index) in demandList" :key="index">
+                  <el-col :span="24" class="name">{{ item.name }}</el-col>
+                  <el-col :span="24" class="field">所属领域:{{ item.field }}</el-col>
+                </el-col>
+              </el-col>
+            </el-tab-pane>
+            <el-tab-pane label="科技需求" name="second">
+              <el-col :span="24" class="two">
+                <el-col :span="24" class="twoList" v-for="(item, index) in twoList" :key="index">
+                  <el-col :span="24" class="name">{{ item.name }}</el-col>
+                  <el-col :span="24" class="field">所属领域:{{ item.field }}</el-col>
+                </el-col>
+              </el-col>
+            </el-tab-pane>
+            <el-tab-pane label="专家智库" name="third">
+              <el-col :span="24" class="two">
+                <el-col :span="24" class="twoList" v-for="(item, index) in twoList" :key="index">
+                  <el-col :span="24" class="name">{{ item.name }}</el-col>
+                  <el-col :span="24" class="field">所属领域:{{ item.field }}</el-col>
+                </el-col>
+              </el-col>
+            </el-tab-pane>
+          </el-tabs>
+        </el-col>
       </el-col>
     </el-row>
   </div>
@@ -30,6 +58,8 @@
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: dock } = createNamespacedHelpers('dock');
 import chat from '@/components/parts/chat.vue';
+// const { mapActions: expertsuser } = createNamespacedHelpers('expertsuser');
+
 export default {
   name: 'videoDetail',
   props: {},
@@ -40,6 +70,13 @@ export default {
     return {
       input: '',
       file_path: '',
+      activeName: 'first',
+      //科技需求
+      twoList: [],
+      //技术成果
+      demandList: [],
+      //专家智库
+      expertList: [],
     };
   },
   created() {
@@ -47,11 +84,28 @@ export default {
   },
   methods: {
     ...dock({ dockQuery: 'query', palcefetch: 'fetch' }),
-    async seachInfo() {
+    // ...expertsuser({ expertQuery: 'query' }),
+    async seachInfo({ skip = 0, limit = 5, ...info } = {}) {
       let res = await this.palcefetch(this.id);
+      console.log(res);
       if (this.$checkRes(res)) {
         this.$set(this, `file_path`, res.data.file_path);
       }
+      let czxm = res.data.apply.map(item => item.goodsList);
+      czxm = _.flattenDeep(czxm);
+      var czxmNew = czxm.filter(item => item.dockStatus == '1');
+      //科技需求
+      var jishuData = czxmNew.filter(item => item.type === '0');
+      this.$set(this, `twoList`, jishuData);
+      // console.log(jishuData);
+      //技术成果
+      var chanpinData = czxmNew.filter(item => item.type === '1');
+      if (chanpinData) this.$set(this, `demandList`, chanpinData);
+      // console.log(chanpinData);
+      // 专家智库
+      // let exportdata = await this.expertQuery({ role: 6, limit: 8 });
+      // if (this.$checkRes(exportdata)) this.$set(this, `expertList`, exportdata.data);
+      // console.log(this.expertList);
     },
     onSubmit() {
       console.log(this.input);
@@ -98,6 +152,25 @@ export default {
       }
     }
   }
+  .two {
+    .twoList {
+      padding: 5px 0px;
+      // font-size: 14px;
+      border-bottom: 1px dashed #ccc;
+      overflow: hidden;
+      white-space: nowrap;
+      text-overflow: ellipsis;
+      .name {
+        font-size: 18px;
+        font-weight: bolder;
+      }
+      .field {
+        margin-top: 8px;
+        font-size: 16px;
+        color: #666;
+      }
+    }
+  }
 }
 /deep/.video-js {
   height: 190px !important;