guhongwei 3 年之前
父节点
当前提交
976ea64b9f

+ 4 - 0
public/home.html

@@ -86,6 +86,9 @@
     <a class="list fn_1 moveUpDownFla1"  href="/platlive/twoweb/live/index">
       <p>直播大厅</p>
     </a>
+    <a class="list fn_1 moveUpDownFla1" href="/platlive/twoweb/channel/index">
+      <p>科技频道</p>
+    </a>
     <a class="list fn_2 moveUpDownFla2"  href="/platlive/twoweb/market/index">
       <p>科技超市</p>
     </a>
@@ -98,6 +101,7 @@
     <a class="list fn_5 moveUpDownFla2"  href="/platlive/twoweb/universal/index">
       <p>科学普及</p>
     </a>
+    
   </div>
   <!-- 浮窗 -->
   <div id="floatingDiv" style="position:absolute;left:50px;top:60px;z-index: 9999;">

+ 15 - 10
public/static/home/css/index.css

@@ -215,32 +215,37 @@ body {
 
 .center .list:nth-child(1) {
   position: relative;
-  left: 75px;
-  top: 60px;
+  left: -240px;
+  top: 150px;
 }
 
 .center .list:nth-child(2) {
   position: relative;
-  left: 80px;
-  top: 0;
+  left: -260px;
+  top: 50px;
 }
 
 .center .list:nth-child(3) {
   position: relative;
-  left: 85px;
-  top: 60px;
+  top: -50px;
+  left: -300px;
 }
 
 .center .list:nth-child(4) {
   position: relative;
-  left: -187px;
-  top: -145px;
+  left: 467px;
+  top: -340px;
 }
 
 .center .list:nth-child(5) {
   position: relative;
-  top: -145px;
-  left: 606px;
+  top: -240px;
+  left: 428px;
+}
+.center .list:nth-child(6) {
+  position: relative;
+  top: -140px;
+  left: 395px;
 }
 
 .center .list p {

+ 6 - 0
src/router/index.js

@@ -143,6 +143,12 @@ const twoweb = [
     meta: { title: '科学普及' },
     component: () => import('../views/twoweb/universal/list.vue'),
   },
+  // 2021-07-23
+  {
+    path: '/twoweb/channel/index',
+    meta: { title: '科技频道' },
+    component: () => import('../views/twoweb/channel/index.vue'),
+  },
 ];
 Vue.use(VueRouter);
 const live = [

+ 69 - 0
src/views/twoweb/channel/index.vue

@@ -0,0 +1,69 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main">
+        <div class="w_1200">
+          <el-col :span="24" class="one">
+            <el-collapse v-model="active">
+              <el-collapse-item title="科技频道" name="1" disabled>
+                <one-data></one-data>
+              </el-collapse-item>
+              <el-collapse-item title="培训问诊" name="2" disabled>
+                <two-data></two-data>
+              </el-collapse-item>
+            </el-collapse>
+          </el-col>
+        </div>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import oneData from './parts/list_1.vue';
+import twoData from './parts/list_2.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'index',
+  props: {},
+  components: {
+    oneData,
+    twoData,
+  },
+  data: function() {
+    return {
+      active: ['1', '2'],
+    };
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  min-height: 500px;
+  .one {
+    margin: 0 0 10px 0;
+  }
+}
+/deep/.el-collapse-item.is-disabled .el-collapse-item__header {
+  color: #000000;
+  font-size: 16px;
+  font-weight: bold;
+  padding: 0 10px;
+}
+</style>

+ 153 - 0
src/views/twoweb/channel/parts/list_1.vue

@@ -0,0 +1,153 @@
+<template>
+  <div id="list_1">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="8" class="list" v-for="(item, index) in list" :key="index">
+          <el-col :span="24" class="image">
+            <el-image :src="imgUrl"></el-image>
+          </el-col>
+          <el-col :span="24" class="info">
+            <el-col :span="24" class="title textOver">
+              <span>[{{ item.room_id }}]</span>
+              <span>{{ item.title }}</span>
+            </el-col>
+            <el-col :span="24" class="other">
+              <el-col :span="12" class="textOver">信息来源:{{ item.origin }} </el-col>
+              <el-col :span="12" class="textOver">更新时间:{{ item.create_time }} </el-col>
+            </el-col>
+            <el-col :span="24" class="btn">
+              <el-button type="warning" size="mini" @click="toAdmin(item.room_id)">管理进入</el-button>
+              <el-button type="primary" size="mini" @click="inChannel(item)">进入频道</el-button>
+            </el-col>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+    <el-dialog title="登陆" width="40%" :visible.sync="adminDialog" @closed="handleClose" :destroy-on-close="true">
+      <data-form :data="loginForm" :fields="loginFields" :rules="rules" @save="toSave" submitText="登陆"> </data-form>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: channel } = createNamespacedHelpers('channel');
+const { mapActions: code } = createNamespacedHelpers('code');
+export default {
+  name: 'list_1',
+  props: {},
+  components: {},
+  data: function() {
+    return {
+      adminDialog: false,
+      imgUrl: require('@common/src/assets/kjzx.jpg'),
+      list: [],
+      loginForm: {},
+      loginFields: [
+        { label: '房间号', model: 'room_id', type: 'text' },
+        { label: '登录密码', model: 'passwd', required: true, type: 'password' },
+      ],
+      rules: {
+        room_id: [{ required: true, trigger: 'blur', message: '请填写房间号' }],
+        passwd: [{ required: true, trigger: 'blur', message: '请填写密码' }],
+      },
+    };
+  },
+  async created() {
+    await this.search();
+  },
+  methods: {
+    ...code({ codeQuery: 'query' }),
+    ...channel(['query', 'login']),
+    async search() {
+      let res = await this.query();
+      if (this.$checkRes(res)) {
+        for (const val of res.data) this.searchOther(val);
+      }
+      this.$set(this, `list`, res.data);
+    },
+    async searchOther(val) {
+      let res = await this.codeQuery({ category: '04' });
+      if (this.$checkRes(res)) {
+        val.type = res.data.find(i => i.id == val.type).name;
+        return;
+      }
+    },
+    toAdmin(room_id) {
+      if (_.isEqual(_.get(this.user, 'room_id'), room_id)) this.$router.push({ path: '/admin/live/science' });
+      this.adminDialog = true;
+      this.loginForm.room_id = room_id;
+    },
+    handleClose() {
+      this.loginForm = {};
+      this.adminDialog = false;
+    },
+    async toSave() {
+      const res = await this.login(_.cloneDeep(this.loginForm));
+      if (res.errcode != '0') {
+        this.$message.error(res.errmsg);
+      } else {
+        this.$router.push({ path: '/admin/live/science' });
+      }
+    },
+    // 进入频道
+    inChannel(data) {
+      this.$router.push({ path: '/twoweb/channelLive/index', query: { id: data.id } });
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .list {
+    width: 390px;
+    border: 1px solid #ccc;
+    margin: 0 15px 10px 0;
+    border-radius: 10px;
+    .image {
+      height: 260px;
+      .el-image {
+        height: 260px;
+        border-top-left-radius: 10px;
+        border-top-right-radius: 10px;
+      }
+    }
+    .info {
+      padding: 5px 10px 10px 10px;
+      .title {
+        font-size: 16px;
+        font-weight: bold;
+        padding: 0 0 5px 0;
+        span:nth-child(1) {
+          color: #ff0000;
+        }
+      }
+      .other {
+        font-size: 14px;
+        padding: 0 0 5px 0;
+      }
+      .btn {
+        text-align: center;
+      }
+    }
+  }
+  .list:nth-child(3n) {
+    margin: 0 0 10px 0;
+  }
+}
+</style>

+ 191 - 0
src/views/twoweb/channel/parts/list_2.vue

@@ -0,0 +1,191 @@
+<template>
+  <div id="list_2">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="8" class="list" v-for="(item, index) in list" :key="index">
+          <el-col :span="24" class="image">
+            <el-image :src="imgUrl"></el-image>
+          </el-col>
+          <el-col :span="24" class="info">
+            <el-col :span="24" class="title textOver">
+              <span>[{{ item.room_id }}]</span>
+              <span>{{ item.title }}</span>
+            </el-col>
+            <el-col :span="24" class="other">
+              <el-col :span="12" class="textOver"><i class="el-icon-location-outline"></i>{{ item.province }}-{{ item.place }} </el-col>
+              <el-col :span="12" class="textOver"><i class="el-icon-time"></i>{{ item.start_date }} </el-col>
+            </el-col>
+            <el-col :span="24" class="btn">
+              <el-button type="warning" size="mini" @click="toAdmin(item.room_id)">管理进入</el-button>
+              <el-button type="primary" size="mini" @click="inChannel(item)">进入频道</el-button>
+              <!-- <el-button type="primary" size="mini" @click="logout">退出登录</el-button> -->
+            </el-col>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+    <el-dialog title="登陆" width="40%" :visible.sync="adminDialog" @closed="handleClose" :destroy-on-close="true">
+      <data-form :data="loginForm" :fields="loginFields" :rules="rules" @save="toSave" submitText="登陆"> </data-form>
+    </el-dialog>
+    <el-dialog title="用户登录" width="30%" :visible.sync="userDialog" @closed="handleClose" :destroy-on-close="true">
+      <data-form :data="userForm" :fields="userFields" :rules="{}" @save="userToSave"> </data-form>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+import dataForm from '@common/src/components/frame/form.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: mapTrainLive } = createNamespacedHelpers('trainLive');
+const { mapActions: place } = createNamespacedHelpers('place');
+export default {
+  name: 'list_2',
+  props: {},
+  components: {},
+  data: function() {
+    return {
+      adminDialog: false,
+      imgUrl: require('@common/src/assets/train.jpg'),
+      list: [],
+      loginForm: {},
+      loginFields: [
+        { label: '房间号', model: 'room_id', type: 'text' },
+        { label: '登录密码', model: 'password', required: true, type: 'password' },
+      ],
+      rules: {
+        room_id: [{ required: true, trigger: 'blur', message: '请填写房间号' }],
+        password: [{ required: true, trigger: 'blur', message: '请填写密码' }],
+      },
+      // 用户登录
+      userDialog: false,
+      userForm: {},
+      userFields: [
+        { label: '账号', model: 'user_phone' },
+        { label: '密码', model: 'user_password', required: true, type: 'password' },
+      ],
+    };
+  },
+  async created() {
+    await this.search();
+  },
+  methods: {
+    ...mapTrainLive(['query', 'login', 'userLogin', 'userLogout']),
+    ...place({ queryName: 'queryName' }),
+    // 查询列表
+    async search() {
+      let res = await this.query();
+      if (this.$checkRes(res)) {
+        for (const val of res.data) this.searchPlace(val);
+        this.$set(this, `list`, res.data);
+      }
+    },
+    // 查询省市
+    async searchPlace(data) {
+      let nameData = { code: [data.province, data.place] };
+      let res = await this.queryName(nameData);
+      if (this.$checkRes(res)) {
+        data.province = res.data.find(i => i.code == data.province).name;
+        data.place = res.data.find(i => i.code == data.place).name;
+        return data;
+      }
+    },
+    // 管理进入
+    toAdmin(room_id) {
+      if (_.isEqual(_.get(this.user, 'room_id'), room_id)) this.$router.push({ path: '/admin/live/train' });
+      this.adminDialog = true;
+      this.loginForm.room_id = room_id;
+    },
+    async toSave() {
+      const res = await this.login(_.cloneDeep(this.loginForm));
+      if (res.errcode != '0') {
+        this.$message.error(res.errmsg);
+      } else {
+        this.$router.push({ path: '/admin/live/train' });
+      }
+    },
+    // 进入频道
+    inChannel(data) {
+      this.$set(this.userForm, `id`, data.id);
+      let user = this.user;
+      this.userDialog = true;
+      // if (user & user._id) {
+      //   this.$router.push({ path: '/trainLive/index', query: { id: data.id } });
+      // } else {
+      //   this.userDialog = true;
+      // }
+    },
+    // 用户登录提交
+    async userToSave({ data }) {
+      let res = await this.userLogin(data);
+      if (this.$checkRes(res)) {
+        this.$router.push({ path: '/twoweb/trainLive/index', query: { id: data.id } });
+      }
+    },
+    // 退出登录
+    async logout() {
+      let res = await this.userLogout('60054402531a84863c5b8622');
+    },
+    // 取消
+    handleClose() {
+      this.loginForm = {};
+      this.adminDialog = false;
+      this.userForm = {};
+      this.userDialog = false;
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .list {
+    width: 379px;
+    border: 1px solid #ccc;
+    margin: 0 15px 10px 0;
+    border-radius: 10px;
+    .image {
+      height: 260px;
+      .el-image {
+        height: 260px;
+        border-top-left-radius: 10px;
+        border-top-right-radius: 10px;
+      }
+    }
+    .info {
+      padding: 5px 10px 10px 10px;
+      .title {
+        font-size: 16px;
+        font-weight: bold;
+        padding: 0 0 5px 0;
+        span:nth-child(1) {
+          color: #ff0000;
+        }
+      }
+      .other {
+        font-size: 14px;
+        padding: 0 0 5px 0;
+      }
+      .btn {
+        text-align: center;
+      }
+    }
+  }
+  .list:nth-child(3n) {
+    margin: 0 0 10px 0;
+  }
+}
+</style>

+ 1 - 1
src/views/twoweb/channelLive/index.vue

@@ -8,7 +8,7 @@
           </el-col>
           <el-col :span="24" class="info">
             <el-col :span="24" class="one">
-              <el-button type="primary" size="mini" @click="$router.push({ path: '/twoweb/live/index' })">返回</el-button>
+              <el-button type="primary" size="mini" @click="$router.push({ path: '/twoweb/channel/index' })">返回</el-button>
             </el-col>
             <el-col :span="24" class="two">
               <el-col :span="24" class="title">

+ 3 - 3
src/views/twoweb/live/index.vue

@@ -10,12 +10,12 @@
             <el-tab-pane label="人才对接在线">
               <personalLive></personalLive>
             </el-tab-pane>
-            <el-tab-pane label="培训问诊在线">
+            <!-- <el-tab-pane label="培训问诊在线">
               <trainLive></trainLive>
             </el-tab-pane>
             <el-tab-pane label="科技频道在线">
               <scienceLive></scienceLive>
-            </el-tab-pane>
+            </el-tab-pane> -->
           </el-tabs>
         </div>
       </el-col>
@@ -35,7 +35,7 @@ export default {
   },
   name: 'index',
   props: {},
-  components: { achieveLive, personalLive, trainLive, scienceLive },
+  components: { achieveLive, personalLive },
   data: function() {
     return {};
   },