| @@ -1,14 +1,12 @@ | |||||
| NODE_ENV=development | |||||
| # process.env.VUE_APP_API_ROOT | |||||
| VUE_APP_ENV=development | |||||
| # VUE_APP_API_ROOT_USER=https://smapitest.malls.iformall.com/C | |||||
| # VUE_APP_API_ROOT=http://192.168.0.89:8392 | |||||
| # VUE_APP_API_ROOT=http://192.168.0.165:8392 | |||||
| #lsf新版接口路径 | |||||
| # VUE_APP_API_ROOT=http://192.168.0.46:48080 | |||||
| VUE_APP_API_ROOT=http://192.168.0.89:48080 | |||||
| # 图片代理接口地址 | |||||
| VUE_APP_API_ROOT_IMAGE=http://192.168.0.89:8096 | |||||
| # 登录 | |||||
| VUE_APP_API_ROOT_USER=http://192.168.0.89:8393 | |||||
| # VUE_APP_API_ROOT_USER=http://192.168.0.89:8391 | |||||
| # 开发 | |||||
| NODE_ENV=development | |||||
| VUE_APP_ENV=development | |||||
| VUE_APP_API_ROOT=https://smapitest.malls.iformall.com/C | |||||
| # 正式 | |||||
| # NODE_ENV=production | |||||
| # VUE_APP_ENV=production | |||||
| # VUE_APP_API_ROOT=http://m.metavatar.cc/C | |||||
| @@ -1,9 +1,4 @@ | |||||
| # just a flag | |||||
| ENV = 'development' | |||||
| # base api | |||||
| VUE_APP_BASE_API = '/api' | |||||
| # environment env 环境 | |||||
| VUE_APP_MONEY = 1000 | |||||
| # NODE_ENV=development | |||||
| # VUE_APP_ENV=development | |||||
| # VUE_APP_API_ROOT=https://smapitest.malls.iformall.com/C | |||||
| @@ -1,5 +1,4 @@ | |||||
| NODE_ENV=production | |||||
| VUE_APP_ENV=production | |||||
| VUE_APP_API_ROOT=http://xxxx.com/api | |||||
| # NODE_ENV=production | |||||
| # VUE_APP_ENV=production | |||||
| # VUE_APP_API_ROOT=http://m.metavatar.cc/C | |||||
| @@ -12,17 +12,25 @@ | |||||
| <link rel="icon" href="<%= BASE_URL %>favicon.ico"> | <link rel="icon" href="<%= BASE_URL %>favicon.ico"> | ||||
| <link rel="icon" href="/favicon.ico" type="image/x-icon" /> | |||||
| <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> | |||||
| <link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.13.2/skins/default/aliplayer-min.css"> | <link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.13.2/skins/default/aliplayer-min.css"> | ||||
| <script src="http://g.alicdn.com/de/prismplayer/{version}/aliplayer-h5-min.js"></script> | <script src="http://g.alicdn.com/de/prismplayer/{version}/aliplayer-h5-min.js"></script> | ||||
| <script charset="utf-8" type="text/javascript" src="https://g.alicdn.com/de/prismplayer/2.13.2/aliplayer-min.js"> | <script charset="utf-8" type="text/javascript" src="https://g.alicdn.com/de/prismplayer/2.13.2/aliplayer-min.js"> | ||||
| </script> | </script> | ||||
| <title> | <title> | ||||
| <%= htmlWebpackPlugin.options.title %> | <%= htmlWebpackPlugin.options.title %> | ||||
| </title> | </title> | ||||
| <!-- 引入样式 --> | |||||
| <% for(var css of htmlWebpackPlugin.options.cdn.css) { %> | |||||
| <link rel="stylesheet" href="<%=css%>"> | |||||
| <% } %> | |||||
| <!-- 引入JS --> | |||||
| <% for(var js of htmlWebpackPlugin.options.cdn.js) { %> | |||||
| <script src="<%=js%>"></script> | |||||
| <% } %> | |||||
| </head> | </head> | ||||
| <body> | <body> | ||||
| @@ -123,7 +123,9 @@ export function doLoginOut() { | |||||
| * @description 获取图形验证码 | * @description 获取图形验证码 | ||||
| * @returns data | * @returns data | ||||
| */ | */ | ||||
| export const doCodeImg = | |||||
| 'https://smapitest.malls.iformall.com/C/api/user/captcha.jpg' | |||||
| // export const doCodeImg = | |||||
| // 'http://m.metavatar.cc/C/api/user/captcha.jpg' | |||||
| // export const doCodeImg = | |||||
| // 'https://smapitest.malls.iformall.com/C/api/user/captcha.jpg' | |||||
| // export const doCodeImg = | |||||
| // 'http://m.metavatar.cc/C/api/user/captcha.jpg' | |||||
| export const doCodeImg =process.env.VUE_APP_API_ROOT+'/api/user/captcha.jpg' | |||||
| @@ -173,8 +173,9 @@ export default { | |||||
| that | that | ||||
| .$axios({ | .$axios({ | ||||
| method: 'post', | method: 'post', | ||||
| url: `https://smapitest.malls.iformall.com/C/api/upload/awsImgUpload`, | |||||
| // url: `https://smapitest.malls.iformall.com/C/api/upload/awsImgUpload`, | |||||
| // url: `http://m.metavatar.cc/C/api/upload/awsImgUpload`, | // url: `http://m.metavatar.cc/C/api/upload/awsImgUpload`, | ||||
| url: process.env.VUE_APP_API_ROOT + `/api/upload/awsImgUpload`, | |||||
| headers: { | headers: { | ||||
| 'content-type': 'multipart/form-data', | 'content-type': 'multipart/form-data', | ||||
| token: AccessToken, | token: AccessToken, | ||||
| @@ -543,8 +543,9 @@ export default { | |||||
| if (AccessToken) { | if (AccessToken) { | ||||
| this.$axios({ | this.$axios({ | ||||
| method: 'get', | method: 'get', | ||||
| url: `https://smapitest.malls.iformall.com/C/api/userVideo/list?pageNum=1&pageSize=3`, | |||||
| // url: `https://smapitest.malls.iformall.com/C/api/userVideo/list?pageNum=1&pageSize=3`, | |||||
| // url: `http://m.metavatar.cc/C/api/userVideo/list?pageNum=1&pageSize=3`, | // url: `http://m.metavatar.cc/C/api/userVideo/list?pageNum=1&pageSize=3`, | ||||
| url: process.env.VUE_APP_API_ROOT + `/api/userVideo/list?pageNum=1&pageSize=3`, | |||||
| headers: { | headers: { | ||||
| 'Content-Type': 'application/json;charset=UTF-8', | 'Content-Type': 'application/json;charset=UTF-8', | ||||
| token: AccessToken | token: AccessToken | ||||
| @@ -3,9 +3,10 @@ import router from '@/router' | |||||
| import { Toast } from 'vant' | import { Toast } from 'vant' | ||||
| // 基础地址 | // 基础地址 | ||||
| const baseURL = 'https://smapitest.malls.iformall.com/C' //测试环境 | |||||
| // const baseURL = 'https://smapitest.malls.iformall.com/C' //测试环境 | |||||
| // const baseURL = 'http://m.metavatar.cc/C' //正式环境 | // const baseURL = 'http://m.metavatar.cc/C' //正式环境 | ||||
| const baseURL = process.env.VUE_APP_API_ROOT //测试环境 | |||||
| /** | /** | ||||
| * @description:发送Axios请求 | * @description:发送Axios请求 | ||||
| */ | */ | ||||
| @@ -359,6 +359,8 @@ export default { | |||||
| }, | }, | ||||
| mounted() { | mounted() { | ||||
| console.log(process.env.NODE_ENV); | |||||
| console.log(process.env.VUE_APP_ENV); | |||||
| this.inPage = true; | this.inPage = true; | ||||
| scrollToID('top'); | scrollToID('top'); | ||||
| }, | }, | ||||
| @@ -1,12 +1,41 @@ | |||||
| // const UglifyJsPlugin = require('uglifyjs-webpack-plugin') | // const UglifyJsPlugin = require('uglifyjs-webpack-plugin') | ||||
| const path = require('path'); | const path = require('path'); | ||||
| let externals = {} | |||||
| let cdn = { css: [], js: [] } | |||||
| const isProduction = process.env.VUE_APP_ENV == 'production' // 判断是否是生产环境 | |||||
| if (isProduction) { | |||||
| externals = { | |||||
| /** | |||||
| * externals 对象属性解析: | |||||
| * '包名' : '在项目中引入的名字' | |||||
| */ | |||||
| 'vue': 'Vue', | |||||
| 'element-ui': 'ELEMENT', | |||||
| 'xlsx': 'XLSX' | |||||
| } | |||||
| cdn = { | |||||
| css: [ | |||||
| 'https://unpkg.com/element-ui/lib/theme-chalk/index.css' // element-ui css 样式表 | |||||
| ], | |||||
| js: [ | |||||
| // vue must at first! | |||||
| 'https://unpkg.com/vue@2.6.12/dist/vue.js', // vuejs | |||||
| 'https://unpkg.com/element-ui/lib/index.js', // element-ui js | |||||
| 'https://cdn.jsdelivr.net/npm/xlsx@0.16.6/dist/xlsx.full.min.js' // xlsx | |||||
| ] | |||||
| } | |||||
| } | |||||
| module.exports = { | module.exports = { | ||||
| configureWebpack: { | configureWebpack: { | ||||
| resolve: { | resolve: { | ||||
| alias: { | alias: { | ||||
| '@': path.resolve(__dirname, 'src') | '@': path.resolve(__dirname, 'src') | ||||
| } | } | ||||
| } | |||||
| }, | |||||
| externals | |||||
| }, | }, | ||||
| css: { | css: { | ||||
| loaderOptions: { | loaderOptions: { | ||||
| @@ -39,7 +68,8 @@ module.exports = { | |||||
| }, | }, | ||||
| proxy: { | proxy: { | ||||
| '/api': { | '/api': { | ||||
| target: 'https://smapitestmalls,iformall.com/C/api', | |||||
| // target: 'https://smapitestmalls,iformall.com/C/api', | |||||
| target: process.env.VUE_APP_API_ROOT+'/api', | |||||
| changeOrigin: true, | changeOrigin: true, | ||||
| pathRewrite: { | pathRewrite: { | ||||
| '^/api': '' | '^/api': '' | ||||
| @@ -56,6 +86,17 @@ module.exports = { | |||||
| args[0].favicon = './public/favicon.ico'; | args[0].favicon = './public/favicon.ico'; | ||||
| return args; | return args; | ||||
| }); | }); | ||||
| // 注入cdn变量 (打包时会执行) | |||||
| config.plugin('html').tap(args => { | |||||
| args[0].cdn = cdn // 配置cdn给插件 | |||||
| return args | |||||
| }) | |||||
| } | } | ||||
| // configureWebpack: { | // configureWebpack: { | ||||
| // plugins: [ | // plugins: [ | ||||