Compare commits

..

No commits in common. "8ec9c844f0c5956354914f79cd828b1b7b6edc96" and "72674f4d77faa00f79a3da617d931d5cdc1f9089" have entirely different histories.

1 changed files with 1143 additions and 1160 deletions

View File

@ -87,7 +87,7 @@
@click="sendMessage"> @click="sendMessage">
</image> </image>
<image v-if="phone == 'oppo'" class="right-icon" <image v-if="phone == 'oppo'" class="right-icon"
:src="`/static/image/phone-message/oppo/${isSend ? 'send' : 'unSend'}.png`" :src="`/static/image/phone-message/oppo/${isSend ? 'send' : 'unsend'}.png`"
@click="sendMessage"> @click="sendMessage">
</image> </image>
<image v-if="phone == 'huawei'" class="right-icon" <image v-if="phone == 'huawei'" class="right-icon"
@ -108,17 +108,9 @@
</view> </view>
</template> </template>
<script setup> <script setup>
import { import { reactive, onMounted, computed, toRefs } from 'vue'
reactive, import { dateUtil, util } from '@/utils/common.js';
onMounted, const props = defineProps({
computed,
toRefs
} from 'vue'
import {
dateUtil,
util
} from '@/utils/common.js';
const props = defineProps({
// //
phone: { phone: {
type: String, type: String,
@ -144,9 +136,9 @@
type: Number, type: Number,
default: 0 default: 0
} }
}) })
const data = reactive({ const data = reactive({
statusBarHeight: 0, statusBarHeight: 0,
topBoxHeight: 0, topBoxHeight: 0,
bottomBoxHeight: 0, bottomBoxHeight: 0,
@ -156,17 +148,12 @@
scrollTop: 0, scrollTop: 0,
keyboardHeight: 0, keyboardHeight: 0,
lastClickTime: 0 lastClickTime: 0
}) })
let { let { isSend, content, simIndex, scrollTop } = toRefs(data)
isSend,
content,
simIndex,
scrollTop
} = toRefs(data)
const emit = defineEmits(['send', 'dblclick-left', 'dblclick-right', 'title-click']) const emit = defineEmits(['send', 'dblclick-left', 'dblclick-right', 'title-click'])
const onInput = (e) => { const onInput = (e) => {
content.value = e.detail.html content.value = e.detail.html
const htmlStr = (content.value || '').trim() const htmlStr = (content.value || '').trim()
if (htmlStr === '' || htmlStr === '<p><br></p>' || htmlStr === '<br>') { if (htmlStr === '' || htmlStr === '<p><br></p>' || htmlStr === '<br>') {
@ -181,21 +168,21 @@
} }
}).exec(); }).exec();
}, 50); }, 50);
} }
/** /**
* 切换sim卡 * 切换sim卡
*/ */
const changeSim = () => { const changeSim = () => {
simIndex.value = simIndex.value == 1 ? 2 : 1 simIndex.value = simIndex.value == 1 ? 2 : 1
} }
/** /**
* 发送消息 * 发送消息
*/ */
const sendMessage = () => { const sendMessage = () => {
if (!isSend.value) return if (!isSend.value) return
const date = dateUtil.now("YYYY-MM-DD HH:mm") const date = dateUtil.now("YYYY-MM-DD HH:mm")
const params = { const params = {
@ -227,12 +214,12 @@
data.isSend = false data.isSend = false
}, 100); }, 100);
data.isSend = false data.isSend = false
} }
/** /**
* 处理 center-box 点击事件检测双击并区分左右 * 处理 center-box 点击事件检测双击并区分左右
*/ */
const handleBoxClick = (e) => { const handleBoxClick = (e) => {
const now = Date.now(); const now = Date.now();
const clickInterval = now - data.lastClickTime; const clickInterval = now - data.lastClickTime;
@ -258,16 +245,16 @@
} else { } else {
data.lastClickTime = now; data.lastClickTime = now;
} }
} }
const handleTitleClick = () => { const handleTitleClick = () => {
emit('title-click'); emit('title-click');
} }
// //
const displayTitle = computed(() => { const displayTitle = computed(() => {
let title = props.chatInfo.title || ''; let title = props.chatInfo.title || '';
if (props.phone === 'oppo') { if (props.phone === 'oppo') {
const noSpace = title.replace(/\s+/g, ''); const noSpace = title.replace(/\s+/g, '');
@ -276,10 +263,10 @@
} }
} }
return title; return title;
}) })
// //
const showInfo = computed(() => { const showInfo = computed(() => {
let placeholder let placeholder
switch (props.phone) { switch (props.phone) {
case "iphone": case "iphone":
@ -300,15 +287,13 @@
default: default:
break; break;
} }
return { return { placeholder }
placeholder })
}
})
/** /**
* 选择图片并发送 * 选择图片并发送
*/ */
const chooseImage = () => { const chooseImage = () => {
uni.chooseImage({ uni.chooseImage({
count: 1, // count: 1, //
sizeType: ['original', 'compressed'], // sizeType: ['original', 'compressed'], //
@ -327,9 +312,7 @@
let h = image.height; let h = image.height;
// EXIF // EXIF
if (image.orientation && ['left', 'right', 'left-mirrored', if (image.orientation && ['left', 'right', 'left-mirrored', 'right-mirrored'].includes(image.orientation)) {
'right-mirrored'
].includes(image.orientation)) {
w = image.height; w = image.height;
h = image.width; h = image.width;
} }
@ -340,8 +323,7 @@
const date = dateUtil.now("YYYY-MM-DD HH:mm") const date = dateUtil.now("YYYY-MM-DD HH:mm")
// HTMLimg // HTMLimg
const content = const content = `<img src="${finalPath}" style="width: ${width}; height: ${height}; border-radius: 16rpx; display: block;" />`;
`<img src="${finalPath}" style="width: ${width}; height: ${height}; border-radius: 16rpx; display: block;" />`;
const params = { const params = {
content: content, content: content,
imgUrl: finalPath, imgUrl: finalPath,
@ -357,11 +339,9 @@
// //
setTimeout(() => { setTimeout(() => {
data.scrollTop = 99999 + Math.random(); data.scrollTop = 99999 + Math.random();
uni.createSelectorQuery().select('.bottom-box') uni.createSelectorQuery().select('.bottom-box').boundingClientRect(rect => {
.boundingClientRect(rect => {
if (rect) { if (rect) {
data.bottomBoxHeight = rect data.bottomBoxHeight = rect.height;
.height;
} }
}).exec(); }).exec();
}, 100); }, 100);
@ -386,9 +366,9 @@
} }
} }
}) })
} }
onMounted(() => { onMounted(() => {
// //
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
data.statusBarHeight = systemInfo.statusBarHeight || 0; data.statusBarHeight = systemInfo.statusBarHeight || 0;
@ -417,51 +397,54 @@
}).exec(); }).exec();
}, 300); }, 300);
}) })
</script> </script>
<style> <style>
@import '@/common/main.css'; @import '@/common/main.css';
</style> </style>
<style lang="less" scoped> <style lang="less" scoped>
.page-container { .page-container {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
background-color: #fff; background-color: #fff;
} }
.m-l-34 { .m-l-34 {
margin-left: 34rpx; margin-left: 34rpx;
} }
.m-l-50 { .m-l-50 {
margin-left: 50rpx; margin-left: 50rpx;
} }
.center-box { .center-box {
overflow: hidden; overflow: hidden;
// overflow-y: scroll; // overflow-y: scroll;
// padding-bottom: 12px; // padding-bottom: 12px;
} }
.fixed-bottom-box { .fixed-bottom-box {
position: fixed; position: fixed;
width: 100%; width: 100%;
background: #fff; background: #fff;
bottom: 0; bottom: 0;
left: 0; left: 0;
} }
.fixed-top-box { .fixed-top-box {
position: fixed; position: fixed;
width: 100%; width: 100%;
z-index: 9; z-index: 9;
left: 0; left: 0;
top: 0; top: 0;
} }
// //
.iphone-style { .iphone-style {
.circle { .circle {
border-radius: 50% !important; border-radius: 50% !important;
} }
@ -603,10 +586,10 @@
} }
} }
} }
// //
.mi-style { .mi-style {
background-color: #F7F7F7 !important; background-color: #F7F7F7 !important;
.top-box { .top-box {
@ -741,10 +724,10 @@
} }
} }
} }
//oppo //oppo
.oppo-style { .oppo-style {
background-color: #F0F1F3 !important; background-color: #F0F1F3 !important;
.top-box { .top-box {
@ -904,10 +887,10 @@
} }
} }
} }
// //
.huawei-style { .huawei-style {
background-color: #F1F5F8 !important; background-color: #F1F5F8 !important;
.top-box { .top-box {
@ -1069,11 +1052,11 @@
} }
} }
} }
//vivo //vivo
.vivo-style { .vivo-style {
background-color: #F6F6F6 !important; background-color: #F6F6F6 !important;
.top-box { .top-box {
@ -1192,10 +1175,10 @@
} }
} }
} }
.bottom-placeholder { .bottom-placeholder {
margin-top: env(safe-area-inset-bottom); margin-top: env(safe-area-inset-bottom);
margin-top: constant(safe-area-inset-bottom); margin-top: constant(safe-area-inset-bottom);
} }
</style> </style>