From 2a1d0edd4e6a067723378a9b9a7754fa08894e70 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期四, 13 七月 2023 16:28:59 +0800 Subject: [PATCH] update 优化 三方按钮 可能无法点击到的问题 --- src/views/login.vue | 53 +++++++++++++++++++++++++---------------------------- 1 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/views/login.vue b/src/views/login.vue index 3234864..ecae572 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -4,8 +4,7 @@ <h3 class="title">RuoYi-Vue-Plus澶氱鎴风鐞嗙郴缁�</h3> <el-form-item prop="tenantId" v-if="tenantEnabled"> <el-select v-model="loginForm.tenantId" filterable placeholder="璇烽�夋嫨/杈撳叆鍏徃鍚嶇О" style="width: 100%"> - <el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" - :value="item.tenantId"></el-option> + <el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"></el-option> <template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template> </el-select> </el-form-item> @@ -15,14 +14,12 @@ </el-input> </el-form-item> <el-form-item prop="password"> - <el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="瀵嗙爜" - @keyup.enter="handleLogin"> + <el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="瀵嗙爜" @keyup.enter="handleLogin"> <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template> </el-input> </el-form-item> <el-form-item prop="code" v-if="captchaEnabled"> - <el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="楠岃瘉鐮�" style="width: 63%" - @keyup.enter="handleLogin"> + <el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="楠岃瘉鐮�" style="width: 63%" @keyup.enter="handleLogin"> <template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template> </el-input> <div class="login-code"> @@ -30,6 +27,20 @@ </div> </el-form-item> <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">璁颁綇瀵嗙爜</el-checkbox> + <el-form-item style="float: right;"> + <el-button circle title="寰俊鐧诲綍" @click="doSocialLogin('wechat')" > + <svg-icon icon-class="wechat" /> + </el-button> + <el-button circle title="MaxKey鐧诲綍" @click="doSocialLogin('maxkey')" > + <svg-icon icon-class="maxkey" /> + </el-button> + <el-button circle title="Gitee鐧诲綍" @click="doSocialLogin('gitee')" > + <svg-icon icon-class="gitee" /> + </el-button> + <el-button circle title="Github鐧诲綍" @click="doSocialLogin('github')" > + <svg-icon icon-class="github" /> + </el-button> + </el-form-item> <el-form-item style="width:100%;"> <el-button :loading="loading" size="large" type="primary" style="width:100%;" @click.prevent="handleLogin"> <span v-if="!loading">鐧� 褰�</span> @@ -39,20 +50,6 @@ <router-link class="link-type" :to="'/register'">绔嬪嵆娉ㄥ唽</router-link> </div> </el-form-item> - <div style="display: flex;justify-content: flex-end;flex-direction: row;"> - <el-button circle> - <svg-icon icon-class="qq" @click="doSocialLogin('qq')" /> - </el-button> - <el-button circle> - <svg-icon icon-class="wechat" @click="doSocialLogin('wechat')" /> - </el-button> - <el-button circle> - <svg-icon icon-class="gitee" @click="doSocialLogin('gitee')" /> - </el-button> - <el-button circle> - <svg-icon icon-class="github" @click="doSocialLogin('github')" /> - </el-button> - </div> </el-form> <!-- 搴曢儴 --> <div class="el-login-footer"> @@ -68,14 +65,14 @@ import { encrypt, decrypt } from '@/utils/jsencrypt'; import { useUserStore } from '@/store/modules/user'; import { LoginData, TenantVO } from '@/api/types'; -import { ElForm, FormRules } from 'element-plus'; import { to } from 'await-to-js'; +import { HttpStatus } from "@/enums/RespEnum"; const userStore = useUserStore(); const router = useRouter(); const loginForm = ref<LoginData>({ - tenantId: "000000", + tenantId: '000000', username: 'admin', password: 'admin123', rememberMe: false, @@ -83,7 +80,7 @@ uuid: '' }); -const loginRules: FormRules = { +const loginRules: ElFormRules = { tenantId: [{ required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勭鎴风紪鍙�" }], username: [{ required: true, trigger: 'blur', message: '璇疯緭鍏ユ偍鐨勮处鍙�' }], password: [{ required: true, trigger: 'blur', message: '璇疯緭鍏ユ偍鐨勫瘑鐮�' }], @@ -101,12 +98,12 @@ // 娉ㄥ唽寮�鍏� const register = ref(false); const redirect = ref(undefined); -const loginRef = ref(ElForm); +const loginRef = ref<ElFormInstance>(); // 绉熸埛鍒楄〃 const tenantList = ref<TenantVO[]>([]); const handleLogin = () => { - loginRef.value.validate(async (valid: boolean, fields: any) => { + loginRef.value?.validate(async (valid: boolean, fields: any) => { if (valid) { loading.value = true; // 鍕鹃�変簡闇�瑕佽浣忓瘑鐮佽缃湪 cookie 涓缃浣忕敤鎴峰悕鍜屽瘑鐮� @@ -123,7 +120,6 @@ Cookies.remove('rememberMe'); } // 璋冪敤action鐨勭櫥褰曟柟娉� - // prittier-ignore const [err] = await to(userStore.login(loginForm.value)); if (!err) { await router.push({ path: redirect.value || '/' }); @@ -192,8 +188,9 @@ */ const doSocialLogin = (type: string) => { authBinding(type).then((res: any) => { - if (res.code === 200) { - window.location.href = res.msg; + if (res.code === HttpStatus.SUCCESS) { + // 鑾峰彇鎺堟潈鍦板潃璺宠浆 + window.location.href = res.data; } else { ElMessage.error(res.msg); } -- Gitblit v1.9.3