feat: 打包

This commit is contained in:
王天骄
2026-06-05 16:22:25 +08:00
parent d962ab98f5
commit 23550c3828
28 changed files with 86 additions and 29 deletions
+52 -10
View File
@@ -112,7 +112,10 @@
<text class="picker-close" @click="institutionPickerVisible = false">关闭</text>
</view>
<scroll-view class="institution-list" scroll-y>
<view v-if="institutionLoading" class="institution-empty">机构列表加载中...</view>
<view v-else-if="institutions.length === 0" class="institution-empty">暂无可选机构</view>
<view
v-else
v-for="institution in institutions"
:key="institution.id"
class="institution-item"
@@ -133,8 +136,8 @@
</template>
<script setup lang="ts">
import { computed, nextTick, onUnmounted, reactive, ref } from 'vue'
import { ApiRequestError, loginWithCode, sendLoginCode } from '../../api/auth'
import { computed, nextTick, onMounted, onUnmounted, reactive, ref } from 'vue'
import { ApiRequestError, fetchInstitutions, loginWithCode, sendLoginCode, type InstitutionRecord } from '../../api/auth'
import ConfigPage from '../config/config.vue'
import ProfilePage from '../profile/profile.vue'
@@ -146,13 +149,7 @@ type Institution = {
typeName: string
}
const institutions: Institution[] = [
{ id: 'H001', code: 'H001', name: '协和医学院', city: '北京', typeName: '医学院校' },
{ id: 'H002', code: 'H002', name: '四川大学华西医院', city: '成都', typeName: '三甲医院' },
{ id: 'H003', code: 'H003', name: '复旦大学附属中山医院', city: '上海', typeName: '三甲医院' },
{ id: 'H004', code: 'H004', name: '中山大学孙逸仙纪念医院', city: '广州', typeName: '三甲医院' },
{ id: 'OTHER', code: 'OTHER', name: '其他机构', city: '其他', typeName: '手动登记' }
]
const institutions = ref<Institution[]>([])
const form = reactive({
phone: '',
@@ -171,12 +168,14 @@ const toastVisible = ref(false)
const showConfigPage = ref(false)
const showProfilePage = ref(false)
const institutionPickerVisible = ref(false)
const institutionLoading = ref(false)
const institutionLoaded = ref(false)
let countdownTimer: ReturnType<typeof setInterval> | null = null
let toastTimer: ReturnType<typeof setTimeout> | null = null
const selectedInstitution = computed(() => {
return institutions.find(item => item.id === form.institutionId)
return institutions.value.find(item => item.id === form.institutionId)
})
const isCounting = computed(() => countdown.value > 0)
@@ -191,6 +190,37 @@ function chooseInstitution(institution: Institution) {
institutionPickerVisible.value = false
}
function normalizeInstitution(item: InstitutionRecord): Institution {
const typeNameMap: Record<string, string> = {
hospital: '医院',
college: '医学院校',
school: '学校',
clinic: '诊所'
}
const region = [item.province, item.city].filter(Boolean).join(' · ')
return {
id: String(item.id),
code: item.code,
name: item.name,
city: region || '其他',
typeName: typeNameMap[item.type] || '机构'
}
}
async function loadInstitutions() {
institutionLoading.value = true
try {
const result = await fetchInstitutions()
institutions.value = result.map(normalizeInstitution)
} catch (error) {
showToast(error instanceof Error ? error.message : '机构列表加载失败')
institutions.value = []
} finally {
institutionLoading.value = false
institutionLoaded.value = true
}
}
function toggleAgreement() {
agreed.value = !agreed.value
}
@@ -220,6 +250,10 @@ async function handleSendCode() {
}
}
onMounted(() => {
void loadInstitutions()
})
function handleLogin() {
if (submitting.value) return
if (!validatePhone()) return
@@ -727,6 +761,14 @@ page {
margin-top: 8px;
}
.institution-empty {
padding: 20px 4px;
color: #727783;
font-size: 14px;
line-height: 20px;
text-align: center;
}
.institution-item {
box-sizing: border-box;
min-height: 64px;