liuyu 5 年之前
父节点
当前提交
5522dd5d76
共有 3 个文件被更改,包括 98 次插入34 次删除
  1. 7 0
      src/store/onlive/room.js
  2. 57 27
      src/views/live/roomDetail.vue
  3. 34 7
      src/views/registered.vue

+ 7 - 0
src/store/onlive/room.js

@@ -6,6 +6,7 @@ Vue.use(Vuex);
 const api = {
   roomInfo: `/api/onlive/room`,
   lookuserInfo: `/api/onlive/lookuser`,
+  lookusercount: `/api/onlive/lookuser/roomcount`,
 };
 const state = () => ({});
 const mutations = {};
@@ -28,6 +29,12 @@ const actions = {
     const res = await this.$axios.$post(`${api.lookuserInfo}`, payload);
     return res;
   },
+  async lookusercount({ commit }, { ...info } = {}) {
+    const res = await this.$axios.$get(`${api.lookusercount}`, {
+      ...info,
+    });
+    return res;
+  },
   // 名字查详情
   async roomfetch({ commit }, payload) {
     const res = await this.$axios.$get(`${api.roomInfo}/roomname`, payload);

+ 57 - 27
src/views/live/roomDetail.vue

@@ -2,6 +2,9 @@
   <div id="roomsDetail">
     <el-row>
       <el-col :span="24" class="info">
+        <el-col :span="24" class="title">
+          <span>{{ roomInfos.title }}</span>
+        </el-col>
         <el-col :span="24" class="video">
           <el-col :span="15" class="videoLeft">
             <div id="look-video-left" class="video-box col-div" style="justify-content: flex-end"></div>
@@ -10,17 +13,16 @@
             <div id="look-video-right" class="video-box col-div" style="justify-content: flex-end"></div>
           </el-col>
         </el-col>
+        <el-col :span="24" class="num">
+          <span>观看:{{ total }}</span>
+        </el-col>
         <el-col :span="24" class="chat">
-          <el-col :span="24" class="chatList">
-            聊天列表
-          </el-col>
-          <el-col :span="24" class="chatInput">
-            <el-col :span="19" class="input">
-              <el-input v-model="input"></el-input>
-            </el-col>
-            <el-col :span="5" class="btn">
-              <el-button type="primary" size="mini" @click="onSubmit">发送</el-button>
-            </el-col>
+          <el-col :span="24">
+            <van-swipe :autoplay="3000">
+              <van-swipe-item v-for="(advert, index) in roomInfos.adverts" :key="index">
+                <img width="100%" height="100%" v-lazy="advert.imgdir" />
+              </van-swipe-item>
+            </van-swipe>
           </el-col>
         </el-col>
       </el-col>
@@ -31,6 +33,13 @@
 <script>
 import TRTC from 'trtc-js-sdk';
 import { mapState, createNamespacedHelpers } from 'vuex';
+import Vue from 'vue';
+import { Swipe, SwipeItem, Lazyload } from 'vant';
+import { Image as VanImage } from 'vant';
+Vue.use(Swipe);
+Vue.use(SwipeItem);
+Vue.use(VanImage);
+Vue.use(Lazyload);
 const { mapActions: gensign } = createNamespacedHelpers('gensign');
 const { mapActions: room } = createNamespacedHelpers('room');
 export default {
@@ -43,15 +52,19 @@ export default {
       localStream_: null,
       sdkAppId_: '1400380125',
       userId_: '',
+      roomInfos: {},
+      sendmemo: '',
+      total: 0,
     };
   },
   created() {
     this.initclient();
     this.lookuserSearch();
+    this.lookusercountsel();
   },
   methods: {
     ...gensign(['gensignFetch']),
-    ...room(['lookuserFetch']),
+    ...room(['lookuserFetch', 'fetch', 'lookusercount']),
     async lookuserSearch() {
       let data = {};
       data.roomid = this.id;
@@ -59,10 +72,23 @@ export default {
       data.userid = this.user.userid;
       data.username = this.user.name;
       const res = await this.lookuserFetch(data);
-      console.log(res);
+      // 根据房间id查询房间详细信息
+      let result = await this.fetch(this.id);
+      if (this.$checkRes(result)) {
+        console.log(result.data);
+        this.$set(this, `roomInfos`, result.data);
+      }
+    },
+    async lookusercountsel() {
+      // 根据房间id查询房间详细信息
+      let result = await this.lookusercount({ roomname: this.roomname });
+      if (this.$checkRes(result)) {
+        console.log(result.total);
+        this.$set(this, `total`, result.total);
+      }
     },
     onSubmit() {
-      console.log(this.input);
+      console.log(this.sendmemo);
     },
     async initclient() {
       this.userId_ = this.user.uid;
@@ -119,8 +145,14 @@ export default {
 
 <style lang="less" scoped>
 .info {
+  .title {
+    text-align: center;
+    padding: 10px 0;
+    font-size: 16px;
+    font-weight: bold;
+  }
   .video {
-    background: #fff;
+    background: #000;
     margin: 0 0 10px 0;
     .videoLeft {
       height: 200px;
@@ -129,24 +161,22 @@ export default {
       height: 200px;
     }
   }
+  .num {
+    padding: 10px 0;
+    font-size: 16px;
+  }
   .chat {
     background: #fff;
     padding: 10px;
-    .chatList {
-      border: 1px solid #ccc;
-      min-height: 300px;
-      margin: 0 0 10px 0;
-      border-radius: 10px;
-      padding: 5px 10px;
-    }
-    .chatInput {
-      .el-button {
-        width: 100%;
-        padding: 13px 0;
-      }
-    }
   }
 }
+.my-swipe .van-swipe-item {
+  color: #fff;
+  font-size: 20px;
+  line-height: 150px;
+  text-align: center;
+  background-color: #39a9ed;
+}
 /deep/.video-js {
   height: 190px !important;
   border-radius: 10px;

+ 34 - 7
src/views/registered.vue

@@ -3,13 +3,40 @@
     <van-row>
       <van-col class="title" :span="24">请填写以下注册信息</van-col>
       <van-form @submit="onSubmit" v-model="form" :show-error-message="false">
-        <van-field required v-model="form.name" name="name" placeholder="请填写用户名" :rules="[{ required: true, message: '请填写用户名' }]" />
-        <van-field required v-model="form.phone" name="phone" placeholder="请填写手机号" :rules="[{ required: true, message: '请填写手机号' }]" />
-        <van-field v-model="form.hosname" name="hosname" placeholder="请填写医院名称" />
-        <van-field v-model="form.deptname" name="deptname" placeholder="请填写机构名称" />
-        <van-field v-model="form.level" name="level" placeholder="请填写职务" />
-        <van-field v-model="form.title" name="title" placeholder="请填写个人简介" type="textarea" rows="2" autosize maxlength="500" show-word-limit />
-        <van-field v-model="form.remark" name="remark" placeholder="请填写备注" type="textarea" rows="2" autosize maxlength="500" show-word-limit />
+        <van-field required v-model="form.name" name="name" label="用户名" placeholder="请填写用户名" :rules="[{ required: true, message: '请填写用户名' }]" />
+        <van-field
+          required
+          v-model="form.phone"
+          name="phone"
+          label="手机号"
+          placeholder="请填写手机号"
+          :rules="[{ required: true, message: '请填写手机号' }]"
+        />
+        <van-field v-model="form.hosname" name="hosname" label="医院" placeholder="请填写医院名称" />
+        <van-field v-model="form.deptname" name="deptname" label="科室" placeholder="请填写机构名称" />
+        <van-field v-model="form.level" name="level" label="职务" placeholder="请填写职务" />
+        <van-field
+          v-model="form.title"
+          name="title"
+          label="简介"
+          placeholder="请填写个人简介"
+          type="textarea"
+          rows="2"
+          autosize
+          maxlength="500"
+          show-word-limit
+        />
+        <van-field
+          v-model="form.remark"
+          name="remark"
+          label="备注"
+          placeholder="请填写备注"
+          type="textarea"
+          rows="2"
+          autosize
+          maxlength="500"
+          show-word-limit
+        />
         <div style="margin: 16px;">
           <van-button round block type="info" native-type="submit">
             注册