提交 2bdc2be4 编写于 作者: cxt104926's avatar cxt104926

bug

上级 073c4f93
......@@ -92,7 +92,7 @@
})
</script>
<style lang="less">
<style>
.but {
font-size: .14rem;
color: #3c8dbc
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>stusystem</title>
</head>
<body>
<div id="app"></div>
<h2>这是首页</h2>
<!-- built files will be auto injected -->
</body>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>stusystem</title>
</head>
<body>
<div id="index">
<el-form :model="addAndEditFormData" :rules="addAndEditRules" class="form">
<el-form-item prop="account" label="账号:" :label-width="formLabelWidth">
<el-input v-model="addAndEditFormData.account" placeholder="请输入账号" style="width:80%"></el-input>
</el-form-item>
<el-form-item prop="password" label="密码:" :label-width="formLabelWidth">
<el-input v-model="addAndEditFormData.password" placeholder="请输入密码" style="width:80%"></el-input>
</el-form-item>
<el-form-item prop="verification" label="验证码:" :label-width="formLabelWidth">
<el-input v-model="addAndEditFormData.verification" placeholder="请输入验证码" style="width:40%"></el-input>
<img id="img" @click="getVerification" :src="imgSrc" alt="验证码" title="点击更换验证码"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleConfirmEvent"><i class="el-icon-upload"></i> 登 录</el-button>
</div>
<div>
<span>还没有账号? <a href="/register">去注册</a></span>
</div>
</div>
<script>
export default {
name: 'index',
data() {
return {
addAndEditFormData: {
account: '',
password: '',
verification: ''
},
imgSrc: '/getVerify',
message: '',
addAndEditRules: {
account: {
required: true, message: '账号不能为空', trigger: 'blur'
},
password: {
required: true, message: '密码不能为空', trigger: 'blur'
},
verification: {
required: true, message: '验证码不能为空', trigger: 'blur'
},
},
// 样式数据
formLabelWidth: '120px',
}
},
created() {
},
methods: {
getVerification() {
let number = Math.ceil(Math.random() * 10);
this.imgSrc = '/getVerify?' + number;
},
handleConfirmEvent() {
let params = {
"account": this.addAndEditFormData.account,
"password": this.addAndEditFormData.password,
"verification": this.addAndEditFormData.verification
};
this.$api.post('/login', params).then(e => {
this.message = e.data.msg;
if (e.data.code === 200) {
this.$notify({
title: '成功',
message: this.message,
showClose: false,
type: 'success'
});
// 登录成功后跳转页面,1、请求后端返回页面;2、前端路由转发
} else {
this.$notify({
title: '失败',
message: this.message,
showClose: false,
type: 'warning'
});
}
});
},
}
}
</script>
<style>
.but {
font-size: .14rem;
color: #3c8dbc
}
</style>
</body>
</html>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册