diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json
index 59d78d5..a97fd25 100644
--- a/.hbuilderx/launch.json
+++ b/.hbuilderx/launch.json
@@ -4,7 +4,7 @@
"configurations": [{
"app-plus" :
{
- "launchtype" : "remote"
+ "launchtype" : "local"
},
"default" :
{
diff --git a/pages/im/index.vue b/pages/im/index.vue
index a8cc868..741e92a 100644
--- a/pages/im/index.vue
+++ b/pages/im/index.vue
@@ -4,9 +4,9 @@
-
+
@@ -67,7 +67,6 @@
return {
isShown: true, // 当前页面显示状态
conversations: [], // 会话列表
- isImToken: '', // 是否已鉴权
connection: 0,
/* 窗口尺寸 */
winSize: {},
@@ -89,16 +88,14 @@
},
onShow() {
if (this.$store.state.token !== '') {
- if (this.isImToken === '') {
- getImToken().then(res => {
- im.connect(res.token, res.userInfo)
- this.isImToken = res.token
- this.getConversationList()
+ getImToken().then(res => {
+ console.log("IMTOKEN", res);
+ im.connect(res.token, res.userInfo, () => {
+ this.getConversationList()
})
- }
- this.getConversationList()
- this.isShown = true
- }
+ })
+ }
+ this.isShown = true
},
onHide() {
this.isShown = false
@@ -182,15 +179,16 @@
},
getConversationList() {
const count = 1000
- const timestamp = 0 // 会话的时间戳(获取这个时间戳之前的会话列表,0 表示从最新开始获取)会话类型
- RongIMLib.getConversationList(undefined, count, timestamp, (res) => {
+ const timestamp = 0
+ RongIMLib.getConversationList(undefined, count, timestamp, (res) => {
+ console.log('获取列表', res);
if (res.code === 0 && res.conversations.length > 0) {
- this.conversations = res.conversations
+ this.conversations = res.conversations
}
- })
+ })
},
// 进入聊天的详情页面,清理未读消息数量
- toDetail(item) {
+ toDetail(item) {
this.hidePop()
uni.navigateTo({
url: '/pages/im/private/index?targetId=' + item.targetId + '&conversationType=' + item
@@ -279,76 +277,6 @@
background: $border-color;
}
}
-
- // .message-box:not(:last-child) {
-
- // .message-action {
- // &::after {
- // position: absolute;
- // left: $padding + 108;
- // right: 0;
- // bottom: 0;
- // content: " ";
- // height: 1rpx;
- // background: $border-color;
- // }
- // }
- // }
-
- // .message-box {
- // background: white;
-
- // .message-action {
- // position: relative;
- // padding: 20rpx $padding;
-
- // .message-avatar {
- // position: relative;
- // background: red;
- // }
-
- // &-content {
- // position: absolute;
- // top: 20rpx;
- // height: 44px;
- // left: $padding + 108;
- // right: $margin;
- // display: flex;
- // flex-direction: column;
- // justify-content: center;
-
- // .message-header {
- // display: flex;
- // font-size: $title-size;
- // line-height: 40rpx;
- // justify-content: space-between;
-
- // .header-name {
- // flex: 1;
- // @extend .nowrap;
- // }
-
- // .header-time {
- // padding-left: $padding;
- // font-size: $title-size-sm - 2;
- // color: $text-gray;
- // }
- // }
-
- // .message-msg {
- // font-size: $title-size-sm - 2;
- // color: $text-gray;
- // @extend .nowrap;
- // }
- // }
- // }
-
- // &-item:last-child {
- // .message-action::after {
- // display: none;
- // }
- // }
- // }
}
/* 遮罩 */
diff --git a/pages/im/private/index.vue b/pages/im/private/index.vue
index ee6d370..eada86a 100644
--- a/pages/im/private/index.vue
+++ b/pages/im/private/index.vue
@@ -3,10 +3,7 @@
-
-
- {{ item.sentTime|timeCustomCN }}
-
+
{{ item.content.content }}
@@ -15,11 +12,14 @@
{{ item.sentStatus == 50 ? '已读': '未读'}}
-
-
+
+
+ {{ item.sentTime|timeCustomCN }}
+
@@ -51,7 +51,7 @@
}
}
},
- onLoad(e) {
+ onLoad(e) {
this.targetId = e.targetId
this.conversationType = e.conversationType // 会话类型
// 消息总数量
diff --git a/pages/im/private/setting.vue b/pages/im/private/setting.vue
index 4c7353b..9de754e 100644
--- a/pages/im/private/setting.vue
+++ b/pages/im/private/setting.vue
@@ -31,7 +31,6 @@
getUserInfo
} from '@/apis/interfaces/im.js'
-
export default {
data() {
return {
diff --git a/pages/topic/details.vue b/pages/topic/details.vue
index c73c794..90137c6 100644
--- a/pages/topic/details.vue
+++ b/pages/topic/details.vue
@@ -1,282 +1,314 @@
-
-
-
-
-
-
-
- {{ topicData.name }}
-
-
- # 话题 -- {{ topicData.category.name }} #
-
-
- {{ topicData.description }}
-
-
-
- {{ topicData.clicks }} 人游览
- {{ topicData.favorites }} 人点赞
-
-
-
- {{ isFavorite ? '已赞' : '点赞' }}
-
-
-
-
-
-
-
-
- {{ topicData.author }}
-
-
- ZH大健康官方账号
-
-
-
-
-
-
-
-
- 相关商品
-
-
-
-
-
- {{ item.name }}
-
-
- ¥{{ item.price }}
-
-
-
- 查看商品
-
-
-
-
-
-
-
-
-
-
-
diff --git a/utils/im/index.js b/utils/im/index.js
index 028e9b7..b769da0 100644
--- a/utils/im/index.js
+++ b/utils/im/index.js
@@ -36,9 +36,11 @@ const setNotifyBadge = (count) => {
* @param {string} token token
* @param {object} userInfo {userId: string, name: string, portraitUrl: string}
*/
-const connect = (token, userInfo) => {
+const connect = (token, userInfo, callback) => {
RongIMLib.connect(token, res => {
- console.log('连接结果', res);
+ console.log('连接结果', res);
+
+ callback(res)
})
store.dispatch('setSenderInfo', userInfo)