mirror of
https://github.com/Cccc-owo/CheckInApp.git
synced 2026-06-17 05:56:29 +00:00
feat: add tips
This commit is contained in:
@@ -1,6 +1,76 @@
|
|||||||
<template>
|
<template>
|
||||||
<Layout>
|
<Layout>
|
||||||
<div class="dashboard-container">
|
<div class="dashboard-container">
|
||||||
|
<!-- 邮箱未设置提醒 -->
|
||||||
|
<a-alert
|
||||||
|
v-if="!authStore.user?.email"
|
||||||
|
message="您还未设置邮箱地址"
|
||||||
|
type="info"
|
||||||
|
:closable="true"
|
||||||
|
show-icon
|
||||||
|
style="margin-bottom: 20px"
|
||||||
|
>
|
||||||
|
<template #description>
|
||||||
|
<div>
|
||||||
|
设置邮箱后可以接收打卡任务的通知和提醒。
|
||||||
|
<a style="margin-left: 8px; cursor: pointer" @click="goToSettings"> 立即前往设置 → </a>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</a-alert>
|
||||||
|
|
||||||
|
<!-- 密码未设置提醒 -->
|
||||||
|
<a-alert
|
||||||
|
v-if="!authStore.user?.has_password"
|
||||||
|
message="您还未设置登录密码"
|
||||||
|
type="info"
|
||||||
|
:closable="true"
|
||||||
|
show-icon
|
||||||
|
style="margin-bottom: 20px"
|
||||||
|
>
|
||||||
|
<template #description>
|
||||||
|
<div>
|
||||||
|
设置密码后可以使用用户名+密码快速登录。
|
||||||
|
<a style="margin-left: 8px; cursor: pointer" @click="goToSettings"> 立即前往设置 → </a>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</a-alert>
|
||||||
|
|
||||||
|
<!-- Token 已过期提醒 -->
|
||||||
|
<a-alert
|
||||||
|
v-if="tokenStatus && !tokenStatus.is_valid"
|
||||||
|
message="打卡凭证已过期"
|
||||||
|
type="warning"
|
||||||
|
:closable="true"
|
||||||
|
show-icon
|
||||||
|
style="margin-bottom: 20px"
|
||||||
|
>
|
||||||
|
<template #description>
|
||||||
|
<div>
|
||||||
|
打卡凭证已过期,无法自动打卡。请扫码刷新 Token。
|
||||||
|
<a style="margin-left: 8px; cursor: pointer" @click="qrcodeModalVisible = true">
|
||||||
|
立即刷新 →
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</a-alert>
|
||||||
|
|
||||||
|
<!-- 没有打卡任务提醒 -->
|
||||||
|
<a-alert
|
||||||
|
v-if="!taskStore.loading && taskStore.tasks.length === 0"
|
||||||
|
message="您还没有打卡任务"
|
||||||
|
type="info"
|
||||||
|
:closable="true"
|
||||||
|
show-icon
|
||||||
|
style="margin-bottom: 20px"
|
||||||
|
>
|
||||||
|
<template #description>
|
||||||
|
<div>
|
||||||
|
创建您的第一个打卡任务,开启自动打卡之旅。
|
||||||
|
<a style="margin-left: 8px; cursor: pointer" @click="goToTasks"> 立即创建 → </a>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</a-alert>
|
||||||
|
|
||||||
<a-row :gutter="[20, 20]">
|
<a-row :gutter="[20, 20]">
|
||||||
<!-- Token 状态卡片 -->
|
<!-- Token 状态卡片 -->
|
||||||
<a-col :xs="24" :sm="24" :md="24">
|
<a-col :xs="24" :sm="24" :md="24">
|
||||||
@@ -199,6 +269,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { ref, computed, onMounted } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import { CalendarOutlined, KeyOutlined, UserOutlined, ReloadOutlined } from '@ant-design/icons-vue';
|
import { CalendarOutlined, KeyOutlined, UserOutlined, ReloadOutlined } from '@ant-design/icons-vue';
|
||||||
import Layout from '@/components/Layout.vue';
|
import Layout from '@/components/Layout.vue';
|
||||||
@@ -210,6 +281,7 @@ import { useCheckInStore } from '@/stores/checkIn';
|
|||||||
import { formatDateTime } from '@/utils/helpers';
|
import { formatDateTime } from '@/utils/helpers';
|
||||||
import { usePollStatus } from '@/composables/usePollStatus';
|
import { usePollStatus } from '@/composables/usePollStatus';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const taskStore = useTaskStore();
|
const taskStore = useTaskStore();
|
||||||
@@ -258,6 +330,16 @@ const formatRemainTime = computed(() => {
|
|||||||
return `${minutes} 分钟`;
|
return `${minutes} 分钟`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 跳转到设置页面
|
||||||
|
const goToSettings = () => {
|
||||||
|
router.push('/settings');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 跳转到任务页面
|
||||||
|
const goToTasks = () => {
|
||||||
|
router.push('/tasks');
|
||||||
|
};
|
||||||
|
|
||||||
// 获取 Token 状态
|
// 获取 Token 状态
|
||||||
const fetchTokenStatus = async () => {
|
const fetchTokenStatus = async () => {
|
||||||
tokenStatusLoading.value = true;
|
tokenStatusLoading.value = true;
|
||||||
@@ -356,6 +438,14 @@ const handleQRCodeError = errorMsg => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
// 刷新用户信息,确保 email 和 has_password 是最新的
|
||||||
|
try {
|
||||||
|
await authStore.fetchCurrentUser();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('刷新用户信息失败:', error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取 Token 状态
|
||||||
fetchTokenStatus();
|
fetchTokenStatus();
|
||||||
checkInStore.fetchMyRecords({ limit: 1 });
|
checkInStore.fetchMyRecords({ limit: 1 });
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ const handlePasswordLogin = async () => {
|
|||||||
if (response.token_warning && response.warning_message) {
|
if (response.token_warning && response.warning_message) {
|
||||||
message.warning({
|
message.warning({
|
||||||
content: response.warning_message,
|
content: response.warning_message,
|
||||||
duration: 5,
|
duration: 2,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
message.success(`欢迎回来,${response.user.alias}!`);
|
message.success(`欢迎回来,${response.user.alias}!`);
|
||||||
|
|||||||
@@ -255,7 +255,10 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item label="接龙 ID" name="thread_id" required>
|
<a-form-item label="接龙 ID" name="thread_id" required>
|
||||||
<a-input v-model:value="templateTaskForm.thread_id" placeholder="请输入接龙项目 ID" />
|
<a-input
|
||||||
|
v-model:value="templateTaskForm.thread_id"
|
||||||
|
placeholder="请输入接龙项目 ID(ThreadID) | 如果你不知道这是什么,请询问管理员"
|
||||||
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item label="打卡时间表">
|
<a-form-item label="打卡时间表">
|
||||||
|
|||||||
Reference in New Issue
Block a user