还是有问题,不过现在后端可以正常收到username和password
This commit is contained in:
parent
d5611562e6
commit
1452208822
@ -2,11 +2,19 @@ import axios from "axios";
|
||||
|
||||
export default {
|
||||
login(username, password, apiUrl="http://localhost:8080"){
|
||||
return axios.get(`/checkLogin`, {username:username, password:password})
|
||||
const url = `${apiUrl}/users/checkLogin`
|
||||
const data = {
|
||||
username: username,
|
||||
password: password
|
||||
};
|
||||
return axios.post(url, data)
|
||||
.then(response => {
|
||||
alert("hahaha");
|
||||
// 处理登录成功的逻辑
|
||||
alert(">login方法中<");
|
||||
alert(response.data);
|
||||
return response.data;
|
||||
});
|
||||
},
|
||||
register(){
|
||||
//跳转逻辑
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@
|
||||
<el-input v-model="username" placeholder="pls enter the username"></el-input>
|
||||
<el-input v-model="password" placeholder="pls enter the password"></el-input>
|
||||
<el-button type="success" @click="handleLogin">LOGIN</el-button>
|
||||
<el-button type="success" @click="handleRegister">REGISTER</el-button>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@ -22,6 +23,11 @@
|
||||
},methods:{
|
||||
handleLogin(){
|
||||
authenticationService.login(this.username,this.password).then(res=>{
|
||||
alert("login方法调用完毕");
|
||||
alert(res.data);
|
||||
});
|
||||
},handleRegister(){
|
||||
authenticationService.register(this.username,this.password).then(res=>{
|
||||
alert(res);
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user