diff --git a/App.vue b/App.vue index 6445058..c6f6389 100644 --- a/App.vue +++ b/App.vue @@ -7,7 +7,7 @@ export default { onLaunch: function() { im.initIm('lmxuhwaglu76d') - return + // return //#ifdef APP-PLUS // 获取系统版本号 getVersions({ diff --git a/README.md b/README.md index 78f16ce..6d20a67 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ # ZhHealth -ZH健康 \ No newline at end of file +ZH健康 + +## uni-icons图标组件 +[图标组件](https://hellouniapp.dcloud.net.cn/pages/extUI/icons/icons) \ No newline at end of file diff --git a/manifest.json b/manifest.json index 7e60da1..e6b69ab 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name" : "ZH-HEALTH", "appid" : "__UNI__C29473D", "description" : "ZH-HEALTH,您手上的健康管理专家", - "versionName" : "1.0.18", + "versionName" : "1.0.19", "versionCode" : 100, "transformPx" : false, /* 5+App特有相关 */ diff --git a/pages/im/friends/info.vue b/pages/im/friends/info.vue index 671796b..4032fc4 100644 --- a/pages/im/friends/info.vue +++ b/pages/im/friends/info.vue @@ -2,10 +2,10 @@ - + - {{ userInfo.name }} + {{ contact(targetId).name }} ({{ userInfo.name }}) 地址:{{ userInfo.address }} @@ -14,20 +14,16 @@ 保密 - - + + - + - - - - - + @@ -69,6 +65,14 @@ + + + + + + + @@ -83,12 +87,17 @@ } from '@/apis/interfaces/im.js' import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index' import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index' + import imBase from '../mixins/imBase.js' + // friendship: '' 没有好友关系 // accepted 好友 // pending 申请中 // denied 拒绝 // blocked 黑名单 export default { + mixins: [ + imBase + ], data() { return { targetId: '', @@ -107,7 +116,9 @@ } ], callShow: false, - hasPeding: false + hasPeding: false, + modalShow: false, + contactRemark: '' } }, onLoad(e) { @@ -151,7 +162,26 @@ url: '/pages/im/private/chat?targetId=' + this.targetId }); }, + // 设置好友备注操作 setRemark() { + this.modalShow = true + this.contactRemark = this.$store.getters.contactInfo(this.targetId).name + }, + onHideModal() { + this.modalShow = false + }, + onChangeRemark() { + this.$store.dispatch('setContactRemark', { + targetId: this.targetId, + remark: this.contactRemark + }) + uni.showToast({ + icon: 'none', + title: '备注设置成功' + }) + this.onHideModal() + }, + setTag() { uni.showToast({ title: '开发中', icon: 'none' @@ -344,6 +374,10 @@ width: 200rpx; } + .uni-icons { + color: $text-gray-m !important; + } + .text { width: calc(100% - 200rpx); color: $text-gray-m; diff --git a/pages/im/mixins/imBase.js b/pages/im/mixins/imBase.js index 959112d..faaf422 100644 --- a/pages/im/mixins/imBase.js +++ b/pages/im/mixins/imBase.js @@ -13,5 +13,10 @@ export default { sender() { return this.$store.getters.sender } + }, + methods: { + rpx2px(size) { + return utils.rpx2px(size) + } } } diff --git a/store/modules/im.js b/store/modules/im.js index ebb50f1..f5f93c5 100644 --- a/store/modules/im.js +++ b/store/modules/im.js @@ -17,7 +17,7 @@ export default { const info = state.contacts[targetId] return { - name: info.name, + name: info.remark ? info.remark : info.name, hash: info.hash, portraitUrl: info.localAvatar ? info.localAvatar : require('@/static/user/cover.png') } @@ -47,9 +47,27 @@ export default { name: contactInfo.name, portraitUrl: contactInfo.portraitUrl } + }, + setContactRemark(state, contactInfo) { + Vue.set(state.contacts, contactInfo.targetId, contactInfo) } }, actions: { + setContactRemark({ + commit + }, { + targetId, + remark + }) { + contactModel.find('targetId="' + targetId + '"', (err, result) => { + if (!err && result.length > 0) { + result[0].remark = remark + contactModel.update('targetId="' + targetId + '"', result[0], (err, res) => { + commit('setContactRemark', result[0]) + }) + } + }) + }, setSenderInfo({ commit }, contactInfo) { @@ -76,7 +94,7 @@ export default { const info = { targetId: contactInfo.targetId, name: contactInfo.name, - hash: contactInfo.hash, + hash: contactInfo.hash, type: contactInfo.type, portraitUrl: contactInfo.portraitUrl, localAvatar: savedFilePath @@ -91,7 +109,7 @@ export default { const info = { targetId: contactInfo.targetId, name: contactInfo.name, - hash: contactInfo.hash, + hash: contactInfo.hash, type: contactInfo.type, portraitUrl: contactInfo.portraitUrl, localAvatar: result[0].localAvatar @@ -118,7 +136,7 @@ export default { const info = { targetId: contactInfo.targetId, name: contactInfo.name, - hash: contactInfo.hash, + hash: contactInfo.hash, type: contactInfo.type, portraitUrl: contactInfo.portraitUrl, localAvatar: savedFilePath @@ -134,13 +152,13 @@ export default { const info = { targetId: contactInfo.targetId, name: contactInfo.name, - hash: contactInfo.hash, + hash: contactInfo.hash, type: contactInfo.type, portraitUrl: contactInfo.portraitUrl, localAvatar: '' } - contactModel.insert(info, (err, res) => { - console.error('没保存头像', err, res) + contactModel.insert(info, (err, res) => { + console.error('没保存头像', err, res) }) } } diff --git a/uni_modules/onemue-USQLite/.DS_Store b/uni_modules/onemue-USQLite/.DS_Store new file mode 100644 index 0000000..d610557 Binary files /dev/null and b/uni_modules/onemue-USQLite/.DS_Store differ diff --git a/utils/im/index.js b/utils/im/index.js index f22b319..3c39229 100644 --- a/utils/im/index.js +++ b/utils/im/index.js @@ -22,8 +22,8 @@ const initIm = (KEY) => { if (store.getters.getToken !== '') { getImToken().then(res => { connect(res.token, res.userInfo, (res) => { - console.log('IM.CONNECT', res); - // 发布全局事件,有新消息,刷新会话列表 + console.log('IM.CONNECT', res); + // 发布全局事件,有新消息,刷新会话列表 uni.$emit('onReceiveMessage') }) }) @@ -85,7 +85,7 @@ const connect = (token, userInfo, callback) => { contacts.map(item => { store.dispatch('initContact', item) }) - }) + }) uni.setStorageSync(FK, userInfo.targetId) }) } diff --git a/utils/im/models.js b/utils/im/models.js index 9220b98..58aa286 100644 --- a/utils/im/models.js +++ b/utils/im/models.js @@ -8,7 +8,8 @@ const contactModel = usqlite.model('contacts', { primaryKey: true, unique: true }, - name: String, + name: String, + remark: String, hash: { type: String, unique: true