diff --git a/src/components/baozuo-demo/test.js b/src/components/baozuo-demo/test.js index 3f5fe79..381cc88 100644 --- a/src/components/baozuo-demo/test.js +++ b/src/components/baozuo-demo/test.js @@ -1,4 +1,5 @@ -const testRes = { +import api from '../../api.js' +let testRes = { "code": "200", "data": { "yx_v_scgdgk": [ @@ -3196,5 +3197,26 @@ const testRes = { ] } } +/** + * 获取当前地址 + * @returns {string} 当前地址 + */ +function getCurrentAddress() { + if (typeof window !== 'undefined' && window.location) { + return window.location.origin; + } else { + console.warn('当前环境非浏览器环境,无法使用 window.location 获取地址'); + return null; + } +} +if(getCurrentAddress().includes('192.168')){ + console.log('当前环境为开发环境'); + api.post2('/api/web/getBiData').then(res => { + testRes = res; + }) +}else{ + console.log('当前环境为生产环境'); +} + export default testRes \ No newline at end of file