diff --git a/src/api/api.js b/src/api/api.js index ba292de..b410582 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -30,13 +30,14 @@ axios.interceptors.response.use( } ); // post请求 -export function postJsonRequest(url, params) { +export function postJsonRequest(url,action, params) { return axios({ method: "post", url: url, data: params, headers: { "Content-Type": "application/json", + action }, }); } diff --git a/src/api/myApi.js b/src/api/myApi.js index a3946e7..fd41634 100644 --- a/src/api/myApi.js +++ b/src/api/myApi.js @@ -1,15 +1,23 @@ -import { - postJsonRequest,downloadRequest - } from './api.js'; - const myApi = { +import { postJsonRequest, downloadRequest } from "./api.js"; +const myApi = { + getProjects(params) { + return postJsonRequest("/api/honeywell/inncon/list/project", params); + }, - getProjects(params) { - return postJsonRequest('/api/honeywell/inncon/list/project', params); - }, + userAPI(action,params) { + return postJsonRequest("/api/honeywell/user",action, params); + }, - download(params) { - return downloadRequest('/api/honeywell/inncon/list/project', params); - } - } - export default myApi; - \ No newline at end of file + download(params) { + return downloadRequest("/api/honeywell/inncon/list/project", params); + }, +}; + +const actionNum = { + QueryUser: 90000, + CreateUser: 90001, + UpdateUser: 90002, + DeleteUser: 90003, + QueryRole: 90100, +}; +export { myApi, actionNum }; diff --git a/src/router/index.js b/src/router/index.js index 8a6d727..ebd50a0 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,34 +1,41 @@ -import { createRouter, createWebHashHistory } from 'vue-router'; -import Home from '../views/Home.vue'; -import Project from '../views/Project.vue'; -import Room from '../views/Room.vue'; -import Login from '../views/Login.vue'; +import { createRouter, createWebHashHistory } from "vue-router"; +import Home from "../views/Home.vue"; +import Project from "../views/Project.vue"; +import Room from "../views/Room.vue"; +import Login from "../views/Login.vue"; +import User from "../views/User.vue"; const routes = [ - { - path: '/', - redirect: '/home' - }, - { - path: '/home', - name: 'home', - component: Home - }, - { - path: '/login', - name: 'login', - component: Login - }, - { - path: '/project', - name: 'project', - component: Project - }, - { - path: '/room', - name: 'room', - component: Room - }, + { + path: "/", + // redirect: "/home", + redirect: "/user", + }, + { + path: "/home", + name: "home", + component: Home, + }, + { + path: "/login", + name: "login", + component: Login, + }, + { + path: "/project", + name: "project", + component: Project, + }, + { + path: "/room", + name: "room", + component: Room, + }, + { + path: "/user", + name: "user", + component: User, + }, ]; const router = createRouter({ @@ -36,4 +43,4 @@ const router = createRouter({ routes, }); -export default router; \ No newline at end of file +export default router; diff --git a/src/views/Home.vue b/src/views/Home.vue index 28686b1..d6a49b2 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -63,7 +63,7 @@ import { onMounted, reactive, ref } from "vue"; import { Plus, SwitchButton } from "@element-plus/icons-vue"; import { ElMessage, ElMessageBox } from "element-plus"; -import myApi from "@/api/myApi.js"; +import {myApi} from "@/api/myApi.js"; import { useRouter } from 'vue-router' import { localRemove } from '@/utils'; const router = useRouter() diff --git a/src/views/Login.vue b/src/views/Login.vue index 59bf2f8..2183c2e 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -25,7 +25,6 @@