增加搜索功能

This commit is contained in:
Silent YANG 2024-10-09 22:51:35 +08:00
parent 3e7bb8e3ad
commit 14068b1920
3 changed files with 61 additions and 12 deletions

View file

@ -3,7 +3,17 @@
<Breadcrumb :items="[$t('menu.workshop'), $t('menu.channel')]" />
<a-row :gutter="20" align="stretch">
<a-col :span="24">
<a-card class="general-card" :title="$t('menu.channel')">
<a-card class="general-card">
<template #title>
<div style="display: flex; gap: 1rem; align-items: flex-end;">
{{ $t('menu.channel') }}
<t-input size="small" style="width: 200px;" v-model="state.title" @enter="searchIt">
<template #suffixIcon>
<search-icon :style="{ cursor: 'pointer' }" @click="searchIt"/>
</template>
</t-input>
</div>
</template>
<template #extra>
<div style="margin-right: 20px;">
<template v-if="userStore.name">
@ -105,6 +115,7 @@
import { RefreshIcon } from 'tdesign-icons-vue-next';
import axios from 'axios';
import { Message } from '@arco-design/web-vue';
import { SearchIcon } from 'tdesign-icons-vue-next';
const appStore = useAppStore();
const userStore = useUserStore();
@ -120,7 +131,8 @@
myList: any,
total: number,
page: number,
nowpage: any
nowpage: any,
title: string
} = reactive({
binaryFile: undefined,
loading: false,
@ -130,7 +142,8 @@
myList: [],
total: 0,
page: 1,
nowpage: []
nowpage: [],
title: ''
})
const formData = reactive({
@ -145,7 +158,7 @@
const loadit = async (page: any) => {
state.page = page.current
const resp : any = await axios.get("https://k5ws.vicicode.cn/api/channel/index?server=1&limit=12&page=" + page.current + "&t=" + Date.now())
const resp : any = await axios.get("https://k5ws.vicicode.cn/api/channel/index?server=1&limit=12&page=" + page.current + "&title=" + state.title + "&t=" + Date.now())
state.total = resp.data.total
state.nowpage = resp.data.list
}
@ -237,6 +250,9 @@ const iDownload = (url: any, name: any) => {
})
}
const searchIt = () => {
loadit({current: 1})
}
</script>
<script lang="ts">

View file

@ -3,7 +3,17 @@
<Breadcrumb :items="[$t('menu.workshop'), $t('menu.firmware')]" />
<a-row :gutter="20" align="stretch">
<a-col :span="24">
<a-card class="general-card" :title="$t('menu.firmware')">
<a-card class="general-card">
<template #title>
<div style="display: flex; gap: 1rem; align-items: flex-end;">
{{ $t('menu.firmware') }}
<t-input size="small" style="width: 200px;" v-model="state.title" @enter="searchIt">
<template #suffixIcon>
<search-icon :style="{ cursor: 'pointer' }" @click="searchIt"/>
</template>
</t-input>
</div>
</template>
<template #extra>
<div style="margin-right: 20px;">
<template v-if="userStore.name">
@ -105,6 +115,7 @@
import { RefreshIcon } from 'tdesign-icons-vue-next';
import axios from 'axios';
import { Message } from '@arco-design/web-vue';
import { SearchIcon } from 'tdesign-icons-vue-next';
const appStore = useAppStore();
const userStore = useUserStore();
@ -120,7 +131,8 @@
myList: any,
total: number,
page: number,
nowpage: any
nowpage: any,
title: string
} = reactive({
binaryFile: undefined,
loading: false,
@ -130,7 +142,8 @@
myList: [],
total: 0,
page: 1,
nowpage: []
nowpage: [],
title: ''
})
const formData = reactive({
@ -145,7 +158,7 @@
const loadit = async (page: any) => {
state.page = page.current
const resp : any = await axios.get("https://k5ws.vicicode.cn/api/firmware/index?server=1&limit=12&page=" + page.current + "&t=" + Date.now())
const resp : any = await axios.get("https://k5ws.vicicode.cn/api/firmware/index?server=1&limit=12&page=" + page.current + "&title=" + state.title + "&t=" + Date.now())
state.total = resp.data.total
state.nowpage = resp.data.list
}
@ -237,6 +250,9 @@
})
}
const searchIt = () => {
loadit({current: 1})
}
</script>
<script lang="ts">

View file

@ -3,7 +3,17 @@
<Breadcrumb :items="[$t('menu.workshop'), $t('menu.image')]" />
<a-row :gutter="20" align="stretch">
<a-col :span="24">
<a-card class="general-card" :title="$t('menu.image')">
<a-card class="general-card">
<template #title>
<div style="display: flex; gap: 1rem; align-items: flex-end;">
{{ $t('menu.image') }}
<t-input size="small" style="width: 200px;" v-model="state.title" @enter="searchIt">
<template #suffixIcon>
<search-icon :style="{ cursor: 'pointer' }" @click="searchIt"/>
</template>
</t-input>
</div>
</template>
<template #extra>
<div style="margin-right: 20px;">
<template v-if="userStore.name">
@ -115,6 +125,7 @@
import axios from 'axios';
import { Message } from '@arco-design/web-vue';
import { RefreshIcon } from 'tdesign-icons-vue-next';
import { SearchIcon } from 'tdesign-icons-vue-next';
const appStore = useAppStore();
const userStore = useUserStore();
@ -131,7 +142,8 @@
total: number,
page: number,
nowpage: any,
dropzoneActive: boolean
dropzoneActive: boolean,
title: string
} = reactive({
binaryFile: undefined,
loading: false,
@ -142,7 +154,8 @@
total: 0,
page: 1,
nowpage: [],
dropzoneActive: false
dropzoneActive: false,
title: ''
})
const dragEnter = (event: any) => {
@ -196,7 +209,7 @@
const loadit = async (page: any) => {
state.page = page.current
const resp : any = await axios.get("https://k5ws.vicicode.cn/api/image/index?server=1&limit=24&page=" + page.current + "&t=" + Date.now())
const resp : any = await axios.get("https://k5ws.vicicode.cn/api/image/index?server=1&limit=24&page=" + page.current + "&title=" + state.title + "&t=" + Date.now())
state.total = resp.data.total
state.nowpage = resp.data.list
}
@ -275,6 +288,10 @@
}
});
}
const searchIt = () => {
loadit({current: 1})
}
</script>
<script lang="ts">