This commit is contained in:
2023-10-29 13:17:28 +08:00
parent dee9051652
commit 336bcc662b
29 changed files with 3077 additions and 169 deletions

View File

@@ -447,28 +447,45 @@
content: 'TRTC_VIDEO_START'
};
this.sendMsg(formdata,formdata.msgType)
// this.sendMsg(formdata,formdata.msgType)
const userId=localStorage.getItem("userId")
const roomId=userId
const roomInfo={
roomId:"call_room",//后面改成发起人的手机号或者id
roomName:"某某发起的视频聊天",
creatorId:"creatorId",
creatorName:"发起人的昵称",
roomId:userId,//后面改成发起人的手机号或者id
roomName:`${userId}发起的视频聊天`,
creatorId:userId,
creatorName:userId,
publishId:userId,
publishName:userId,
isOver:0,
webrtcUrl:config.getSRSUrl()+"/call_room/uid13",
webrtcUrl:config.getSRSUrl()+`/${roomId}/${userId}`,
type:"webrtc",
offline:0
offline:0,
invitedUserList:[this.talkTo.userId]
}
this.$store
.dispatch('createRoom', roomInfo)
.then(res => {
location.href=config.getVideoRoomUrl(roomInfo.roomId,roomInfo.creatorId,1,1)
customHttp.customHttp.post("/api/im/app/wsMsg",{
msgType:"10000",
msgId:JSON.stringify(roomInfo),
cmd:"",
msgTxt:""
},{
dataType: 'json',
custom: {target: "znzq"} ,
}).then((res1)=>{
location.href=config.getVideoRoomUrl(roomInfo.roomId,roomInfo.creatorId,1,1)
})
})
this.$http.request({
if(1>0){
return false;
}
this.$http.request({
url: '/chat/sendMsg',
method: 'POST',
data: JSON.stringify(formdata),

View File

@@ -45,6 +45,8 @@
</template>
<script>
import customHttp from "@/common/customHttp.js"
import { Base64 } from 'js-base64';
export default {
data() {
@@ -146,91 +148,51 @@
return Math.floor(Math.random() * (max - min + 1)) + min
},
sublogin(e) {
var rules = {
phone: {
rules: [{
checkType: "required",
errorMsg: "请填写手机号码"
}, {
checkType: "phone",
errorMsg: "请填写正确的手机号码"
}]
},
password: {
rules: [{
checkType: "required",
errorMsg: "请输入密码"
}, {
checkType: "string",
checkRule: "4,6",
errorMsg: "至少输入4-6位"
}]
},
code: {
rules: [{
checkType: "required",
errorMsg: "请输入验证码"
}]
}
};
// var formData = e.detail.value;
var formData = JSON.parse(JSON.stringify(this.form));
var checkRes = this.$zmmFormCheck.check(formData, rules);
// #ifdef APP-PLUS
var cid = plus.push.getClientInfo().clientid
formData['cid'] = cid
// #endif
// #ifdef H5
// todo
var cid = ''
formData['cid'] = cid
// #endif
uni.setStorageSync('cid', cid);
console.log(cid)
if (checkRes) {
if (!this.agree) {
uni.showToast({
title: '请先同意《隐私及服务协议》',
icon: 'none'
});
return;
}
uni.showLoading()
formData.loginType = 1
this.$http.request({ //手机+验证码
url: '/v1/login',
method: 'POST',
data: JSON.stringify(formData),
success: (res) => {
if (res.data.code == 200) {
this.loginDone(res.data.data)
}
customHttp.customHttp.post('/api/im/app/login', {
"username": this.form.userName,
"password":Base64.encode(this.form.password)
}, {
params: {},
/* 会加在url上 */
header: {},
/* 会与全局header合并如有同名属性局部覆盖全局 */
dataType: 'json',
// 注如果局部custom与全局custom有同名属性则后面的属性会覆盖前面的属性相当于Object.assign(全局,局部)
custom: {
target: "znzq"
}, // 可以加一些自定义参数在拦截器等地方使用。比如这里我加了一个auth可在拦截器里拿到如果true就传token
}).then(res => {
console.log("=========获取到数据")
console.log(res)
if (res.statusCode == 200) {
if (res.data.code == 200) {
this.loginDone(res.data.result)
}
});
}
}).catch(err => {
})
} else {
uni.showToast({
title: this.$zmmFormCheck.error,
icon: "none",
position: 'bottom'
});
}
},
loginDone(data) {
uni.setStorageSync('appId', data.appId);
uni.setStorageSync('im_userId', data.userId);
uni.setStorageSync('userId', data.userId);
uni.setStorageSync('im_userId', data.id);
uni.setStorageSync('userId', data.id);
uni.setStorageSync('im_userCSign', data.userSign);
uni.setStorageSync('im_imUserSign', data.imUserSign);
uni.setStorageSync('imUserSign', data.imUserSign);
uni.setStorageSync('token', data.token);
uni.setStorageSync('hd_token', data.token);
uni.reLaunch({
url: '../tabbar1/index'
})
}
}
}
@@ -333,4 +295,4 @@
width: 300rpx;
margin-top: 120rpx;
}
</style>
</style>

View File

@@ -63,21 +63,49 @@
}
]
this.list=this.$fc.sortList({list:list,key:'name'})
console.log(customHttp)
console.log("================开始请求通讯录列表")
// 局部修改配置,局部配置优先级高于全局配置
customHttp.customHttp.post('/api/im/app/addressList', {userName: 'name', password: '123456'}, {
customHttp.customHttp.get('/api/im/app/addressList', {
params: {}, /* 会加在url上 */
header: {}, /* 会与全局header合并如有同名属性局部覆盖全局 */
dataType: 'json',
// 注如果局部custom与全局custom有同名属性则后面的属性会覆盖前面的属性相当于Object.assign(全局,局部)
custom: {target: "znzq"} // 可以加一些自定义参数在拦截器等地方使用。比如这里我加了一个auth可在拦截器里拿到如果true就传token
custom: {target: "znzq"} , // 可以加一些自定义参数在拦截器等地方使用。比如这里我加了一个auth可在拦截器里拿到如果true就传token
}).then(res => {
console.log("=========获取到数据")
console.log(res)
if(res.statusCode==200){
if(res.data.code==200){
var list=[]
res.data.result.records.map((item)=>{
console.log(item)
list.push({
name:item.realname,
avatar:item.portrait,
userId:item.userId,
userType:1,
chatNo:item.userId
})
})
this.list=this.$fc.sortList({list:list,key:'name'})
}
}
}).catch(err => {
})
/*
this.$http.request({
url: '/friend/friendList',
method: 'POST',
@@ -99,7 +127,8 @@
this.list=this.$fc.sortList({list:list,key:'name'})
}
}
});
});
*/
},
},
onNavigationBarButtonTap(e) {