vue.config.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. let proxy = {
  2. "/api/ecs_core": {
  3. target: "http://ecs-dev.qmth.com.cn:8000", //代理跨域转地址,基础信息
  4. changeOrigin: true
  5. },
  6. // "/api/logic/portal": {
  7. // target: " http://ecs-dev.qmth.com.cn:8018", //基础信息 门户 王伟
  8. // changeOrigin: true
  9. // },
  10. "/api/ecs_exam_work": {
  11. target: "http://ecs-dev.qmth.com.cn:8001", // 考务 王伟
  12. changeOrigin: true
  13. },
  14. // "/api/ecs_outlet": {
  15. // target: " http://ecs-dev.qmth.com.cn:8007", // 王伟
  16. // changeOrigin: true
  17. // },
  18. "/facepp_api": {
  19. target: "http://ecs-dev.qmth.com.cn:8898", // 陈恳
  20. changeOrigin: true
  21. }
  22. };
  23. const stu = [
  24. "/api/ecs_oe",
  25. "/api/online_exam_course",
  26. "/api/sys_param",
  27. "/api/exam_record",
  28. "/api/exam_control",
  29. "/api/exam_question",
  30. "/api/exam_score",
  31. "/api/practice_course",
  32. "/api/practice_detail",
  33. "/api/practice_record",
  34. "/api/exam_captures",
  35. "/api/face_capture",
  36. "/api/face_verify",
  37. "/api/offline_exam"
  38. ];
  39. for (const s of stu) {
  40. proxy[s] = {
  41. target: "http://ecs-dev.qmth.com.cn:8003", // 陈恳
  42. changeOrigin: true
  43. };
  44. }
  45. const mock = [{ source: "/api/mock/exam_question", dest: "/examQuestions" }];
  46. for (const m of mock) {
  47. proxy[m.source] = {
  48. target: "http://localhost:3000/",
  49. changeOrigin: true,
  50. pathRewrite: {
  51. ".*": m.dest
  52. }
  53. };
  54. }
  55. var webpack = require("webpack");
  56. module.exports = {
  57. devServer: {
  58. proxy
  59. },
  60. chainWebpack: config => {
  61. // iview Loader
  62. config.module
  63. .rule("vue")
  64. .test(/\.vue$/)
  65. .use("iview-loader")
  66. .loader("iview-loader")
  67. .options({
  68. prefix: true
  69. })
  70. .end();
  71. },
  72. configureWebpack: {
  73. plugins: [
  74. // Ignore all locale files of moment.js
  75. // TODO: use webpack stats to check if iview locale matters
  76. new webpack.IgnorePlugin(/^\.\/locale$/, /moment|iview$/)
  77. ]
  78. }
  79. };