|
@@ -14,9 +14,12 @@
|
|
|
</van-overlay>
|
|
|
<el-row class="chatrow">
|
|
|
<el-col :span="24" class="info">
|
|
|
- <el-col :span="24" class="num">
|
|
|
+ <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 @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">
|
|
@@ -109,6 +112,7 @@ 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);
|
|
@@ -150,9 +154,10 @@ export default {
|
|
|
rvideoid_: '',
|
|
|
userList: [],
|
|
|
isxf: '',
|
|
|
- showQuest: true,
|
|
|
+ showQuest: false,
|
|
|
queid: '',
|
|
|
questInfo: {},
|
|
|
+ switchbtn: false,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -160,6 +165,7 @@ export default {
|
|
|
this.lookuserSearch();
|
|
|
this.lookusercountsel();
|
|
|
this.chatSearch();
|
|
|
+ this.userswichrole();
|
|
|
},
|
|
|
mounted() {
|
|
|
this.channel();
|
|
@@ -173,7 +179,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
...gensign(['gensignFetch']),
|
|
|
- ...room(['lookuserFetch', 'fetch', 'lookusercount', 'lookquery', 'lookupdate', 'lookrecord']),
|
|
|
+ ...room(['lookuserFetch', 'fetch', 'lookusercount', 'lookquery', 'lookupdate', 'lookrecord', 'lookuserswichrole']),
|
|
|
...chat(['query', 'create']),
|
|
|
...quest(['questfetch']),
|
|
|
...uploadquestion({ upcreate: 'create', upquery: 'query' }),
|
|
@@ -237,6 +243,9 @@ export default {
|
|
|
this.$stomp({
|
|
|
[`/exchange/quest_publish_` + this.id]: this.onQueMessage,
|
|
|
});
|
|
|
+ this.$stomp({
|
|
|
+ [`/exchange/switch_role_` + this.user.uid]: this.onSwichMessage,
|
|
|
+ });
|
|
|
},
|
|
|
onMessage(message) {
|
|
|
// console.log('receive a message: ', message.body);
|
|
@@ -260,6 +269,32 @@ export default {
|
|
|
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;
|
|
|
+ } 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 questSearch() {
|
|
|
if (this.queid) {
|
|
|
const result = await this.questfetch(this.queid);
|