| | |
| | | <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="captchaOnOff">
|
| | | <el-form-item prop="code" v-if="captchaEnabled">
|
| | | <el-input
|
| | | v-model="loginForm.code"
|
| | | size="large"
|
| | |
| | | const codeUrl = ref("");
|
| | | const loading = ref(false);
|
| | | // 验证码开关
|
| | | const captchaOnOff = ref(true);
|
| | | const captchaEnabled = ref(true);
|
| | | // 注册开关
|
| | | const register = ref(false);
|
| | | const redirect = ref(undefined);
|
| | |
| | | proxy.$refs.loginRef.validate(valid => {
|
| | | if (valid) {
|
| | | loading.value = true;
|
| | | // 勾选了需要记住密码设置在cookie中设置记住用户明和名命
|
| | | // 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
| | | if (loginForm.value.rememberMe) {
|
| | | Cookies.set("username", loginForm.value.username, { expires: 30 });
|
| | | Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 });
|
| | |
| | | }).catch(() => {
|
| | | loading.value = false;
|
| | | // 重新获取验证码
|
| | | if (captchaOnOff.value) {
|
| | | if (captchaEnabled.value) {
|
| | | getCode();
|
| | | }
|
| | | });
|
| | |
| | |
|
| | | function getCode() {
|
| | | getCodeImg().then(res => {
|
| | | captchaOnOff.value = res.captchaOnOff === undefined ? true : res.captchaOnOff;
|
| | | if (captchaOnOff.value) {
|
| | | captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
| | | if (captchaEnabled.value) {
|
| | | codeUrl.value = "data:image/gif;base64," + res.img;
|
| | | loginForm.value.uuid = res.uuid;
|
| | | }
|
| | |
| | | height: 40px;
|
| | | padding-left: 12px;
|
| | | }
|
| | | </style> |
| | | </style>
|