|
@@ -1,8 +1,53 @@
|
|
|
<script setup>
|
|
|
import {ref} from 'vue'
|
|
|
+import {apiPPTSearch} from '@/api/ppt'
|
|
|
+import { showToast } from 'vant'
|
|
|
+import { useRouter } from 'vue-router'
|
|
|
+
|
|
|
+const router=useRouter()
|
|
|
|
|
|
const searchVal=ref('')
|
|
|
|
|
|
+let list=ref([])
|
|
|
+let finished=ref(false)
|
|
|
+async function handleSearch(){
|
|
|
+ finished.value=false
|
|
|
+ const res=await apiPPTSearch({
|
|
|
+ Keyword:searchVal.value
|
|
|
+ })
|
|
|
+ if(res.Ret===200){
|
|
|
+ list.value=res.Data.List||[]
|
|
|
+ finished.value=true
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function onSearch(){
|
|
|
+ if(!searchVal.value){
|
|
|
+ showToast('请输入关键词')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ handleSearch()
|
|
|
+}
|
|
|
+
|
|
|
+function goDetail(item){
|
|
|
+ if(window.location.pathname.startsWith('/ppten')){
|
|
|
+ router.push({
|
|
|
+ path:"/ppten/detail",
|
|
|
+ query:{
|
|
|
+ id:item.PptId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ router.push({
|
|
|
+ path:"/ppt/detail",
|
|
|
+ query:{
|
|
|
+ id:item.PptId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -12,12 +57,14 @@ const searchVal=ref('')
|
|
|
v-model="searchVal"
|
|
|
shape="round"
|
|
|
placeholder="请输入搜索关键词"
|
|
|
+ @search="onSearch"
|
|
|
/>
|
|
|
</div>
|
|
|
+ <van-empty image="search" description="试试别的关键词吧~" v-if="list.length==0&&finished"/>
|
|
|
<ul class="list-wrap">
|
|
|
- <li class="item">
|
|
|
- <div class="title">名称</div>
|
|
|
- <div class="time">ccw 2023-01-16创建</div>
|
|
|
+ <li class="item" v-for="item in list" :key="item.PptId" @click="goDetail(item)">
|
|
|
+ <div class="title" v-html="item.Title"></div>
|
|
|
+ <div class="time">{{item.AdminRealName}} {{item.PptCreateTime.split(' ')[0]}}创建</div>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
@@ -35,9 +82,13 @@ const searchVal=ref('')
|
|
|
.item{
|
|
|
padding: 30px 0 20px 0;
|
|
|
border-bottom: 1px solid $border-color;
|
|
|
+ :deep(.color-light){
|
|
|
+ color: $theme-color;
|
|
|
+ }
|
|
|
.time{
|
|
|
color: $font-grey_999;
|
|
|
margin-top: 10px;
|
|
|
+ font-size: 24px;
|
|
|
}
|
|
|
}
|
|
|
}
|