fix(mobile): 登录页面医院选择移至第一位
This commit is contained in:
@@ -6,10 +6,6 @@
|
||||
<p>护士工作站</p>
|
||||
</div>
|
||||
<div class="login-form">
|
||||
<div class="form-item">
|
||||
<label>用户名</label>
|
||||
<input v-model="form.username" type="text" placeholder="请输入用户名" class="input" @blur="loadTenants" />
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label>医院/租户</label>
|
||||
<select v-model="form.tenantId" class="input" @change="onTenantChange">
|
||||
@@ -17,6 +13,10 @@
|
||||
<option v-for="t in tenantOptions" :key="t.value" :value="t.value">{{ t.label }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label>用户名</label>
|
||||
<input v-model="form.username" type="text" placeholder="请输入用户名" class="input" />
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label>密码</label>
|
||||
<input v-model="form.password" type="password" placeholder="请输入密码" class="input" @keyup.enter="handleLogin" />
|
||||
@@ -28,7 +28,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { authApi } from '../api'
|
||||
@@ -41,9 +41,8 @@ const currentTenantName = ref('')
|
||||
const form = ref({ username: '', password: '', tenantId: '' })
|
||||
|
||||
const loadTenants = async () => {
|
||||
if (!form.value.username) return
|
||||
try {
|
||||
const res = await authApi.getTenants(form.value.username)
|
||||
const res = await authApi.getTenants('')
|
||||
if (res.code === 200 && res.data) {
|
||||
tenantOptions.value = res.data.map(item => ({ label: item.tenantName, value: item.id }))
|
||||
if (tenantOptions.value.length === 1) { form.value.tenantId = tenantOptions.value[0].value; currentTenantName.value = tenantOptions.value[0].label }
|
||||
@@ -56,6 +55,8 @@ const onTenantChange = () => {
|
||||
currentTenantName.value = selected ? selected.label : ''
|
||||
}
|
||||
|
||||
onMounted(loadTenants)
|
||||
|
||||
const handleLogin = async () => {
|
||||
if (!form.value.username) { errorMsg.value = '请输入用户名'; return }
|
||||
if (!form.value.password) { errorMsg.value = '请输入密码'; return }
|
||||
|
||||
Reference in New Issue
Block a user