https://gitee.com/y_project/RuoYi-Vue
npm install --registry=https://registry.npmmirror.com
npm run dev
否则打包后请求路径会和后端冲突
src/router/index.js
export default new Router({// mode: 'history', // 去掉url中的#mode: 'hash', // 去掉url中的#scrollBehavior: () => ({ y: 0 }),routes: constantRoutes
})
否则打包后访问会出现找不到模块的错误
src/store/modules/permission.js
export const loadView = (view) => {if (process.env.NODE_ENV === 'development') {return (resolve) => require([`@/views/${view}`], resolve)} else {// 使用 import 实现生产环境的路由懒加载// return () => import(`@/views/${view}`)return (resolve) => require([`@/views/${view}`], resolve)}
}
.env.staging提前去掉代理路径
VUE_APP_BASE_API = ''
npm run build:stage
也就是想通过localhost/admin访问,而不是直接通过localhost访问
前端css,css等资源需要开启权限,否则访问不到,包括/admin路径
com.ruoyi.framework.config.SecurityConfig.configure()
.antMatchers("/admin","/static/**").permitAll()
主动退出后台,或者过期退出后台,会调到/路径,而不是/admin,需要在前端配置
src/layout/components/Navbar.vue
async logout() {this.$confirm('确定注销并退出系统吗?', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {this.$store.dispatch('LogOut').then(() => {location.href = '/admin';})}).catch(() => {});}
src/utils/request.js
if (!isRelogin.show) {isRelogin.show = true;MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {isRelogin.show = false;store.dispatch('LogOut').then(() => {location.href = '/admin';})}).catch(() => {isRelogin.show = false;});}
生成信息讲解
@RequestMapping("/diskCard/cardPass")
@RequestMapping("/模块名/业务名")
package com.ruoyi.diskCard.domain;
package 生成包路径.domain;
1.头像上传路径需要修改
需要提前在linux系统中新建/home/ruoyi文件夹,有个log文件也是在此文件夹下,否则启动报错
src/main/resources/application.yml
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)profile: D:/ruoyi/uploadPath
2.部署全流程