diff --git a/.env.development b/.env.development
index 761feb0..8c13db9 100644
--- a/.env.development
+++ b/.env.development
@@ -8,5 +8,5 @@ VITE_PUBLIC_PATH = /
VITE_APP_ENV = 'development'
# 多麦管理系统/开发环境
-# VITE_APP_BASE_API = 'http://192.168.0.192:8080/'
-VITE_APP_BASE_API = 'https://www.saas.duomailianmeng.com/srv'
+VITE_APP_BASE_API = 'http://192.168.0.93:6012/admin/'
+# VITE_APP_BASE_API = 'https://www.saas.duomailianmeng.com/srv'
diff --git a/index.html b/index.html
index 9028687..043317e 100644
--- a/index.html
+++ b/index.html
@@ -202,12 +202,12 @@
diff --git a/src/api/login.js b/src/api/login.js
index ee97960..96754df 100644
--- a/src/api/login.js
+++ b/src/api/login.js
@@ -1,15 +1,13 @@
import request from '@/utils/request'
// 登录方法
-export function login(username, password, code, uuid) {
+export function login(account, password) {
const data = {
- username,
+ account,
password,
- code,
- uuid
}
return request({
- url: '/login',
+ url: '/system/login',
headers: {
isToken: false,
repeatSubmit: false
@@ -42,7 +40,7 @@ export function getInfo() {
// 退出方法
export function logout() {
return request({
- url: '/logout',
- method: 'post'
+ url: '/system/logout',
+ method: 'get'
})
}
diff --git a/src/api/system/apply.js b/src/api/system/apply.js
index a40c3b1..abdd976 100644
--- a/src/api/system/apply.js
+++ b/src/api/system/apply.js
@@ -2,16 +2,25 @@ import request from "@/utils/request";
export function getApplyList(data) {
return request({
- url: "/auto-apply/list-activity-admin",
- method: "post",
+ url: "/activity/list",
+ method: "get",
params: data,
});
}
export function setOrderSort(query) {
return request({
- url: "/auto-apply/set-order",
+ url: "/activity/updateSort",
method: "post",
- params: query,
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ data: query,
+ });
+}
+export function setAutoApply(query) {
+ return request({
+ url: "/activity/changeEnableAutoApply",
+ method: "post",
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ data: query,
});
}
diff --git a/src/api/system/user.js b/src/api/system/user.js
index b5e3edd..2a61c52 100644
--- a/src/api/system/user.js
+++ b/src/api/system/user.js
@@ -4,7 +4,7 @@ import { parseStrEmpty } from "@/utils/ruoyi";
// 查询用户列表
export function listUser(query) {
return request({
- url: '/system/user/list',
+ url: '/user/list',
method: 'get',
params: query
})
@@ -58,14 +58,14 @@ export function resetUserPwd(userId, password) {
}
// 用户状态修改
-export function changeUserStatus(userId, status) {
+export function changeUserStatus(id, status) {
const data = {
- userId,
+ id,
status
}
return request({
- url: '/system/user/changeStatus',
- method: 'put',
+ url: '/user/changeStatus',
+ method: 'post',
data: data
})
}
diff --git a/src/permission.js b/src/permission.js
index dad13fe..0ff6810 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -1,69 +1,72 @@
-import router from './router'
-import { ElMessage } from 'element-plus'
-import NProgress from 'nprogress'
-import 'nprogress/nprogress.css'
-import { getToken } from '@/utils/auth'
-import { isHttp, isPathMatch } from '@/utils/validate'
-import { isRelogin } from '@/utils/request'
-import useUserStore from '@/store/modules/user'
-import useSettingsStore from '@/store/modules/settings'
-import usePermissionStore from '@/store/modules/permission'
+import router from "./router";
+import { ElMessage } from "element-plus";
+import NProgress from "nprogress";
+import "nprogress/nprogress.css";
+import { getToken } from "@/utils/auth";
+import { isHttp, isPathMatch } from "@/utils/validate";
+import { isRelogin } from "@/utils/request";
+import useUserStore from "@/store/modules/user";
+import useSettingsStore from "@/store/modules/settings";
+import usePermissionStore from "@/store/modules/permission";
-NProgress.configure({ showSpinner: false })
+NProgress.configure({ showSpinner: false });
-const whiteList = ['/login', '/register']
+const whiteList = ["/login", "/register"];
const isWhiteList = (path) => {
- return whiteList.some(pattern => isPathMatch(pattern, path))
-}
+ return whiteList.some((pattern) => isPathMatch(pattern, path));
+};
router.beforeEach((to, from, next) => {
- NProgress.start()
+ NProgress.start();
if (getToken()) {
- to.meta.title && useSettingsStore().setTitle(to.meta.title)
+ to.meta.title && useSettingsStore().setTitle(to.meta.title);
/* has token*/
- if (to.path === '/login') {
- next({ path: '/' })
- NProgress.done()
+ if (to.path === "/login") {
+ next({ path: "/" });
+ NProgress.done();
} else if (isWhiteList(to.path)) {
- next()
+ next();
} else {
if (useUserStore().roles.length === 0) {
- isRelogin.show = true
- // 判断当前用户是否已拉取完user_info信息
- useUserStore().getInfo().then(() => {
- isRelogin.show = false
- usePermissionStore().generateRoutes().then(accessRoutes => {
+ // isRelogin.show = true;
+ // // 判断当前用户是否已拉取完user_info信息
+ // isRelogin.show = false;
+ usePermissionStore()
+ .generateRoutes()
+ .then((accessRoutes) => {
// 根据roles权限生成可访问的路由表
- accessRoutes.forEach(route => {
+ accessRoutes.forEach((route) => {
if (!isHttp(route.path)) {
- router.addRoute(route) // 动态添加可访问路由表
+ router.addRoute(route); // 动态添加可访问路由表
}
- })
- next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
- })
- }).catch(err => {
- useUserStore().logOut().then(() => {
- ElMessage.error(err)
- next({ path: '/' })
- })
- })
+ });
+ // next({ ...to, replace: true }); // hack方法 确保addRoutes已完成
+ next();
+ });
+
+ // }).catch(err => {
+ // useUserStore().logOut().then(() => {
+ // ElMessage.error(err)
+ // next({ path: '/' })
+ // })
+ // })
} else {
- next()
+ next();
}
}
} else {
// 没有token
if (isWhiteList(to.path)) {
// 在免登录白名单,直接进入
- next()
+ next();
} else {
- next(`/login`) // 否则全部重定向到登录页
- NProgress.done()
+ next({ path: "/login" }); // 否则全部重定向到登录页
+ NProgress.done();
}
}
-})
+});
router.afterEach(() => {
- NProgress.done()
-})
+ NProgress.done();
+});
diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js
index 496a995..d1350da 100644
--- a/src/store/modules/permission.js
+++ b/src/store/modules/permission.js
@@ -7,7 +7,8 @@ import InnerLink from '@/layout/components/InnerLink'
// 匹配views里面所有的.vue文件
const modules = import.meta.glob('./../../views/**/*.vue')
-
+const route2r = '[{"name":"System","path":"/system","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统管理","icon":"system","noCache":false,"link":null},"children":[{"name":"User","path":"user","hidden":false,"component":"system/user/index","meta":{"title":"用户管理","icon":"user","noCache":false,"link":null}},{"name":"Role","path":"role","hidden":false,"component":"system/role/index","meta":{"title":"角色管理","icon":"peoples","noCache":false,"link":null}},{"name":"Apply","path":"apply","hidden":false,"component":"system/apply/index","meta":{"title":"提报管理","icon":"excel","noCache":false,"link":null}},{"name":"Menu","path":"menu","hidden":false,"component":"system/menu/index","meta":{"title":"菜单管理","icon":"tree-table","noCache":false,"link":null}},{"name":"Dept","path":"dept","hidden":false,"component":"system/dept/index","meta":{"title":"部门管理","icon":"tree","noCache":false,"link":null}},{"name":"Post","path":"post","hidden":false,"component":"system/post/index","meta":{"title":"岗位管理","icon":"post","noCache":false,"link":null}},{"name":"Dict","path":"dict","hidden":false,"component":"system/dict/index","meta":{"title":"字典管理","icon":"dict","noCache":false,"link":null}},{"name":"Config","path":"config","hidden":false,"component":"system/config/index","meta":{"title":"参数设置","icon":"edit","noCache":false,"link":null}},{"name":"Notice","path":"notice","hidden":false,"component":"system/notice/index","meta":{"title":"通知公告","icon":"message","noCache":false,"link":null}},{"name":"Log","path":"log","hidden":false,"redirect":"noRedirect","component":"ParentView","alwaysShow":true,"meta":{"title":"日志管理","icon":"log","noCache":false,"link":null},"children":[{"name":"Operlog","path":"operlog","hidden":false,"component":"monitor/operlog/index","meta":{"title":"操作日志","icon":"form","noCache":false,"link":null}},{"name":"Logininfor","path":"logininfor","hidden":false,"component":"monitor/logininfor/index","meta":{"title":"登录日志","icon":"logininfor","noCache":false,"link":null}}]}]},{"name":"Monitor","path":"/monitor","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统监控","icon":"monitor","noCache":false,"link":null},"children":[{"name":"Online","path":"online","hidden":false,"component":"monitor/online/index","meta":{"title":"在线用户","icon":"online","noCache":false,"link":null}},{"name":"Job","path":"job","hidden":false,"component":"monitor/job/index","meta":{"title":"定时任务","icon":"job","noCache":false,"link":null}},{"name":"Druid","path":"druid","hidden":false,"component":"monitor/druid/index","meta":{"title":"数据监控","icon":"druid","noCache":false,"link":null}},{"name":"Server","path":"server","hidden":false,"component":"monitor/server/index","meta":{"title":"服务监控","icon":"server","noCache":false,"link":null}},{"name":"Cache","path":"cache","hidden":false,"component":"monitor/cache/index","meta":{"title":"缓存监控","icon":"redis","noCache":false,"link":null}},{"name":"CacheList","path":"cacheList","hidden":false,"component":"monitor/cache/list","meta":{"title":"缓存列表","icon":"redis-list","noCache":false,"link":null}}]},{"name":"Tool","path":"/tool","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统工具","icon":"tool","noCache":false,"link":null},"children":[{"name":"Build","path":"build","hidden":false,"component":"tool/build/index","meta":{"title":"表单构建","icon":"build","noCache":false,"link":null}},{"name":"Gen","path":"gen","hidden":false,"component":"tool/gen/index","meta":{"title":"代码生成","icon":"code","noCache":false,"link":null}},{"name":"Swagger","path":"swagger","hidden":false,"component":"tool/swagger/index","meta":{"title":"系统接口","icon":"swagger","noCache":false,"link":null}}]}]'
+const dwx = JSON.parse(route2r)
const usePermissionStore = defineStore(
'permission',
{
@@ -35,10 +36,9 @@ const usePermissionStore = defineStore(
generateRoutes(roles) {
return new Promise(resolve => {
// 向后端请求路由数据
- getRouters().then(res => {
- const sdata = JSON.parse(JSON.stringify(res.data))
- const rdata = JSON.parse(JSON.stringify(res.data))
- const defaultData = JSON.parse(JSON.stringify(res.data))
+ const sdata = JSON.parse(JSON.stringify(dwx))
+ const rdata = JSON.parse(JSON.stringify(dwx))
+ const defaultData = JSON.parse(JSON.stringify(dwx))
const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
const defaultRoutes = filterAsyncRouter(defaultData)
@@ -49,7 +49,7 @@ const usePermissionStore = defineStore(
this.setDefaultRoutes(sidebarRoutes)
this.setTopbarRoutes(defaultRoutes)
resolve(rewriteRoutes)
- })
+
})
}
}
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 1e59417..788f763 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -17,14 +17,13 @@ const useUserStore = defineStore(
actions: {
// 登录
login(userInfo) {
- const username = userInfo.username.trim()
+ const username = userInfo.account
const password = userInfo.password
- const code = userInfo.code
- const uuid = userInfo.uuid
return new Promise((resolve, reject) => {
- login(username, password, code, uuid).then(res => {
- setToken(res.token)
- this.token = res.token
+ login(username, password).then(res => {
+ console.log(res)
+ setToken(res.data.token)
+ this.token = res.data.token
resolve()
}).catch(error => {
reject(error)
@@ -55,7 +54,7 @@ const useUserStore = defineStore(
})
})
},
- // 退出系统
+ // // 退出系统
logOut() {
return new Promise((resolve, reject) => {
logout(this.token).then(() => {
diff --git a/src/utils/request.js b/src/utils/request.js
index 00b910f..ad1f620 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -11,7 +11,7 @@ let downloadLoadingInstance;
// 是否显示重新登录
export let isRelogin = { show: false };
-axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
+axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'
// 创建axios实例
const service = axios.create({
// axios中请求配置有baseURL选项,表示请求URL公共部分
@@ -27,8 +27,9 @@ service.interceptors.request.use(config => {
// 是否需要防止数据重复提交
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
if (getToken() && !isToken) {
- config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
+ config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
+
// get请求映射params参数
if (config.method === 'get' && config.params) {
let url = config.url + '?' + tansParams(config.params);
diff --git a/src/utils/ruoyi.js b/src/utils/ruoyi.js
index c66547c..08f28f1 100644
--- a/src/utils/ruoyi.js
+++ b/src/utils/ruoyi.js
@@ -224,5 +224,5 @@ export function getNormalPath(p) {
// 验证是否为blob格式
export function blobValidate(data) {
- return data.type !== 'application/json'
+ return data.type !== 'application/x-www-form-urlencoded'
}
diff --git a/src/views/login.vue b/src/views/login.vue
index 830fa1f..16cb081 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -5,38 +5,20 @@
{{ title }}
-
-
+
+
-
+
记住密码
-
+
登 录
登 录 中...
@@ -64,15 +46,13 @@ const router = useRouter();
const { proxy } = getCurrentInstance();
const loginForm = ref({
- username: "admin",
- password: "admin123",
- rememberMe: false,
- code: "",
- uuid: ""
+ account: "",
+ password: "",
+ rememberMe: false
});
const loginRules = {
- username: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
+ account: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
};
@@ -82,21 +62,22 @@ const register = ref(false);
const redirect = ref(undefined);
watch(route, (newRoute) => {
- redirect.value = newRoute.query && newRoute.query.redirect;
+ redirect.value = newRoute.query && newRoute.query.redirect;
}, { immediate: true });
function handleLogin() {
proxy.$refs.loginRef.validate(valid => {
+ console.log(valid);
if (valid) {
loading.value = true;
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
if (loginForm.value.rememberMe) {
- Cookies.set("username", loginForm.value.username, { expires: 30 });
+ Cookies.set("account", loginForm.value.account, { expires: 30 });
Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 });
Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 });
} else {
// 否则移除
- Cookies.remove("username");
+ Cookies.remove("account");
Cookies.remove("password");
Cookies.remove("rememberMe");
}
@@ -119,11 +100,11 @@ function handleLogin() {
function getCookie() {
- const username = Cookies.get("username");
+ const account = Cookies.get("account");
const password = Cookies.get("password");
const rememberMe = Cookies.get("rememberMe");
loginForm.value = {
- username: username === undefined ? loginForm.value.username : username,
+ account: account === undefined ? loginForm.value.account : account,
password: password === undefined ? loginForm.value.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
};
@@ -141,6 +122,7 @@ getCookie();
background-image: url("../assets/images/loginbg.png");
background-size: cover;
}
+
.title {
// margin: 0px auto 30px auto;
text-align: center;
@@ -154,32 +136,39 @@ getCookie();
width: 400px;
padding: 25px 25px 5px 25px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+
.el-input {
height: 40px;
+
input {
height: 40px;
}
}
+
.input-icon {
height: 39px;
width: 14px;
margin-left: 0px;
}
}
+
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
+
.login-code {
width: 33%;
height: 40px;
float: right;
+
img {
cursor: pointer;
vertical-align: middle;
}
}
+
.el-login-footer {
height: 40px;
line-height: 40px;
@@ -192,6 +181,7 @@ getCookie();
font-size: 12px;
letter-spacing: 1px;
}
+
.login-code-img {
height: 40px;
padding-left: 12px;
diff --git a/src/views/register.vue b/src/views/register.vue
index 457bba9..df77829 100644
--- a/src/views/register.vue
+++ b/src/views/register.vue
@@ -77,7 +77,7 @@