feat: 添加动态配置API基础URL功能
在config.js中添加全局变量__API_BASE__,并在main.js中实现优先使用配置的API基础URL,其次使用location.origin或默认值的逻辑
This commit is contained in:
parent
996f4cb2a0
commit
08d0000f3f
|
|
@ -0,0 +1 @@
|
|||
window.__API_BASE__ = ''
|
||||
|
|
@ -305,6 +305,7 @@
|
|||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<script src="./config.js"></script>
|
||||
<script src="./vendor/vue.global.prod.js"></script>
|
||||
<script src="./vendor/element-plus.full.min.js"></script>
|
||||
<script src="./main.js"></script>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ const { createApp, reactive } = Vue;
|
|||
exportTpl: { id: null, filters: {}, main_table: '', fields: [], datasource: '', file_format: '' }
|
||||
})
|
||||
|
||||
const API_BASE = 'http://localhost:8077'
|
||||
const API_BASE = (window.__API_BASE__ && String(window.__API_BASE__).trim()) ? String(window.__API_BASE__).trim() : (typeof location !== 'undefined' ? location.origin : 'http://localhost:8077')
|
||||
const getUserId = ()=>{
|
||||
const sp = new URLSearchParams(window.location.search||'')
|
||||
const v = sp.get('userId') || sp.get('userid') || sp.get('user_id')
|
||||
|
|
|
|||
Loading…
Reference in New Issue