浏览代码

根据课程页面跳转来源判断标题栏显示

11wqe1 1 年之前
父节点
当前提交
c2220c1f2d
共有 3 个文件被更改,包括 52 次插入4 次删除
  1. 2 1
      src/views/course/index.vue
  2. 49 2
      src/views/courseDetail/index.vue
  3. 1 1
      src/views/home/components/courseItem.vue

+ 2 - 1
src/views/course/index.vue

@@ -106,6 +106,7 @@ export default {
     return {
       courseid: this.$route.query.courseid,
       oid: '',
+      routeType: this.$route.query.routeType,
       courseDetail: {},
       chapInfo: {},
       chapList: [],
@@ -177,7 +178,7 @@ export default {
     },
     back() {
       // eslint-disable-next-line prettier/prettier
-      this.$router.push({ path: '/courseDetail', query: { courseid: this.courseid }})
+      this.$router.push({ path: '/courseDetail', query: { courseid: this.courseid, routeType: this.routeType }})
     },
     onRefresh() {
       this.getCourse()

+ 49 - 2
src/views/courseDetail/index.vue

@@ -1,10 +1,15 @@
 <template>
   <div>
-    <head-bar @back="back">
+    <head-bar @back="back" v-if="routeType == 0">
       <template #title>
         <div class="navTitle">课程详情</div>
       </template>
     </head-bar>
+    <div class="head-container" v-if="routeType == 1">
+      <div class="head-box">
+        <div class="navTitle">课程详情</div>
+      </div>
+    </div>
     <div class="courseBoxMes">
       <course-message
         :cDetail="courseDetail"
@@ -36,6 +41,7 @@ export default {
   data() {
     return {
       courseid: this.$route.query.courseid,
+      routeType: '',
       courseDetail: {},
       courseTypeJson: {},
       chapInfo: [],
@@ -50,7 +56,7 @@ export default {
     },
     goToStudy() {
       // eslint-disable-next-line object-curly-spacing
-      this.$router.push({ path: '/course', query: { courseid: this.courseid } })
+      this.$router.push({ path: '/course', query: { courseid: this.courseid, routeType: this.routeType } })
     },
     getCourse() {
       const params = {
@@ -87,7 +93,21 @@ export default {
         })
     }
   },
+  created() {
+    const routeType = this.$route.query.routeType
+    // console.log('routeType', routeType)
+    if (!!routeType) {
+      localStorage.setItem('routeType', routeType)
+    }
+  },
   mounted() {
+    // if (!this.$route.query.routeType) {
+    //   this.$router.push('/courseDetail', { replace: true })
+    // }
+    this.routeType = localStorage.getItem('routeType')
+    // console.log('this.routeType', this.routeType==false)
+
+    // console.log(this.$route.query.routeType, 'luo', this.routeType)
     this.getCourse()
   }
 }
@@ -100,6 +120,33 @@ export default {
   padding: 0 0 60px;
   box-sizing: border-box;
 }
+.head-container {
+  height: 55px;
+  width: 100%;
+  background-image: url(../../assets/images/course/head-back.png);
+  position: fixed;
+  top: 0;
+  .back {
+    width: 0.3rem;
+    height: 0.3rem;
+    border-top: 2px solid #fff;
+    border-left: 2px solid #fff;
+    position: absolute;
+    transform: rotate(-45deg) translateY(-50%);
+    top: 47%;
+    left: 0.8rem;
+    cursor: pointer;
+  }
+  .head-box {
+    padding: 0 1.5rem;
+    display: flex;
+    width: 100%;
+    height: 100%;
+    align-items: center;
+    justify-content: center;
+    box-sizing: border-box;
+  }
+}
 .navTitle {
   font-size: 16px;
   color: #fff;

+ 1 - 1
src/views/home/components/courseItem.vue

@@ -41,7 +41,7 @@ export default {
   methods: {
     goTo(cid) {
       // eslint-disable-next-line prettier/prettier
-      this.$router.push({ path: '/courseDetail', query: { courseid: cid } })
+      this.$router.push({ path: '/courseDetail', query: { courseid: cid, routeType: 0 } })
     }
   }
 }