nuxt.config.js 6.6 KB

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