vue.config.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * @Author: your name
  3. * @Date: 2020-01-20 08:56:10
  4. * @LastEditTime: 2020-05-28 17:49:57
  5. * @LastEditors: Please set LastEditors
  6. * @Description: In User Settings Edit
  7. * @FilePath: \admin-frame\vue.config.js
  8. */
  9. const path = require('path');
  10. const menu = require(process.env.VUE_APP_MOCK_MENU || './mock/menu');
  11. const frameSrc = path.resolve(__dirname);
  12. const baseUrl = '/admin';
  13. module.exports = {
  14. // baseUrl: './',
  15. publicPath: baseUrl, // : process.env.VUE_APP_ROOT_URL,
  16. productionSourceMap: false,
  17. configureWebpack: {
  18. resolve: {
  19. alias: {
  20. '@frame': frameSrc,
  21. '@naf': path.join(frameSrc, '/naf'),
  22. '@lib': path.join(frameSrc, '/lib'),
  23. },
  24. },
  25. },
  26. devServer: {
  27. port: 3000,
  28. // historyApiFallback: {
  29. // disableDotRule: true,
  30. // rewrites: [
  31. // { from: /^\/$/, to: path.posix.join(baseUrl, 'loading.html') },
  32. // { from: /\/login/, to: path.posix.join(baseUrl, 'login.html') },
  33. // { from: /\/frame/, to: path.posix.join(baseUrl, 'frame.html') },
  34. // { from: /./, to: path.posix.join(baseUrl, '404.html') },
  35. // ],
  36. // },
  37. before(app) {
  38. app.use('/api', (req, res, next) => {
  39. console.log(`[${req.method}]`, req.path);
  40. res.set({
  41. 'Cache-Control': 'no-cache',
  42. Pragma: 'no-cache',
  43. Expires: -1,
  44. });
  45. next();
  46. });
  47. app.use('/api/gaf', menu);
  48. },
  49. proxy: {
  50. '/admin/gaf': {
  51. target: 'http://localhost:3001',
  52. },
  53. '/admin/xms': {
  54. target: 'http://localhost:3002',
  55. },
  56. '/api/gaf/': {
  57. target: 'http://192.168.0.120:18080',
  58. // pathRewrite: { '^/api': '' },
  59. },
  60. '/api/xms/': {
  61. target: 'http://192.168.0.120:18080',
  62. // pathRewrite: { '^/api': '' },
  63. },
  64. '/api/': {
  65. target: 'http://192.168.0.120:18080',
  66. // pathRewrite: { '^/api': '' },
  67. },
  68. '/api/CapturePicture': {
  69. target: 'http://127.0.0.1:18090',
  70. changeOrigin: true,
  71. pathRewrite: { '^/api': '/' },
  72. },
  73. '/api/getcert': {
  74. target: 'http://127.0.0.1:18090',
  75. changeOrigin: true,
  76. pathRewrite: { '^/api': '/' },
  77. },
  78. // '/api/menu/': {
  79. // // target: 'http://jit.cc-lotus.info',
  80. // // target: 'http://debug.cc-lotus.info',
  81. // target: 'http://localhost:8085',
  82. // pathRewrite: { '^/api': '/gaf' },
  83. // },
  84. },
  85. },
  86. };