Browse Source

修改搜索

zs 1 year ago
parent
commit
e3790f6db9
2 changed files with 12 additions and 42 deletions
  1. 0 41
      src/views/achievement/index.vue
  2. 12 1
      src/views/home/index.vue

+ 0 - 41
src/views/achievement/index.vue

@@ -4,13 +4,6 @@
       <el-col :span="24" class="main animate__animated animate__backInRight">
         <el-col :span="24" class="iachievement">
           <el-image class="image" :src="achievement" fit="fill" />
-          <div class="input">
-            <a-input v-model:value="searchValue" placeholder="请输入想要搜索的内容">
-              <template #suffix>
-                <SearchOutlined :style="{ fontSize: '30px', color: '#ffffff' }" />
-              </template>
-            </a-input>
-          </div>
         </el-col>
         <div class="w_1200">
           <el-col :span="24" class="one">
@@ -80,7 +73,6 @@
 </template>
 
 <script setup>
-import { SearchOutlined } from '@ant-design/icons-vue'
 import { get } from 'lodash-es'
 const $checkRes = inject('$checkRes')
 // 接口
@@ -94,7 +86,6 @@ const router = useRouter()
 import achievement from '@/assets/home.jpg'
 // 加载中
 const loading = ref(false)
-const searchValue = ref('')
 const searchForm = ref({})
 // 列表
 const list = ref([])
@@ -258,42 +249,10 @@ const sizeChange = (limits) => {
   background: rgb(248, 248, 248);
 
   .iachievement {
-    position: relative;
-
     .image {
       width: 100%;
       height: 200px;
     }
-
-    .input {
-      width: 800px;
-      position: absolute;
-      left: 30%;
-      bottom: 40%;
-
-      :deep(.ant-input-affix-wrapper) {
-        background-color: transparent;
-        border: 3px solid #fff !important;
-      }
-
-      :deep(.ant-input) {
-        height: 45px;
-        line-height: 45px;
-        font-family: PingFangSC-Regular;
-        font-size: 16px;
-        padding-right: 24px;
-
-        border: none !important;
-        outline: none !important;
-        box-shadow: 0 0 0 0 !important;
-        text-shadow: 0 0 0 0 !important;
-        background-color: transparent !important;
-
-        &::placeholder {
-          color: #ffffff !important;
-        }
-      }
-    }
   }
 
   .one {

+ 12 - 1
src/views/home/index.vue

@@ -7,7 +7,10 @@
           <div class="input">
             <a-input v-model:value="searchValue" placeholder="请输入想要搜索的内容">
               <template #suffix>
-                <SearchOutlined :style="{ fontSize: '30px', color: '#ffffff' }" />
+                <SearchOutlined
+                  @click="onSearch(searchValue)"
+                  :style="{ fontSize: '30px', color: '#ffffff' }"
+                />
               </template>
             </a-input>
           </div>
@@ -317,6 +320,8 @@ import science9 from '@/assets/science9.png'
 import news from '@/assets/news.jpg'
 // 加载中
 const loading = ref(false)
+// 搜索
+const searchValue = ref('')
 const active = ref('0')
 const typeList = ref([
   { url: science_1, icon: science1, title: '生物技术', type: '0' },
@@ -484,6 +489,12 @@ const removeHtmlStyle = (html) => {
   }
   return newHtml
 }
+// 搜索
+const onSearch = (data) => {
+  const query = { type: 'search' }
+  if (data) query.searchValue = data
+  router.push({ path: '/search', query })
+}
 </script>
 <style scoped lang="scss">
 .main {