feat(profile): refine student creation workflow
This commit is contained in:
@@ -8,13 +8,13 @@ import {
|
||||
import { addMinutes, formatUpdatedAt } from '../../utils/time'
|
||||
import type { StudentDraft, StudentProfile, StudentProfileDefaults, Term } from '../../utils/types'
|
||||
|
||||
const grades = ['艺术类', '幼儿园', '一年级', '二年级', '三年级', '四年级', '五年级', '六年级']
|
||||
const grades = ['初一', '初二', '初三']
|
||||
const subjects = ['美术', '书法', '音乐', '舞蹈', '语文', '数学', '英语']
|
||||
const terms: Term[] = ['春', '暑', '秋', '寒']
|
||||
const years = Array.from({ length: 5 }, (_, index) => new Date().getFullYear() - 1 + index)
|
||||
const initialDefaults: StudentProfileDefaults = {
|
||||
grade: '艺术类',
|
||||
subject: '美术',
|
||||
grade: '初一',
|
||||
subject: '数学',
|
||||
lessonDurationMinutes: 60
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ Page({
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.getTabBar()?.setData({ selected: 1 })
|
||||
this.getTabBar()?.setData({ selected: 1, visible: !this.data.sheetVisible })
|
||||
void this.refreshProfiles()
|
||||
if (this.data.sheetVisible && this.data.refreshDraftFromDefaults) {
|
||||
void this.refreshDraftDefaults()
|
||||
@@ -172,6 +172,7 @@ Page({
|
||||
guardianAuto: true,
|
||||
draft: buildDraft()
|
||||
})
|
||||
this.getTabBar()?.setData({ visible: false })
|
||||
await this.refreshDraftDefaults()
|
||||
},
|
||||
|
||||
@@ -193,6 +194,7 @@ Page({
|
||||
|
||||
closeCreate() {
|
||||
this.setData({ sheetVisible: false })
|
||||
this.getTabBar()?.setData({ visible: true })
|
||||
},
|
||||
|
||||
noop() {},
|
||||
@@ -273,6 +275,7 @@ Page({
|
||||
lastUpdatedText: formatUpdatedAt(profile.updatedAt),
|
||||
errorMessage: ''
|
||||
})
|
||||
this.getTabBar()?.setData({ visible: true })
|
||||
wx.showToast({ title: '学生档案已保存', icon: 'success' })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: getApiErrorMessage(error), icon: 'none' })
|
||||
|
||||
Reference in New Issue
Block a user