Quellcode durchsuchen

复制直播链接进来

xuqiaoying vor 3 Jahren
Ursprung
Commit
b23f0fe3f3
4 geänderte Dateien mit 67 neuen und 6 gelöschten Zeilen
  1. 2 2
      src/axios.js
  2. 2 1
      src/components/goodsItem/index.vue
  3. 61 2
      src/pages/living-room/index.vue
  4. 2 1
      src/pages/login/index.vue

+ 2 - 2
src/axios.js

@@ -3,8 +3,8 @@ import store from './store'
 import { Message } from 'element-ui'
 // export const BASE_URL = 'https://api.xyyxt.net'   //release
 // 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.24:5055'    //dev
+export const BASE_URL = 'https://test.xyyxt.net'   //预发布
+// export const BASE_URL = 'http://192.168.1.24:5055'    //dev
 // export const BASE_URL = 'http://120.79.166.78:19012'    //测试-外网
 export const tenantId = '867735392558919680'
 

+ 2 - 1
src/components/goodsItem/index.vue

@@ -51,7 +51,7 @@ export default {
   },
   mounted() {},
   methods: {
-    ...mapMutations(["getCartCount"]),
+    ...mapMutations(["setCurrentRouter", "getCartCount"]),
     /**
      * 查看商品详情
      */
@@ -78,6 +78,7 @@ export default {
     },
 
     buyNow(item) {
+      console.log('加入购物车---000',this.$route)
       console.log(item);
       if (!this.$tools.isLogin()) {
         this.setCurrentRouter(this.$route);

+ 61 - 2
src/pages/living-room/index.vue

@@ -176,6 +176,9 @@ export default {
       liveLast: null,
       isFirst: true,
       backNum: -1, //返回页面数
+      buyCourse: 1, // 是否购买课程:1是 0否
+      identification: '', // 标识
+
     };
   },
   computed: {
@@ -191,7 +194,23 @@ export default {
       }
     });
   },
-  mounted() {
+  created() {
+    if (!this.$tools.isLogin()) {
+      console.log('1111',this.$route)
+      this.setCurrentRouter(this.$route);
+      this.$router.push({
+        path: "/login",
+      });
+      return;
+    }
+    const { a } = this.$route.query
+    this.channelId = this.$route.params.channelId
+    // 有a字段是标识是复制链接进来
+    if (a ==1) {
+      this.getParam()
+      return
+    }
+    // 下面不是复制链接进来的
     this.sectionId = this.$route.query.sectionId;
     this.goodsId = this.$route.query.goodsId;
     this.courseId = this.$route.query.courseId;
@@ -200,6 +219,8 @@ export default {
     this.chapterId = this.$route.query.chapterId;
     this.moduleId = this.$route.query.moduleId;
     this.channelId = this.$route.params.channelId;
+    this.identification = new Date().valueOf() + ""
+    this.buyCourse = 0
     this.playVideo();
     this.studyRecordGetLastLive();
   },
@@ -208,7 +229,41 @@ export default {
     clearInterval(this.timer);
   },
   methods: {
-    ...mapMutations(["getCartCount"]),
+    ...mapMutations(["setCurrentRouter", "getCartCount"]),
+    // 获取直播间跳转参数的接口
+    getParam() {
+      const { cid, gid, sid} = this.$route.query
+      this.$request({
+        url: '/course/check/watch/per',
+        method: 'get',
+        params: {
+          courseId: cid, //课程ID	
+          goodsId: gid, // 商品id
+          sectionId: sid, // 节id
+        },
+      }).then((res) => {
+        if (res.data.code == 200) {
+          let item = res.data.data
+          console.log('item', item)
+          const {sectionId, goodsId, courseId, orderGoodsId, gradeId, chapterId, moduleId, buyCourse} = item
+          this.sectionId = sectionId
+          this.goodsId = goodsId
+          this.courseId = courseId
+          this.orderGoodsId = orderGoodsId
+          this.gradeId = +gradeId || 0
+          this.chapterId = chapterId
+          this.moduleId = moduleId
+          this.buyCourse = buyCourse
+          // console.log('url:', this.url)
+          this.identification = new Date().valueOf() + ""
+          this.playVideo();
+          this.studyRecordGetLastLive();
+        } else {
+          this.$u.toast(res.data.msg)
+        }
+      })
+
+    },
     close() {
       this.signModal = false;
       this.signSuccess = true;
@@ -218,6 +273,7 @@ export default {
     },
     polyvLivesign() {
       console.log(this.channelId);
+      // /polyv/live/sign
       this.$request
         .polyvLivesign({
           channelId: this.channelId,
@@ -246,6 +302,7 @@ export default {
      */
     studyRecordGetLastLive() {
       if (!this.gradeId && this.sectionId) {
+        // /study/record/getLastLive
         this.$request
           .studyRecordGetLastLive({
             orderGoodsId: this.orderGoodsId,
@@ -417,6 +474,8 @@ export default {
       }
       let self = this;
       this.$request.studyRecord({
+        buyCourse: this.buyCourse,
+        identification: this.identification,
         sectionId: parseInt(this.sectionId),
         goodsId: parseInt(self.goodsId),
         courseId: parseInt(self.courseId),

+ 2 - 1
src/pages/login/index.vue

@@ -1130,8 +1130,9 @@ export default {
           this.islogin = false;
           this.isloginSms = false;
           this.setUserInfo(res.data);
-          console.log(this.currentRouter);
+          console.log('=========',this.currentRouter);
           if (JSON.stringify(this.currentRouter) != "{}") {
+            console.log('zhelisafhsdifgsdiufg')
             this.$router.push(this.currentRouter);
             this.setCurrentRouter({});
           } else {