Pre Merge pull request !86 from 周建/dev
commit
d442a83594
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
|
|
@ -0,0 +1,47 @@
|
|||
<template>
|
||||
<div class="head-portrait">
|
||||
<img :src="imgUrl" alt="">
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
imgUrl:{ default:require('@/assets/img/head_portrait.jpg')}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.head-portrait {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
// border: 2px solid rgb(137,140,151);
|
||||
border: 2px solid rgb(255, 255, 255);
|
||||
position:relative;
|
||||
&::before {
|
||||
content: '';
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
z-index: 1;
|
||||
display: block;
|
||||
border-radius: 50%;
|
||||
background-color: rgb(144,225,80);
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
img {
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
border-radius: 50%;
|
||||
// padding: 2px;
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
<template>
|
||||
<div class="person-card" :class="{ activeCard: personInfo.id == current }">
|
||||
<div class="info">
|
||||
<!-- <HeadPortrait :imgUrl="personInfo.headImg" /> -->
|
||||
<div class="info-detail">
|
||||
<div class="name">{{ personInfo.name }}</div>
|
||||
<div class="detail">{{ personInfo.detail }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import HeadPortrait from "./HeadPortrait.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
// HeadPortrait,
|
||||
},
|
||||
props: {
|
||||
personInfo: {
|
||||
default: {}
|
||||
},
|
||||
pcCurrent: {
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
current: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
pcCurrent: function () {
|
||||
this.isActive()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isActive() {
|
||||
this.current = this.pcCurrent
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.person-card {
|
||||
width: 250px;
|
||||
height: 80px;
|
||||
border-radius: 10px;
|
||||
background-color: rgb(50, 54, 68);
|
||||
position: relative;
|
||||
margin: 25px 0;
|
||||
cursor: pointer;
|
||||
.info {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 90%;
|
||||
transform: translate(-50%, -50%);
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
.info-detail {
|
||||
margin-top: 5px;
|
||||
margin-left: 20px;
|
||||
.name {
|
||||
color: #fff;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.detail {
|
||||
color: #5c6675;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
background-color: #1d90f5;
|
||||
transition: 0.3s;
|
||||
box-shadow: 0px 0px 10px 0px rgba(0, 136, 255);
|
||||
// box-shadow: 0 5px 20px rgba(251, 152, 11, .5);
|
||||
.info {
|
||||
.info-detail {
|
||||
.detail {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.activeCard {
|
||||
background-color: #1d90f5;
|
||||
transition: 0.3s;
|
||||
box-shadow: 3px 2px 10px 0px rgba(0, 136, 255);
|
||||
.info {
|
||||
.info-detail {
|
||||
.detail {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,472 @@
|
|||
<template>
|
||||
<div class="chat-window">
|
||||
<div class="botoom">
|
||||
<div class="chat-content" ref="chatContent">
|
||||
<div class="chat-wrapper" v-for="item in chatList" :key="item.id">
|
||||
<div class="chat-friend" v-if="item.uid !== '1001'">
|
||||
<div class="chat-text" v-if="item.chatType == 0">
|
||||
{{ item.msg }}
|
||||
</div>
|
||||
<div class="chat-img" v-if="item.chatType == 1">
|
||||
<img
|
||||
:src="item.msg"
|
||||
alt="表情"
|
||||
v-if="item.extend.imgType == 1"
|
||||
style="width: 100px; height: 100px"
|
||||
/>
|
||||
<el-image :src="item.msg" :preview-src-list="srcImgList" v-else />
|
||||
</div>
|
||||
<div class="chat-img" v-if="item.chatType == 2">
|
||||
<div class="word-file">
|
||||
<FileCard :fileType="item.extend.fileType" :file="item.msg" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-time">
|
||||
<img :src="item.headImg" alt="" />
|
||||
<span>{{ item.name }}</span>
|
||||
<span>{{ item.time }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chat-me" v-else>
|
||||
<div class="chat-text" v-if="item.chatType == 0">
|
||||
{{ item.msg }}
|
||||
</div>
|
||||
<div class="chat-img" v-if="item.chatType == 1">
|
||||
<img
|
||||
:src="item.msg"
|
||||
alt="表情"
|
||||
v-if="item.extend.imgType == 1"
|
||||
style="width: 100px; height: 100px"
|
||||
/>
|
||||
<el-image
|
||||
style="max-width: 300px; border-radius: 10px"
|
||||
:src="item.msg"
|
||||
:preview-src-list="srcImgList"
|
||||
v-else
|
||||
/>
|
||||
</div>
|
||||
<div class="chat-img" v-if="item.chatType == 2">
|
||||
<div class="word-file">
|
||||
<!-- <FileCard :fileType="item.extend.fileType" :file="item.msg" /> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-time">
|
||||
<span>{{ item.name }}</span>
|
||||
<span>{{ item.time }}</span>
|
||||
<img :src="item.headImg" alt="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { animation } from './util'
|
||||
|
||||
// import FileCard from '@/components/FileCard.vue'
|
||||
export default {
|
||||
components: {
|
||||
// FileCard
|
||||
},
|
||||
props: {
|
||||
frinedInfo: Object,
|
||||
default() {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chatList: [],
|
||||
inputMsg: '',
|
||||
showEmoji: false,
|
||||
friendInfo: {},
|
||||
srcImgList: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
frinedInfo() {
|
||||
this.getFriendChatMsg()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getFriendChatMsg()
|
||||
},
|
||||
methods: {
|
||||
//获取聊天记录
|
||||
getFriendChatMsg() {
|
||||
// let params = {
|
||||
// frinedId: this.frinedInfo.id
|
||||
// }
|
||||
// getChatMsg(params).then((res) => {
|
||||
// this.chatList = res
|
||||
// this.chatList.forEach((item) => {
|
||||
// if (item.chatType == 2 && item.extend.imgType == 2) {
|
||||
// this.srcImgList.push(item.msg)
|
||||
// }
|
||||
// })
|
||||
this.scrollBottom()
|
||||
// })
|
||||
},
|
||||
//发送信息
|
||||
sendMsg(msgList) {
|
||||
this.chatList.push(msgList)
|
||||
this.scrollBottom()
|
||||
},
|
||||
//获取窗口高度并滚动至最底层
|
||||
scrollBottom() {
|
||||
this.$nextTick(() => {
|
||||
const scrollDom = this.$refs.chatContent
|
||||
animation(scrollDom, scrollDom.scrollHeight - scrollDom.offsetHeight)
|
||||
})
|
||||
},
|
||||
//关闭标签框
|
||||
clickEmoji() {
|
||||
this.showEmoji = !this.showEmoji
|
||||
},
|
||||
//发送文字信息
|
||||
sendText() {
|
||||
if (this.inputMsg) {
|
||||
let chatMsg = {
|
||||
headImg: require('@/assets/img/head_portrait.jpg'),
|
||||
name: '大毛是小白',
|
||||
time: '09:12 AM',
|
||||
msg: this.inputMsg,
|
||||
chatType: 0, //信息类型,0文字,1图片
|
||||
uid: '1001' //uid
|
||||
}
|
||||
this.sendMsg(chatMsg)
|
||||
this.$emit('personCardSort', this.frinedInfo.id)
|
||||
this.inputMsg = ''
|
||||
} else {
|
||||
this.$message({
|
||||
message: '消息不能为空哦~',
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
},
|
||||
//发送表情
|
||||
sendEmoji(msg) {
|
||||
let chatMsg = {
|
||||
headImg: require('@/assets/img/head_portrait.jpg'),
|
||||
name: '大毛是小白',
|
||||
time: '09:12 AM',
|
||||
msg: msg,
|
||||
chatType: 1, //信息类型,0文字,1图片
|
||||
extend: {
|
||||
imgType: 1 //(1表情,2本地图片)
|
||||
},
|
||||
uid: '1001'
|
||||
}
|
||||
this.sendMsg(chatMsg)
|
||||
this.clickEmoji()
|
||||
},
|
||||
//发送本地图片
|
||||
sendImg(e) {
|
||||
console.log(e.target.files)
|
||||
let chatMsg = {
|
||||
headImg: require('@/assets/img/head_portrait.jpg'),
|
||||
name: '大毛是小白',
|
||||
time: '09:12 AM',
|
||||
msg: '',
|
||||
chatType: 1, //信息类型,0文字,1图片, 2文件
|
||||
extend: {
|
||||
imgType: 2 //(1表情,2本地图片)
|
||||
},
|
||||
uid: '1001'
|
||||
}
|
||||
let files = e.target.files[0] //图片文件名
|
||||
if (!e || !window.FileReader) return // 看是否支持FileReader
|
||||
let reader = new FileReader()
|
||||
reader.readAsDataURL(files) // 关键一步,在这里转换的
|
||||
reader.onloadend = function () {
|
||||
chatMsg.msg = this.result //赋值
|
||||
this.srcImgList.push(chatMsg.msg)
|
||||
}
|
||||
this.sendMsg(chatMsg)
|
||||
e.target.files = null
|
||||
},
|
||||
//发送文件
|
||||
sendFile(e) {
|
||||
let chatMsg = {
|
||||
headImg: require('@/assets/img/head_portrait.jpg'),
|
||||
name: '大毛是小白',
|
||||
time: '09:12 AM',
|
||||
msg: '',
|
||||
chatType: 2, //信息类型,0文字,1图片, 2文件
|
||||
extend: {
|
||||
fileType: '' //(1word,2excel,3ppt,4pdf,5zpi, 6txt)
|
||||
},
|
||||
uid: '1001'
|
||||
}
|
||||
let files = e.target.files[0] //图片文件名
|
||||
chatMsg.msg = files
|
||||
console.log(files)
|
||||
if (files) {
|
||||
switch (files.type) {
|
||||
case 'application/msword':
|
||||
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
||||
chatMsg.extend.fileType = 1
|
||||
break
|
||||
case 'application/vnd.ms-excel':
|
||||
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
||||
chatMsg.extend.fileType = 2
|
||||
break
|
||||
case 'application/vnd.ms-powerpoint':
|
||||
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
|
||||
chatMsg.extend.fileType = 3
|
||||
break
|
||||
case 'application/pdf':
|
||||
chatMsg.extend.fileType = 4
|
||||
break
|
||||
case 'application/zip':
|
||||
case 'application/x-zip-compressed':
|
||||
chatMsg.extend.fileType = 5
|
||||
break
|
||||
case 'text/plain':
|
||||
chatMsg.extend.fileType = 6
|
||||
break
|
||||
default:
|
||||
chatMsg.extend.fileType = 0
|
||||
}
|
||||
this.sendMsg(chatMsg)
|
||||
e.target.files = null
|
||||
}
|
||||
},
|
||||
// 发送语音
|
||||
telephone() {
|
||||
this.$message('该功能还没有开发哦,敬请期待一下吧~🥳')
|
||||
},
|
||||
//发送视频
|
||||
video() {
|
||||
this.$message('该功能还没有开发哦,敬请期待一下吧~🥳')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.chat-window {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin-left: 20px;
|
||||
position: relative;
|
||||
|
||||
.top {
|
||||
margin-bottom: 50px;
|
||||
&::after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
.head-pic {
|
||||
float: left;
|
||||
}
|
||||
.info-detail {
|
||||
float: left;
|
||||
margin: 5px 20px 0;
|
||||
.name {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
}
|
||||
.detail {
|
||||
color: #9e9e9e;
|
||||
font-size: 12px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
.other-fun {
|
||||
float: right;
|
||||
margin-top: 20px;
|
||||
span {
|
||||
margin-left: 30px;
|
||||
cursor: pointer;
|
||||
}
|
||||
// .icon-tupian {
|
||||
|
||||
// }
|
||||
input {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
.botoom {
|
||||
width: 100%;
|
||||
height: 60vh;
|
||||
background-color: rgb(50, 54, 68);
|
||||
border-radius: 20px;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
.chat-content {
|
||||
width: 100%;
|
||||
height: 85%;
|
||||
overflow-y: scroll;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
&::-webkit-scrollbar {
|
||||
width: 0; /* Safari,Chrome 隐藏滚动条 */
|
||||
height: 0; /* Safari,Chrome 隐藏滚动条 */
|
||||
display: none; /* 移动端、pad 上Safari,Chrome,隐藏滚动条 */
|
||||
}
|
||||
.chat-wrapper {
|
||||
position: relative;
|
||||
word-break: break-all;
|
||||
.chat-friend {
|
||||
width: 100%;
|
||||
float: left;
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
.chat-text {
|
||||
max-width: 90%;
|
||||
padding: 20px;
|
||||
border-radius: 20px 20px 20px 5px;
|
||||
background-color: rgb(56, 60, 75);
|
||||
color: #fff;
|
||||
&:hover {
|
||||
background-color: rgb(39, 42, 55);
|
||||
}
|
||||
}
|
||||
.chat-img {
|
||||
img {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
}
|
||||
.info-time {
|
||||
margin: 10px 0;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
margin-right: 10px;
|
||||
}
|
||||
span:last-child {
|
||||
color: rgb(101, 104, 115);
|
||||
margin-left: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
.chat-me {
|
||||
width: 100%;
|
||||
float: right;
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
align-items: flex-end;
|
||||
.chat-text {
|
||||
float: right;
|
||||
max-width: 90%;
|
||||
padding: 20px;
|
||||
border-radius: 20px 20px 5px 20px;
|
||||
background-color: rgb(29, 144, 245);
|
||||
color: #fff;
|
||||
&:hover {
|
||||
background-color: rgb(26, 129, 219);
|
||||
}
|
||||
}
|
||||
.chat-img {
|
||||
img {
|
||||
max-width: 300px;
|
||||
max-height: 200px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
}
|
||||
.info-time {
|
||||
margin: 10px 0;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
||||
img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
margin-left: 10px;
|
||||
}
|
||||
span {
|
||||
line-height: 30px;
|
||||
}
|
||||
span:first-child {
|
||||
color: rgb(101, 104, 115);
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.chatInputs {
|
||||
width: 90%;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
margin: 3%;
|
||||
display: flex;
|
||||
.boxinput {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
background-color: rgb(66, 70, 86);
|
||||
border-radius: 15px;
|
||||
border: 1px solid rgb(80, 85, 103);
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
.emoji {
|
||||
transition: 0.3s;
|
||||
&:hover {
|
||||
background-color: rgb(46, 49, 61);
|
||||
border: 1px solid rgb(71, 73, 82);
|
||||
}
|
||||
}
|
||||
|
||||
.inputs {
|
||||
width: 90%;
|
||||
height: 50px;
|
||||
background-color: rgb(66, 70, 86);
|
||||
border-radius: 15px;
|
||||
border: 2px solid rgb(34, 135, 225);
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
transition: 0.2s;
|
||||
font-size: 20px;
|
||||
color: #fff;
|
||||
font-weight: 100;
|
||||
margin: 0 20px;
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
.send {
|
||||
background-color: rgb(29, 144, 245);
|
||||
border: 0;
|
||||
transition: 0.3s;
|
||||
box-shadow: 0px 0px 5px 0px rgba(0, 136, 255);
|
||||
&:hover {
|
||||
box-shadow: 0px 0px 10px 0px rgba(0, 136, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,247 @@
|
|||
<template>
|
||||
<ContentWrap style="height: 80vh">
|
||||
<div class="common-layout">
|
||||
<el-container>
|
||||
<el-container>
|
||||
<el-aside width="20%">
|
||||
<div class="asideTop">
|
||||
<el-row>
|
||||
<el-col style="display: grid">
|
||||
<!-- <div class="addSession">
|
||||
<Icon icon="ep:plus" />
|
||||
新建会话
|
||||
</div>
|
||||
-->
|
||||
<XButton type="primary" title="新建会话" preIcon="ep:plus" @click="addSession" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="asideFooter">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<div class="online-person">
|
||||
<!-- <span class="onlin-text">聊天列表</span> -->
|
||||
<div class="person-cards-wrapper">
|
||||
<div
|
||||
class="personList"
|
||||
v-for="personInfo in personList"
|
||||
:key="personInfo.id"
|
||||
@click="clickPerson(personInfo)"
|
||||
>
|
||||
<PersonCard :personInfo="personInfo" :pcCurrent="pcCurrent" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-aside>
|
||||
<el-container>
|
||||
<el-main>
|
||||
<div class="main">
|
||||
<ChatWindow :frinedInfo="chatWindowInfo" @person-cardSort="personCardSort"
|
||||
/></div>
|
||||
</el-main>
|
||||
<el-footer>
|
||||
<div class="footer">
|
||||
<div class="chatInputs">
|
||||
<div class="emoji-content"> </div>
|
||||
<input class="inputs" />
|
||||
<!-- <input class="inputs" v-model="inputMsg" @keyup.enter="sendText" /> -->
|
||||
<!-- <div class="send boxinput" @click="sendText"> -->
|
||||
<div class="send boxinput">
|
||||
<img src="@/assets/imgs/rocket.png" alt="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</div>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import PersonCard from './PersonCard.vue'
|
||||
import ChatWindow from './chatwindow.vue'
|
||||
// 聊天列表
|
||||
const personList = ref([
|
||||
{
|
||||
id: 1,
|
||||
name: 'qq'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'ww'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'ee'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: 'rr'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: 'tt'
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: 'yy'
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: 'uu'
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: 'ii'
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: 'oo'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: 'pp'
|
||||
}
|
||||
])
|
||||
const pcCurrent = ref('')
|
||||
// 聊天页面
|
||||
const chatWindowInfo = ref({})
|
||||
const personCardSort = (item) => {
|
||||
console.log(item, '聊天页面回显')
|
||||
}
|
||||
// 新建会话
|
||||
const addSession = () => {
|
||||
console.log('新建会话')
|
||||
}
|
||||
const clickPerson = (item) => {
|
||||
console.log(item, '点击某个信息记录')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.common-layout {
|
||||
/* border: 1px black solid; */
|
||||
height: 75vh;
|
||||
}
|
||||
.asideTop {
|
||||
height: 3vh;
|
||||
margin: 10px;
|
||||
/* border: 1px solid black; */
|
||||
}
|
||||
.addSession {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.asideFooter {
|
||||
height: 65vh;
|
||||
margin: 10px;
|
||||
/* border: 1px solid black; */
|
||||
}
|
||||
.online-person {
|
||||
overflow: auto;
|
||||
height: 600px;
|
||||
/* margin-top: 100px; */
|
||||
}
|
||||
/* .onlin-text {
|
||||
padding-left: 10px;
|
||||
color: rgb(176, 178, 189);
|
||||
} */
|
||||
.person-cards-wrapper {
|
||||
padding-left: 10px;
|
||||
/* height: 65vh; */
|
||||
/* margin-top: 20px; */
|
||||
overflow: hidden;
|
||||
/* overflow-y: scroll; */
|
||||
box-sizing: border-box;
|
||||
}
|
||||
person-cards-wrapper::-webkit-scrollbar {
|
||||
width: 0px; /* Safari,Chrome 隐藏滚动条 */
|
||||
height: 0px; /* Safari,Chrome 隐藏滚动条 */
|
||||
display: none; /* 移动端、pad 上Safari,Chrome,隐藏滚动条 */
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.footer {
|
||||
width: 100%;
|
||||
height: 20%;
|
||||
}
|
||||
.chatInputs {
|
||||
width: 100%;
|
||||
/* margin: 3%; */
|
||||
display: flex;
|
||||
}
|
||||
.boxinput {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
background-color: rgb(66, 70, 86);
|
||||
border-radius: 15px;
|
||||
border: 1px solid rgb(80, 85, 103);
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.boxinput img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.emoji {
|
||||
transition: 0.3s;
|
||||
}
|
||||
.emoji:hover {
|
||||
background-color: rgb(46, 49, 61);
|
||||
border: 1px solid rgb(71, 73, 82);
|
||||
}
|
||||
.inputs {
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
background-color: rgb(66, 70, 86);
|
||||
border-radius: 15px;
|
||||
border: 2px solid rgb(34, 135, 225);
|
||||
/* padding: 10px; */
|
||||
box-sizing: border-box;
|
||||
transition: 0.2s;
|
||||
font-size: 20px;
|
||||
color: #fff;
|
||||
font-weight: 100;
|
||||
margin: 0 20px;
|
||||
}
|
||||
.inputs:focus {
|
||||
outline: none;
|
||||
}
|
||||
.send {
|
||||
background-color: rgb(29, 144, 245);
|
||||
border: 0;
|
||||
transition: 0.3s;
|
||||
box-shadow: 0px 0px 5px 0px rgba(0, 136, 255);
|
||||
}
|
||||
.send:hover {
|
||||
box-shadow: 0px 0px 10px 0px rgba(0, 136, 255);
|
||||
}
|
||||
.main {
|
||||
flex: 1;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
.main .showIcon {
|
||||
position: absolute;
|
||||
top: calc(50% - 150px); /*垂直居中 */
|
||||
left: calc(50% - 50px); /*水平居中 */
|
||||
}
|
||||
.main .showIcon .icon-snapchat {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
font-size: 300px;
|
||||
/* // color: rgb(28, 30, 44); */
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
//防抖
|
||||
export function debounce(fn) {
|
||||
console.log(1)
|
||||
let t = null //只会执行一次
|
||||
debugger
|
||||
|
||||
return function (){
|
||||
if(t){
|
||||
clearTimeout(t)
|
||||
}
|
||||
t = setTimeout(()=>{
|
||||
console.log(temp); //可以获取
|
||||
// console.log(arguments[0]) //undefined
|
||||
fn.apply(this,arguments)
|
||||
//在这个回调函数里面的argument是这个回调函数的参数,因为没有参数所以undefined,可以通过外面的函数赋值来进行访问
|
||||
//也可以改变成箭头函数,箭头函数的this是指向定义函数的那一层的,所以访问到的arguments是上一层函数的arguments
|
||||
},1000)
|
||||
|
||||
}
|
||||
}
|
||||
//节流
|
||||
export function throttle(fn, delay = 200) {
|
||||
let timer = null
|
||||
console.log(fn);
|
||||
debugger
|
||||
return function () {
|
||||
if(timer) return
|
||||
timer = setTimeout(() => {
|
||||
debugger
|
||||
fn.apply(this,arguments)
|
||||
timer = null
|
||||
})
|
||||
}
|
||||
}
|
||||
//下拉动画
|
||||
export function animation(obj, target, fn1) {
|
||||
// console.log(fn1);
|
||||
// fn是一个回调函数,在定时器结束的时候添加
|
||||
// 每次开定时器之前先清除掉定时器
|
||||
clearInterval(obj.timer);
|
||||
obj.timer = setInterval(function () {
|
||||
// 步长计算公式 越来越小
|
||||
// 步长取整
|
||||
var step = (target - obj.scrollTop) / 10;
|
||||
step = step > 0 ? Math.ceil(step) : Math.floor(step);
|
||||
if (obj.scrollTop >= target) {
|
||||
clearInterval(obj.timer);
|
||||
// 如果fn1存在,调用fn
|
||||
if (fn1) {
|
||||
fn1();
|
||||
}
|
||||
} else {
|
||||
// 每30毫秒就将新的值给obj.left
|
||||
obj.scrollTop = obj.scrollTop + step;
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
|
||||
//判断文件类型
|
||||
export function judgeFileType(file) {
|
||||
if (file == null||file == ""){
|
||||
alert("请选择要上传的图片!");
|
||||
return false;
|
||||
}
|
||||
if (file.lastIndexOf('.')==-1){ //如果不存在"."
|
||||
alert("路径不正确!");
|
||||
return false;
|
||||
}
|
||||
var AllImgExt=".jpg|.jpeg|.gif|.bmp|.png|";
|
||||
var extName = file.substring(file.lastIndexOf(".")).toLowerCase();//(把路径中的所有字母全部转换为小写)
|
||||
if(AllImgExt.indexOf(extName+"|")==-1)
|
||||
{
|
||||
ErrMsg="该文件类型不允许上传。请上传 "+AllImgExt+" 类型的文件,当前文件类型为"+extName;
|
||||
alert(ErrMsg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//文件类型
|
||||
export function fileType() {
|
||||
return {
|
||||
'application/msword': 'word',
|
||||
'application/pdf': 'pdf',
|
||||
'application/vnd.ms-powerpoint': 'ppt',
|
||||
'application/vnd.ms-excel': 'excel',
|
||||
'aplication/zip': 'zpi',
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue