nuxt.config.js 6.3 KB

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