diff --git a/components/tki-file-manager/tki-file-manager.vue b/components/tki-file-manager/tki-file-manager.vue
new file mode 100644
index 0000000..2d1f0c3
--- /dev/null
+++ b/components/tki-file-manager/tki-file-manager.vue
@@ -0,0 +1,188 @@
+
+
+
+
+
diff --git a/main.js b/main.js
index 5b16def..4c6e272 100644
--- a/main.js
+++ b/main.js
@@ -31,21 +31,21 @@ Vue.use(router)
Vue.config.productionTip = false
Vue.prototype.$store = store
-usqlite.connect({
+uni.$sql = usqlite.connect({
name: 'zh-health', // 数据库名称
path: '_doc/health.db', // 路径
-}, (err, res) => {
- uni.getStorage({
- key: 'FIRST_RUN',
- fail: () => {
- contactModel.create((err, res) => {
- console.error('SQLITE 创建表格', err, res)
- uni.setStorageSync('FIRST_RUN', 'X')
- })
- }
+}, (err, res) => {
+ uni.getStorage({
+ key: 'FIRST_RUN',
+ fail: () => {
+ contactModel.create((err, res) => {
+ console.error('SQLITE 创建表格', err, res)
+ uni.setStorageSync('FIRST_RUN', true)
+ })
+ }
})
})
-
+
App.mpType = 'app'
const app = new Vue({
store,
diff --git a/manifest.json b/manifest.json
index 55f8dea..0b1b1a0 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,7 +2,7 @@
"name" : "ZH-HEALTH",
"appid" : "__UNI__C29473D",
"description" : "ZH-HEALTH,您手上的健康管理专家",
- "versionName" : "1.0.20",
+ "versionName" : "1.0.22",
"versionCode" : 100,
"transformPx" : false,
/* 5+App特有相关 */
@@ -47,6 +47,7 @@
"",
"",
"",
+ "",
"",
"",
"",
diff --git a/pages/im/components/conversation/messagePreview.vue b/pages/im/components/conversation/messagePreview.vue
index 37dd25e..f2ac028 100644
--- a/pages/im/components/conversation/messagePreview.vue
+++ b/pages/im/components/conversation/messagePreview.vue
@@ -7,33 +7,36 @@
{{ user.name }}:{{ msg.content || '' }}
-
+
{{ user.name }}:[语音]
-
+
{{ user.name }}:[图片]
-
+
{{ user.name }}:[表情]
-
+
{{ user.name }}:[文件]
-
+
{{ user.name }}:[位置]
-
+
{{ user.name }}:[语音通话]
-
+
{{ user.name }}:[视频通话]
-
+
[{{ msg.message }}]
-
+
{{ user.name }}: 撤回了一条消息
+
+ {{ msg.objectName }}
+
diff --git a/pages/im/components/sent/sentEmoji.vue b/pages/im/components/sent/sentEmoji.vue
index cb08343..d3c8e4d 100644
--- a/pages/im/components/sent/sentEmoji.vue
+++ b/pages/im/components/sent/sentEmoji.vue
@@ -1,79 +1,87 @@
-
-
-
-
- {{item.emoji}}
-
-
-
-
- 发送
-
-
-
-
-
-
-
diff --git a/pages/im/components/sent/sentPopups.vue b/pages/im/components/sent/sentPopups.vue
index d4824a0..f42e345 100644
--- a/pages/im/components/sent/sentPopups.vue
+++ b/pages/im/components/sent/sentPopups.vue
@@ -25,6 +25,8 @@
文件
+
+
@@ -34,11 +36,15 @@
@@ -91,6 +81,7 @@
display: flex;
flex-direction: row;
justify-content: space-between;
+
.input {
background: #F3F6FB;
height: 70rpx;
diff --git a/pages/im/components/sent/sentVoice.vue b/pages/im/components/sent/sentVoice.vue
index a9e3903..644c0f4 100644
--- a/pages/im/components/sent/sentVoice.vue
+++ b/pages/im/components/sent/sentVoice.vue
@@ -1,21 +1,22 @@
-
+
按住 说话
-
-
-
-
- 上滑取消
-
+
+
+
+
+ 上滑取消
+
@@ -23,8 +24,8 @@
-
+
+
diff --git a/pages/im/components/show/showCall.vue b/pages/im/components/show/showAudio.vue
similarity index 72%
rename from pages/im/components/show/showCall.vue
rename to pages/im/components/show/showAudio.vue
index b373326..323b299 100644
--- a/pages/im/components/show/showCall.vue
+++ b/pages/im/components/show/showAudio.vue
@@ -2,8 +2,7 @@
{{ contact(message.senderUserId).name }}
-
-
+
{{ label }}
@@ -18,7 +17,6 @@
mixins: [
imBase
],
- name: 'showText',
props: {
message: {
type: Object,
@@ -31,23 +29,18 @@
default: false
}
},
- mounted() {
- },
computed: {
- msg() {
- return JSON.parse(this.message.content.message)
- },
label() {
- return this.msg.connected ? '通话时长:' + duration : '未接通'
+ return this.message.content.customFields.status == 1 ? '通话时长:' + duration : '未接通'
},
isRemote() {
return this.message.messageDirection == 2
},
duration() {
- if (this.message.duration > 3600) {
- return moment.utc(this.message.duration * 1000).format('HH:mm:ss')
+ if (this.message.content.customFields.duration > 3600) {
+ return moment.utc(this.message.content.customFields.duration * 1000).format('HH:mm:ss')
} else {
- return moment.utc(this.message.duration * 1000).format('mm:ss')
+ return moment.utc(this.message.content.customFields.duration * 1000).format('mm:ss')
}
}
}
diff --git a/pages/im/components/show/showFile.vue b/pages/im/components/show/showFile.vue
new file mode 100644
index 0000000..56e4951
--- /dev/null
+++ b/pages/im/components/show/showFile.vue
@@ -0,0 +1,95 @@
+
+
+
+
+
+ {{ contact(message.senderUserId).name }}
+
+
+ {{ content.fileType }}
+ {{ content.name }}
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/im/components/show/showLocation.vue b/pages/im/components/show/showLocation.vue
new file mode 100644
index 0000000..3c14247
--- /dev/null
+++ b/pages/im/components/show/showLocation.vue
@@ -0,0 +1,112 @@
+
+
+
+
+
+ {{ contact(message.senderUserId).name }}
+
+
+ {{ content.customFields.name }}
+
+
+ {{ content.customFields.address }}
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/im/components/show/showNormal.vue b/pages/im/components/show/showNormal.vue
new file mode 100644
index 0000000..6d08131
--- /dev/null
+++ b/pages/im/components/show/showNormal.vue
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/im/components/show/showVideo.vue b/pages/im/components/show/showVideo.vue
new file mode 100644
index 0000000..606991c
--- /dev/null
+++ b/pages/im/components/show/showVideo.vue
@@ -0,0 +1,84 @@
+
+
+ {{ contact(message.senderUserId).name }}
+
+
+ {{ label }}
+
+
+
+
+
+
+
diff --git a/pages/im/components/showMessageCell.vue b/pages/im/components/showMessageCell.vue
index 0aed87b..6195687 100644
--- a/pages/im/components/showMessageCell.vue
+++ b/pages/im/components/showMessageCell.vue
@@ -7,6 +7,9 @@
{{ contact(message.senderUserId).name }} 撤回了一条消息
+
+
+ {{ message.sentTime|timeCustomCN }}
-
+
+
+
[未处理的消息类型 {{ message.objectName }}]
@@ -33,7 +38,8 @@
import showVoice from './show/showVoice'
import showImage from './show/showImage'
import showText from './show/showText'
- import showCall from './show/showCall'
+ import showFile from './show/showFile'
+ import showNormal from './show/showNormal'
import utils from '@/utils/index.js'
import imBase from '../mixins/imBase.js'
@@ -42,11 +48,12 @@
imBase
],
components: {
- showCall,
showVoice,
showImage,
- showText
- },
+ showText,
+ showFile,
+ showNormal
+ },
props: {
message: {
type: Object,
diff --git a/pages/im/group/chat.vue b/pages/im/group/chat.vue
index 9f1a5c1..a0d5ec0 100644
--- a/pages/im/group/chat.vue
+++ b/pages/im/group/chat.vue
@@ -1,6 +1,7 @@
-
+
@@ -11,7 +12,8 @@
-
+
+
@@ -30,13 +32,13 @@
import showMessageCell from '../components/showMessageCell'
import utils from '@/utils/index.js'
import onGroupDismiss from '../mixins/onGroupDismiss.js'
- import imBase from '../mixins/imBase.js'
+ import imBase from '../mixins/imBase.js'
import messageActions from '../mixins/messageActions.js'
export default {
mixins: [
imBase,
- onGroupDismiss,
+ onGroupDismiss,
messageActions
],
components: {
@@ -51,7 +53,9 @@
messages: [],
groupInfo: {
name: ''
- }
+ },
+ placeHeight: uni.getSystemInfoSync().windowHeight,
+ bottomHeihgt: 56
}
},
computed: {
@@ -69,6 +73,20 @@
this.initGroupInfo()
},
onLoad(e) {
+ const query = uni.createSelectorQuery().in(this);
+ this.$nextTick(function() {
+ query.select('#msgbar').boundingClientRect(bottom => {
+ this.bottomHeihgt = bottom.height
+ }).exec();
+ })
+ // 监听键盘高度变化
+ uni.onKeyboardHeightChange(keyboard => {
+ query.select('#scroll').boundingClientRect(scroll => {
+ const placeHeight = this.windowHeight - scroll.height - keyboard.height - this
+ .bottomHeihgt
+ this.placeHeight = placeHeight > 0 ? placeHeight : 0
+ }).exec();
+ })
this.targetId = e.targetId
// 获取历史消息列表
this.getMessageList()
@@ -99,7 +117,7 @@
})
// 清理聊天记录
uni.$once('cleanGroupMessage', this.getMessageList)
- uni.$on('onRecallMessage_' + this.targetId, (message) => {
+ uni.$on('onRecallMessage_' + this.targetId, (message) => {
this.messages = this.messages.map(item => {
if (message.messageId == item.messageId) {
return message
@@ -138,14 +156,25 @@
this.$refs.messageBar.onHidePopus()
},
getNewMessage() {
+ if (new Date().getTime() - this.latestMessage.sentTime > 18000000) {
+ // 在本地插入一条时间的消息
+ const messageContent = {
+ objectName: 'RC:InfoNtf',
+ message: 'DateInfo'
+ }
+ RongIMLib.insertOutgoingMessage(this.conversationType, this.targetId, 50, messageContent, 0)
+ }
+
im.getMessageList(
this.conversationType,
this.targetId,
- this.latestMessage.sentTime,
+ this.latestMessage.sentTime || 0,
10,
false,
(messages) => {
- this.messages.unshift(...messages)
+ console.log(messages);
+ //
+ this.messages.unshift(...messages.reverse())
this.scrollBottom()
})
},
@@ -158,12 +187,9 @@
20,
true,
(messages) => {
- console.log('获取消息列表', messages);
const msgs = messages.filter(item => item.receivedStatus == 0)
- console.log('未读消息', msgs);
if (msgs.length) {
RongIMLib.sendReadReceiptResponse(3, this.targetId, msgs, (res) => {
- console.error('发送群聊已读回执成功', res);
msgs.map(item => {
RongIMLib.setMessageReceivedStatus(item.messageId, 1)
})
@@ -228,7 +254,7 @@
height: 100%;
z-index: 999;
- .pop {
+ .pop {
border-radius: 10rpx;
position: fixed;
z-index: 101;
diff --git a/pages/im/index.vue b/pages/im/index.vue
index 344ef48..6992100 100644
--- a/pages/im/index.vue
+++ b/pages/im/index.vue
@@ -20,10 +20,17 @@
-
-
+
+
+
+
+
+
+ 空空如也~
+
-
+
@@ -55,6 +62,11 @@
connectionStatus
},
onLoad() {
+ RongIMLib.getCurrentUserId(({
+ userId
+ }) => {
+ console.log('getCurrentUserId', userId);
+ })
// 监听新的好友申请
uni.$on('onNewContactConversation', () => {
console.log('更新好友申请数量');
@@ -106,8 +118,8 @@
code,
conversations
}) => {
- if (code === 0) {
- console.log(conversations,',,,,,')
+ if (code === 0) {
+ console.log('获取会话列表', conversations);
this.conversations = conversations
}
})
@@ -214,5 +226,22 @@
.u-border-bottom {
border-bottom: solid 1rpx #f9f9f9 !important;
+ }
+ .no-lists {
+ min-height: 80vh;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ box-sizing: border-box;
+ font-size: $title-size-m;
+ color: $text-gray-m;
+ .cover{
+ opacity: 0.8!important;
+ }
+
+ span {
+ padding-top: $padding;
+ }
}
diff --git a/pages/im/mixins/imBase.js b/pages/im/mixins/imBase.js
index faaf422..fb37af2 100644
--- a/pages/im/mixins/imBase.js
+++ b/pages/im/mixins/imBase.js
@@ -12,6 +12,9 @@ export default {
},
sender() {
return this.$store.getters.sender
+ },
+ windowHeight() {
+ return uni.getSystemInfoSync().windowHeight
}
},
methods: {
diff --git a/pages/im/private/call.nvue b/pages/im/private/call.nvue
index bfb7884..d071fee 100644
--- a/pages/im/private/call.nvue
+++ b/pages/im/private/call.nvue
@@ -75,7 +75,7 @@
// 关闭扬声器
volumeOff: false,
// 通话时长
- duration: 0,
+ duration: 0,
interval: null
}
},
@@ -83,7 +83,7 @@
this.avatarSize = utils.rpx2px(200)
this.targetId = e.targetId
this.mediaType = e.mediaType
- this.isCall = Boolean(e.isCall)
+ this.isCall = Boolean(e.isCall)
// 进入页面开启外呼
if (this.isCall) {
CallLib.startSingleCall(this.targetId, this.mediaType, '');
@@ -131,25 +131,9 @@
}
},
methods: {
- afterHangup() {
- clearInterval(this.interval)
- const targetId = this.targetId
- const sentStatus = 30
- const messageContent = {
- objectName: 'RC:InfoNtf',
- userInfo: this.$store.getters.sender,
- message: JSON.stringify({
- mediaType: this.mediaType,
- connected: this.connected,
- duration: this.duration
- })
- }
- const sentTime = 0
- if (this.isCall) {
- IMLib.insertOutgoingMessage(1, targetId, sentStatus, messageContent, sentTime)
- } else {
- IMLib.insertIncomingMessage(1, targetId, targetId, sentStatus, messageContent, sentTime)
- }
+ afterHangup() {
+ clearInterval(this.interval)
+ // duration: this.duration
uni.$emit('onReceiveMessage_' + this.targetId, {
targetId: this.targetId
})
@@ -179,9 +163,9 @@
CallLib.setVideoView(session.targetId, this.$refs.bigVideoView.ref, 0, false)
CallLib.setVideoView(session.mine.userId, this.$refs.smallVideoView.ref, 0, true)
}, 200)
- }
- this.interval = setInterval(() => {
- this.duration++
+ }
+ this.interval = setInterval(() => {
+ this.duration++
}, 1000)
},
// 切换主屏显示人
diff --git a/pages/im/private/chat.vue b/pages/im/private/chat.vue
index 24f48ce..46a2786 100644
--- a/pages/im/private/chat.vue
+++ b/pages/im/private/chat.vue
@@ -1,6 +1,7 @@
-
+
@@ -10,7 +11,8 @@
-
+
+
@@ -26,11 +28,11 @@
import showMessageCell from '../components/showMessageCell'
import utils from '@/utils/index.js'
import imBase from '../mixins/imBase.js'
- import messageActions from '../mixins/messageActions.js'
-
+ import messageActions from '../mixins/messageActions.js'
+
export default {
mixins: [
- imBase,
+ imBase,
messageActions
],
components: {
@@ -46,7 +48,9 @@
name: '',
userId: '',
portraitUrl: ''
- }
+ },
+ placeHeight: uni.getSystemInfoSync().windowHeight,
+ bottomHeihgt: 56
}
},
computed: {
@@ -59,13 +63,27 @@
}
}
}
- },
- onShow() {
- uni.setNavigationBarTitle({
- title: this.contact(this.targetId).name
- })
},
- onLoad(e) {
+ onShow() {
+ uni.setNavigationBarTitle({
+ title: this.contact(this.targetId).name
+ })
+ },
+ onLoad(e) {
+ const query = uni.createSelectorQuery().in(this);
+ this.$nextTick(function() {
+ query.select('#msgbar').boundingClientRect(bottom => {
+ this.bottomHeihgt = bottom.height
+ }).exec();
+ })
+ // 监听键盘高度变化
+ uni.onKeyboardHeightChange(keyboard => {
+ query.select('#scroll').boundingClientRect(scroll => {
+ const placeHeight = this.windowHeight - scroll.height - keyboard.height - this
+ .bottomHeihgt
+ this.placeHeight = placeHeight > 0 ? placeHeight : 0
+ }).exec();
+ })
this.targetId = e.targetId
this.userInfo = this.$store.getters.contactInfo(this.targetId)
// 获取消息列表
@@ -106,27 +124,41 @@
})
},
onUnload() {
+ uni.offKeyboardHeightChange(res => {
+ console.log('卸载监听键盘高度变化', res);
+ })
uni.$off('onUserDelete_' + this.targetId)
uni.$off('onReceiveMessage_' + this.targetId)
uni.$off('onRecallMessage_' + this.targetId)
uni.$off('onRecallMessage')
uni.$off('onReadReceiptReceived')
- },
- onNavigationBarButtonTap() {
- uni.navigateTo({
- url:'/pages/im/friends/info?targetId='+this.targetId
- })
+ },
+ onNavigationBarButtonTap() {
+ uni.navigateTo({
+ url: '/pages/im/friends/info?targetId=' + this.targetId
+ })
},
methods: {
getNewMessage() {
+ if (new Date().getTime() - this.latestMessage.sentTime > 18000000) {
+ // 在本地插入一条时间的消息
+ const messageContent = {
+ objectName: 'RC:InfoNtf',
+ message: 'DateInfo'
+ }
+ RongIMLib.insertOutgoingMessage(this.conversationType, this.targetId, 50, messageContent, 0)
+ }
+
im.getMessageList(
this.conversationType,
this.targetId,
this.latestMessage.sentTime || 0,
- 1,
+ 10,
false,
(messages) => {
- this.messages.unshift(...messages)
+ console.log(messages);
+ //
+ this.messages.unshift(...messages.reverse())
this.scrollBottom()
})
},
@@ -160,6 +192,8 @@