jwyu 2 years ago
parent
commit
a6e60b94db
6 changed files with 39 additions and 11 deletions
  1. 4 1
      src/router/ppt.js
  2. 1 1
      src/router/pptEn.js
  3. 19 5
      src/views/404.vue
  4. 4 2
      src/views/ppt/Detail.vue
  5. 3 1
      src/views/ppt/Preview.vue
  6. 8 1
      src/views/ppt/Search.vue

+ 4 - 1
src/router/ppt.js

@@ -29,7 +29,10 @@ export const pptRoutes=[
         path:"/ppt/search",
         name:"PPTSearch",
         component: () => import("@/views/ppt/Search.vue"),
-        meta: { title: "搜索PPT" },
+        meta: { 
+            title: "搜索PPT",
+            keepAlive:true
+        },
     },
     {
         path:"/ppt/preview",

+ 1 - 1
src/router/pptEn.js

@@ -29,7 +29,7 @@
         path:"/ppten/search",
         name:"PPTENSearch",
         component: () => import("@/views/ppt/Search.vue"),
-        meta: { title: "搜索PPT" },
+        meta: { title: "搜索PPT",keepAlive:true },
     },
     {
         path:"/ppten/preview",

+ 19 - 5
src/views/404.vue

@@ -1,19 +1,33 @@
+<script setup>
+import { useRouter } from "vue-router";
+
+const router=useRouter()
+
+function goHome(){
+    router.replace('/')
+}
+
+</script>
+
 <template>
     <div class="nofound-page">
         <img src="@/assets/imgs/404.png" alt="">
         <p>404</p>
+        <van-button type="primary" @click="goHome">返回首页</van-button>
     </div>
 </template>
 
-<style scoped>
+<style lang="scss" scoped>
 .nofound-page{
     text-align: center;
-    font-size: 16px;
+    font-size: 32px;
     color: #666;
     padding-top: 100px;
-    
+    p{
+        margin: 20px 0;
+    }
 }
 img{
-        width: 300px;
-    }
+    width: 80%;
+}
 </style>

+ 4 - 2
src/views/ppt/Detail.vue

@@ -93,8 +93,9 @@ function onSelectPlayOpt(e){
         const itemH=pptContentHeight.value/conArr.value.length
         index=Math.floor(y.value/itemH)
     }
+    let routerEl
     if(window.location.pathname.startsWith('/ppten')){
-        router.push({
+        routerEl=router.resolve({
             path:"/ppten/preview",
             query:{
                 id:pptId,
@@ -102,7 +103,7 @@ function onSelectPlayOpt(e){
             }
         })
     }else{
-        router.push({
+        routerEl=router.resolve({
             path:"/ppt/preview",
             query:{
                 id:pptId,
@@ -110,6 +111,7 @@ function onSelectPlayOpt(e){
             }
         })
     } 
+    window.open(routerEl.href,'_blank')
 }
 
 

+ 3 - 1
src/views/ppt/Preview.vue

@@ -113,7 +113,9 @@ function handleShowAction(){
         >退出播放</div>
     </div>
 </template>
-
+<style lang="scss">
+@import "./style/common.scss";
+</style>
 <style lang="scss" scoped>
 .ppt-preview-page{
     width: 100vw;

+ 8 - 1
src/views/ppt/Search.vue

@@ -2,7 +2,7 @@
 import {ref} from 'vue'
 import {apiPPTSearch} from '@/api/ppt'
 import { showToast } from 'vant'
-import { useRouter } from 'vue-router'
+import { useRouter,onBeforeRouteLeave } from 'vue-router'
 
 const router=useRouter()
 
@@ -47,6 +47,13 @@ function goDetail(item){
     }
 }
 
+onBeforeRouteLeave((to,from)=>{
+    if(to.path=='/ppt/index'||to.path=='/ppten/index'){
+        searchVal.value=''
+        list.value=[]
+        finished.value=false
+    }
+})
 
 </script>