Browse Source

修改全局字体,与课程详情跳转

11wqe1 1 year ago
parent
commit
6ba403257b

+ 3 - 3
public/index.html

@@ -15,14 +15,14 @@
     <%= webpackConfig.name %>
   </title>
   <style>
-    @font-face {
+    /* @font-face {
       font-family: 'Source Han Sans SC';
       src: url('./SourceHanSans-Regular.otf') format('truetype');
       font-weight: normal;
       font-style: normal;
-    }
+    } */
     html,body{
-      font-family: 'Source Han Sans SC', sans-serif;
+      font-family:'黑体';
     }
   </style>
 </head>

+ 16 - 0
src/App.vue

@@ -19,6 +19,22 @@ export default {
     }
   },
   created() {
+    const url = window.location.href
+    const paramRegex = /[?&]([^=#]+)=([^&#]*)/g
+    const params = {}
+    let match
+
+    while ((match = paramRegex.exec(url)) !== null) {
+      const paramName = decodeURIComponent(match[1])
+      const paramValue = decodeURIComponent(match[2])
+      params[paramName] = paramValue
+    }
+    // console.log('window.location.href', params)
+    // console.log('params99999999999999999999',params);
+    if (!!params.shareCourseId) {
+      localStorage.setItem('urlType',1)
+      this.$router.push(`/courseDetail?courseid=${params.shareCourseId}`)
+    }
     console.log(this.$wx)
   },
   methods: {

+ 11 - 2
src/views/course/components/courseTitle.vue

@@ -7,7 +7,9 @@
     </div>
     <div class="ct-taskName">
       <div class="ct-task">任务{{ taskCount + 1 }}</div>
-      <div class="ct-tname" v-if="chapInfo.chapterInfo && chapInfo.chapterInfo[0].taskJson[taskCount].task">{{ chapInfo.chapterInfo[0].taskJson[taskCount].task }}</div>
+      <div class="ct-tname" v-if="chapInfo.chapterInfo && chapInfo.chapterInfo[0].taskJson[taskCount].task">
+        {{ chapInfo.chapterInfo[0].taskJson[taskCount].task }}
+      </div>
     </div>
     <div class="ct-detail" v-if="chapInfo.chapterInfo && chapInfo.chapterInfo[0].taskJson[taskCount].taskDetail">
       <div class="detail" v-html="chapInfo.chapterInfo[0].taskJson[taskCount].taskDetail"></div>
@@ -33,6 +35,13 @@ export default {
   },
   data() {
     return {}
+  },
+  mounted() {
+    // let con = this.chapInfo
+    console.log('??????????????????????????????', this.chapInfo)
+    this.chapInfo.chapterInfo[0].taskJson[this.taskCount].taskDetail = this.chapInfo.chapterInfo[0].taskJson[
+      this.taskCount
+    ].taskDetail.replace(/(<img[^>]+)style="max-width:\s*100%25;"/g, '$1style="max-width:100%;"')
   }
 }
 </script>
@@ -83,7 +92,7 @@ export default {
       border-radius: 0.1rem;
       min-width: fit-content;
     }
-    .ct-tname{
+    .ct-tname {
       margin-left: 10px;
       font-size: 16px;
     }

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

@@ -106,7 +106,6 @@ export default {
     return {
       courseid: this.$route.query.courseid,
       oid: '',
-      routeType: this.$route.query.routeType,
       courseDetail: {},
       chapInfo: {},
       chapList: [],
@@ -148,6 +147,8 @@ export default {
           this.courseDetail = res[0][0]
           this.chapInfo = JSON.parse(this.courseDetail.chapters)[this.courseType]
           this.chapList = JSON.parse(this.courseDetail.chapters)
+          console.log('this.courseDetail',this.chapList);
+
           this.oid = res[0][0].organizeid
           this.tcid = this.arrayToArray(
             this.courseDetail.juri ? this.courseDetail.juri.split(',') : [],
@@ -178,7 +179,7 @@ export default {
     },
     back() {
       // eslint-disable-next-line prettier/prettier
-      this.$router.push({ path: '/courseDetail', query: { courseid: this.courseid, routeType: this.routeType }})
+      this.$router.push({ path: '/courseDetail', query: { courseid: this.courseid }})
     },
     onRefresh() {
       this.getCourse()

+ 8 - 16
src/views/courseDetail/index.vue

@@ -41,8 +41,8 @@ export default {
   data() {
     return {
       courseid: this.$route.query.courseid,
-      routeType: '',
       courseDetail: {},
+      routeType: 0,
       courseTypeJson: {},
       chapInfo: [],
       courseType: [],
@@ -56,7 +56,7 @@ export default {
     },
     goToStudy() {
       // eslint-disable-next-line object-curly-spacing
-      this.$router.push({ path: '/course', query: { courseid: this.courseid, routeType: this.routeType } })
+      this.$router.push({ path: '/course', query: { courseid: this.courseid } })
     },
     getCourse() {
       const params = {
@@ -93,21 +93,13 @@ 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)
+    // console.log('hahahha',!localStorage.getItem('urlType'));
+    if (localStorage.getItem('urlType')==1) {
+      this.routeType = 1
+    } else {
+      this.routeType = 0
+    }
     this.getCourse()
   }
 }

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

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