Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加了查成绩过滤器的记忆功能 #14

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions src/views/Score.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
* @LastEditTime: 2023-05-15 10:38:36
* @Description:
* _(:з」∠)_

* Modified by: CharlesHsu
* @Date: 2023-06-28
* @Description:
* 添加了一个没啥用的记忆功能
-->
<script setup lang="ts">
import router from '@/router';
Expand Down Expand Up @@ -249,8 +254,9 @@ function GetList() {
}

}
course_type.filter = course_type_tmp.concat();
course_time.filter = course_time_tmp.concat();
const storedValues = JSON.parse(localStorage.getItem(user.sid + 'courseFilters') || '{}');
course_type.filter = storedValues.courseTypeFilter || course_type_tmp.concat();
course_time.filter = storedValues.courseTimeFilter || course_time_tmp.concat();
Filter();
})
}
Expand Down Expand Up @@ -288,16 +294,25 @@ watch(() => webvpn.cookie, () => {
GetList();
})

watch([() => course_type.filter, () => course_time.filter], () => {
const filters = {
id: user.sid,
courseTypeFilter: course_type.filter,
courseTimeFilter: course_time.filter,
};
localStorage.setItem(user.sid + 'courseFilters', JSON.stringify(filters));
});
</script>

<template>
<div class="container">
<n-card title="成寄查询">
<n-space vertical v-if="!webvpn.cookie">
<n-input :input-props="{id:'sid'}" v-model:value="user.sid" type="number" placeholder="学号" />
<n-input :input-props="{id:'password'}" v-model:value="user.password" type="password" show-password-on="click" placeholder="学校统一身份认证密码" />
<n-button id="submit" @click="WebvpnVerify(user.sid, user.password)" :disabled="!user.sid || !user.password || webvpn.loading"
block :loading="webvpn.loading">
<n-input :input-props="{ id: 'sid' }" v-model:value="user.sid" type="number" placeholder="学号" />
<n-input :input-props="{ id: 'password' }" v-model:value="user.password" type="password" show-password-on="click"
placeholder="学校统一身份认证密码" />
<n-button id="submit" @click="WebvpnVerify(user.sid, user.password)"
:disabled="!user.sid || !user.password || webvpn.loading" block :loading="webvpn.loading">
Comment on lines +311 to +315

This comment was marked as resolved.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,我使用VScode会自动格式化我的代码:D

查询
</n-button>
</n-space>
Expand Down Expand Up @@ -344,4 +359,4 @@ watch(() => webvpn.cookie, () => {
</n-scrollbar>
</n-modal>
</div>
</template>
</template>