From ac4341ea6b66ae02427d39d35f41d42d78b2eb2e Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期五, 14 二月 2025 10:08:32 +0800 Subject: [PATCH] # --- zy-asrs-admin/src/views/login/LoginView.vue | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 40 insertions(+), 6 deletions(-) diff --git a/zy-asrs-admin/src/views/login/LoginView.vue b/zy-asrs-admin/src/views/login/LoginView.vue index f981e72..bc8e659 100644 --- a/zy-asrs-admin/src/views/login/LoginView.vue +++ b/zy-asrs-admin/src/views/login/LoginView.vue @@ -2,22 +2,26 @@ import { getCurrentInstance, inject, ref } from 'vue'; import { message } from 'ant-design-vue'; import { get, post } from '../../utils/request.js' +import { formatMessage } from '@/utils/localeUtils.js'; const context = getCurrentInstance()?.appContext.config.globalProperties; const globalState = inject('globalState'); let copyrightLargeShow = ref(false); let username = ref(""); let password = ref(""); +let hostId = ref(null); +let hostList = ref([]); function loginConfirm() { if (username.value == "" || password.value == "") { - message.info('璇疯緭鍏ヨ处鍙峰瘑鐮�!'); + message.info(formatMessage('login.input', '璇疯緭鍏ヨ处鍙峰瘑鐮�!')); return; } post('/api/login', { username: username.value, - password: password.value + password: password.value, + hostId: hostId.value, }).then((result) => { if (result.data.code == 200) { let data = result.data.data; @@ -25,12 +29,37 @@ globalState.user = data.user; localStorage.setItem('token', data.accessToken) localStorage.setItem('user', JSON.stringify(data.user)) - message.success('鐧诲綍鎴愬姛') + message.success(formatMessage('login.success', '鐧诲綍鎴愬姛')) + window.location.reload(); } else { message.error(result.data.msg) } }) +} + +getHostList() +function getHostList() { + get('/api/auth/host', {}).then((result) => { + if (result.data.code == 200) { + let data = result.data.data; + let tmp = [] + data.forEach((item) => { + tmp.push({ + label: item.name, + value: item.id + }) + }) + hostList.value = tmp; + + if(tmp.length > 0) { + let tmpHost = tmp[0] + hostId.value = tmpHost.value; + } + } else { + message.error(result.data.msg) + } + }) } </script> @@ -59,6 +88,11 @@ </p> <p style="margin-top: -10px;"><span class="login100-form-title p-t-20 p-b-45" style="color: #868686;font-size: 24px">WMS</span></p> + + <div class="inputContainer"> + <a-select v-model:value="hostId" style="width: 100%;" :options="hostList"></a-select> + </div> + <div class="inputContainer"> <svg viewBox="0 0 16 16" fill="#2e2e2e" height="16" width="16" xmlns="http://www.w3.org/2000/svg" class="inputIcon"> @@ -66,7 +100,7 @@ d="M13.106 7.222c0-2.967-2.249-5.032-5.482-5.032-3.35 0-5.646 2.318-5.646 5.702 0 3.493 2.235 5.708 5.762 5.708.862 0 1.689-.123 2.304-.335v-.862c-.43.199-1.354.328-2.29.328-2.926 0-4.813-1.88-4.813-4.798 0-2.844 1.921-4.881 4.594-4.881 2.735 0 4.608 1.688 4.608 4.156 0 1.682-.554 2.769-1.416 2.769-.492 0-.772-.28-.772-.76V5.206H8.923v.834h-.11c-.266-.595-.881-.964-1.6-.964-1.4 0-2.378 1.162-2.378 2.823 0 1.737.957 2.906 2.379 2.906.8 0 1.415-.39 1.709-1.087h.11c.081.67.703 1.148 1.503 1.148 1.572 0 2.57-1.415 2.57-3.643zm-7.177.704c0-1.197.54-1.907 1.456-1.907.93 0 1.524.738 1.524 1.907S8.308 9.84 7.371 9.84c-.895 0-1.442-.725-1.442-1.914z"> </path> </svg> - <input placeholder="璇疯緭鍏ョ敤鎴峰悕" v-model="username" class="inputField" type="text"> + <input :placeholder="formatMessage('login.rule.username', '璇疯緭鍏ョ敤鎴峰悕')" v-model="username" class="inputField" type="text"> </div> <div class="inputContainer"> @@ -76,10 +110,10 @@ d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z"> </path> </svg> - <input placeholder="璇疯緭鍏ュ瘑鐮�" v-model="password" class="inputField" type="password"> + <input :placeholder="formatMessage('login.rule.password', '璇疯緭鍏ュ瘑鐮�')" v-model="password" class="inputField" type="password"> </div> - <input @click="loginConfirm" type="button" class="login-button" value="鐧诲綍"> + <input @click="loginConfirm" type="button" class="login-button" :value="formatMessage('common.submit', '鐧诲綍')"> <div style="display: none;margin-top: 5px;width: 100%;" id="updateLicense"> <form enctype="multipart/form-data" style="display: none;"> -- Gitblit v1.9.1