Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions uni-app/NECallKit-Miniprogram/pages/index/index.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<template>
<view class="container">
<view class="content-wrapper">
<view class="header">
<view class="header">
<view class="header-left" @tap="logout">
<text class="logout-text">退出登录</text>
</view>
<view class="header-center">
<text class="header-title">一对一音视频通话</text>
</view>
<view class="header-right" @tap="logout">
<text class="logout-text">退出登录</text>
</view>
<view class="header-right">
<text class="logout-text-hidden">退出登录</text>
</view>
</view>

Expand Down Expand Up @@ -170,7 +173,7 @@ export default {
uni.showModal({
title: '退出账号',
content: '是否退出当前账号?',
success: (res) => {
success: async (res) => {
if (res.confirm) {
const app = getApp();

Expand All @@ -179,7 +182,13 @@ export default {
}

if (app.globalData.nim) {
app.globalData.nim.V2NIMLoginService.logout();
try {
await app.globalData.nim.V2NIMLoginService.logout();
await app.globalData.nim.destroy();
console.log('logout success!')
} catch (err) {
console.log(err)
}
}

app.globalData.nim = null;
Expand All @@ -204,7 +213,7 @@ export default {
height: 100vh;
overflow: hidden;
margin: 0;
padding-top: 80px;
padding-top: 40px;
background-color: #1f1f26;
box-sizing: border-box;
display: flex;
Expand All @@ -230,7 +239,7 @@ export default {

.header-left {
flex: none;
padding: 10rpx 20rpx;
padding: 10rpx;
}

.header-text {
Expand All @@ -257,6 +266,10 @@ export default {
.logout-text {
font-size: 28rpx;
color: #ff4757;
}

.logout-text-hidden {
visibility: hidden;
}

.user-id-row {
Expand Down
6 changes: 2 additions & 4 deletions uni-app/NECallKit-Miniprogram/pages/login/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,15 @@ export default {
try {
const app = getApp()
const appkey = app.globalData.appkey
console.log('app.globalData:', app.globalData)
console.log('appkey:', appkey)

const nim = V2NIM.getInstance({
appkey,
account: this.accountId,
token: this.token,
apiVersion: 'v2',
debugLevel: 'debug',
debugLevel: 'off',
})

await nim.V2NIMLoginService.login(this.accountId, this.token)

const neCall = NECall.getInstance()
Expand Down