浏览代码

fix:复制链接进入直播间登录后没返回直播页面的问题

xuqiaoying 3 年之前
父节点
当前提交
a08b3c5f44
共有 3 个文件被更改,包括 9 次插入6 次删除
  1. 2 2
      src/axios.js
  2. 5 3
      src/pages/living-room/index.vue
  3. 2 1
      src/router/index.js

+ 2 - 2
src/axios.js

@@ -5,9 +5,9 @@ import { Message } from 'element-ui'
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
 // export const BASE_URL = 'https://test.xyyxt.net'   //预发布
 // export const BASE_URL = 'http://192.168.1.7:5055'    //dev
-// export const BASE_URL = 'http://120.79.166.78:19012'    //测试-外网
+export const BASE_URL = 'http://120.79.166.78:19012'    //测试-外网
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
-export const BASE_URL = 'http://192.168.1.222:5055'    //测试
+// export const BASE_URL = 'http://192.168.1.222:5055'    //测试
 export const tenantId = '867735392558919680'
 
 

+ 5 - 3
src/pages/living-room/index.vue

@@ -5,6 +5,7 @@
     <div class="container">
       <div class="clearfix top-line">
         <el-button
+          v-if="backNum"
           class="float-right"
           type="primary"
           size="small"
@@ -185,19 +186,19 @@ export default {
     ...mapGetters(["userInfo"]),
   },
   beforeRouteEnter(to, from, next) {
-    console.log(to,from)
     next((vm) => {
       if (from.path.includes("my-course-detail")) {
         vm.backNum = -2;
+      } else if (from.path == '/login') {
+        vm.backNum = 0;
       } else {
         vm.backNum = -1;
       }
     });
   },
   created() {
-    console.log('this.$tools.isLogin()', this.$tools.isLogin())
+    console.log('是否登录了', this.$tools.isLogin())
     if (!this.$tools.isLogin()) {
-      console.log('1111',this.$route)
       this.setCurrentRouter(this.$route);
       this.$router.push({
         path: "/login",
@@ -227,6 +228,7 @@ export default {
     this.studyRecordGetLastLive();
   },
   beforeDestroy() {
+    if (!this.$tools.isLogin()) return
     this.plv.liveSdk.destroy();
     clearInterval(this.timer);
   },

+ 2 - 1
src/router/index.js

@@ -190,7 +190,8 @@ const router =  new Router({
     },
     {
       path: '/living-room/:channelId',
-      name: '课程详情',
+      // name: '课程详情',
+      name: '直播页面详情',
       component: resolve => require(['@/pages/living-room/index'],resolve),
       meta: {
         title: '祥粤云学堂-一二级建造师、工程师、建筑师视频课程、免费直播课',