59 lines
1.6 KiB
JavaScript
59 lines
1.6 KiB
JavaScript
import axios from "axios";
|
|
|
|
import {ref} from "vue";
|
|
|
|
export default {
|
|
addUser(user){
|
|
const url='http://localhost:8080/addUser'
|
|
const data={
|
|
account: user.account,
|
|
name: user.name,
|
|
organization: user.organization,
|
|
email: user.email,
|
|
gender: user.gender,
|
|
phone: user.phone,
|
|
password:user.password
|
|
}
|
|
return axios.post(url, data)
|
|
.then(response => {
|
|
if(response.data!=null){
|
|
alert("新增成功");
|
|
}else
|
|
alert("新增失败");
|
|
location.href="/userManagement";
|
|
});
|
|
|
|
},
|
|
|
|
|
|
getAll(){
|
|
const url='http://localhost:8080/getAll'
|
|
return axios.get(url)
|
|
.then(response => {
|
|
return response.data;
|
|
});
|
|
},
|
|
|
|
update(user){
|
|
const url='http://localhost:8080/update';
|
|
console.log("哈哈哈哈哈哈哈啊哈哈哈哈哈"+user);
|
|
return axios.post(url,user)
|
|
.then(response => {
|
|
location.href="/userManagement";
|
|
});
|
|
},
|
|
|
|
delete(user){
|
|
const url='http://localhost:8080/delete';
|
|
console.log("哈哈哈哈哈哈哈啊哈哈哈哈哈"+user);
|
|
return axios.post(url,user)
|
|
.then(response => {
|
|
if(response.data==boolean){
|
|
alert("删除成功");
|
|
}else
|
|
alert("删除失败");
|
|
location.href="/userManagement";
|
|
});
|
|
}
|
|
|
|
} |