|
|
@@ -9,7 +9,7 @@
|
|
|
<div
|
|
|
id="chat-list"
|
|
|
class="chat-list"
|
|
|
- @click="showAttach = false"
|
|
|
+ @click="showAttach = ''"
|
|
|
:style="{ paddingBottom: `calc(${100 + attachHeight}px + env(safe-area-inset-bottom))` }"
|
|
|
>
|
|
|
<chat-info
|
|
|
@@ -33,22 +33,36 @@
|
|
|
:boder="false"
|
|
|
placeholder="请输入需要咨询的问题"
|
|
|
:value="message"
|
|
|
+ @blur="message = $event.detail.value"
|
|
|
@input="message = $event.detail"
|
|
|
@confirm="confirm"
|
|
|
/>
|
|
|
|
|
|
- <img src="/native/svgs/icon_liaotian_biaoqing.svg" alt="" class="icon" />
|
|
|
<img
|
|
|
- @click="showAttach = !showAttach"
|
|
|
+ src="/native/svgs/icon_liaotian_biaoqing.svg"
|
|
|
+ @click="showAttach = showAttach !== 'emoji' ? 'emoji' : ''"
|
|
|
+ alt=""
|
|
|
+ class="icon"
|
|
|
+ />
|
|
|
+ <van-button type="primary" size="small" @click="confirm('')" v-if="message"> 发送</van-button>
|
|
|
+ <img
|
|
|
+ @click="showAttach = showAttach != 'img' ? 'img' : ''"
|
|
|
src="/native/svgs/icon_liaotian_gengduo.svg"
|
|
|
alt=""
|
|
|
class="icon"
|
|
|
+ v-else
|
|
|
/>
|
|
|
</div>
|
|
|
<div class="attach-box" :style="{ height: `${attachHeight}px` }">
|
|
|
- <div class="up-btn" @click="sendImg">
|
|
|
+ <div class="up-btn" @click="sendImg" v-if="showAttach === 'img'">
|
|
|
<img src="/native/svgs/icon_zhaopian.svg" alt="" />
|
|
|
</div>
|
|
|
+
|
|
|
+ <div class="emojiList" v-else>
|
|
|
+ <div class="emoji-item" @click="addEmoji(item)" v-for="(item, index) in connectemoji" :key="index">
|
|
|
+ {{ item }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -70,7 +84,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
message: '',
|
|
|
- showAttach: false,
|
|
|
+ showAttach: '',
|
|
|
topicInfo: null,
|
|
|
list: [],
|
|
|
toUserId: 0,
|
|
|
@@ -82,13 +96,49 @@ export default {
|
|
|
lastDay: 'MM/DD HH:mm', // The day before ( Yesterday at 2:30 AM )
|
|
|
lastWeek: 'MM/DD HH:mm', // Last week ( Last Monday at 2:30 AM )
|
|
|
sameElse: 'YYYY/MM/DD' // Everything else ( 7/10/2011 )
|
|
|
- }
|
|
|
+ },
|
|
|
+ connectemoji: [
|
|
|
+ '😊',
|
|
|
+ '😅',
|
|
|
+ '😲',
|
|
|
+ '😭',
|
|
|
+ '😂',
|
|
|
+ '😄',
|
|
|
+ '😩',
|
|
|
+ '😞',
|
|
|
+ '😵',
|
|
|
+ '😒',
|
|
|
+ '😍',
|
|
|
+ '😤',
|
|
|
+ '😜',
|
|
|
+ '😝',
|
|
|
+ '😋',
|
|
|
+ '😘',
|
|
|
+ '😚',
|
|
|
+ '😷',
|
|
|
+ '😳',
|
|
|
+ '😃',
|
|
|
+ '😆',
|
|
|
+ '😁',
|
|
|
+ '😢',
|
|
|
+ '😨',
|
|
|
+ '😠',
|
|
|
+ '😣',
|
|
|
+ '😌',
|
|
|
+ '😖',
|
|
|
+ '😔',
|
|
|
+ '😰',
|
|
|
+ '😱',
|
|
|
+ '😪',
|
|
|
+ '😏',
|
|
|
+ '😓'
|
|
|
+ ]
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['userInfo', 'systemInfo']),
|
|
|
attachHeight() {
|
|
|
- return this.showAttach ? 114 : 0;
|
|
|
+ return this.showAttach ? 200 : 0;
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
@@ -103,7 +153,6 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
loginMethods() {
|
|
|
- console.log(this.$mp.options.toUserId);
|
|
|
let eventChannel = this.$mp.page.getOpenerEventChannel();
|
|
|
|
|
|
this.$http
|
|
|
@@ -173,8 +222,10 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
confirm(e) {
|
|
|
- this.newMessage(e.detail);
|
|
|
- this.message = '';
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.newMessage(e ? e.detail : this.message);
|
|
|
+ this.message = '';
|
|
|
+ });
|
|
|
},
|
|
|
newMessage(info, isSend = true, messageType = 'TEXT', beenRead = false) {
|
|
|
let data = {
|
|
|
@@ -193,16 +244,20 @@ export default {
|
|
|
this.$http.postJson('/message/save', data).then(res => {
|
|
|
this.getList();
|
|
|
});
|
|
|
+ },
|
|
|
+ addEmoji(emoji) {
|
|
|
+ this.message = this.message + emoji + ' ';
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
-<style lang="less">
|
|
|
-page {
|
|
|
+<style lang="less" scoped>
|
|
|
+/deep/ page {
|
|
|
background-color: @bg;
|
|
|
}
|
|
|
.chat-list {
|
|
|
padding: 10px 20px 100px;
|
|
|
+ z-index: 1;
|
|
|
}
|
|
|
|
|
|
.bottom-box {
|
|
|
@@ -243,13 +298,18 @@ page {
|
|
|
input {
|
|
|
font-weight: normal;
|
|
|
}
|
|
|
+
|
|
|
+ .van-button {
|
|
|
+ --button-small-min-width: 50px;
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.attach-box {
|
|
|
transition: height ease-in-out 0.3s;
|
|
|
padding: 0 20px;
|
|
|
overflow: hidden;
|
|
|
-
|
|
|
+ z-index: 2;
|
|
|
.up-btn {
|
|
|
width: 60px;
|
|
|
height: 60px;
|
|
|
@@ -274,4 +334,25 @@ page {
|
|
|
.flex();
|
|
|
justify-content: center;
|
|
|
}
|
|
|
+.emojiList {
|
|
|
+ padding: 5px 0;
|
|
|
+ overflow: auto;
|
|
|
+ box-sizing: border-box;
|
|
|
+ height: 100%;
|
|
|
+ .flex();
|
|
|
+ flex-wrap: wrap;
|
|
|
+}
|
|
|
+.emoji-item {
|
|
|
+ width: 20%;
|
|
|
+ flex-shrink: 0;
|
|
|
+ text-align: center;
|
|
|
+ padding: 10px 0;
|
|
|
+ margin-top: 10px;
|
|
|
+ border-radius: 2px;
|
|
|
+ &:active {
|
|
|
+ background-color: #00000010;
|
|
|
+ }
|
|
|
+ font-family: 'color-emoji';
|
|
|
+ font-size: 25px;
|
|
|
+}
|
|
|
</style>
|