소스 검색

```
feat: 更新开发环境API配置并修复学习笔记页面跳转逻辑

- 更新.env.development文件中的API基础URL配置
- 修复App.vue中菜单项的学习笔记跳转方法名错误
- 调整协议链接的命名规范以匹配国际化配置
- 添加nextTick导入并修复学习笔记访问权限控制逻辑
- 完善登录对话框中的页面刷新逻辑
- 更新多语言文件中的协议条款键名
- 修复中文语言包中的文字错误
- 在学习笔记页面添加播放图标和立即学习按钮
- 实现学习系统详情页的路由参数监听功能
- 调整工作流详情页的文件下载字段映射
- 更新订单确认页的协议链接配置
```

zhangningning 3 주 전
부모
커밋
9895fab2e5

+ 2 - 2
.env.development

@@ -1,10 +1,10 @@
 # 乔功
-VITE_API_BASE_URL=http://192.168.100.134:8080/api
+# VITE_API_BASE_URL=http://192.168.100.134:8080/api
 # VITE_API_BASE_URL=http://47.104.167.40/prod-api/api
 # VITE_API_BASE_URL=http://192.168.100.134:8080/api
 # VITE_API_BASE_URL=http://192.168.101.12:8080/api
 # 高运甲
-# VITE_API_BASE_URL=http://192.168.100.89:8080/api
+VITE_API_BASE_URL=http://192.168.100.89:8080/api
 # VITE_API_BASE_URL=http://192.168.101.12:8080/api
 
 

+ 22 - 6
src/App.vue

@@ -5,12 +5,13 @@
       <el-header class="box_shadow_card">
         <div class="header-content">
           <div class="logo" @click="$router.push('/')">{{ $t('common.title') }}</div>
-          <el-menu :default-active="activeIndex" mode="horizontal" :ellipsis="false" class="meauList">
+          <el-menu :default-active="activeIndex" 
+          mode="horizontal" :ellipsis="false" class="meauList">
             <el-menu-item index="1" @click="$router.push('/')">AI {{ $t('common.gongzuoliu') }}</el-menu-item>
             <!-- <el-menu-item index="2" @click="$router.push('/my-learning')">工作流交易</el-menu-item> -->
             <el-menu-item index="2" @click="goMyLearning">{{ $t('common.gongzuoliu_trade') }}</el-menu-item>
             <el-menu-item index="3" @click="$router.push('/learning-system')">{{ $t('route.learning_system') }}</el-menu-item>
-            <el-menu-item index="4" @click="$router.push('/learn-note')">{{ $t('common.xuxibiji') }}</el-menu-item>
+            <el-menu-item index="4" @click=" goLearnNote">{{ $t('common.xuxibiji') }}</el-menu-item>
             <el-menu-item index="5" @click="$router.push('/mibi-shop')">{{ $t('route.mibiShop') }}</el-menu-item>
             <!-- <el-menu-item index="5" @click="$router.push('/my-learning')">米币商城</el-menu-item> -->
           </el-menu>
@@ -46,7 +47,7 @@
       <el-footer>
         <div class="footer-content" >
           <p> 
-            <span class="cursor-pointer" @click="router.push({name:'Agreement',query:{type:'serviceAgreement'}})">{{ $t('agreement.serviceAgreement') }}</span>
+            <span class="cursor-pointer" @click="router.push({name:'Agreement',query:{type:'service_agreement'}})">{{ $t('agreement.service_agreement') }}</span>
             <span class="gray999"> | </span>
             <span class="cursor-pointer" @click="router.push({name:'Agreement',query:{type:'privacy_policy'}})">{{ $t('agreement.privacy_policy') }}</span> 
             <span class="gray999"> | </span>
@@ -66,11 +67,11 @@
 <script setup>
 import { logout } from '@/api/auth.js'
 import LoginDialog from './components/LoginDialog.vue'
-import { computed,ref,onMounted, provide, watch } from 'vue'
+import { computed,ref,onMounted, provide, watch, nextTick } from 'vue'
 import LangSwitch from './components/LangSwitch.vue'
 import { ElConfigProvider, ElMessage } from 'element-plus'
 import { useRoute, useRouter } from 'vue-router'
-import { openNewTab } from '@/utils/util.js'
+import { openNewTab, isLogin } from '@/utils/util.js'
 // 在Pinia安装后再设置初始语言
 import { useLangStore } from '@/pinia/langStore'
 import { useAppStore } from '@/pinia/appStore'
