123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922 |
- <template>
- <div id="roomsDetail">
- <el-row>
- <el-col :span="24" class="video" :style="{ height: oheight }"> </el-col>
- </el-row>
- <van-overlay :show="show" :style="{ height: oheight, width: '100%' }">
- <div id="transformid" class="wrapper" :style="{ transform: transform, height: vheight, width: vwidth, padding: vpadding, position: 'absolute' }">
- <div :style="{ height: lheight, width: lwidth }" id="look-video-left" class="video-box col-div look-video-left"></div>
- <div id="look-video-right" :style="{ height: rheight, width: rwidth }" class="video-box col-div look-video-right"></div>
- </div>
- <div id="othediv" v-show="othedivshow" :style="{ transform: transform, height: otheheight, width: vwidth, padding: othepadding, position: 'absolute' }">
- <div id="otheplaydiv" :style="{ height: otheheight, width: vwidth, background: background_ }">
- <div id="othe-video-1" :style="{ height: otheheight, width: othewidth }" class="video-box col-div othe-video-left"></div>
- <div id="othe-video-2" :style="{ height: otheheight, width: othewidth }" class="video-box col-div othe-video-left"></div>
- <div id="othe-video-3" :style="{ height: otheheight, width: othewidth }" class="video-box col-div othe-video-left"></div>
- <div id="othe-video-4" :style="{ height: otheheight, width: othewidth }" class="video-box col-div othe-video-left"></div>
- <div id="othe-video-5" :style="{ height: otheheight, width: othewidth }" class="video-box col-div othe-video-left"></div>
- </div>
- </div>
- <div class="videoBtn" id="videobtnid" :style="{ top: btop, right: bright }">
- <el-button type="warning" round @click="full()" size="mini"><i class="el-icon-rank"></i></el-button>
- </div>
- </van-overlay>
- <el-row class="chatrow">
- <el-col :span="24" class="info">
- <el-col :span="12" class="num">
- <span>观看:{{ total }}</span>
- </el-col>
- <el-col :span="12" class="meetBtn">
- <el-button v-show="switchbtn" type="warning" round size="small" @click="roomMeetBtn()">小程序<i class="el-icon-camera el-icon--right"></i></el-button>
- </el-col>
- </el-col>
- </el-row>
- <van-tabs type="card" @click="tabsClick">
- <van-tab title="会议简介">
- <van-col :span="24">
- <van-col class="content">{{ roomInfos.content }}</van-col>
- </van-col>
- <van-col :span="24">
- <van-swipe :autoplay="3000">
- <van-swipe-item v-for="(advert, index) in roomInfos.adverts" :key="index">
- <img width="100%" height="100px" v-lazy="advert.imgdir" @click="imgclick(advert.imgurl)" />
- </van-swipe-item>
- </van-swipe>
- </van-col>
- </van-tab>
- <van-tab title="互动留言">
- <el-row>
- <el-col :span="24" class="info">
- <el-col :span="24" class="chat">
- <el-col :span="24" class="chatInfo" id="chatSell">
- <el-col :span="24" class="list" v-for="(item, index) in dataList" :key="index">
- <p>
- <span :class="item.sendname == user.name ? 'selfColor' : ''">{{ item.sendname }}:</span>
- <span>{{ item.content }}</span>
- </p>
- </el-col>
- </el-col>
- </el-col>
- <el-col :span="24" class="submit">
- <el-col :span="19" class="input">
- <el-input type="textarea" maxlength="5000" show-word-limit v-model="content"></el-input>
- </el-col>
- <el-col :span="5" class="btn">
- <el-button type="primary" size="mini" @click="chatCreate">发送</el-button>
- </el-col>
- </el-col>
- </el-col>
- </el-row>
- </van-tab>
- <van-tab title="参与成员">
- <van-col :span="24" class="userList">
- <van-grid :column-num="3">
- <van-grid-item v-for="(item, index) in userList" :key="index" icon="manager" :text="item.username" />
- </van-grid>
- </van-col>
- </van-tab>
- <van-tab title="申请评分">
- <van-col :span="24">
- <van-field v-model="isxf" name="isxf" left-icon="star-o" label="学分" type="number" placeholder="请填写需要授予学分" />
- </van-col>
- <van-col :span="24" style="text-align:center">
- <van-button icon="star-o" type="primary" @click="sqClick">
- 申请
- </van-button>
- </van-col>
- </van-tab>
- </van-tabs>
- <van-popup v-model="showQuest" position="bottom">
- <van-col :span="24" class="questtitle">
- <span>{{ questInfo.name }}</span>
- </van-col>
- <van-col class="questpopup" :span="24" v-for="(item, index) in questInfo.question" :key="index">
- <p style="margin:5px 0;">
- {{ index + 1 }}({{ item.type == '0' ? '单选' : item.type == '1' ? '多选' : item.type == '2' ? '问答' : '未识别' }})、{{ item.topic }}
- </p>
- <span v-if="item.type == '0'">
- <van-radio-group v-model="item.answer">
- <van-radio v-for="(i, ri) in item.option" :key="`${index}-${ri}`" :name="i.opname">{{ i.opname }}</van-radio>
- </van-radio-group>
- </span>
- <span v-if="item.type == '1'">
- <van-checkbox-group v-model="item.answer">
- <van-checkbox shape="square" v-for="(i, ci) in item.option" :key="`${index}-${ci}`" :name="i.opname">{{ i.opname }}</van-checkbox>
- </van-checkbox-group>
- </span>
- <span v-if="item.type == '2'">
- <van-field v-model="item.answer" type="textarea" rows="2" autosize placeholder="请输入" maxlength="200" show-word-limit />
- </span>
- </van-col>
- <van-col :span="24" class="questbtn">
- <van-button color="linear-gradient(to right, #4bb0ff, #6149f6)" @click="submitQuest">提交</van-button>
- </van-col>
- </van-popup>
- </div>
- </template>
- <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';
- import wx from 'weixin-js-sdk';
- Vue.use(Swipe);
- Vue.use(SwipeItem);
- Vue.use(VanImage);
- Vue.use(Lazyload);
- const { mapActions: uploadquestion } = createNamespacedHelpers('uploadquestion');
- const { mapActions: gensign } = createNamespacedHelpers('gensign');
- const { mapActions: room } = createNamespacedHelpers('room');
- const { mapActions: quest } = createNamespacedHelpers('quest');
- const { mapActions: chat } = createNamespacedHelpers('chat');
- export default {
- name: 'roomsDetail',
- props: {},
- components: {},
- data: function() {
- return {
- client_: null,
- localStream_: null,
- sdkAppId_: '1400380125',
- userId_: '',
- roomInfos: {},
- sendmemo: '',
- total: 0,
- transform: 'rotate(0)',
- oheight: '200px',
- vwidth: '100%',
- vheight: '200px',
- rheight: '200px',
- rwidth: '30%',
- lheight: '200px',
- lwidth: '70%',
- show: true,
- vpadding: '0',
- othepadding: '200px 0px 0px 0px',
- othetop: '200px',
- btop: '167px',
- bright: '10px',
- isscreen: false,
- content: '',
- dataList: [],
- lvideoid_: '',
- rvideoid_: '',
- userList: [],
- isxf: '',
- showQuest: false,
- queid: '',
- questInfo: {},
- switchbtn: false,
- switchmeetbtn: false,
- iscamera: false,
- otheheight: '10px',
- othewidth: '20%',
- bcolor: '#000',
- index_: 0,
- userindex_: 1,
- background_: '#000',
- swichusers: [],
- sbuser: '',
- othedivshow: false,
- };
- },
- created() {
- this.initclient();
- this.lookuserSearch();
- this.lookusercountsel();
- this.chatSearch();
- this.userswichrole();
- },
- mounted() {
- this.channel();
- },
- destroyed() {
- const that = this;
- window.addEventListener('pagehide', function() {
- console.log('页面要关闭了');
- that.recordSave();
- });
- },
- methods: {
- ...gensign(['gensignFetch']),
- ...room(['lookuserFetch', 'fetch', 'lookusercount', 'lookquery', 'lookupdate', 'lookrecord', 'lookuserswichrole']),
- ...chat(['query', 'create']),
- ...quest(['questfetch']),
- ...uploadquestion({ upcreate: 'create', upquery: 'query' }),
- zbfullbtn() {
- const width = document.documentElement.clientWidth;
- const lvr_ = document.getElementById('look-video-right');
- let style = 'width:' + width + 'px;';
- style += 'height:200px;';
- style += 'position:absolute;top:0;left:0;';
- style += 'z-index:1;';
- lvr_.style.cssText = style;
- },
- zbfpbtn() {
- const width = document.documentElement.clientWidth;
- const lvr_ = document.getElementById('look-video-right');
- let stylel = 'width:30%;';
- stylel += 'height:200px;';
- lvr_.style.cssText = style;
- const lvl_ = document.getElementById('look-video-left');
- let stylell = 'width:70%;';
- stylell += 'height:200px;';
- lvl_.style.cssText = stylell;
- },
- swichposition(objid) {
- console.log('in swichposition---' + objid);
- if (objid) {
- console.log(this.swichusers);
- const width = document.documentElement.clientWidth;
- for (const elm of this.swichusers) {
- if (elm.swichuserid === objid) {
- const id_ = 'othe-video-' + elm.swichindex;
- const thr_ = document.getElementById(id_);
- let style = 'width:70%;';
- style += 'height:200px;';
- style += 'position:absolute;top:0;left:0;';
- style += 'z-index:1;';
- thr_.style.cssText = style;
- } else {
- const id_ = 'othe-video-' + elm.swichindex;
- const thr_ = document.getElementById(id_);
- const left_ = (width / 5) * (elm.swichindex - 1);
- let style = 'width:20%;';
- style += 'height:70px;';
- style += 'position:absolute;top:200;';
- style = 'left:' + left_ + 'px;';
- thr_.style.cssText = style;
- }
- }
- } else {
- console.log('share--' + this.othedivshow);
- if (this.othedivshow) {
- for (const i = 1; i < 6; i++) {
- const id_ = 'othe-video-' + i;
- const thr_ = document.getElementById(id_);
- const left_ = (width / 5) * (i - 1);
- let style = 'width:20%;';
- style += 'height:70px;';
- style += 'background: blue;';
- style += 'position:absolute;top:200px;';
- style = 'left:' + left_ + 'px;';
- thr_.style.cssText = style;
- }
- }
- console.log('share设置大小--');
- const lvl_ = document.getElementById('look-video-left');
- let stylell = 'width:70%;';
- stylell += 'height:200px;';
- lvl_.style.cssText = stylell;
- }
- const lvr_ = document.getElementById('look-video-right');
- let stylel = 'width:30%;';
- stylel += 'height:200px;';
- lvr_.style.cssText = stylel;
- },
- async recordSave() {
- console.log(2121);
- let data = {};
- data.type = '1';
- data.roomid = this.id;
- data.roomname = this.roomname;
- data.userid = this.user.uid;
- data.username = this.user.name;
- const res = await this.lookrecord(data);
- },
- async sqClick() {
- let data = {};
- data.roomid = this.id;
- data.isxf = this.isxf;
- data.userid = this.user.uid;
- const res = await this.lookupdate(data);
- if (this.$checkRes(res)) {
- console.log(res.data);
- this.$message({
- message: '操作成功',
- type: 'success',
- });
- }
- },
- async tabsClick(name, title) {
- if (title === '参与成员') {
- this.lookuserQuery();
- }
- },
- async lookuserQuery({ skip = 0, limit = 1000 } = {}) {
- const info = { roomid: this.id };
- let res = await this.lookquery({ skip, limit, ...info });
- this.$set(this, `userList`, res.data);
- },
- async chatSearch({ skip = 0, limit = 1000 } = {}) {
- const info = { roomid: this.id };
- let res = await this.query({ skip, limit, ...info });
- this.$set(this, `dataList`, res.data);
- },
- async chatCreate() {
- let data = {};
- data.roomid = this.id;
- data.type = '0';
- data.content = this.content;
- data.sendid = this.user.uid;
- data.sendname = this.user.name;
- const res = await this.create(data);
- if (this.$checkRes(res)) {
- //this.$message('发送成功');
- this.content = '';
- }
- },
- channel() {
- console.log('in function:');
- console.log(`/exchange/switch_shmai_` + this.id);
- this.$stomp({
- [`/exchange/public_chat_` + this.id]: this.onMessage,
- });
- this.$stomp({
- [`/exchange/switch_role_` + this.user.uid]: this.onSwichMessage,
- });
- this.$stomp({
- [`/exchange/switch_shmai_` + this.id]: this.onSwichShmaiMessage,
- });
- this.$stomp({
- [`/exchange/quest_publish_` + this.id]: this.onQueMessage,
- });
- // this.$stomp({
- // [`/exchange/othe_publish_` + this.id]: this.onOtheMessage,
- // });
- },
- onMessage(message) {
- // console.log('receive a message: ', message.body);
- let body = _.get(message, 'body');
- if (body) {
- body = JSON.parse(body);
- this.dataList.push(body);
- this.content = '';
- }
- this.$nextTick(() => {
- document.getElementById('chatSell').scrollTop = document.getElementById('chatSell').scrollHeight + 275;
- });
- },
- onQueMessage(message) {
- // console.log('receive a message: ', message.body);
- this.showQuest = true;
- let body = _.get(message, 'body');
- if (body) {
- body = JSON.parse(body);
- this.queid = body.queid;
- this.questSearch();
- }
- },
- onSwichMessage(message) {
- // console.log('receive a message: ', message.body);
- let body = _.get(message, 'body');
- if (body) {
- body = JSON.parse(body);
- if (body.switchrole === 'anchor' && body.userid === this.user.uid) {
- this.switchbtn = true;
- this.switchmeetbtn = true;
- this.roomMeetSwich();
- } else {
- this.switchbtn = false;
- this.switchmeetbtn = false;
- }
- if (body.switchrole !== 'anchor' && body.userid === this.user.uid) {
- const videoTrack = this.localStream_.getVideoTrack();
- if (videoTrack) {
- this.localStream_.removeTrack(videoTrack).then(() => {
- console.log('remove video call success');
- // 关闭摄像头
- videoTrack.stop();
- // this.client_.unpublish(this.localStream_).then(() => {
- // // 取消发布本地流成功
- // });
- });
- }
- }
- }
- },
- onSwichShmaiMessage(message) {
- let body = _.get(message, 'body');
- console.log(body);
- console.log(this.user.uid);
- if (body) {
- body = JSON.parse(body);
- this.swichposition(body.shmaiid);
- }
- },
- onOtheMessage(message) {
- let body = _.get(message, 'body');
- if (body) {
- body = JSON.parse(body);
- if (body.otheid) {
- this.switchbtn = true;
- this.roomMeetBtn();
- } else {
- this.switchbtn = false;
- }
- }
- },
- async userswichrole() {
- // 根据房间id查询房间详细信息
- let result = await this.lookuserswichrole({ roomid: this.id, userid: this.user.uid });
- if (this.$checkRes(result)) {
- if (result.data && result.data.switchrole === 'anchor') {
- this.switchbtn = true;
- }
- }
- },
- roomMeetBtn() {
- const url = '/pages/meeting/meeting?uid=' + this.user.uid + '&username=' + this.user.name + '&rid=' + this.id + '&roomname=' + this.roomname;
- console.log(url);
- wx.miniProgram.navigateTo({ url });
- },
- async roomMeetSwich() {
- this.othedivshow = true;
- this.oheight = '270px';
- this.otheheight = '70px';
- this.iscamera = true;
- const _userid = 'meetu-' + this.userId_;
- this.localStream_ = await TRTC.createStream({
- audio: true,
- video: true,
- // cameraId: this.cameraId,
- // microphoneId: this.microphoneId,
- userId: _userid,
- });
- this.localStream_.setVideoProfile('480p');
- await this.localStream_.initialize();
- console.log('initialize local stream success');
- // publish the local stream
- await this.client_.publish(this.localStream_);
- this.index_ = this.index_ + 1;
- if (this.index_ < 6) {
- // const otheplaydiv = document.getElementById('otheplaydiv');
- const id_ = 'othe-video-' + this.index_;
- // const newdiv = '<div id="' + id_ + '" style="height: 70px, width: 20%" class="video-box col-div othe-video-left"></div>';
- // otheplaydiv.appendChild(newdiv);
- const newdata = { swichuserid: this.userId_, swichindex: this.index_ };
- this.swichusers.push(newdata);
- console.log('将用户push到列表里' + this.swichusers);
- this.localStream_.play(id_);
- }
- },
- async questSearch() {
- if (this.queid) {
- const result = await this.questfetch(this.queid);
- if (this.$checkRes(result)) {
- console.log(result.data);
- this.$set(this, `questInfo`, result.data);
- }
- }
- },
- async submitQuest() {
- let form = { roomid: this.id, userid: this.user.uid, questionnaireid: this.queid };
- let answers = [];
- for (const question of this.questInfo.question) {
- answers.push({ questionid: question._id, answer: JSON.stringify(question.answer) });
- }
- form.answers = answers;
- console.log(form);
- let res = await this.upcreate(form);
- if (res.errcode == '0') {
- this.showQuest = false;
- }
- },
- async lookuserSearch() {
- if (this.user.uid) {
- let data = {};
- data.roomid = this.id;
- data.roomname = this.roomname;
- data.userid = this.user.uid;
- data.username = this.user.name;
- const res = await this.lookuserFetch(data);
- }
- // 根据房间id查询房间详细信息
- let result = await this.fetch(this.id);
- if (this.$checkRes(result)) {
- console.log(result.data);
- this.$set(this, `roomInfos`, result.data);
- // 根据房间信息判断是否回答问卷
- if (result.data.isque === '1') {
- const info = { roomid: this.id, userid: this.user.uid, questionnaireid: result.data.queid };
- const skip = 0;
- const limit = 10;
- const upres = await this.upquery({ skip, limit, ...info });
- if (this.$checkRes(upres)) {
- if (upres.data.length === 0) {
- this.showQuest = true;
- this.queid = result.data.queid;
- this.questSearch();
- }
- }
- }
- // 根据是否上麦进行上麦判断
- }
- },
- 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.sendmemo);
- },
- async initclient() {
- this.userId_ = this.user.uid;
- const res = await this.gensignFetch({ userid: this.userId_ });
- if (this.$checkRes(res)) {
- this.client_ = TRTC.createClient({
- mode: 'live',
- sdkAppId: this.sdkAppId_,
- userId: this.userId_,
- userSig: res.data,
- });
- await this.client_.join({ roomId: this.roomname, role: 'anchor' });
- this.client_.on('stream-subscribed', event => {
- const remoteStream = event.stream;
- // 远端流订阅成功,播放远端音视频流
- console.log(remoteStream);
- this.show = true;
- console.log('111' + remoteStream.getType());
- console.log('111' + remoteStream.getUserId());
- console.log('111' + remoteStream.getId());
- const userid_ = remoteStream.getUserId();
- const res_ = userid_.indexOf('-');
- const useridsplit_ = userid_.substring(0, 5);
- const userid_zs = userid_.substring(5);
- console.log('222--->' + useridsplit_);
- console.log('555--->' + userid_zs);
- if (useridsplit_ === 'share') {
- console.log('进入分享模式' + useridsplit_);
- this.lvideoid_ = 'video_' + remoteStream.getId();
- //this.zbfpbtn();
- this.swichposition();
- this.othedivshow = false;
- this.oheight = '200px';
- this.otheheight = '1px';
- console.log('进入分享模式' + this.lvideoid_);
- remoteStream
- .play('look-video-left')
- .then(() => {
- // autoplay success
- // 播放成功时调用css属性
- const _lvideoid_ = document.getElementById(this.lvideoid_);
- const style = 'width: 100%; height: 200px; position: absolute; transform: rotateY(0); object-fit: fill';
- _lvideoid_.style.cssText = style;
- })
- .catch(e => {
- const errorCode = e.getCode();
- if (errorCode === 0x4043) {
- // PLAY_NOT_ALLOWED,引导用户手势操作恢复音视频播放
- remoteStream.resume();
- }
- });
- } else if (useridsplit_ === 'mainr') {
- console.log('333');
- this.rvideoid_ = 'video_' + remoteStream.getId();
- // this.zbfullbtn();
- remoteStream
- .play('look-video-right')
- .then(() => {
- // autoplay success
- })
- .catch(e => {
- const errorCode = e.getCode();
- if (errorCode === 0x4043) {
- // PLAY_NOT_ALLOWED,引导用户手势操作恢复音视频播放
- remoteStream.resume();
- }
- });
- } else if (useridsplit_ === 'other') {
- console.log('333');
- this.rvideoid_ = 'video_' + remoteStream.getId();
- remoteStream
- .play('look-video-right')
- .then(() => {
- // autoplay success
- })
- .catch(e => {
- const errorCode = e.getCode();
- if (errorCode === 0x4043) {
- // PLAY_NOT_ALLOWED,引导用户手势操作恢复音视频播放
- remoteStream.resume();
- }
- });
- } else if (useridsplit_ === 'meetu') {
- console.log('333');
- console.log('公众号进入画面' + this.index_);
- this.othedivshow = true;
- this.oheight = '270px';
- this.otheheight = '70px';
- this.iscamera = true;
- this.index_ = this.index_ + 1;
- if (this.index_ < 6) {
- const id_ = 'othe-video-' + this.index_;
- console.log(id_);
- const newdata = { swichuserid: this.userid_zs, swichindex: this.index_ };
- this.swichusers.push(newdata);
- console.log('将用户push到列表里' + this.swichusers);
- if (this.user.uid === this.userid_zs) {
- this.userindex_ = this.index_;
- }
- remoteStream.play(id_);
- }
- } else if (useridsplit_ === 'wxxcx') {
- console.log('小程序进入画面' + this.index_);
- this.index_ = this.index_ + 1;
- if (this.index_ < 6) {
- const id_ = 'othe-video-' + this.index_;
- console.log(id_);
- remoteStream.play(id_);
- }
- }
- });
- // 监听远端流增加事件
- this.client_.on('stream-added', event => {
- const remoteStream = event.stream;
- console.log('222' + remoteStream.getType());
- // 订阅远端音频和视频流
- this.client_.subscribe(remoteStream, { audio: true, video: true }).catch(e => {
- console.error('failed to subscribe remoteStream');
- });
- });
- this.client_.on('stream-removed', event => {
- const remoteStream = event.stream;
- console.log('stop----');
- if (remoteStream) {
- const userid_ = remoteStream.getUserId();
- const useridsplit_ = userid_.substring(0, 5);
- if (useridsplit_ === 'wxxcx' || useridsplit_ === 'meetu') {
- console.log('退出userid_' + useridsplit_);
- // 订阅远端音频和视频流
- if (this.index_ > 0) {
- this.index_ = this.index_ - 1;
- }
- }
- }
- remoteStream.stop();
- });
- this.client_.on('mute-video', event => {
- const remoteStream = event.stream;
- console.log('退出');
- console.log('退出remoteStream' + remoteStream);
- if (remoteStream) {
- const userid_ = remoteStream.getUserId();
- const useridsplit_ = userid_.substring(0, 5);
- console.log('退出userid_' + userid_);
- if (useridsplit_ === 'wxxcx' || useridsplit_ === 'meetu') {
- console.log('退出userid_' + useridsplit_);
- // 订阅远端音频和视频流
- if (this.index_ > 0) {
- this.index_ = this.index_ - 1;
- }
- }
- }
- console.log('333--index---->' + this.index);
- });
- }
- },
- imgclick(url) {
- location.href = url;
- },
- full() {
- this.show = true;
- const width = document.documentElement.clientWidth;
- const height = document.documentElement.clientHeight;
- if (!this.isscreen) {
- console.log('全屏');
- this.isscreen = true;
- this.oheight = height;
- const transformid_ = document.getElementById('transformid');
- let style = 'width:' + height + 'px;';
- style += 'height:' + width + 'px;';
- style += '-webkit-transform: rotate(90deg); transform: rotate(90deg);';
- // 注意旋转中点的处理
- style += '-webkit-transform-origin: ' + width / 2 + 'px ' + width / 2 + 'px;';
- style += 'transform-origin: ' + width / 2 + 'px ' + width / 2 + 'px;';
- transformid_.style.cssText = style;
- this.transform = 'rotate(90deg)';
- // this.vwidth = height;
- console.log(height);
- if (this.othedivshow) {
- this.vheight = `${width - 70}px`;
- this.vwidth = `${height}px`;
- this.lheight = `${width - 70}px`;
- this.rheight = `${width - 70}px`;
- } else {
- this.vheight = `${width}px`;
- this.vwidth = `${height}px`;
- this.lheight = `${width}px`;
- this.rheight = `${width}px`;
- }
- this.btop = `${height - 40}px`;
- this.bright = `${width - 50}px`;
- if (this.othedivshow) {
- const othediv_ = document.getElementById('othediv');
- let styleothe = 'width:' + height + 'px;';
- styleothe += 'height:' + 70 + 'px;';
- styleothe += '-webkit-transform: rotate(90deg); transform: rotate(90deg);';
- // // 注意旋转中点的处理
- styleothe += '-webkit-transform-origin: ' + width / 2 + 'px ' + width / 2 + 'px;';
- styleothe += 'transform-origin: ' + width / 2 + 'px ' + width / 2 + 'px;';
- othediv_.style.cssText = styleothe;
- this.otheheight = '70px';
- this.othewidth = '20%';
- const ppp_ = `${width - 70}px`;
- this.othepadding = `${width - 70}px 0 0 0`;
- }
- } else {
- console.log('退出全屏');
- this.isscreen = false;
- if (this.othedivshow) {
- this.oheight = '270px';
- } else {
- this.oheight = '200px';
- }
- const transformid_ = document.getElementById('transformid');
- let style = 'width:' + width + 'px;';
- style += 'height: 200px;';
- transformid_.style.cssText = style;
- this.transform = 'rotate(0deg)';
- // this.vwidth = height;
- console.log(height);
- this.vheight = `200px`;
- this.vwidth = `${width}px`;
- this.lheight = `200px`;
- this.rheight = `200px`;
- this.btop = `167px`;
- this.bright = `10px`;
- if (this.othedivshow) {
- const othediv_ = document.getElementById('othediv');
- let styleothe = 'width:' + width + 'px;';
- styleothe += 'height:' + 70 + 'px;';
- // // 注意旋转中点的处理
- othediv_.style.cssText = styleothe;
- this.otheheight = '70px';
- this.othewidth = '20%';
- const ppp_ = `${width - 70}px`;
- this.othepadding = '200px 0 0 0';
- }
- }
- },
- },
- computed: {
- ...mapState(['user']),
- id() {
- return this.$route.query.id;
- },
- roomname() {
- return this.$route.query.roomname;
- },
- pageTitle() {
- return `${this.$route.meta.title}`;
- },
- },
- metaInfo() {
- return { title: this.$route.meta.title };
- },
- };
- </script>
- <style lang="less" scoped>
- .video {
- top: 0;
- left: 0;
- width: 100%;
- }
- .content {
- padding: 10px;
- }
- .info {
- .title {
- text-align: center;
- padding: 10px 0;
- font-size: 16px;
- font-weight: bold;
- }
- .num {
- padding: 10px 0;
- font-size: 16px;
- }
- .advert {
- background: #fff;
- padding: 10px;
- }
- .chat {
- min-height: 280px;
- max-height: 300px;
- overflow-y: auto;
- padding: 0 0 50px 0;
- .chatInfo {
- .list {
- margin: 10px 0 10px 0;
- span:first-child {
- float: left;
- width: 17%;
- text-align: center;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- // font-weight: bold;
- }
- span:last-child {
- float: right;
- width: 82%;
- }
- }
- }
- }
- .submit {
- width: 100%;
- position: absolute;
- bottom: 0px;
- .el-button {
- width: 100%;
- padding: 20px 0;
- }
- }
- }
- .my-swipe .van-swipe-item {
- color: #fff;
- font-size: 20px;
- line-height: 120px;
- text-align: center;
- background-color: #39a9ed;
- }
- /deep/.video-js {
- height: 190px !important;
- border-radius: 10px;
- }
- .look-video-left {
- float: left;
- background: #000;
- grid-area: 1/1/3/4;
- justify-content: flex-end;
- }
- .look-video-right {
- float: right;
- background: #000;
- grid-area: 1/1/3/4;
- justify-content: flex-end;
- }
- .othe-video-left {
- float: left;
- background: #000;
- grid-area: 1/1/3/4;
- justify-content: flex-end;
- }
- .wrapper {
- background: #000;
- position: absolute;
- width: 100%;
- }
- .van-overlay {
- position: fixed;
- top: 0;
- left: 0;
- z-index: 1;
- width: 100%;
- height: 200px;
- background-color: rgba(0, 0, 0, 0.7);
- }
- .videoBtn {
- z-index: 999;
- position: absolute;
- }
- .userList {
- height: 300px;
- min-height: 300px;
- overflow-y: auto;
- padding: 0 10px;
- margin: 0 0 10px 0;
- }
- .questpopup {
- padding: 10px 10px;
- }
- .questpopup div {
- padding: 8px 0 0 5px;
- }
- .questtitle {
- padding: 8px 0 0 5px;
- text-align: center;
- font-size: 18px;
- font-weight: bold;
- }
- .questbtn {
- text-align: center;
- padding: 10px 0 15px 0;
- }
- /deep/.van-cell {
- padding: 25px 16px;
- font-size: 16px;
- }
- </style>
|