登录取token

This commit is contained in:
asd 2019-11-28 09:54:00 +08:00
parent 221840dd20
commit 57c616726f

View File

@ -7,18 +7,18 @@
<p>+86</p>
<img src="./assets/order.png" alt class="order" />
<div class="line"></div>
<input type="text" class="shuru" placeholder="输入手机号" />
<input type="text" class="shuru" placeholder="输入手机号" v-model="tel" />
</div>
<div class="tel yzm">
<input type="text" class="shuru tel1" placeholder="输入6位验证码" />
<button class="getyzm">发送验证码</button>
<input type="text" class="shuru tel1" placeholder="输入6位验证码" v-model="yzm"/>
<button class="getyzm" @click="yz">发送验证码</button>
</div>
<div class="ale">
<p class="alert">未注册手机验证后自动登录</p>
<p>注册即同意隐私保护指引</p>
</div>
<button class="submit">登录</button>
<button class="submit" @click="sub">登录</button>
<div class="other">
<p>密码登录</p>
<p @click="open">需要帮助</p>
@ -49,7 +49,11 @@
export default {
data() {
return {
ifshow: false
ifshow: false,
tel: "",
yzm:"",
yztoken:"",
Verification:""
};
},
methods: {
@ -58,6 +62,42 @@ export default {
},
off() {
this.ifshow = false;
},
yz() {
let yz=""
if (this.tel != "") {
window.console.log("aaaa");
var t =this
this.axios.post("http://lawpro.earnest.pro/api/Main/Verification", {
mobile:this.tel
}).then(function(res) {
window.console.log(res.data.data);
yz=res.data.data.yz;
t.yztoken=yz
}).catch(function(error) {
window.console.log(error);
});
} else {
window.console.log("请输入正确的手机号");
}
},
sub(){
let t=this;
if(t.tel&&t.yzm){
this.axios.post("http://lawpro.earnest.pro/api/Main/isVerification",{Verification: t.yzm,yz:this.yztoken, mobile:this.tel}).then((res)=>{
if(res.data.code==200){
this.axios.post("http://lawpro.earnest.pro/api/Main/sign",{yz:t.yztoken,Verification:t.yzm,mobile:this.tel}).then((res)=>{
window.console.log(res)
localStorage.setItem('token', res.data.data)
})
}
window.console.log(res)
}).catch((err)=>{
window.console.log(err)
})
}
window.console.log( t.yztoken,t.Verification,9652)
}
}
};
@ -133,7 +173,7 @@ export default {
justify-content: space-between;
}
.getyzm {
width: 166px;
width: 176px!important;
height: 54px;
border: 2px solid rgba(107, 145, 71, 1);
border-radius: 4px;