nuxt.config.js 6.1 KB

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