nuxt.config.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. const path = require('path')
  2. const isProdMode = Object.is(process.env.NODE_ENV, 'production')
  3. // b2c后台
  4. const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://api.usoftmall.com/' : 'http://192.168.253.121:9090/platform-b2c')
  5. // 公共询价
  6. const commonUrl = process.env.COMMON_URL || (isProdMode ? 'https://api-inquiry.usoftmall.com/' : 'http://218.17.158.219:24000/')
  7. // 公共物料
  8. const materialUrl = process.env.MATERIAL_URL || (isProdMode ? 'https://api-product.usoftmall.com/' : 'http://218.17.158.219:24000/')
  9. module.exports = {
  10. router: {
  11. middleware: 'check-auth',
  12. scrollBehavior: function (to, from, savedPosition) {
  13. return { x: 0, y: 0 }
  14. }
  15. },
  16. /*
  17. ** Headers of the page
  18. */
  19. head: {
  20. title: '【优软商城】IC电子元器件现货采购交易平台商城',
  21. meta: [
  22. { charset: 'utf-8' },
  23. { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge,chrome=1' },
  24. { name: 'render', content: 'webkit' },
  25. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  26. { hid: 'description', name: 'description', content: '优软商城(usoftmall.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!' }
  27. ],
  28. link: [
  29. { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
  30. ]
  31. },
  32. /*
  33. ** loading Style
  34. */
  35. loading: '~components/common/loading/Loading.vue',
  36. /*
  37. ** Build configuration
  38. */
  39. build: {
  40. /*
  41. ** Run ESLINT on save
  42. */
  43. extractCSS: { allChunks: true },
  44. extend(config, { isDev, isClient, isServer }) {
  45. config.resolve.alias['~utils'] = path.join(__dirname, 'utils')
  46. config.resolve.alias['~components'] = path.join(__dirname, 'components')
  47. config.resolve.alias['~plugins'] = path.join(__dirname, 'plugins')
  48. config.resolve.alias['~store'] = path.join(__dirname, 'store')
  49. config.resolve.alias['~assets'] = path.join(__dirname, 'assets')
  50. // config.module.rules.push({
  51. // test: /\.scss$/,
  52. // loader: 'style-loader!css-loader!sass-loader'
  53. // })
  54. if (isClient) {
  55. config.module.rules.push({
  56. enforce: 'pre',
  57. test: /\.(js|vue)$/,
  58. loader: 'eslint-loader',
  59. exclude: /(node_modules)/
  60. })
  61. }
  62. },
  63. vendor: [
  64. 'axios',
  65. 'swiper',
  66. 'element-ui'
  67. ],
  68. babel: {
  69. presets: ['es2015', 'stage-2'],
  70. plugins: [
  71. 'transform-async-to-generator',
  72. 'transform-runtime'
  73. ],
  74. comments: true
  75. },
  76. postcss: [
  77. require('autoprefixer')({
  78. browsers: ['last 3 versions']
  79. })
  80. ]
  81. },
  82. css: [
  83. '~assets/scss/app.scss'
  84. ],
  85. dev: !isProdMode,
  86. env: {
  87. baseUrl,
  88. commonUrl,
  89. materialUrl
  90. },
  91. plugins: [
  92. {
  93. src: '~plugins/axios.js'
  94. },
  95. {
  96. src: '~plugins/vue-filter.js'
  97. }, {
  98. src: '~plugins/mixin.js'
  99. }, {
  100. src: '~plugins/swiper.js',
  101. ssr: false
  102. }, {
  103. src: '~plugins/vue-loading.js',
  104. ssr: false
  105. }, {
  106. src: '~plugins/vue-empty.js',
  107. ssr: false
  108. }, {
  109. src: '~plugins/element-ui.js',
  110. ssr: true
  111. }, {
  112. src: '~plugins/filters.js',
  113. ssr: false
  114. }, {
  115. src: '~plugins/jsonp.js',
  116. ssr: false
  117. }],
  118. // proxyTable: ['/api/**', '/search/**', '/user/**', '/login/**', '/register/**', '/logout/**', '/static/**', '/vendor**', '/user**', '/trade/**', '/recommendation/**', '/store-service/**', '/basic/**', '/logout**', '/operation/**', '/help**', '/product**', '/store**', '/order/proxy**', '/report/**', '/store/**#/**', '/kdn/**', '/product/**Submit', '/admin**', '/product/**Submit/**', '/release/**', '/auth/store/**', '/produce/**', '/file**', '/rate/**', '/log/**', '/help-service/**', '/keyword/**', '/tip/**', '/UASBatchPutOnProperty**', '/UASBatchPutOnProperty/**']
  119. /**
  120. * http-proxy configuration example: {
  121. * '/api/order/**': 'https://api-order.example.com',
  122. * '/api/product/**': 'https://api-product.example.com'
  123. * }
  124. */
  125. proxyTable: {
  126. '/api/**': baseUrl,
  127. '/search/**': baseUrl,
  128. '/user/**': baseUrl,
  129. '/user**': baseUrl,
  130. '/login/**': baseUrl,
  131. '/newLogin/**': baseUrl,
  132. '/mPassWord/page': baseUrl,
  133. '/mEmail/page': baseUrl,
  134. '/mPhone/page': baseUrl,
  135. '/mQuestion/page': baseUrl,
  136. '/realNameAuth/page': baseUrl,
  137. '/register/**': baseUrl,
  138. '/logout/**': baseUrl,
  139. '/static/**': baseUrl,
  140. '/vendor**': baseUrl,
  141. '/trade/**': baseUrl,
  142. '/recommendation/**': baseUrl,
  143. '/store-service/**': baseUrl,
  144. '/basic/**': baseUrl,
  145. '/logout**': baseUrl,
  146. '/operation/**': baseUrl,
  147. '/help**': baseUrl,
  148. '/product**': baseUrl,
  149. '/store**': baseUrl,
  150. '/order/proxy**': baseUrl,
  151. '/report/**': baseUrl,
  152. '/store/**#/**': baseUrl,
  153. '/kdn/**': baseUrl,
  154. '/product/**Submit': baseUrl,
  155. '/admin**': baseUrl,
  156. '/product/**Submit/**': baseUrl,
  157. '/release/**': baseUrl,
  158. '/auth/store/**': baseUrl,
  159. '/produce/**': baseUrl,
  160. '/file**': baseUrl,
  161. '/rate/**': baseUrl,
  162. '/log/**': baseUrl,
  163. '/help-service/**': baseUrl,
  164. '/keyword/**': baseUrl,
  165. '/tip/**': baseUrl,
  166. '/UASBatchPutOnProperty**': baseUrl,
  167. '/UASBatchPutOnProperty/**': baseUrl,
  168. '/seek/**': baseUrl,
  169. '/inquiry/**': commonUrl,
  170. '/b2b/**': baseUrl,
  171. '/commodity-service/**': baseUrl,
  172. '/background/**': baseUrl,
  173. '/goods/**': baseUrl,
  174. // 公共物料匹配类目
  175. '/productuser/**': materialUrl,
  176. // 权限管理
  177. '/account/**': baseUrl,
  178. '/vendor/**': baseUrl,
  179. '/internalmessage-service/**': baseUrl,
  180. '/wx/**': baseUrl
  181. }
  182. }