|
|
|
@ -31,6 +31,20 @@ |
|
|
|
</template> |
|
|
|
<uni-easyinput type="password" v-model="formData.password" placeholder="请输入密码" :inputBorder="false" /> |
|
|
|
</uni-forms-item> |
|
|
|
|
|
|
|
<uni-forms-item prop="code" v-if="captchaOnOff"> |
|
|
|
<uni-easyinput |
|
|
|
v-model="formData.code" |
|
|
|
auto-complete="off" |
|
|
|
placeholder="验证码" |
|
|
|
style="width: 63%" |
|
|
|
@keyup.enter.native="handleLogin"> |
|
|
|
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" /> |
|
|
|
</uni-easyinput> |
|
|
|
<div class="login-code"> |
|
|
|
<img :src="codeUrl" @click="getCode" class="login-code-img"/> |
|
|
|
</div> |
|
|
|
</uni-forms-item> |
|
|
|
</uni-forms> |
|
|
|
<button class="login-btn" type="primary" @click="$noMultipleClicks(login,formData)">登录</button> |
|
|
|
<div class="foget-password uni-secondary-color"> |
|
|
|
@ -42,7 +56,7 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import { |
|
|
|
login |
|
|
|
login,getCodeImg |
|
|
|
} from '@/api/auth.js' |
|
|
|
import md5 from "js-md5" |
|
|
|
export default { |
|
|
|
@ -51,9 +65,14 @@ |
|
|
|
phoneFlag: false, |
|
|
|
passwordFlag: false, |
|
|
|
noClick:true, //防止重复提交 |
|
|
|
// 验证码开关 |
|
|
|
captchaOnOff: true, |
|
|
|
codeUrl: "", |
|
|
|
formData: { |
|
|
|
phone: '', |
|
|
|
password: '' |
|
|
|
password: '', |
|
|
|
code: "", |
|
|
|
uuid: "" |
|
|
|
}, |
|
|
|
|
|
|
|
rules: { |
|
|
|
@ -76,6 +95,10 @@ |
|
|
|
} |
|
|
|
}] |
|
|
|
}, |
|
|
|
code: [{ |
|
|
|
required: true, |
|
|
|
errorMessage: '请输入验证码' |
|
|
|
}], |
|
|
|
phone: { |
|
|
|
rules: [{ |
|
|
|
required: true, |
|
|
|
@ -108,7 +131,20 @@ |
|
|
|
//设置校验规则 |
|
|
|
this.$refs.form.setRules(this.rules); |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.getCode(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
//获取验证码 |
|
|
|
getCode() { |
|
|
|
getCodeImg().then(res => { |
|
|
|
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff; |
|
|
|
if (this.captchaOnOff) { |
|
|
|
this.codeUrl = "data:image/gif;base64," + res.img; |
|
|
|
this.formData.uuid = res.uuid; |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
login(e) { |
|
|
|
// console.log(e) |
|
|
|
let that = this |
|
|
|
|