略改一点user模块

This commit is contained in:
高子兴 2024-07-06 02:26:45 +08:00
parent 4edc0d242c
commit 65a880db47
3 changed files with 20 additions and 9 deletions

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue</title>
<title>测盟汇管理系统</title>
</head>
<body>
<div id="app"></div>

View File

@ -1,8 +1,10 @@
import axios from "axios";
import store from "@store/index.js"
export default {
addTenant(tenant) {
const url = '/api/tenant/addTenant'
const token = store.getters['authentication/token']
const url = `/api/tenant/addTenant?token=${token}`
const data = {
symbol: tenant.symbol,
contact: tenant.contact,
@ -23,20 +25,23 @@ export default {
async getAll() {
const url = '/api/tenant/getAllTenant'
const token = store.getters['authentication/token']
const url = `/api/tenant/getAllTenant?token=${token}`
const response = await axios.get(url)
return response.data;
},
update(tenant) {
const url = '/api/tenant/updateTenant';
const token = store.getters['authentication/token']
const url = `/api/tenant/updateTenant?token=${token}`;
return axios.post(url, tenant)
.then(response => {
});
},
delete(tenant) {
const url = '/api/tenant/deleteTenant';
const token = store.getters['authentication/token']
const url = `/api/tenant/deleteTenant?token=${token}`;
return axios.post(url, tenant)
.then(response => {
});

View File

@ -1,8 +1,11 @@
import axios from "axios";
import {useStore} from 'vuex';
import store from '@store/index.js'
export default {
addUser(user){
const url='/api/user/addUser'
const token = store.getters['authentication/token']
const url=`/api/user/addUser?token=${token}`
const data={
account: user.account,
name: user.name,
@ -25,13 +28,15 @@ export default {
async getAll() {
const url = '/api/user/getAll'
const token = store.getters['authentication/token']
const url = `/api/user/getAll?token=${token}`
const response = await axios.get(url)
return response.data;
},
update(user){
const url='/api/user/update';
const token = store.getters['authentication/token']
const url=`/api/user/update?token=${token}`
return axios.post(url,user)
.then(() => {
location.href="/userManagement";
@ -39,7 +44,8 @@ export default {
},
async delete(user){
const url='/api/user/delete';
const token = store.getters['authentication/token']
const url=`/api/user/delete?token=${token}`
return await axios.post(url, user)
}