修改
This commit is contained in:
parent
3626999766
commit
a5b9c2e832
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="content" :style="{'padding-bottom': bottomVal }">
|
<view class="content">
|
||||||
<!-- <view class="title">
|
<!-- <view class="title">
|
||||||
<image src="../../static/huijiantou.png" @click="back"></image>
|
<image src="../../static/huijiantou.png" @click="back"></image>
|
||||||
{{currentItem.senderName}}
|
{{currentItem.senderName}}
|
||||||
@ -34,9 +34,9 @@
|
|||||||
<!-- <view class="placeholder" id="placeholder" v-if="showFunBtn"></view> -->
|
<!-- <view class="placeholder" id="placeholder" v-if="showFunBtn"></view> -->
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
<!-- 底部输入 -->
|
<!-- 底部输入 -->
|
||||||
<view class="input-box" :class="{ 'input-box-mpInputMargin': mpInputMargin }">
|
<view class="input-box" :class="{ 'input-box-mpInputMargin': mpInputMargin }"
|
||||||
|
:style="{'padding-bottom':bottomVal+'px'}">
|
||||||
<view class="input-box-flex">
|
<view class="input-box-flex">
|
||||||
<!--弹出常用 -->
|
<!--弹出常用 -->
|
||||||
<!-- <image class="icon_img" :src="require('@/static/ico/often.png')" @tap="oftenx"></image> -->
|
<!-- <image class="icon_img" :src="require('@/static/ico/often.png')" @tap="oftenx"></image> -->
|
||||||
@ -44,7 +44,7 @@
|
|||||||
<view class="input-box-flex-grow"> <input type="text" class="contenxxt" id="input"
|
<view class="input-box-flex-grow"> <input type="text" class="contenxxt" id="input"
|
||||||
v-model="formData.content" :hold-keyboard="true" :confirm-type="'send'" :confirm-hold="true"
|
v-model="formData.content" :hold-keyboard="true" :confirm-type="'send'" :confirm-hold="true"
|
||||||
placeholder-style="color:#DDDDDD;" :cursor-spacing="10" @confirm='sendconfirm'
|
placeholder-style="color:#DDDDDD;" :cursor-spacing="10" @confirm='sendconfirm'
|
||||||
@focus="inputBindFocus" @blur="inputBindBlur" /> </view>
|
:adjust-position="false" @keyboardheightchange="keyboardheightchange" /> </view>
|
||||||
<!-- 选择表情包 -->
|
<!-- 选择表情包 -->
|
||||||
<!-- <image class=" icon_btn_add" :src="require('@/static/ico/emoji.png')" @tap="exprec"></image> -->
|
<!-- <image class=" icon_btn_add" :src="require('@/static/ico/emoji.png')" @tap="exprec"></image> -->
|
||||||
<!-- 发送消息按钮 -->
|
<!-- 发送消息按钮 -->
|
||||||
@ -181,14 +181,22 @@
|
|||||||
// })
|
// })
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
inputBindFocus(e) {
|
keyboardheightchange(event) {
|
||||||
this.bottomVal = e.detail.height + 'px'
|
const {
|
||||||
// 获取手机键盘的高度,赋值给input 所在盒子的 bottom 值
|
height,
|
||||||
// 注意!!! 这里的 px 至关重要!!! 我搜到的很多解决方案都没有说这里要添加 px
|
duration
|
||||||
},
|
} = event.detail
|
||||||
inputBindBlur() {
|
this.bottomVal = height
|
||||||
this.bottomVal = 0
|
setTimeout(() => {
|
||||||
// input 失去焦点,键盘隐藏,设置 input 所在盒子的 bottom 值为0
|
let query = uni.createSelectorQuery().in(this);
|
||||||
|
//需要给黄色区域设置一个id标识,在这里是demo
|
||||||
|
query.select('.input-box').boundingClientRect(data => {
|
||||||
|
this.inputboxtop = data.height //赋值,待会要用
|
||||||
|
setTimeout(e => {
|
||||||
|
this.scrollTop = this.scrollTop + 1;
|
||||||
|
}, 300)
|
||||||
|
}).exec();
|
||||||
|
}, 200)
|
||||||
},
|
},
|
||||||
getPageHistory() {
|
getPageHistory() {
|
||||||
let obj = {
|
let obj = {
|
||||||
@ -208,7 +216,9 @@
|
|||||||
//需要给黄色区域设置一个id标识,在这里是demo
|
//需要给黄色区域设置一个id标识,在这里是demo
|
||||||
query.select('.input-box').boundingClientRect(data => {
|
query.select('.input-box').boundingClientRect(data => {
|
||||||
this.inputboxtop = data.height //赋值,待会要用
|
this.inputboxtop = data.height //赋值,待会要用
|
||||||
this.scrollTop = this.scrollTop + 1;
|
setTimeout(e => {
|
||||||
|
this.scrollTop = this.scrollTop + 1;
|
||||||
|
}, 300)
|
||||||
}).exec();
|
}).exec();
|
||||||
}, 100)
|
}, 100)
|
||||||
})
|
})
|
||||||
@ -235,7 +245,9 @@
|
|||||||
//需要给黄色区域设置一个id标识,在这里是demo
|
//需要给黄色区域设置一个id标识,在这里是demo
|
||||||
query.select('.input-box').boundingClientRect(data => {
|
query.select('.input-box').boundingClientRect(data => {
|
||||||
this.inputboxtop = data.height //赋值,待会要用
|
this.inputboxtop = data.height //赋值,待会要用
|
||||||
this.scrollTop = this.scrollTop + 1;
|
setTimeout(e => {
|
||||||
|
this.scrollTop = this.scrollTop + 1;
|
||||||
|
}, 300)
|
||||||
}).exec();
|
}).exec();
|
||||||
}, 200)
|
}, 200)
|
||||||
},
|
},
|
||||||
@ -272,16 +284,14 @@
|
|||||||
recipientName: that.currentItem.doctorName,
|
recipientName: that.currentItem.doctorName,
|
||||||
messageType: 1,
|
messageType: 1,
|
||||||
sendTime: new Date(),
|
sendTime: new Date(),
|
||||||
content: this.formData.content
|
content: that.formData.content
|
||||||
}
|
}
|
||||||
sendMessage(obj).then(res => {
|
sendMessage(obj).then(res => {
|
||||||
that.formData.content = '' //清空输入框的文本
|
that.formData.content = '' //清空输入框的文本
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
that.scrollTop = that.scrollTop + 1;
|
that.scrollTop = that.scrollTop + 1;
|
||||||
}, 100)
|
}, 100)
|
||||||
if (res.code != 200) {
|
if (res.code != 200) {}
|
||||||
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
// try {
|
// try {
|
||||||
// const that = this
|
// const that = this
|
||||||
@ -452,7 +462,9 @@
|
|||||||
//需要给黄色区域设置一个id标识,在这里是demo
|
//需要给黄色区域设置一个id标识,在这里是demo
|
||||||
query.select('.input-box').boundingClientRect(data => {
|
query.select('.input-box').boundingClientRect(data => {
|
||||||
this.inputboxtop = data.height //赋值,待会要用
|
this.inputboxtop = data.height //赋值,待会要用
|
||||||
this.scrollTop = this.scrollTop + 1;
|
setTimeout(e => {
|
||||||
|
this.scrollTop = this.scrollTop + 1;
|
||||||
|
}, 300)
|
||||||
}).exec();
|
}).exec();
|
||||||
}, 200)
|
}, 200)
|
||||||
},
|
},
|
||||||
@ -502,7 +514,9 @@
|
|||||||
//需要给黄色区域设置一个id标识,在这里是demo
|
//需要给黄色区域设置一个id标识,在这里是demo
|
||||||
query.select('.input-box').boundingClientRect(data => {
|
query.select('.input-box').boundingClientRect(data => {
|
||||||
this.inputboxtop = data.height //赋值,待会要用
|
this.inputboxtop = data.height //赋值,待会要用
|
||||||
this.scrollTop = this.scrollTop + 1;
|
setTimeout(e => {
|
||||||
|
this.scrollTop = this.scrollTop + 1;
|
||||||
|
}, 300)
|
||||||
}).exec();
|
}).exec();
|
||||||
}, 100)
|
}, 100)
|
||||||
that.Read()
|
that.Read()
|
||||||
@ -818,4 +832,4 @@
|
|||||||
bottom: 38rpx;
|
bottom: 38rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user