本地开发

This commit is contained in:
2023-11-16 10:52:39 +08:00
parent 75000d846b
commit 9a57e4aaab
18 changed files with 700 additions and 484 deletions

View File

@@ -11,6 +11,7 @@ export default class config{
}
}
}
static getBaseApiUrl(){
//return process.env.NODE_ENV === 'development' ? 'http://119.45.242.222:8989' :'http://172.16.2.3:8989';
return process.env.NODE_ENV === 'development' ? 'http://119.45.242.222:8989' :'/base_api';
@@ -22,14 +23,14 @@ export default class config{
static getImAppId(){
return 10000;
}
static getVideoRoomUrl(room,userid,isPublish=0,isPlayer=1){
static getVideoRoomUrl(room,userid,isPublish=0,isPlayer=1,hasVideo=1){
if(process.env.NODE_ENV === 'development' ){
return `http://localhost:8080/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}`
return `http://localhost:8080/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}&hasVideo=${hasVideo}`
}else{
if(this.prod=="online"){
return `https://119.45.242.222/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}`
return `https://119.45.242.222/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}&hasVideo=${hasVideo}`
}else{
return `https://172.16.3.19/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}`
return `https://172.16.3.19/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}&hasVideo=${hasVideo}`
}
}
}

View File

@@ -73,6 +73,7 @@ export default {
const userId = uni.getStorageSync("userId")
const imUserSign = uni.getStorageSync("imUserSign")
var listeners = {};
@@ -95,6 +96,16 @@ export default {
console.log(this.socketTask)
console.log('sdk 成功连接的回调, 可以使用 sdk 请求数据了.');
sdk.getSingleUserInfo(userId).then(res=>{
console.log("获取到自己的用户信息")
console.log(res)
if(res.code==200){
uni.setStorageSync('userInfo', res.data);
}
})
// sdk.getAllFriend().then(res => {
// console.warn(res)
// })
@@ -106,9 +117,7 @@ export default {
console.warn(res)
})
return uni.switchTab({
url: "/pages/tabbar/index/index"
})
} else {
console.log('sdk 初始化失败.');
}

View File

@@ -1,22 +1,3 @@
/**
* getUrlKey 截取地址栏参数
* @param value
* @returns {String}
*/
export function getUrlParam(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
let url = window.location.href.split('#')[0];
let search = url.split('?')[1];
console.log(search);
if (search) {
var r = search.substr(0).match(reg);
if (r !== null) {
return unescape(r[2]);
}
return null;
} else return null;
}
export function appInit(ms) {
return new Promise((resolve, reject) => {
@@ -26,6 +7,7 @@ export function appInit(ms) {
var hd_userId = uni.getStorageSync("hd_userid")
if(hd_userId){
uni.setStorageSync("userId",hd_userId)
}else{
console.log("============未获取到hd_userid")
}
@@ -46,9 +28,29 @@ export function appInit(ms) {
resolve("ok")
}
}
}else{
uni.setStorageSync("initReady",null)
}
}, ms);
})
}
/**
* getUrlKey 截取地址栏参数
* @param value
* @returns {String}
*/
export function getUrlParam(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
let url = window.location.href
let search = url.split('?')[1];
console.log(search);
if (search) {
var r = search.substr(0).match(reg);
if (r !== null) {
return unescape(r[2]);
}
return null;
} else return null;
}