mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-17 14:42:51 +00:00
feat:聊天表情包 - 添加左右滚动条
This commit is contained in:
parent
c11f946979
commit
46705dd55f
@ -175,7 +175,7 @@ services:
|
|||||||
|
|
||||||
okr:
|
okr:
|
||||||
container_name: "dootask-okr-${APP_ID}"
|
container_name: "dootask-okr-${APP_ID}"
|
||||||
image: "kuaifan/doookr:0.0.4"
|
image: "kuaifan/doookr:0.0.5"
|
||||||
environment:
|
environment:
|
||||||
TZ: "${TIMEZONE:-PRC}"
|
TZ: "${TIMEZONE:-PRC}"
|
||||||
DOO_TASK_URL: "http://${APP_IPPR}.3"
|
DOO_TASK_URL: "http://${APP_IPPR}.3"
|
||||||
|
|||||||
@ -23,7 +23,8 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</Scrollbar>
|
</Scrollbar>
|
||||||
</div>
|
</div>
|
||||||
<ul v-if="!onlyEmoji" class="chat-emoji-menu">
|
<ul v-if="!onlyEmoji" ref="chatEmojiMenuRef" class="chat-emoji-menu" :style="chatEmojiMenuStyle" @scroll="onHandleScroll">
|
||||||
|
<li v-if="showEmojiMenuScrollLeftBtn" @click="onEmojiMenuScroll('left')" class="left-btn"><i class="taskfont"></i></li>
|
||||||
<li :class="{active: type === 'emosearch'}" @click="type='emosearch'">
|
<li :class="{active: type === 'emosearch'}" @click="type='emosearch'">
|
||||||
<i class="taskfont"></i>
|
<i class="taskfont"></i>
|
||||||
</li>
|
</li>
|
||||||
@ -33,6 +34,7 @@
|
|||||||
<li v-for="item in emoticonData" :class="{active: type === 'emoticon' && emoticonPath == item.path}" @click="onEmoticon(item.path)">
|
<li v-for="item in emoticonData" :class="{active: type === 'emoticon' && emoticonPath == item.path}" @click="onEmoticon(item.path)">
|
||||||
<img :title="item.name" :alt="item.name" :src="item.src"/>
|
<img :title="item.name" :alt="item.name" :src="item.src"/>
|
||||||
</li>
|
</li>
|
||||||
|
<li v-if="showEmojiMenuScrollRightBtn" @click="onEmojiMenuScroll('right')" class="right-btn"><i class="taskfont"></i></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -77,10 +79,13 @@ export default {
|
|||||||
|
|
||||||
emojiData: [],
|
emojiData: [],
|
||||||
emoticonData: [],
|
emoticonData: [],
|
||||||
|
|
||||||
|
emojiMenuScrollLeft: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initData()
|
this.initData()
|
||||||
|
this.onMonitorWheel()
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
type() {
|
type() {
|
||||||
@ -109,6 +114,20 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
|
},
|
||||||
|
chatEmojiMenuStyle() {
|
||||||
|
return {
|
||||||
|
paddingLeft: this.showEmojiMenuScrollLeftBtn ? '34px' : 0,
|
||||||
|
paddingRight: this.showEmojiMenuScrollRightBtn ? '34px' : 0,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
showEmojiMenuScrollLeftBtn(){
|
||||||
|
return this.emojiMenuScrollLeft > 34
|
||||||
|
},
|
||||||
|
showEmojiMenuScrollRightBtn(){
|
||||||
|
const container = this.$refs['chatEmojiMenuRef'];
|
||||||
|
const liWidth = container?.querySelector('li')?.offsetWidth || 48;
|
||||||
|
return this.emojiMenuScrollLeft < this.emoticonData.length * liWidth - 34
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -201,7 +220,27 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.$emit('on-select', item)
|
this.$emit('on-select', item)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onMonitorWheel() {
|
||||||
|
const container = this.$refs['chatEmojiMenuRef'];
|
||||||
|
container?.addEventListener("wheel", (event) =>{
|
||||||
|
event.preventDefault();
|
||||||
|
container.scrollLeft += event.deltaY;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onEmojiMenuScroll(type) {
|
||||||
|
const container = this.$refs['chatEmojiMenuRef'];
|
||||||
|
const containerWidth = container.offsetWidth - 68
|
||||||
|
const scrollLeft = type == 'right' ? container.scrollLeft + containerWidth : container.scrollLeft - containerWidth
|
||||||
|
container.scrollTo({ left: scrollLeft, behavior: "smooth" })
|
||||||
|
},
|
||||||
|
|
||||||
|
onHandleScroll(event) {
|
||||||
|
this.emojiMenuScrollLeft = event.target.scrollLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -339,7 +339,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 3px 0;
|
padding: 3px 0;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
box-sizing: content-box;
|
// box-sizing: content-box;
|
||||||
> li {
|
> li {
|
||||||
position: relative;
|
position: relative;
|
||||||
&:before {
|
&:before {
|
||||||
@ -375,6 +375,7 @@
|
|||||||
.chat-emoji-wrapper {
|
.chat-emoji-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.chat-emoji-emosearch {
|
.chat-emoji-emosearch {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
@ -523,6 +524,24 @@
|
|||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.left-btn,.right-btn{
|
||||||
|
position: absolute !important;
|
||||||
|
height: 40px;
|
||||||
|
background: #f2f4f7 !important;
|
||||||
|
width: 34px;
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-btn{
|
||||||
|
left: 0;
|
||||||
|
box-shadow: 10px 0 10px -10px rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-btn{
|
||||||
|
right: 0;
|
||||||
|
box-shadow: -10px 0 10px -10px rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -891,7 +910,8 @@ body.window-portrait {
|
|||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
background-color: #f8f8f8;
|
background-color: #f8f8f8;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
width: calc(100% - 8px);
|
width: 100%;
|
||||||
|
height: 48px;
|
||||||
> li {
|
> li {
|
||||||
&.active {
|
&.active {
|
||||||
&:before {
|
&:before {
|
||||||
@ -899,6 +919,9 @@ body.window-portrait {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.left-btn,.right-btn{
|
||||||
|
background: #f8f8f8 !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user