Преглед изворни кода

修改ai通识课接收传参

11wqe1 пре 1 месец
родитељ
комит
8f2c92b017
2 измењених фајлова са 13 додато и 6 уклоњено
  1. 10 5
      src/App.vue
  2. 3 1
      src/views/main.vue

+ 10 - 5
src/App.vue

@@ -24,8 +24,7 @@ onMounted(() => {
   let ticket = getUrlParam(window.parent.location.href, 'ticket')
   let userid = getUrlParam(window.parent.location.href, 'userid')
   axios.defaults.headers = { 'content-type': 'application/json;charset=utf-8' }
-  // 获取gotype传参
-  pageType2()
+
   if (isGrantCode) {
     let params = {
       grantCode: isGrantCode,
@@ -66,6 +65,8 @@ onMounted(() => {
   } else {
     linkLogin()
   }
+  // 获取gotype传参
+  pageType2()
 })
 
 const linkLogin = () => {
@@ -78,9 +79,13 @@ const linkLogin = () => {
 }
 
 const pageType2 = () => {
-  const val = route.query.gotype ? route.query.gotype :''
-  console.log('gotype',val);
-  setgotype.setpageType(val);
+  // const val = route.query.gotype ? route.query.gotype :''
+  console.log('window.location.search',window.location.search);
+  const urlParams = new URLSearchParams(window.location.search);
+  const gotype = urlParams.get('gotype');
+
+  console.log('gotype',gotype);
+  setgotype.setpageType(gotype);
 }
 
 // 同步登录信息

+ 3 - 1
src/views/main.vue

@@ -67,7 +67,7 @@
         <div class="pgb" v-if="gotype.gotype && gotype.gotype == 'CourseCon'">
           <div @click="backO" class="pgbL">
               <img src="../assets/icon/backPage.svg" alt="">
-              <div>AI通识课</div>
+              <div style="font-weight: 700;">AI通识课</div>
           </div>
         </div>
         <!-- <BannerVue></BannerVue> -->
@@ -416,5 +416,7 @@ const show = () => {
     display: flex;align-items: center;
     gap: 10px;
     cursor: pointer;
+    color: #000;
+    font-family: '黑体';
 }
 </style>