diff --git a/package.json b/package.json index 0421739..f65cb7c 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,7 @@ "moment": "^2.29.1", "uni-read-pages": "^1.0.5", "uni-simple-router": "^2.0.7", - "uview-ui": "^2.0.19", - "vuex": "^3.6.2" + "uview-ui": "^2.0.27" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/pages/im/components/groupUserList.vue b/pages/im/components/groupUserList.vue index ee804a2..112a4d0 100644 --- a/pages/im/components/groupUserList.vue +++ b/pages/im/components/groupUserList.vue @@ -65,6 +65,7 @@ avatarSize: 45, labelSize: 14, iconSize: 14 + } }, computed: { diff --git a/pages/im/components/sentText.vue b/pages/im/components/sentText.vue index 79c8a1b..efa4034 100644 --- a/pages/im/components/sentText.vue +++ b/pages/im/components/sentText.vue @@ -1,8 +1,7 @@ @@ -19,10 +18,6 @@ targetId: { type: String, default: '' - }, - inputTxt: { - type: String, - default: '' } }, computed: { @@ -33,7 +28,7 @@ return this.$store.getters.sender } }, - created() { + mounted() { RongIMLib.getTextMessageDraft(this.conversationType, this.targetId, ({ draft }) => { @@ -41,35 +36,29 @@ }) }, beforeDestroy() { - RongIMLib.saveTextMessageDraft(this.conversationType, this.targetId, this.inputTxt, (res) => { - console.log('销毁组件之前,保存草稿信息,但是没有执行', res); - }) - }, - data() { - return { + // 保存草稿 + RongIMLib.saveTextMessageDraft(this.conversationType, this.targetId, this.inputTxt) + }, + data() { + return { focusState: false, - } + inputTxt: '' + } }, methods: { - // 发送文本消息 sent() { - if (!this.disabled) { - RongIMLib.clearTextMessageDraft(this.conversationType, this.targetId) - im.sentText(this.conversationType, this.targetId, this.inputTxt, this.sender, () => { + if (!this.disabled) { + im.sentText(this.conversationType, this.targetId, this.inputTxt, this.sender, () => { + RongIMLib.clearTextMessageDraft(this.conversationType, this.targetId) this.$emit('success') - this.inputTxt = '' + this.inputTxt = '' }) } - }, - demo(){ - console.log(this.focusState) - - this.focusState = !this.focusState }, - focus() { - this.$emit('focus') + focus() { + this.$emit('focus') }, - blur() { + blur() { uni.hideKeyboard() this.$emit('blur') } diff --git a/pages/im/components/showImage.vue b/pages/im/components/showImage.vue index af297cc..7654eb6 100644 --- a/pages/im/components/showImage.vue +++ b/pages/im/components/showImage.vue @@ -1,74 +1,110 @@ - - - + isGroup: { + type: Boolean, + default: false + } + }, + computed: { + isRemote() { + return this.message.messageDirection == 2 + }, + content() { + return this.message.content + }, + contact() { + return function(targetId) { + return this.$store.getters.contactInfo(targetId) + } + } + }, + methods: { + previewImage() { + if (this.content.local) { + uni.previewImage({ + urls: [ + this.content.local + ], + success: (e) => { + console.log(e); + }, + fail: (er) => { + console.log(er); + } + }) + } else { + RongIMLib.downloadMediaMessage(this.messageId, { + success: (path) => { + this.content.local = path + uni.previewImage({ + urls: [ + path + ], + success: (e) => { + console.log(e); + }, + fail: (er) => { + console.log(er); + } + }) + }, + progress: (progress, messageId) => { + console.log('progress', progress); + }, + cancel: (messageId) => { + console.log('cancel', messageId); + }, + error: (errorCode, messageId) => { + console.log('errorCode', errorCode); + } + }) + } + } + } + } + + diff --git a/pages/im/components/showText.vue b/pages/im/components/showText.vue index 946dc69..c8bba49 100644 --- a/pages/im/components/showText.vue +++ b/pages/im/components/showText.vue @@ -1,29 +1,65 @@