nuxt.config.js 7.1 KB

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