登陆检查 init

pull/269/head
volleyball26 2021-01-25 18:12:53 +08:00
parent 8761e0826b
commit 710768a4ec
3 changed files with 23 additions and 2 deletions

View File

@ -30,4 +30,12 @@ export const departmentData = query => {
method: 'delete',
params: query
});
};
export const userLogin = query => {
return request({
url: 'http://127.0.0.1:8000/user/login',
method: 'post',
data: query
});
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 91 KiB

View File

@ -19,7 +19,7 @@
</el-input>
</el-form-item>
<div class="login-btn">
<el-button type="primary" @click="submitForm()"></el-button>
<el-button type="primary" @click="submitForm(param.username, param.password)">登录</el-button>
</div>
<p class="login-tips">Tips : 用户名和密码随便填</p>
</el-form>
@ -28,6 +28,8 @@
</template>
<script>
import {userLogin } from '../../api/userlist';
export default {
data: function() {
return {
@ -42,8 +44,19 @@ export default {
};
},
methods: {
submitForm() {
submitForm(username, password) {
this.username = username;
this.password = password;
let data = {
username : this.username,
password : this.password,
}
userLogin(data).then((res)=>{
console.log(res)
})
this.$refs.login.validate(valid => {
console.log(data)
if (valid) {
this.$message.success('登录成功');
localStorage.setItem('ms_username', this.param.username);