feat: 凭据刷新时记录本月学时和有效状态
This commit is contained in:
@@ -9,6 +9,7 @@ interface UserRow {
|
||||
refresh_paused: boolean;
|
||||
last_refresh_at: string | null;
|
||||
credential_valid: boolean | null;
|
||||
month_hours: string;
|
||||
}
|
||||
|
||||
interface SecretField {
|
||||
@@ -66,6 +67,7 @@ function asUser(value: unknown): UserRow | null {
|
||||
refresh_paused: value.refresh_paused === true,
|
||||
last_refresh_at: typeof value.last_refresh_at === "string" && value.last_refresh_at ? value.last_refresh_at : null,
|
||||
credential_valid: readValid(value.credential_valid),
|
||||
month_hours: textOf(value.month_hours),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -86,8 +88,8 @@ function checkLabel(payload: Record<string, unknown>) {
|
||||
|
||||
function validityText(row: UserRow) {
|
||||
const live = liveResults.value[row.employee_id];
|
||||
if (live) return live;
|
||||
if (row.refresh_paused) return "未检查";
|
||||
if (live === "检查失败") return live;
|
||||
if (!row.has_credential) return "未保存凭证";
|
||||
if (row.credential_valid === true) return "有效";
|
||||
if (row.credential_valid === false) return "已失效";
|
||||
return "未检查";
|
||||
@@ -325,6 +327,7 @@ onMounted(() => {
|
||||
<th>工号</th>
|
||||
<th>凭证</th>
|
||||
<th>凭据是否有效</th>
|
||||
<th>本月学时</th>
|
||||
<th>上次刷新时间</th>
|
||||
<th>自动刷新</th>
|
||||
<th>操作</th>
|
||||
@@ -335,6 +338,7 @@ onMounted(() => {
|
||||
<td class="employee">{{ row.employee_id }}</td>
|
||||
<td>{{ row.has_credential ? "已保存凭证" : "未保存凭证" }}</td>
|
||||
<td :class="validityClass(validityText(row))">{{ validityText(row) }}</td>
|
||||
<td class="when">{{ row.month_hours || "—" }}</td>
|
||||
<td class="when">{{ formatRefreshTime(row.last_refresh_at) }}</td>
|
||||
<td>{{ row.refresh_paused ? "已停止" : "开启" }}</td>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user