mixins优化

This commit is contained in:
2022-02-24 09:28:59 +08:00
parent 358372cdba
commit 78d4611fb2
5 changed files with 35 additions and 37 deletions

View File

@@ -34,8 +34,12 @@
<script> <script>
import im from '@/utils/im/index.js' import im from '@/utils/im/index.js'
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index' import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
import imBase from '../mixins/imBase.js'
export default { export default {
mixins: [
imBase
],
data() { data() {
return { return {
callActions: [{ callActions: [{
@@ -64,15 +68,11 @@
default: '' default: ''
} }
}, },
computed: {
sender() {
return this.$store.getters.sender
}
},
methods: { methods: {
singleCall(e) { singleCall(e) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/im/private/call?targetId=' + this.targetId + '&mediaType=' + e.type + '&isCall=true' url: '/pages/im/private/call?targetId=' + this.targetId + '&mediaType=' + e.type +
'&isCall=true'
}) })
}, },
onPopupsItem(type) { onPopupsItem(type) {
@@ -144,6 +144,7 @@
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
flex-direction: row; flex-direction: row;
.item { .item {
width: 150rpx; width: 150rpx;
margin: 15rpx; margin: 15rpx;

View File

@@ -8,8 +8,12 @@
<script> <script>
import im from '@/utils/im/index.js' import im from '@/utils/im/index.js'
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index' import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
import imBase from '../mixins/imBase.js'
export default { export default {
mixins: [
imBase
],
props: { props: {
conversationType: { conversationType: {
type: Number, type: Number,
@@ -23,9 +27,6 @@
computed: { computed: {
disabled() { disabled() {
return this.inputTxt.length === 0 return this.inputTxt.length === 0
},
sender() {
return this.$store.getters.sender
} }
}, },
mounted() { mounted() {

View File

@@ -14,8 +14,12 @@
<script> <script>
import im from '@/utils/im/index.js' import im from '@/utils/im/index.js'
import permision from '@/utils/permission.js' import permision from '@/utils/permission.js'
import imBase from '../mixins/imBase.js'
export default { export default {
mixins: [
imBase
],
props: { props: {
conversationType: { conversationType: {
type: Number, type: Number,
@@ -35,11 +39,6 @@
recorderManager: null recorderManager: null
} }
}, },
computed: {
sender() {
return this.$store.getters.sender
}
},
created() { created() {
this.recorderManager = uni.getRecorderManager() this.recorderManager = uni.getRecorderManager()
}, },
@@ -110,6 +109,7 @@
width: 500rpx; width: 500rpx;
border-radius: 10rpx; border-radius: 10rpx;
margin-right: 15rpx; margin-right: 15rpx;
.button { .button {
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
@@ -129,6 +129,7 @@
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.icon { .icon {
width: 88rpx; width: 88rpx;
height: 88rpx; height: 88rpx;

View File

@@ -1,13 +1,9 @@
import utils from '@/utils/index.js' import utils from '@/utils/index.js'
const imBase = { export default {
onLoad() { onLoad() {},
console.log('IM BASE MININX');
},
data() { data() {
return { return {}
}
}, },
computed: { computed: {
contact() { contact() {
@@ -17,8 +13,9 @@ const imBase = {
}, },
avatarSize() { avatarSize() {
return utils.rpx2px(84) return utils.rpx2px(84)
},
sender() {
return this.$store.getters.sender
} }
} }
} }
export default imBase

View File

@@ -1,5 +1,5 @@
// 监听群解散的消息,直接跳转到会话列表页面 // 监听群解散的消息,直接跳转到会话列表页面
const onGroupDismiss = { export default {
data() { data() {
return { return {
currentTargetId: '' currentTargetId: ''
@@ -32,5 +32,3 @@ const onGroupDismiss = {
uni.$off('onGroupRemoveYou_' + this.currentTargetId) uni.$off('onGroupRemoveYou_' + this.currentTargetId)
} }
} }
export default onGroupDismiss