diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/custom/SysContractController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/custom/SysContractController.java index 634d58b14..f0eebdb6c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/custom/SysContractController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/custom/SysContractController.java @@ -91,8 +91,15 @@ public class SysContractController extends BaseController { @GetMapping("/file/{id}") - public String getContract(@PathVariable long id) { - return redirect("/swagger-ui.html"); + public AjaxResult getfile(@PathVariable long id) { + try { + AjaxResult ajax = AjaxResult.success(); +// ajax.put("url", "/login"); + ajax.put("data", id); + return ajax; + } catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } } /** diff --git a/ruoyi-ui/src/api/custom/contract.js b/ruoyi-ui/src/api/custom/contract.js index 80fa8bec4..8cfc776ae 100644 --- a/ruoyi-ui/src/api/custom/contract.js +++ b/ruoyi-ui/src/api/custom/contract.js @@ -50,4 +50,11 @@ export function exportContract(query) { method: 'get', params: query }) -} \ No newline at end of file +} + +export function getFile(id) { + return request({ + url: '/custom/contract/file/' + id, + method: 'get', + }) +} diff --git a/ruoyi-ui/src/permission.js b/ruoyi-ui/src/permission.js index 5b7d18cd1..14fb79fef 100644 --- a/ruoyi-ui/src/permission.js +++ b/ruoyi-ui/src/permission.js @@ -1,20 +1,20 @@ import router from './router' import store from './store' -import { Message } from 'element-ui' +import {Message} from 'element-ui' import NProgress from 'nprogress' import 'nprogress/nprogress.css' -import { getToken } from '@/utils/auth' +import {getToken} from '@/utils/auth' -NProgress.configure({ showSpinner: false }) +NProgress.configure({showSpinner: false}) -const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/sign'] +const whiteList = ['/login', '/auth-redirect', '/bind', '/register'] router.beforeEach((to, from, next) => { NProgress.start() if (getToken()) { /* has token*/ if (to.path === '/login') { - next({ path: '/' }) + next({path: '/'}) NProgress.done() } else { if (store.getters.roles.length === 0) { @@ -22,18 +22,18 @@ router.beforeEach((to, from, next) => { store.dispatch('GetInfo').then(res => { // 拉取user_info const roles = res.roles - store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => { - // 测试 默认静态页面 - // store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => { + store.dispatch('GenerateRoutes', {roles}).then(accessRoutes => { + // 测试 默认静态页面 + // store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => { // 根据roles权限生成可访问的路由表 router.addRoutes(accessRoutes) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 + next({...to, replace: true}) // hack方法 确保addRoutes已完成 }) }) .catch(err => { store.dispatch('FedLogOut').then(() => { Message.error(err) - next({ path: '/' }) + next({path: '/'}) }) }) } else { @@ -49,7 +49,7 @@ router.beforeEach((to, from, next) => { } } else { // 没有token - if (whiteList.indexOf(to.path) !== -1) { + if (whiteList.indexOf(to.path) !== -1 || to.path.startsWith('/contract')) { // 在免登录白名单,直接进入 next() } else { diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index 59e6ce592..e231d899b 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -125,9 +125,10 @@ export const constantRoutes = [ ] }, { - path: '/sign', + path: '/contract/:id(\\d+)', hidden: true, component: (resolve) => require(['@/views/custom/signContract'], resolve), + meta: { title: '合同' } } ] diff --git a/ruoyi-ui/src/views/custom/signContract/index.vue b/ruoyi-ui/src/views/custom/signContract/index.vue index 0b4f0409d..b1cd1999b 100644 --- a/ruoyi-ui/src/views/custom/signContract/index.vue +++ b/ruoyi-ui/src/views/custom/signContract/index.vue @@ -1,85 +1,59 @@