style: index page
This commit is contained in:
@@ -44,7 +44,7 @@ export interface MeasurementStation {
|
||||
values: Record<string, any>
|
||||
}
|
||||
|
||||
function createDefaultUserProfile(): UserProfile {
|
||||
function createDefaultUserProfile (): UserProfile {
|
||||
return {
|
||||
name: '林建國',
|
||||
birthday: '1961-08-15',
|
||||
@@ -59,7 +59,7 @@ function createDefaultUserProfile(): UserProfile {
|
||||
}
|
||||
}
|
||||
|
||||
function createDefaultSelfAssessment(): SelfAssessment {
|
||||
function createDefaultSelfAssessment (): SelfAssessment {
|
||||
return {
|
||||
exerciseFrequency: '1-2',
|
||||
painLevel: '輕微',
|
||||
@@ -72,7 +72,7 @@ function createDefaultSelfAssessment(): SelfAssessment {
|
||||
}
|
||||
}
|
||||
|
||||
function createDefaultAppointments(): Appointment[] {
|
||||
function createDefaultAppointments (): Appointment[] {
|
||||
return [
|
||||
{
|
||||
id: 'apt-01',
|
||||
@@ -122,7 +122,7 @@ function createDefaultAppointments(): Appointment[] {
|
||||
]
|
||||
}
|
||||
|
||||
function createDefaultMeasurements(): Record<string, MeasurementStation> {
|
||||
function createDefaultMeasurements (): Record<string, MeasurementStation> {
|
||||
return {
|
||||
BloodPressure: {
|
||||
name: '血壓量測',
|
||||
@@ -184,7 +184,7 @@ function createDefaultMeasurements(): Record<string, MeasurementStation> {
|
||||
}
|
||||
}
|
||||
|
||||
function createDefaultRadarData() {
|
||||
function createDefaultRadarData () {
|
||||
return {
|
||||
strength: 65,
|
||||
balance: 60,
|
||||
@@ -205,7 +205,7 @@ export const useAppStore = defineStore('app', () => {
|
||||
const isReportGenerated = ref(false)
|
||||
|
||||
const completedStationsCount = computed(() => {
|
||||
return Object.values(measurements.value).filter((station) => station.completed).length
|
||||
return Object.values(measurements.value).filter(station => station.completed).length
|
||||
})
|
||||
|
||||
const totalStationsCount = computed(() => {
|
||||
@@ -218,24 +218,24 @@ export const useAppStore = defineStore('app', () => {
|
||||
return 0
|
||||
}
|
||||
|
||||
const done = Object.values(measurements.value).filter((station) => station.completed).length
|
||||
const done = Object.values(measurements.value).filter(station => station.completed).length
|
||||
return Math.round((done / keys.length) * 100)
|
||||
})
|
||||
|
||||
function login(phone: string) {
|
||||
function login (phone: string) {
|
||||
isLoggedIn.value = true
|
||||
userProfile.value.phone = phone
|
||||
}
|
||||
|
||||
function logout() {
|
||||
function logout () {
|
||||
isLoggedIn.value = false
|
||||
}
|
||||
|
||||
function updateProfile(profile: Partial<UserProfile>) {
|
||||
function updateProfile (profile: Partial<UserProfile>) {
|
||||
userProfile.value = { ...userProfile.value, ...profile }
|
||||
}
|
||||
|
||||
function submitSelfAssessment(answers: Partial<SelfAssessment>) {
|
||||
function submitSelfAssessment (answers: Partial<SelfAssessment>) {
|
||||
selfAssessment.value = {
|
||||
...selfAssessment.value,
|
||||
...answers,
|
||||
@@ -248,9 +248,9 @@ export const useAppStore = defineStore('app', () => {
|
||||
}
|
||||
|
||||
if (
|
||||
answers.painLevel === '中度' ||
|
||||
answers.painLevel === '重度' ||
|
||||
(answers.chronicDiseases && answers.chronicDiseases.length >= 2)
|
||||
answers.painLevel === '中度'
|
||||
|| answers.painLevel === '重度'
|
||||
|| (answers.chronicDiseases && answers.chronicDiseases.length >= 2)
|
||||
) {
|
||||
level = '建議諮詢'
|
||||
}
|
||||
@@ -258,8 +258,8 @@ export const useAppStore = defineStore('app', () => {
|
||||
selfAssessment.value.scoreLevel = level
|
||||
}
|
||||
|
||||
function registerAppointment(appointmentId: string) {
|
||||
const appointment = appointments.value.find((item) => item.id === appointmentId)
|
||||
function registerAppointment (appointmentId: string) {
|
||||
const appointment = appointments.value.find(item => item.id === appointmentId)
|
||||
if (!appointment) {
|
||||
return
|
||||
}
|
||||
@@ -268,8 +268,8 @@ export const useAppStore = defineStore('app', () => {
|
||||
appointment.slots -= 1
|
||||
}
|
||||
|
||||
function cancelAppointment(appointmentId: string) {
|
||||
const appointment = appointments.value.find((item) => item.id === appointmentId)
|
||||
function cancelAppointment (appointmentId: string) {
|
||||
const appointment = appointments.value.find(item => item.id === appointmentId)
|
||||
if (!appointment) {
|
||||
return
|
||||
}
|
||||
@@ -278,8 +278,8 @@ export const useAppStore = defineStore('app', () => {
|
||||
appointment.slots += 1
|
||||
}
|
||||
|
||||
function checkinAppointment(appointmentId: string) {
|
||||
const appointment = appointments.value.find((item) => item.id === appointmentId)
|
||||
function checkinAppointment (appointmentId: string) {
|
||||
const appointment = appointments.value.find(item => item.id === appointmentId)
|
||||
if (!appointment) {
|
||||
return
|
||||
}
|
||||
@@ -287,7 +287,7 @@ export const useAppStore = defineStore('app', () => {
|
||||
appointment.status = '已報到'
|
||||
}
|
||||
|
||||
function saveMeasurement(code: string, values: Record<string, any>) {
|
||||
function saveMeasurement (code: string, values: Record<string, any>) {
|
||||
const measurement = measurements.value[code]
|
||||
if (!measurement) {
|
||||
return
|
||||
@@ -301,15 +301,15 @@ export const useAppStore = defineStore('app', () => {
|
||||
measurement.time = timeStr
|
||||
}
|
||||
|
||||
function generateFinalReport() {
|
||||
function generateFinalReport () {
|
||||
const currentMeasurements = measurements.value
|
||||
|
||||
let strScore = 65
|
||||
if (currentMeasurements.GripStrength.completed) {
|
||||
const avgGrip =
|
||||
((currentMeasurements.GripStrength.values.leftHand || 0) +
|
||||
(currentMeasurements.GripStrength.values.rightHand || 0)) /
|
||||
2
|
||||
const avgGrip
|
||||
= ((currentMeasurements.GripStrength.values.leftHand || 0)
|
||||
+ (currentMeasurements.GripStrength.values.rightHand || 0))
|
||||
/ 2
|
||||
const limit = userProfile.value.gender === '男' ? 30 : 20
|
||||
strScore = Math.min(95, Math.max(50, Math.round((avgGrip / limit) * 75)))
|
||||
}
|
||||
@@ -318,7 +318,7 @@ export const useAppStore = defineStore('app', () => {
|
||||
if (currentMeasurements.OneLegTest.completed) {
|
||||
const maxSec = Math.max(
|
||||
currentMeasurements.OneLegTest.values.leftSeconds || 0,
|
||||
currentMeasurements.OneLegTest.values.rightSeconds || 0
|
||||
currentMeasurements.OneLegTest.values.rightSeconds || 0,
|
||||
)
|
||||
balScore = Math.min(98, Math.max(40, Math.round((maxSec / 30) * 90)))
|
||||
}
|
||||
@@ -354,7 +354,7 @@ export const useAppStore = defineStore('app', () => {
|
||||
isReportGenerated.value = true
|
||||
}
|
||||
|
||||
function resetMeasurements() {
|
||||
function resetMeasurements () {
|
||||
for (const [key, measurement] of Object.entries(measurements.value)) {
|
||||
if (key !== 'BloodPressure' && key !== 'BodyFat') {
|
||||
measurement.completed = false
|
||||
|
||||
Reference in New Issue
Block a user