This commit is contained in:
luyuan 2020-08-18 10:43:15 +08:00
parent a39aa6e059
commit 9f17c5478c
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
5 changed files with 77 additions and 25 deletions

View File

@ -61,6 +61,7 @@
</view>
</template>
<script>
import IMService from '@/static/imservice.js'
import identifying from '@/components/logininput/identifying'
import {
mapMutations
@ -107,6 +108,8 @@
let pages = getCurrentPages();
let prePage = pages[pages.length - 2];
this.temp_url = prePage.route;
console.log(this.imService.lianjie)
this.imService.disconnect()
// console.log(this.temp_url);
},
//
@ -181,6 +184,12 @@
me.loginIn(res.data.token); //
//
uni.setStorageSync('user_info',res.data);
let im = this.imService
im.status = false
console.log(123)
im.lianjie = false
im = new IMService();
console.log(im.lianjie)
if (res.data.member.has_labels) {
uni.switchTab({
url: '/pages/index/index'

View File

@ -23,6 +23,7 @@
import {
mapMutations
} from 'vuex';
import IMService from '@/static/imservice.js'
export default {
data() {
return {
@ -88,7 +89,12 @@
url: url
});
},
loginOut() {
async loginOut() {
let im = this.imService
await im.disconnect()
im.lianjie = false
im = new IMService();
console.log(im.lianjie)
this.logout();
uni.redirectTo({
url: "../../pageA/login/login",

View File

@ -267,27 +267,19 @@
indexad,
darenItem
},
onShow() {
async onShow() {
this.page = 1;
if (this.page != 1) {
}
// if (this.hasLogin) {
// this.isNewmembervoucher();
// }
},
async onLoad(){
this.articleList = [];
this.getArticlelist();
this.getSwiper();
//
if(this.$store.state.hasLogin){
}
console.log(this.imService.lianjie,this.imService.status)
if(!this.imService.status && this.$store.state.hasLogin && !this.imService.lianjie){
this.isNewmembervoucher();
const user = uni.getStorageSync('user_info');
// console.log(user)
this.imService.login(user.member.member_id,user.member.member_nickname,user.member.member_avatar)
await this.imService.connectIM()
}else{
}else if(!this.imService.status && !this.imService.lianjie){
await this.$u.api.getDefaultAvatar().then((res)=>{
console.log(res)
uni.setStorageSync("morenimg",res.data.avatar)
@ -298,16 +290,57 @@
await this.imService.connectIM()
}
console.log("1212")
let that = this
setTimeout(function(){
that.imService.disconnect()
console.log("guanbi")
},1000)
setTimeout(function(){
console.log("lianjie")
that.imService.connectIM()
},2000)
if(!this.imService.status && !this.imService.lianjie){
console.log("1212")
this.imService.lianjie = true
let that = this
setTimeout(function(){
that.imService.disconnect()
console.log("guanbi")
},1000)
setTimeout(function(){
console.log("lianjie")
that.imService.connectIM()
},2000)
}
// if (this.hasLogin) {
// this.isNewmembervoucher();
// }
},
async onLoad(){
this.articleList = [];
this.getArticlelist();
this.getSwiper();
//
// if(this.$store.state.hasLogin){
// this.isNewmembervoucher();
// const user = uni.getStorageSync('user_info');
// // console.log(user)
// this.imService.login(user.member.member_id,user.member.member_nickname,user.member.member_avatar)
// await this.imService.connectIM()
// }else{
// await this.$u.api.getDefaultAvatar().then((res)=>{
// console.log(res)
// uni.setStorageSync("morenimg",res.data.avatar)
// this.imService.login(new Date().getTime(),"123",res.data.avatar)
// console.log("")
// })
// console.log("")
// await this.imService.connectIM()
// }
// console.log("1212")
// let that = this
// setTimeout(function(){
// that.imService.disconnect()
// console.log("guanbi")
// },1000)
// setTimeout(function(){
// console.log("lianjie")
// that.imService.connectIM()
// },2000)
},
onPullDownRefresh() {
this.page = 1;

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,8 @@
* @Last Modified time: 2020-4-21 15:01:41
*/
import GoEasyIM from './goeasy-im-1.0.9';
// import GoEasyIM from './goeasy-im-1.0.9';
import GoEasyIM from './goeasy-im-1.1.1';
import restApi from './restapi';
function Friend(uuid, name, avatar,time = "", text = "",date = "",unReadMessage = 0) {
@ -38,6 +39,7 @@ function IMService() {
appkey:'BC-453aa755c4ea48148abefc55a86df283'
});
this.status = false
this.lianjie = false
//当前“我”
this.currentUser = null;
//我的好友