|
@@ -6,6 +6,13 @@
|
|
|
<el-form-item prop="password" :label="$t('login.PWName')">
|
|
<el-form-item prop="password" :label="$t('login.PWName')">
|
|
|
<el-input v-model="form.password" clearable show-password :placeholder="$t('login.PWPlaceholder')"></el-input>
|
|
<el-input v-model="form.password" clearable show-password :placeholder="$t('login.PWPlaceholder')"></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item prop="code" :label="$t('login.code')">
|
|
|
|
|
+ <el-input v-model="form.code" :placeholder="$t('login.codeErr')">
|
|
|
|
|
+ <template #suffix>
|
|
|
|
|
+ <div class="captcha" @click="updateCaptcha"><img :src="captcha.base64" /></div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
<el-form-item style="margin-bottom: 0;">
|
|
<el-form-item style="margin-bottom: 0;">
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
<el-checkbox :label="$t('login.rememberMe')" v-model="form.autologin"></el-checkbox>
|
|
<el-checkbox :label="$t('login.rememberMe')" v-model="form.autologin"></el-checkbox>
|
|
@@ -22,7 +29,7 @@
|
|
|
</el-checkbox>
|
|
</el-checkbox>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
- <el-button type="primary" size="large" style="width: 100%;" :loading="islogin" @click="login_code">{{ $t('login.signIn') }}</el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" size="large" style="width: 100%;" :loading="islogin" @click="onSuccess">{{ $t('login.signIn') }}</el-button>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<el-dialog title="隐私协议" v-model="visible" :width="680" destroy-on-close :close-on-click-modal="false" :show-close="false">
|
|
<el-dialog title="隐私协议" v-model="visible" :width="680" destroy-on-close :close-on-click-modal="false" :show-close="false">
|
|
@@ -36,7 +43,8 @@
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
export default {
|
|
export default {
|
|
|
- props: ['baseData'],
|
|
|
|
|
|
|
+ emits: ['success', 'upCaptcha'],
|
|
|
|
|
+ props: ['baseData',"captcha"],
|
|
|
data(){
|
|
data(){
|
|
|
return {
|
|
return {
|
|
|
visible:false,
|
|
visible:false,
|
|
@@ -50,6 +58,9 @@ export default {
|
|
|
password: [
|
|
password: [
|
|
|
{ required: true, message: this.$t('login.PWError'), trigger: 'blur' }
|
|
{ required: true, message: this.$t('login.PWError'), trigger: 'blur' }
|
|
|
],
|
|
],
|
|
|
|
|
+ code: [
|
|
|
|
|
+ { required: true, message: this.$t('login.codeErr'), trigger: 'blur' }
|
|
|
|
|
+ ],
|
|
|
privacy: [
|
|
privacy: [
|
|
|
{ required: true, message: this.$t('login.privacy'), trigger: 'change' }
|
|
{ required: true, message: this.$t('login.privacy'), trigger: 'change' }
|
|
|
]
|
|
]
|
|
@@ -57,6 +68,9 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ updateCaptcha(){
|
|
|
|
|
+ this.$emit("upCaptcha");
|
|
|
|
|
+ },
|
|
|
showPrivacy(){
|
|
showPrivacy(){
|
|
|
this.visible = true;
|
|
this.visible = true;
|
|
|
},
|
|
},
|
|
@@ -68,19 +82,23 @@ export default {
|
|
|
},
|
|
},
|
|
|
async onSuccess() {
|
|
async onSuccess() {
|
|
|
this.isShow = false;
|
|
this.isShow = false;
|
|
|
- this.islogin = true
|
|
|
|
|
var data = {
|
|
var data = {
|
|
|
username: this.form.user,
|
|
username: this.form.user,
|
|
|
|
|
+ code: this.form.code,
|
|
|
|
|
+ key: this.captcha.key,
|
|
|
password: this.$TOOL.crypto.MD5(this.form.password)
|
|
password: this.$TOOL.crypto.MD5(this.form.password)
|
|
|
}
|
|
}
|
|
|
|
|
+ var validate = await this.$refs.loginForm.validate().catch(() => { })
|
|
|
|
|
+ if (!validate) { return false }
|
|
|
//获取token
|
|
//获取token
|
|
|
|
|
+ this.islogin = true
|
|
|
var user = await this.$API.auth.login.post(data)
|
|
var user = await this.$API.auth.login.post(data)
|
|
|
|
|
+ this.islogin = false
|
|
|
if (user.code == 1) {
|
|
if (user.code == 1) {
|
|
|
this.$TOOL.cookie.set("TOKEN", user.data.access_token, {
|
|
this.$TOOL.cookie.set("TOKEN", user.data.access_token, {
|
|
|
expires: user.data.expires_in
|
|
expires: user.data.expires_in
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
- this.islogin = false
|
|
|
|
|
this.$message.error(user.msg)
|
|
this.$message.error(user.msg)
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
@@ -158,4 +176,21 @@ export default {
|
|
|
overflow-y: scroll;
|
|
overflow-y: scroll;
|
|
|
line-height: 1.5;
|
|
line-height: 1.5;
|
|
|
}
|
|
}
|
|
|
|
|
+.el-input--large .el-input__wrapper{
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+}
|
|
|
|
|
+.captcha{
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ right: 1px;
|
|
|
|
|
+ top: 1px;
|
|
|
|
|
+ bottom: 1px;
|
|
|
|
|
+ z-index: 99;
|
|
|
|
|
+}
|
|
|
|
|
+.captcha img{
|
|
|
|
|
+ height: 38px;
|
|
|
|
|
+ border-radius: 5px;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|