Skip to content

Commit

Permalink
feat(dataDisplay): 增加了搜索和近期筛选功能 (#52)
Browse files Browse the repository at this point in the history
* feat(dataDisplay): 增加了搜索和近期筛选功能

* feat(CD):新增CD workflows

* feat(CI):为dev新增CI workflows

* fix(node): CD node版本降级

* fix

* feat(axios):新增axios依赖 (#49)

* style:优化代码格式

* feat(axios):新增axios依赖

* fix(CD):修复github_token失效的问题

* test(CD):测试CD

* Update package.json

* Update package.json

* Update package.json

* Update package.json

* Update package.json

* Update cd.yml

* Update package.json

* Update axios.ts

* Update package.json

* feat(dataDisplay): 增加了搜索和近期筛选功能

* fix(apis): 修改为代理

---------

Co-authored-by: 离谱 <144224541+xixiIBN5100@users.noreply.github.com>

* Update package.json

---------

Co-authored-by: RosyrRais <145672957+RosyrRais@users.noreply.github.com>
  • Loading branch information
xixiIBN5100 and RosyrRais authored Aug 13, 2024
1 parent ee90de2 commit 159ae60
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "text-ci",
"version": "0.1.0",
"version": "0.1.1",
"private": true,
"type": "module",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions src/apis/service/DataDisplay/getAnswersAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const getAnswersAPI = (data:{
id:number,
page_num: number,
page_size: number,
text?: string,
unique: boolean,
}) => {
return request("/api/admin/list/answers", {
params: data,
Expand Down
20 changes: 16 additions & 4 deletions src/pages/DataDisplay/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
</div>
<div class="btn btn-sm btn-accent" @click="downloadDatatable">下载数据表格</div>
<div class="btn btn-sm btn-accent" @click="switchCount">统计切换</div>
<div class="btn btn-sm" :class="isUnique ? 'btn-neutral' : 'btn-accent'" @click="changeUnique">展示近期</div>
<span>搜索</span><input class="input input-sm input-bordered" type="text" v-model="keyText">
</div>
<div class="overflow-x-auto">
<!-- 填空数据展示 -->
Expand All @@ -37,7 +39,7 @@
layout="prev, pager, next"
:page-count="totalPageNum"
@current-change="handleCurrentChange"
v-show="!isCount"
v-show="!isCount"
/>
<div class="gap-8 m-5 grid grid-cols-2 mt-30" v-show="isCount">
<n-card v-for="obj in staticsData" v-bind:key='obj'>
Expand All @@ -58,7 +60,7 @@

<script setup lang="ts">
import { getAnswersAPI, getDatatableAPI, getStaticsDataAPI } from '@/apis';
import {onMounted, ref} from 'vue';
import {onMounted, ref, watch} from 'vue';
import { useRequest } from 'vue-hooks-plus';
import router from '@/router';
import {ElNotification, ElPagination} from 'element-plus';
Expand All @@ -75,6 +77,8 @@ const time = ref();
const staticsData = ref();
const totalNum = ref();
const isCount = ref(false);
const isUnique = ref(false);
const keyText = ref("");
onMounted(() => {
getAnswers();
Expand All @@ -84,8 +88,12 @@ const getAnswers = () => {
id: tempStore.checkId,
page_num: pageNum.value,
page_size: pageSize.value,
text: keyText.value === "" ? undefined : keyText.value,
unique: isUnique.value,
}), {
debounceWait: 500,
onSuccess(res: any) {
console.log(res);
if(res.code === 200) {
totalPageNum.value = res.data.total_page_num;
answers.value = res.data.answers_data.question_answers;
Expand All @@ -94,7 +102,7 @@ const getAnswers = () => {
},
onError(e: any) {
ElNotification.error('获取失败,请重试' + e);
}
},
})
useRequest(() => getStaticsDataAPI({
id: tempStore.checkId,
Expand All @@ -103,7 +111,6 @@ const getAnswers = () => {
}), {
onSuccess(res: any) {
if(res.code === 200) {
console.log(res.data)
staticsData.value = res.data.statistics;
totalNum.value = res.data.total;
}
Expand All @@ -114,6 +121,11 @@ const getAnswers = () => {
})
}
watch(keyText, getAnswers);
watch(isUnique, getAnswers);
const changeUnique = () => { isUnique.value = !isUnique.value; }
const handleCurrentChange = (val: number) => {
pageNum.value = val;
Expand Down

0 comments on commit 159ae60

Please sign in to comment.