Commit a54a7302 authored by 吴冠's avatar 吴冠

登录和短信验证码更改

parent e3cbd55e
......@@ -101,7 +101,7 @@ export function sendSms(params){
//忘记密码---->手机验证码
export function getVerifyPhone(data){
return request({
url:"/verify-phone",
url:"/sms/verify-phone",
method:'post',
data:data
})
......
......@@ -201,9 +201,6 @@
dataform.phone=this.form.phone
dataform.verify=this.form.verify
const {data} = getVerifyPhone(dataform)
//后端返回个字段 然后判断是否可以登录
/* this.dataMsg = data */
/* if(this.form.phoneCode===this.dataMsg){ */
this.active++
/* } */
} else {
......
......@@ -16,7 +16,7 @@
</el-input>
</el-form-item>
<div class="login-btn">
<el-button type="primary" @click="submitForm()" style="width: 100%;">登录</el-button>
<el-button type="primary" @click="submitForm1()" style="width: 100%;">登录</el-button>
</div>
</el-form>
<!-- 手机验证码验证 -->
......@@ -28,10 +28,10 @@
<el-form-item prop="phonecode" class="item">
<el-input v-model="phone.phonecode" placeholder="请输入短信验证码" style="width:1.8rem" maxlength="30"></el-input>
</el-form-item>
<div class="phonecode handle">获取短信验证码</div>
<div class="phonecode handle" @click = "getPhoneCode">获取短信验证码</div>
</div>
<div class="login-btn">
<el-button type="primary" @click="submitForm()" style="width: 100%;">登录</el-button>
<el-button type="primary" @click="submitForm2()" style="width: 100%;">登录</el-button>
</div>
</el-form>
<div class="login-font flex-between">
......@@ -46,7 +46,7 @@
<script>
import {powerLogin} from '~/api/bid/login';
import {getSecond} from '@/common/list.js';
import {getSecond,sendSms,getVerifyPhone} from '@/common/list.js';
export default {
data() {
return {
......@@ -89,19 +89,64 @@
created() {
},
methods: {
/* async getSecond(){
const {data} = await getSecond()
console.log(data+'------------------------')
}, */
async submitForm(event) {
//发送短信验证码
async getPhoneCode(){
let message = {}
message.phone = this.phone.phone
message.type = 2
const {data} = await sendSms(message)
},
async submitForm1() {
try {
const valid = await this.$refs['params'].validate()
if (valid) {
/* const {
msg,
code,
data
} = await powerLogin(this.param) */
//将手机号和手机验证码发送
let mess = {}
mess.phone = this.phone.phone
mess.verify = this.phone.password
const {data,code,msg} = await getVerifyPhone(mess)
console.log(data,code)
if (code == 200) {
sessionStorage.setItem("token",data);
this.$message({
message: msg,
type: 'success',
duration:1500
});
setTimeout(()=>{
this.$router.push("/")
},1500)
} else {
this.$message({
message: msg,
type: 'error'
});
}
}
} catch (err) {
console.log(err);
}
},
async submitForm2() {
try {
const valid = await this.$refs['param'].validate()
const valid = await this.$refs['phone'].validate()
if (valid) {
const {
/* const {
msg,
code,
data
} = await powerLogin(this.param)
} = await powerLogin(this.param) */
//将手机号和手机验证码发送
let mess = {}
mess.phone = this.phone.phone
mess.verify = this.phone.phonecode
const {data,code,msg} = await getVerifyPhone(mess)
console.log(data,code)
if (code == 200) {
sessionStorage.setItem("token",data);
this.$message({
......@@ -226,4 +271,7 @@
.el-form {
padding: 0.2rem
}
/* .login-btn{
cursor: pointer;
} */
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment