|
|
|
@ -107,7 +107,7 @@ |
|
|
|
//是否长按事件 |
|
|
|
//是否长按事件 |
|
|
|
islongPress: false, |
|
|
|
islongPress: false, |
|
|
|
timer: null, //长按计时器 |
|
|
|
timer: null, //长按计时器 |
|
|
|
|
|
|
|
|
|
|
|
param: { |
|
|
|
param: { |
|
|
|
pageSize: 10, |
|
|
|
pageSize: 10, |
|
|
|
pageNo: 1, |
|
|
|
pageNo: 1, |
|
|
|
@ -117,6 +117,7 @@ |
|
|
|
openid: undefined, |
|
|
|
openid: undefined, |
|
|
|
appid: undefined, |
|
|
|
appid: undefined, |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
nowUserId:null |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
onUnload() { |
|
|
|
onUnload() { |
|
|
|
@ -150,8 +151,8 @@ |
|
|
|
userInfo.refreshToken = newRefreshToken; |
|
|
|
userInfo.refreshToken = newRefreshToken; |
|
|
|
store.commit('setUserInfo', userInfo) |
|
|
|
store.commit('setUserInfo', userInfo) |
|
|
|
this.Token = newAccessToken |
|
|
|
this.Token = newAccessToken |
|
|
|
|
|
|
|
this.nowUserId = response.data.userId |
|
|
|
this.getUserInfo(response.data.userId) |
|
|
|
this.getUserInfo(response.data.userId) |
|
|
|
this.connectWs() |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
.catch(error => { |
|
|
|
store.commit('setUserInfo', null) |
|
|
|
store.commit('setUserInfo', null) |
|
|
|
@ -166,7 +167,7 @@ |
|
|
|
}) |
|
|
|
}) |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
created: function() { |
|
|
|
created: function() { |
|
|
|
const res = uni.getSystemInfoSync(); |
|
|
|
const res = uni.getSystemInfoSync(); |
|
|
|
@ -183,7 +184,8 @@ |
|
|
|
"identity": this.generateRandomString(8), |
|
|
|
"identity": this.generateRandomString(8), |
|
|
|
"userId": userId |
|
|
|
"userId": userId |
|
|
|
}; |
|
|
|
}; |
|
|
|
console.log(this.querUserInfo) |
|
|
|
console.log('querUserInfo',this.querUserInfo) |
|
|
|
|
|
|
|
this.connectWs() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// websocket |
|
|
|
// websocket |
|
|
|
connectWs() { |
|
|
|
connectWs() { |
|
|
|
@ -252,7 +254,7 @@ |
|
|
|
//发送消息 |
|
|
|
//发送消息 |
|
|
|
handlerMessage(data) { |
|
|
|
handlerMessage(data) { |
|
|
|
let $this = this |
|
|
|
let $this = this |
|
|
|
if (Number(data.userId) == Number(this.querUserInfo.userId)) { |
|
|
|
if (Number(data.userId) == Number(this.querUserInfo.userId)) { |
|
|
|
if (data.identity == this.querUserInfo.identity) { |
|
|
|
if (data.identity == this.querUserInfo.identity) { |
|
|
|
if (data.context !== null) { |
|
|
|
if (data.context !== null) { |
|
|
|
this.list[this.list.length - 1].content += data.context |
|
|
|
this.list[this.list.length - 1].content += data.context |
|
|
|
@ -302,7 +304,8 @@ |
|
|
|
// 发送消息 |
|
|
|
// 发送消息 |
|
|
|
sendMsg() { |
|
|
|
sendMsg() { |
|
|
|
const $this = this |
|
|
|
const $this = this |
|
|
|
this.getUserInfo() |
|
|
|
console.log('$this.nowUserId',$this.nowUserId) |
|
|
|
|
|
|
|
this.getUserInfo($this.nowUserId) |
|
|
|
this.list.push({ |
|
|
|
this.list.push({ |
|
|
|
content: this.content, |
|
|
|
content: this.content, |
|
|
|
userType: 'friend', |
|
|
|
userType: 'friend', |
|
|
|
@ -378,12 +381,12 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
//长按事件 |
|
|
|
//长按事件 |
|
|
|
longpress() { |
|
|
|
longpress() { |
|
|
|
const $this = this |
|
|
|
const $this = this |
|
|
|
this.islongPress = true; |
|
|
|
this.islongPress = true; |
|
|
|
if (this.islongPress == true && this.inputDisabled == false) { |
|
|
|
if (this.islongPress == true && this.inputDisabled == false) { |
|
|
|
//开始录音 |
|
|
|
//开始录音 |
|
|
|
const _permission = 'scope.record' |
|
|
|
const _permission = 'scope.record' |
|
|
|
uni.getSetting({ |
|
|
|
uni.getSetting({ |
|
|
|
success: (res) => { |
|
|
|
success: (res) => { |
|
|
|
@ -759,4 +762,4 @@ |
|
|
|
.loading-dot:nth-child(3) { |
|
|
|
.loading-dot:nth-child(3) { |
|
|
|
animation-delay: 0.4s; |
|
|
|
animation-delay: 0.4s; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|
|