uniapp和web.html互相通讯

This commit is contained in:
2023-09-25 22:10:02 +08:00
parent 161631f6a0
commit a4dda571ab
5 changed files with 15 additions and 4 deletions

View File

@@ -1,6 +1,9 @@
export default class config{
static getBaseApiUrl(){
return process.env.NODE_ENV === 'development' ? 'http://192.168.1.117:8989' :'http://www.shudong.xyz/shudong_api/';
}
static getImApiUrl(){
return process.env.NODE_ENV === 'development' ? 'http://127.0.0.1:28000/v1' :'http://www.shudong.xyz/shudong_api/';
return process.env.NODE_ENV === 'development' ? 'http://192.168.1.117:28000/v1' :'http://www.shudong.xyz/shudong_api/';
}
static getImAppId(){
return 10000;

View File

@@ -1,6 +1,7 @@
// #ifdef APP-PLUS
import appUpgrade from '@/common/appUpgrade.js';
// #endif
import config from "@/common/config.js"
let http = {
'setBaseUrl': (url) => {
if (url.charAt(url.length - 1) === "/") {
@@ -289,6 +290,6 @@ function downloadFile(con) {
// }
// });
// 地址及配置
http.setBaseUrl("http://localhost:8989"); //在线服务器
http.setBaseUrl(config.getBaseApiUrl()); //在线服务器
// http.setBaseUrl("http://192.168.0.105:8080"); //离线服务器
export default http

View File

@@ -52,6 +52,12 @@
userId:"18200000001",
userType:"item.userType",
chatNo:"item.chatNo"
},{
name:"测试lld3",
avatar:"item.portrait",
userId:"lld3",
userType:"item.userType",
chatNo:"item.chatNo"
}
]