添加了退出登录

This commit is contained in:
luyuan 2020-08-22 16:58:18 +08:00
parent fc4c187702
commit 9361f5bffe
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
3 changed files with 17 additions and 1 deletions

View File

@ -48,6 +48,7 @@ export default {
// 退 // 退
loginout(){ loginout(){
uni.clearStorage(); uni.clearStorage();
this.imService.disconnect()
this.$refs.uToast.show({ this.$refs.uToast.show({
title: "退出登陆成功!", title: "退出登陆成功!",
type: 'success' type: 'success'

View File

@ -19,6 +19,10 @@
<text>内容管理</text> <text>内容管理</text>
<image src="/static/image/user/1.png"></image> <image src="/static/image/user/1.png"></image>
</view> </view>
<view class="nav" @click="loginout()">
<text>退出登录</text>
<image src="/static/image/user/1.png"></image>
</view>
<view class="release-btn" @click="publish"> <view class="release-btn" @click="publish">
<image src="../../static/image/index/publish.png"></image> <image src="../../static/image/index/publish.png"></image>
<view class="text">发布</view> <view class="text">发布</view>
@ -64,6 +68,18 @@ export default {
this.imService.connectIM() this.imService.connectIM()
}, },
methods: { methods: {
loginout(){
this.imService.disconnect()
uni.clearStorage();
this.$refs.uToast.show({
title: "退出登陆成功!",
type: 'success'
});
uni.reLaunch({
url:"../login/login"
})
},
// //
getmyinfo(){ getmyinfo(){
let that = this; let that = this;

View File

@ -226,7 +226,6 @@ IMService.prototype.connectIM = function () {
this.subscribeFriendsPresence(); this.subscribeFriendsPresence();
}).catch(error => { }).catch(error => {
console.log('连接失败,请确保网络正常appkey和host正确code:' + error.code + " content:" + error.content); console.log('连接失败,请确保网络正常appkey和host正确code:' + error.code + " content:" + error.content);
this.connectIM()
}); });
} catch (error) { } catch (error) {
console.log(12323) console.log(12323)