@@ -114,8 +115,21 @@ const handleLoginSuccess = () => {
 function goMyLearning() {
   router.push('/workflow-trade')
 };
+const goLearnNote = () => {
+  router.push('/learn-note');
+  if (!isLogin({ callback: openLoginDialog, t })) {
+    nextTick(()=>{
+      setTimeout(()=>{
+        router.back();
+      },500)
+    })
+    return; // 如果未登录则不执行跳转,也不激活菜单
+  }
+  
+}
 // 将 activeIndex 改为响应式,并根据当前路由动态计算
 const activeIndex = computed(() => {
+  console.log('route.path',route.path)
   if (route.path === '/') return '1'
   if (route.path.startsWith('/workflow-trade')) {
     return '2'
@@ -124,7 +138,9 @@ const activeIndex = computed(() => {
     return '3'
   }
   if (route.path.startsWith('/learn-note')) {
-    return '4'
+    // 如果用户未登录,不应该显示此菜单为激活状态
+    if (!appStore.token) return null; // 或者返回上一个有效菜单
+    return '4';
   }
   if (route.path.startsWith('/mibi-shop')) {
     return '5'

+ 9 - 9
src/components/LoginDialog.vue

@@ -548,14 +548,14 @@ const setToken = (token) => {
   appStore.UPDATE_TOKEN(token);
   //获取当前路由 ,路由是/learn-note
   console.log(route.path)
-  // if(
-  //   route.path.startsWith('/learn-note') ||
-  //   route.path.startsWith('/mibi-shop')
-  // ){
-  //   // 刷新当前页
-  //   window.location.reload();
-  // }
-  window.location.reload();
+  if(
+    route.path.startsWith('/learn-note') ||
+    route.path.startsWith('/mibi-shop')
+  ){
+    // 刷新当前页
+    window.location.reload();
+  }
+  // window.location.reload();
 }
 
 
@@ -571,7 +571,7 @@ const handleQqLogin = () => {
 
 defineExpose({
   open
-})
+});
 </script>
 
 <style scoped lang="scss">

+ 2 - 2
src/locales/en.js

@@ -357,8 +357,8 @@ export default {
     pleaseUploadVoucher:'Please upload payment voucher',
   },
   agreement:{
-    serviceAgreement:'AI Learning Forum Service Agreement',
-    IntellectualAgreement:'AI Learning Forum Intellectual Property Protection Agreement',
+    service_agreement:'AI Learning Forum Service Agreement',
+    Intellectual_agreement:'AI Learning Forum Intellectual Property Protection Agreement',
     privacy_policy:'Privacy Policy',
   }
 }

+ 3 - 3
src/locales/zh-CN.js

@@ -184,7 +184,7 @@ export default {
     priceSetting:"价格设置",
     paySetting:"付费设置",
     paySettingTip:"付费(用户需付费后使用)",
-    freeSettingTip:"免费(所有用户可免费数据)",
+    freeSettingTip:"免费(所有用户可免费使用)",
     placeholderPrice:"请输入暴米币数量",
     placeholderWorkflowContent:"请输入工作流详情内容",
   },
@@ -361,8 +361,8 @@ export default {
     pleaseUploadVoucher:'请上传转账凭证',
   },
   agreement:{
-    serviceAgreement:'AI学习论坛服务协议',
-    IntellectualAgreement:'AI学习论坛知识产权保护协议',
+    service_agreement:'AI学习论坛服务协议',
+    Intellectual_agreement:'AI学习论坛知识产权保护协议',
     privacy_policy:'隐私政策',
   }
 

+ 34 - 4
src/pages/LearnNote/LearnNote.vue

@@ -16,6 +16,12 @@
             <div class="flex_1 ml20">
               <div class="font_size18 bold">{{ item.courseTitle }}</div>
               <div class="font_size14 line2 gray mt10">{{ item.courseIntro }}</div>
+              <div class="flex-center-flex-end mt10">
+                <div class="gap5 gradient border_radius_4 cursor-pointer xuexi" @click.stop.prevent="goDetail(item)">
+                  <img :src="playIcon" alt="" style="width:13px;height:15px">
+                  <div>{{$t('common.lijixuexi')}}</div>
+                </div>
+              </div>
             </div>
           </div>
           <div v-if="list.length === 0" >
@@ -30,6 +36,7 @@
   </div>
 </template>
 <script setup>
+import playIcon from '@/assets/imgs/bofang.png'
 import Xuxibiji from '@/pages/LearningSystem/components/xuxibiji.vue'
 import { getCourseWithNotesList } from '@/api/course.js'
 import { isLogin,openFullScreenLoading } from '@/utils/util.js'
@@ -39,22 +46,25 @@ const { t } = useI18n()
 
 
 import { ref, onMounted, inject } from 'vue'
-import { useRoute } from 'vue-router'
+import { useRoute, useRouter } from 'vue-router'
 import { useAppStore } from '@/pinia/appStore'
 const appStore = useAppStore()
 const route = useRoute()
+const router = useRouter()
 const list = ref({})
 const selectedItem = ref({})
 const openLoginDialog = inject('openLoginDialog')
 
 onMounted(() => {
   //判断是否登录
-  if(!isLogin({callback: openLoginDialog,t})){
-    return;
-  }
+  // if(!isLogin({callback: openLoginDialog,t})){
+  //   return;
+  // }
   getList();
 });
 const getList = async () => {
+  let token = localStorage.getItem('token');
+  if(!token)return;
   // 打开loading
   const loading = openFullScreenLoading();
   getCourseWithNotesList().then(res => {
@@ -69,6 +79,20 @@ const getList = async () => {
     }
   })
 };
+const goDetail = (item) => {
+  //判断是否登录
+  if(!isLogin({callback: openLoginDialog,t})){
+    return;
+  }
+  //增加参数名称
+  router.push({
+    path: `/learning-system/detail/${item.courseId}`,
+    query: {
+      courseId: item.courseId,
+      metaTitle: item.courseTitle || '课程详情'
+    }
+  })
+};
 </script>
 <style lang="scss">
 .LearnNote{
@@ -82,5 +106,11 @@ const getList = async () => {
       background-color: rgba(45, 113, 255, 0.10) ;
     }
   }
+  .xuexi{
+    color: #ffffff;
+    padding: 5px 10px;
+    border-radius: 10px;
+    font-size: 14px;
+  }
 }
 </style>

+ 11 - 2
src/pages/LearningSystem/LearningSystemDetail.vue

@@ -99,7 +99,7 @@
   });
 
 
-  import { ref, computed, onMounted, onActivated } from 'vue'
+  import { ref, computed, onMounted, onActivated, watch } from 'vue'
   import { useAppStore } from '@/pinia/appStore'
   const appStore = useAppStore()
 
@@ -112,6 +112,15 @@
   const courseId = ref(route.params.courseId || '');
   const info = ref({})
 
+  //监听route.params.courseId变化
+  watch(() => route.params.courseId, (newVal, oldVal) => {
+    courseId.value = newVal || '';
+    if(newVal !== oldVal){
+      getDetail();
+    }
+  })
+
+
   
   onMounted(() => {
    getDetail();
@@ -169,7 +178,7 @@
       width: 100%;
       height: 400px;
       //背景模糊
-      filter: blur(180px);
+      filter: blur(80px);
     }
     .xuexi{
       color: #ffffff;

+ 2 - 2
src/pages/WorkflowDetail.vue

@@ -219,8 +219,8 @@ const downloadWorkflow = () => {
   }).then(res => {
     if(res.code === 200){
       if(res.data?.buyFlag == 1){
-        if(res.data?.contentUrl){
-          downloadFile({url:res.data?.contentUrl,t});
+        if(res.data?.workflowFile){
+          downloadFile({url:res.data?.workflowFile,t});
         }
       }else{
         confirmBuy({

+ 2 - 2
src/pages/order/orderConfirm.vue

@@ -193,8 +193,8 @@
       <div class="mt20 gap10 cursor-pointer" @click="agreement = !agreement">
         <div class="checkType" :class="{'active': agreement}"></div>
         {{$t('common.readAndAgree')}} 
-        <span class="color_theme bold" @click="router.push({name:'Agreement',query:{type:'serviceAgreement'}})">《{{$t('agreement.serviceAgreement')}}》</span> 和
-         <span class="color_theme bold" @click="router.push({name:'Agreement',query:{type:'IntellectualAgreement'}})">《{{$t('agreement.IntellectualAgreement')}}》</span> 
+        <span class="color_theme bold" @click="router.push({name:'Agreement',query:{type:'service_agreement'}})">《{{$t('agreement.service_agreement')}}》</span> 和
+        <span class="color_theme bold" @click="router.push({name:'Agreement',query:{type:'Intellectual_agreement'}})">《{{$t('agreement.Intellectual_agreement')}}》</span> 
       </div>
     </div>
   </div>