113 lines
3.1 KiB
Vue
113 lines
3.1 KiB
Vue
<template>
|
|
<view class="msg--location">
|
|
<message-state :message="message" :isGroup="isGroup" :isRemote="isRemote" />
|
|
|
|
<view class="">
|
|
<view class="name" v-if="isGroup && isRemote">{{ contact(message.senderUserId).name }}</view>
|
|
<view class="location" :class="isRemote ? 'left': 'right'" @click="showLocation">
|
|
<view class="location--name">
|
|
{{ content.customFields.name }}
|
|
</view>
|
|
<view class="location--address">
|
|
{{ content.customFields.address }}
|
|
</view>
|
|
<image class="map" :src="require('@/static/imgs/map.jpeg')" mode="aspectFill" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
|
import messageState from './messageState'
|
|
import imBase from '../../mixins/imBase.js'
|
|
|
|
export default {
|
|
mixins: [
|
|
imBase
|
|
],
|
|
name: 'showImage',
|
|
props: {
|
|
message: {
|
|
type: Object,
|
|
default: () => {
|
|
return {}
|
|
}
|
|
},
|
|
isGroup: {
|
|
type: Boolean,
|
|
default: false
|
|
}
|
|
},
|
|
components: {
|
|
messageState
|
|
},
|
|
computed: {
|
|
isRemote() {
|
|
return this.message.messageDirection == 2
|
|
},
|
|
content() {
|
|
return this.message.content
|
|
}
|
|
},
|
|
methods: {
|
|
showLocation() {
|
|
uni.openLocation({
|
|
latitude: Number(this.content.customFields.latitude),
|
|
longitude: Number(this.content.customFields.longitude),
|
|
fail: (err) => {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '打开地图失败'
|
|
})
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.msg--location {
|
|
display: flex;
|
|
align-items: flex-end;
|
|
|
|
.name {
|
|
font-size: 24rpx;
|
|
color: $text-gray-m;
|
|
}
|
|
|
|
.location {
|
|
position: relative;
|
|
width: 400rpx;
|
|
background: #FFFFFF;
|
|
padding: 10rpx;
|
|
|
|
.location--name {
|
|
font-size: 32rpx;
|
|
overflow: hidden;
|
|
word-break: break-all;
|
|
}
|
|
|
|
.location--address {
|
|
padding-bottom: 10rpx;
|
|
font-size: 24rpx;
|
|
color: $text-gray-m;
|
|
}
|
|
|
|
.map {
|
|
width: 400rpx;
|
|
height: 200rpx;
|
|
}
|
|
|
|
&.left {
|
|
border-radius: 0 10rpx 10rpx 10rpx;
|
|
}
|
|
|
|
&.right {
|
|
border-radius: 10rpx 0 10rpx 10rpx;
|
|
}
|
|
}
|
|
}
|
|
</style>
|