测试调用接口数据

This commit is contained in:
ljx 2025-04-27 16:55:10 +08:00
parent 244e94ab95
commit a0c8d6f7ed
1 changed files with 23 additions and 1 deletions

View File

@ -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