[update app] 增加打包APP命令

This commit is contained in:
danshihao
2024-05-30 15:04:42 +08:00
parent b495205f16
commit c8a1f0b36b
7 changed files with 27 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
NODE_ENV=production
VUE_APP_PLATFORM_NAME=昆鸿设备管理系统
VUE_APP_SSO=false
VUE_APP_ROUTER_MODE=hash
VUE_APP_IS_APP=true
+1
View File
@@ -5,6 +5,7 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"build:app": "vue-cli-service build --mode app",
"lint": "vue-cli-service lint",
"build:test": "vue-cli-service build --mode test",
"pre": "cnpm install || yarn --registry https://registry.npm.taobao.org || npm install --registry https://registry.npm.taobao.org "
+12
View File
@@ -0,0 +1,12 @@
/**
* 防止打包部署时路径被写死
*/
window._CONFIG = {}
window._CONFIG.domianURL = 'http://192.168.137.1:9393/jero-boot' // 路由转发 devServer
window._CONFIG.domianWebSocketURL = 'http://192.168.137.1:9393'
// 单点登录地址
window._CONFIG.staticDomainURL = window._CONFIG.domianURL + '/sys/common/download'
window._CONFIG.pdfDomainURL = window._CONFIG.domianURL + '/sys/common/pdf/pdfPreviewIframe'
window._CONFIG.casPrefixUrl = 'http://cas.example.org:8443/cas'
// 预览文件地址
window._CONFIG.onlinePreviewDomainURL = 'http://127.0.0.1:8012/onlinePreview'
+4
View File
@@ -9,6 +9,10 @@
<!--<link rel="icon" href="<%= BASE_URL %>logo.png">-->
<script src="<%= BASE_URL %>cdn/babel-polyfill/polyfill_7_2_5.js"></script>
<script src="<%= BASE_URL %>api_address_config.js"></script>
<!-- 打包app的接口 -->
<% if (process.env.VUE_APP_IS_APP === 'true' ) { %>
<script src="<%= BASE_URL %>app_api_address_config.js"></script>
<% } %>
<style>
html,
body,
+2 -2
View File
@@ -165,7 +165,7 @@ export default {
message: '真的要注销登录吗 ?'
}).then(() => {
return that.Logout({}).then(() => {
window.location.replace('/user/login')
this.$router.replace('/user/login')
}).catch(err => {
that.$message.error({
title: '错误',
@@ -180,7 +180,7 @@ export default {
content: '真的要注销登录吗 ?',
onOk () {
return that.Logout({}).then(() => {
window.location.replace('/user/login')
this.$router.replace('/user/login')
}).catch(err => {
that.$message.error({
title: '错误',
+2 -1
View File
@@ -11,7 +11,8 @@ Router.prototype.push = function push (location, onResolve, onReject) {
}
export default new Router({
mode: 'history',
// 打包app使用hash模式
mode: process.env.VUE_APP_ROUTER_MODE || 'history',
base: process.env.BASE_URL,
scrollBehavior: () => ({ y: 0 }),
routes: constantRouterMap
+1 -1
View File
@@ -15,7 +15,7 @@ module.exports = {
// 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
productionSourceMap: false,
// 打包app时放开该配置
// publicPath:'./',
publicPath: process.env.VUE_APP_IS_APP === 'true' ? './' : '/',
configureWebpack: config => {
// 生产环境取消 console.log
if (process.env.NODE_ENV === 'production') {