nuxt.config.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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 ? 'https://api.usoftchina.com/' : 'http://test-b2c.uuzcc.cn/')
  5. // 公共询价
  6. const commonUrl = process.env.COMMON_URL || (isProdMode ? 'https://api-inquiry.usoftchina.com/' : 'http://test-inquiry.uuzcc.cn/')
  7. // 公共物料
  8. const materialUrl = process.env.MATERIAL_URL || (isProdMode ? 'https://api-product.usoftchina.com/' : 'http://test-product.uuzcc.cn/')
  9. // 公共cms
  10. const cmsUrl = process.env.CMS_URL || (isProdMode ? 'https://cms.usoftchina.com' : 'https://cms.usoftchina.com/')
  11. // 消息
  12. const messageUrl = process.env.MESSAGE_URL || (isProdMode ? 'https://api-message.usoftchina.com/' : 'http://test-message.uuzcc.cn/')
  13. // B2B
  14. const uasUrl = process.env.uasUrl || (isProdMode ? 'https://b2b.usoftchina.com/' : 'http://test-b2b.uuzcc.cn/')
  15. // 帐户中心
  16. const ssoUrl = process.env.ssoUrl || (isProdMode ? 'https://sso.ubtob.com/' : 'http://test-sso-server.uuzcc.cn/')
  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'
  130. },
  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. // B2B服务接口 uasUrl
  147. '/purchase/arCheck': uasUrl,
  148. '/sale/inquiry/**': uasUrl,
  149. '/purc/inquiry/**': uasUrl,
  150. '/sale/orders/**': uasUrl,
  151. '/sale/apBill/**': uasUrl,
  152. '/sale/arCheck/**': uasUrl,
  153. '/sale/apCheck/**': uasUrl,
  154. '/sale/tender/**': uasUrl,
  155. '/sale/sample/**': uasUrl,
  156. '/sale/**': uasUrl,
  157. '/vendorDistribute/**': uasUrl,
  158. '/tender/purc/**': uasUrl,
  159. '/tender/getUnreadIds/**': uasUrl,
  160. '/token**': uasUrl,
  161. '/authentication**': uasUrl,
  162. '/authentication/**': uasUrl,
  163. '/vendor/customer/**': uasUrl,
  164. '/vendor/info/**': uasUrl,
  165. '/vendorPerformanceAssess/info/**': uasUrl,
  166. '/vendor/**': baseUrl,
  167. '/vendor**': baseUrl,
  168. // 账户中心统一前缀
  169. '/ssoPrefix/**': ssoUrl,
  170. '/api/**': baseUrl,
  171. '/search/**': baseUrl,
  172. '/user/**': baseUrl,
  173. '/user**': baseUrl,
  174. '/login/**': baseUrl,
  175. '/newLogin/**': baseUrl,
  176. '/mPassWord/page': baseUrl,
  177. '/mEmail/page': baseUrl,
  178. '/mPhone/page': baseUrl,
  179. '/mQuestion/page': baseUrl,
  180. '/realNameAuth/page': baseUrl,
  181. '/register/**': baseUrl,
  182. '/logout/**': baseUrl,
  183. '/static/**': baseUrl,
  184. '/trade/**': baseUrl,
  185. '/CommodityInOutbound/**': baseUrl,
  186. '/recommendation/**': baseUrl,
  187. '/store-service/**': baseUrl,
  188. '/basic/**': baseUrl,
  189. '/logout**': baseUrl,
  190. '/operation/**': baseUrl,
  191. '/help**': baseUrl,
  192. '/product**': baseUrl,
  193. '/store**': baseUrl,
  194. '/order/proxy**': baseUrl,
  195. '/report/**': baseUrl,
  196. '/store/**#/**': baseUrl,
  197. '/kdn/**': baseUrl,
  198. '/product/**Submit': baseUrl,
  199. '/admin**': baseUrl,
  200. '/product/**Submit/**': baseUrl,
  201. '/release/**': baseUrl,
  202. '/auth/store/**': baseUrl,
  203. '/produce/**': baseUrl,
  204. '/file**': baseUrl,
  205. '/rate/**': baseUrl,
  206. '/log/**': baseUrl,
  207. '/help-service/**': baseUrl,
  208. '/keyword/**': baseUrl,
  209. '/tip/**': baseUrl,
  210. '/UASBatchPutOnProperty**': baseUrl,
  211. '/UASBatchPutOnProperty/**': baseUrl,
  212. '/seek/**': baseUrl,
  213. '/inquiry/**': commonUrl,
  214. '/b2b/**': baseUrl,
  215. '/commodity-service/**': baseUrl,
  216. '/background/**': baseUrl,
  217. '/goods/**': baseUrl,
  218. // 公共物料匹配物料名称
  219. '/productuser/**': materialUrl,
  220. '/account/**': baseUrl,
  221. '/internalmessage-service/**': baseUrl,
  222. '/wx/**': baseUrl,
  223. '/messages**': messageUrl,
  224. '/messages/**': messageUrl,
  225. '/cmsApi**': cmsUrl,
  226. '/mEmail/**': baseUrl,
  227. '/mPhone/**': baseUrl,
  228. '/sso**': baseUrl,
  229. // 代办事项
  230. '/adminToDo/**': baseUrl,
  231. // 账户中心获取申请绑定列表接口
  232. '/api/userspace/apply/**': ssoUrl,
  233. // 权限管理
  234. '/btob/**': {target: uasUrl, changeOrigin: true, pathRewrite: {'^/btob': '/'}}
  235. }
  236. }