From d9c99e0480b4910cdb134778dd5c314b35ec4cf2 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期一, 29 九月 2025 10:05:23 +0800 Subject: [PATCH] 1 --- 项目代码/WMS/WIDESEA_WMSClient/src/views/Login.vue | 87 +++++++++++++++++++++++++++---------------- 1 files changed, 55 insertions(+), 32 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/views/Login.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/views/Login.vue" index 500b81e..7d169b5 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/views/Login.vue" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/views/Login.vue" @@ -8,28 +8,50 @@ <div>娆㈣繋鐧诲綍...</div> <div class="login-line"></div> </div> - <div style="flex:1;"></div> + <div style="flex: 1"></div> </div> <div class="login-text-small">WELCOME TO LOGIN</div> <div class="item"> <div class="input-icon el-icon-user"></div> - <input type="text" v-focus v-model="userInfo.userName" placeholder="璇疯緭鍏ヨ处鍙�" /> + <input + type="text" + v-focus + v-model="userInfo.userName" + placeholder="璇疯緭鍏ヨ处鍙�" + /> </div> <div class="item"> <div class="input-icon el-icon-lock"></div> - <input type="password" v-focus v-model="userInfo.password" placeholder="璇疯緭鍏ュ瘑鐮�" /> + <input + type="password" + v-focus + v-model="userInfo.password" + placeholder="璇疯緭鍏ュ瘑鐮�" + /> </div> <div class="item"> <div class="input-icon el-icon-mobile"></div> - <input v-focus type="text" v-model="userInfo.verificationCode" placeholder="杈撳叆楠岃瘉鐮�" /> + <input + v-focus + type="text" + v-model="userInfo.verificationCode" + placeholder="杈撳叆楠岃瘉鐮�" + /> <div class="code" @click="getVierificationCode"> <img v-show="codeImgSrc != ''" :src="codeImgSrc" /> </div> </div> </div> <div class="loging-btn"> - <el-button size="large" :loading="loading" color="#3a6cd1" :dark="true" @click="login" long> + <el-button + size="large" + :loading="loading" + color="#3a6cd1" + :dark="true" + @click="login" + long + > <span v-if="!loading">鐧诲綍</span> <span v-else>姝e湪鐧诲綍...</span> </el-button> @@ -84,26 +106,26 @@ ref, reactive, toRefs, - getCurrentInstance -} from 'vue'; -import { useRouter, useRoute } from 'vue-router'; -import store from '../store/index'; -import http from '@/../src/api/http.js'; + getCurrentInstance, +} from "vue"; +import { useRouter, useRoute } from "vue-router"; +import store from "../store/index"; +import http from "@/../src/api/http.js"; export default defineComponent({ setup(props, context) { - store.commit('clearUserInfo', ''); + store.commit("clearUserInfo", ""); const loading = ref(false); - const codeImgSrc = ref(''); + const codeImgSrc = ref(""); const userInfo = reactive({ - userName: '', - password: '', - verificationCode: '', - UUID: undefined + userName: "", + password: "", + verificationCode: "", + UUID: undefined, }); const getVierificationCode = () => { - http.get('/api/User/getVierificationCode').then((x) => { - codeImgSrc.value = 'data:image/png;base64,' + x.img; + http.get("/api/User/getVierificationCode").then((x) => { + codeImgSrc.value = "data:image/png;base64," + x.img; userInfo.UUID = x.uuid; }); }; @@ -114,20 +136,22 @@ let router = useRouter(); const login = () => { - if (!userInfo.userName) return $message.error('璇疯緭鍏ョ敤鎴峰悕'); - if (!userInfo.password) return $message.error('璇疯緭鍏ュ瘑鐮�'); - if (!userInfo.verificationCode) return $message.error('璇疯緭鍏ラ獙璇佺爜'); - if (userInfo.verificationCode!="1234") return $message.error('楠岃瘉鐮佹湁璇�'); + if (!userInfo.userName) return $message.error("璇疯緭鍏ョ敤鎴峰悕"); + if (!userInfo.password) return $message.error("璇疯緭鍏ュ瘑鐮�"); + if (!userInfo.verificationCode) return $message.error("璇疯緭鍏ラ獙璇佺爜"); + if (userInfo.verificationCode != "1234") + return $message.error("楠岃瘉鐮佹湁璇�"); loading.value = true; - http.post('/api/User/login', userInfo, '姝e湪鐧诲綍....').then((result) => { + http.post("/api/User/login", userInfo, "姝e湪鐧诲綍....").then((result) => { if (!result.status) { loading.value = false; getVierificationCode(); return $message.error(result.message); } - $message.success('鐧诲綍鎴愬姛,姝e湪璺宠浆!'); - store.commit('setUserInfo', result.data); - router.push({ path: '/' }); + if (result.message != "") $message.error(result.message); + $message.success("鐧诲綍鎴愬姛,姝e湪璺宠浆!"); + store.commit("setUserInfo", result.data); + router.push({ path: "/" }); }); }; const loginPress = (e) => { @@ -136,7 +160,7 @@ } }; const openUrl = (url) => { - window.open(url, '_blank'); + window.open(url, "_blank"); }; return { loading, @@ -145,16 +169,16 @@ login, userInfo, loginPress, - openUrl + openUrl, }; }, directives: { focus: { inserted: function (el) { el.focus(); - } - } - } + }, + }, + }, }); </script> <style lang="less" scoped> @@ -359,7 +383,6 @@ <style lang="less" scoped> @media screen and (max-width: 700px) { - .login-bg, .account-info, .app-link, -- Gitblit v1.9.3