聊天页面提交还有honneybtn和列表显示的bug

pull/1/head
xuan 2 months ago
parent 091f7be7e5
commit 19e2473fc8

64
package-lock.json generated

@ -13,7 +13,8 @@
"element-plus": "^2.8.6", "element-plus": "^2.8.6",
"vite": "^5.4.10", "vite": "^5.4.10",
"vue": "^3.2.13", "vue": "^3.2.13",
"vue-router": "^4.4.5" "vue-router": "^4.4.5",
"vue-virtual-scroller": "^1.1.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.16", "@babel/core": "^7.12.16",
@ -2320,7 +2321,7 @@
"version": "0.3.5", "version": "0.3.5",
"resolved": "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", "resolved": "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz",
"integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==",
"devOptional": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@jridgewell/set-array": "^1.2.1", "@jridgewell/set-array": "^1.2.1",
@ -2335,7 +2336,7 @@
"version": "3.1.2", "version": "3.1.2",
"resolved": "https://registry.npmmirror.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", "resolved": "https://registry.npmmirror.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
"devOptional": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=6.0.0" "node": ">=6.0.0"
@ -2345,7 +2346,7 @@
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmmirror.com/@jridgewell/set-array/-/set-array-1.2.1.tgz", "resolved": "https://registry.npmmirror.com/@jridgewell/set-array/-/set-array-1.2.1.tgz",
"integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==",
"devOptional": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=6.0.0" "node": ">=6.0.0"
@ -2355,7 +2356,7 @@
"version": "0.3.6", "version": "0.3.6",
"resolved": "https://registry.npmmirror.com/@jridgewell/source-map/-/source-map-0.3.6.tgz", "resolved": "https://registry.npmmirror.com/@jridgewell/source-map/-/source-map-0.3.6.tgz",
"integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==",
"devOptional": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/gen-mapping": "^0.3.5",
@ -2372,7 +2373,7 @@
"version": "0.3.25", "version": "0.3.25",
"resolved": "https://registry.npmmirror.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", "resolved": "https://registry.npmmirror.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz",
"integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==",
"devOptional": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/resolve-uri": "^3.1.0",
@ -2957,7 +2958,7 @@
"version": "22.8.1", "version": "22.8.1",
"resolved": "https://registry.npmmirror.com/@types/node/-/node-22.8.1.tgz", "resolved": "https://registry.npmmirror.com/@types/node/-/node-22.8.1.tgz",
"integrity": "sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==", "integrity": "sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==",
"devOptional": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"undici-types": "~6.19.8" "undici-types": "~6.19.8"
@ -4063,7 +4064,7 @@
"version": "8.14.0", "version": "8.14.0",
"resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.14.0.tgz", "resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.14.0.tgz",
"integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==",
"devOptional": true, "dev": true,
"license": "MIT", "license": "MIT",
"bin": { "bin": {
"acorn": "bin/acorn" "acorn": "bin/acorn"
@ -4721,7 +4722,7 @@
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmmirror.com/buffer-from/-/buffer-from-1.1.2.tgz", "resolved": "https://registry.npmmirror.com/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
"devOptional": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/bytes": { "node_modules/bytes": {
@ -11072,6 +11073,12 @@
"url": "https://opencollective.com/webpack" "url": "https://opencollective.com/webpack"
} }
}, },
"node_modules/scrollparent": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/scrollparent/-/scrollparent-2.1.0.tgz",
"integrity": "sha512-bnnvJL28/Rtz/kz2+4wpBjHzWoEzXhVg/TE8BeVGJHUqE8THNIRnDxDWMktwM+qahvlRdvlLdsQfYe+cuqfZeA==",
"license": "ISC"
},
"node_modules/scule": { "node_modules/scule": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmmirror.com/scule/-/scule-1.3.0.tgz", "resolved": "https://registry.npmmirror.com/scule/-/scule-1.3.0.tgz",
@ -11430,7 +11437,7 @@
"version": "0.6.1", "version": "0.6.1",
"resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz", "resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"devOptional": true, "dev": true,
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
@ -11449,7 +11456,7 @@
"version": "0.5.21", "version": "0.5.21",
"resolved": "https://registry.npmmirror.com/source-map-support/-/source-map-support-0.5.21.tgz", "resolved": "https://registry.npmmirror.com/source-map-support/-/source-map-support-0.5.21.tgz",
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
"devOptional": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"buffer-from": "^1.0.0", "buffer-from": "^1.0.0",
@ -11806,7 +11813,7 @@
"version": "5.36.0", "version": "5.36.0",
"resolved": "https://registry.npmmirror.com/terser/-/terser-5.36.0.tgz", "resolved": "https://registry.npmmirror.com/terser/-/terser-5.36.0.tgz",
"integrity": "sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w==", "integrity": "sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w==",
"devOptional": true, "dev": true,
"license": "BSD-2-Clause", "license": "BSD-2-Clause",
"dependencies": { "dependencies": {
"@jridgewell/source-map": "^0.3.3", "@jridgewell/source-map": "^0.3.3",
@ -11879,7 +11886,7 @@
"version": "2.20.3", "version": "2.20.3",
"resolved": "https://registry.npmmirror.com/commander/-/commander-2.20.3.tgz", "resolved": "https://registry.npmmirror.com/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"devOptional": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/text-table": { "node_modules/text-table": {
@ -12072,7 +12079,7 @@
"version": "6.19.8", "version": "6.19.8",
"resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.19.8.tgz", "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.19.8.tgz",
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
"devOptional": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/unicode-canonical-property-names-ecmascript": { "node_modules/unicode-canonical-property-names-ecmascript": {
@ -12664,6 +12671,21 @@
"url": "https://github.com/chalk/chalk?sponsor=1" "url": "https://github.com/chalk/chalk?sponsor=1"
} }
}, },
"node_modules/vue-observe-visibility": {
"version": "0.4.6",
"resolved": "https://registry.npmjs.org/vue-observe-visibility/-/vue-observe-visibility-0.4.6.tgz",
"integrity": "sha512-xo0CEVdkjSjhJoDdLSvoZoQrw/H2BlzB5jrCBKGZNXN2zdZgMuZ9BKrxXDjNP2AxlcCoKc8OahI3F3r3JGLv2Q==",
"license": "MIT"
},
"node_modules/vue-resize": {
"version": "0.4.5",
"resolved": "https://registry.npmjs.org/vue-resize/-/vue-resize-0.4.5.tgz",
"integrity": "sha512-bhP7MlgJQ8TIkZJXAfDf78uJO+mEI3CaLABLjv0WNzr4CcGRGPIAItyWYnP6LsPA4Oq0WE+suidNs6dgpO4RHg==",
"license": "MIT",
"peerDependencies": {
"vue": "^2.3.0"
}
},
"node_modules/vue-router": { "node_modules/vue-router": {
"version": "4.4.5", "version": "4.4.5",
"resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-4.4.5.tgz", "resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-4.4.5.tgz",
@ -12704,6 +12726,20 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/vue-virtual-scroller": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vue-virtual-scroller/-/vue-virtual-scroller-1.1.2.tgz",
"integrity": "sha512-SkUyc7QHCJFB5h1Fya7LxVizlVzOZZuFVipBGHYoTK8dwLs08bIz/tclvRApYhksaJIm/nn51inzO2UjpGJPMQ==",
"license": "MIT",
"dependencies": {
"scrollparent": "^2.0.1",
"vue-observe-visibility": "^0.4.4",
"vue-resize": "^0.4.5"
},
"peerDependencies": {
"vue": "^2.6.11"
}
},
"node_modules/watchpack": { "node_modules/watchpack": {
"version": "2.4.2", "version": "2.4.2",
"resolved": "https://registry.npmmirror.com/watchpack/-/watchpack-2.4.2.tgz", "resolved": "https://registry.npmmirror.com/watchpack/-/watchpack-2.4.2.tgz",

@ -13,7 +13,8 @@
"element-plus": "^2.8.6", "element-plus": "^2.8.6",
"vite": "^5.4.10", "vite": "^5.4.10",
"vue": "^3.2.13", "vue": "^3.2.13",
"vue-router": "^4.4.5" "vue-router": "^4.4.5",
"vue-virtual-scroller": "^1.1.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.16", "@babel/core": "^7.12.16",

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

@ -1,26 +1,27 @@
/* 给圆形定义关键帧 */ /* 给圆形定义关键帧 */
@keyframes switch { @keyframes switch {
0% { 0% {
left: calc(4px * 0.5); left: calc(4px * 0.2);
} }
60% { 60% {
left:calc(4px * 0.5); left:calc(4px * 0.2);
width: calc(112px * 0.5); width: calc(112px * 0.2);
} }
100%{ 100%{
left: calc(104px * 0.5); left: calc(104px * 0.2);
} }
} }
@keyframes reverse_switch { @keyframes reverse_switch {
0% { 0% {
left: calc(104px * 0.5); left: calc(104px * 0.2);
} }
60%{ 60%{
left: calc(74px * 0.5); left: calc(74px * 0.2);
width: calc(112px * 0.5); width: calc(112px * 0.2);
} }
100%{ 100%{
left: calc(4px * 0.5); left: calc(4px * 0.2);
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

@ -5,10 +5,12 @@ import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css' import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue' import * as ElementPlusIconsVue from '@element-plus/icons-vue'
const app = createApp(App) const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) { for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component) app.component(key, component)
} }
app.use(ElementPlus) app.use(ElementPlus)
app.use(router) app.use(router)
app.mount('#app') app.mount('#app')

@ -0,0 +1,77 @@
<template>
<div v-if="name == yours" class="card-layout-1">
<img id="card-icon-1" :src="your_icon" alt="" style="width: 50px;height:50px">
<div class="card-color-size-1">{{ content }} {{ console.log(content) }}</div>
</div>
<div v-else class="card-layout-2">
<div class="card-color-size-2">{{ content }} {{ console.log(content) }}</div>
<img id="card-icon-2" :src="my_icon" alt="" style="width: 50px;height:50px">
</div>
</template>
<script>
export default{
data(){
return{
msg: ''
}
},
props:{
yours: String,
content: String,
name: String,
your_icon: String,
my_icon: String,
},
computed:{
}
}
</script>
<style scoped>
.card-layout-1{
display: flex;
margin: 10px;
margin-left: 30px;
margin-top: 30px;
/* max-width: 70%; */
}
.card-layout-2{
display: flex;
justify-content: flex-end;
margin: 10px;
margin-right: 30px;
margin-top: 30px;
/* max-width: 70%; */
}
.card-color-size-1{
white-space: pre-line;
background-color: rgb(248, 248, 248);
margin-left: 10px;
border-radius: 10px;
border-bottom-left-radius: 0px;
padding: 10px;
}
#card-icon-1{
align-self: flex-end;
border: 2px solid #ff68b8;
border-radius: 100%;
}
#card-icon-2{
align-self: flex-end;
border: 2px solid #ff68b8;
border-radius: 100%;
}
.card-color-size-2{
white-space: pre-line;
background-color: #fcb7dc;
margin-right: 10px;
border-radius: 10px;
border-bottom-right-radius: 0px;
padding: 10px;
}
</style>

@ -16,14 +16,19 @@ export default{
}, },
mounted(){ mounted(){
// //
this.status = true this.status = this.Status
} },
props:{
Status:String,
// Status2:String
},
} }
</script> </script>
<style scoped> <style scoped>
:root{ :root{
--prpotion: 0.5; --honey-width:200px;
--honey-height:100px;
} }
input{ input{
display: none; display: none;
@ -33,8 +38,8 @@ label{
display: block; display: block;
position: relative; position: relative;
background-color:#979797; background-color:#979797;
width: calc(200px * 0.5); width: calc(200px * 0.2);
height: calc(100px * 0.5); height: calc(100px * 0.2);
border-radius: 200px; border-radius: 200px;
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
@ -44,24 +49,50 @@ label::before{
/* 圆角矩形里面的按钮 */ /* 圆角矩形里面的按钮 */
content: ''; content: '';
position: absolute; position: absolute;
width: calc(82px * 0.5); width: calc(82px * 0.2);
height: calc(82px * 0.5); height: calc(82px * 0.2);
border-radius: 50%; border-radius: 50%;
border: calc(2px * 0.5) solid #b0b0b0; border: calc(2px * 0.2) solid #b0b0b0;
background-color: white; background-color: white;
top: calc(7px * 0.5); top: calc(7px * 0.2);
left: calc(5px * 0.5); left: calc(5px * 0.2);
transition: all 1s ease-in; transition: all 1s ease-in;
animation: reverse_switch 0.35s forwards; animation: reverse_switch 0.35s forwards;
} }
input:checked + label{ #honneyBtn:checked + label{
background-color: #FE4E96; background-color: #FE4E96;
} }
input:checked +label::before{ #honneyBtn:checked + label::before{
border:calc(2px * 0.5) solid #fc5ea0; border:calc(2px * 0.2) solid #fc5ea0;
animation: switch 0.35s forwards; animation: switch 0.35s forwards;
} }
@import url('../../assets/css/chat/honneyBtn.css'); /* 给圆形定义关键帧 */
@keyframes switch {
0% {
left: calc(4px * 0.2);
}
60% {
left:calc(4px * 0.2);
width: calc(112px * 0.2);
}
100%{
left: calc(104px * 0.2);
}
}
@keyframes reverse_switch {
0% {
left: calc(104px * 0.2);
}
60%{
left: calc(74px * 0.2);
width: calc(112px * 0.2);
}
100%{
left: calc(4px * 0.2);
}
}
</style> </style>

@ -20,63 +20,141 @@
</div> </div>
</div> </div>
</div> </div>
<div class="chat-middlelayout"></div> <div class="chat-middlelayout">
<div class="chat-rightlayout"></div> <div v-for="(item,index) of getHistory" :key="index">
<ChatCard :your_icon="getFriendObject.icon" :my_icon="userInfo.icon" :name="item.name" :yours="chatWith" :content="item.content"></ChatCard>
</div>
<div class="send-msg">
<img :src="userInfo.icon" alt="" style="width: 40px;height: 40px; border-radius: 50%;">
<input id="send-msg-input" type="search" v-model="sendingMsg">
<button class="search-btn" @click="sendMsg"></button>
</div>
</div>
<div class="chat-rightlayout" v-if="chatWith != ''">
<img :src="getFriendObject.icon" alt="" style="width: 90px;height: 90px; border-radius: 50%;border: 1px solid #f85096;">
<p style="font-weight: 600; font-size: large;">{{ getFriendObject.name }}</p>
<div class="friend-information">
<img src="../../assets/pictures/chat/Location.png" alt="" style="height: 20px;">
<p>{{ getFriendObject.position }}</p>
<img src="../../assets/pictures/chat/Calendar.png" alt="" style="height: 20px;">
<p>{{ getFriendObject.birth }}</p>
</div>
<div class="chat-special-btn" style="position: relative;top: -3%;">
<div class="chat-home-tree-btn">
<button class="chat-home-page-btn" style=""></button>
<p style="color: #f85096;">他的主页</p>
</div>
<div class="chat-home-tree-btn">
<button class="chat-tree-btn"></button>
<p style="color: #a75efb;">族谱树</p>
</div>
</div>
<div style="position: relative;top: -3%; width: 60%; height: 2px; background: linear-gradient(to right, transparent, gray, transparent);opacity: 0.7;">
</div>
<div style="position: relative;top: -1%;font-size: small;">你和他已经聊了{{ beeing_friends_time }}</div>
<div class="chat-connection" style="position: relative;top: 1%;">
<img src="../../assets/pictures/chat/GuanZhu.png" style="height: 23px;">
<p style="position: relative;top: -27%;">关注他</p>
<HonneyBtn style="position: relative;top: 6%;" key="1" :Status="getFriendObject.concern_status"></HonneyBtn>
</div>
<div class="chat-connection" style="position: relative;top: -2%;">
<img src="../../assets/pictures/chat/HeiMinDan.png" style="height: 25px;">
<p style="position: relative;top: -25%;">拉黑他</p>
<HonneyBtn style="position: relative;top: 10%;" key="2" :Status="getFriendObject.black_status"></HonneyBtn>
</div>
<div style="position:relative;top: -4%;width: 60%; height: 2px; background: linear-gradient(to right, transparent, gray, transparent);opacity: 0.7;"></div>
<p style="position: relative;top: -5%;">可能感兴趣的人</p>
<div class="chat-recomend" style="position: relative;top: -5%;">
<div v-for="(item,index) of recomendList" :key="index" style="display: flex;flex-direction: column;align-items: center;">
<img :src="item.icon" alt="" style="width: 50px;height: 50px;border: 2px solid #f85096;border-radius: 50%;">
<p>{{ item.name }}</p>
</div>
</div>
</div>
</div> </div>
</template> </template>
<script> <script>
// import HonneyBtn from './HonneyBtn.vue'; // import RecycleScroller from 'vue-virtual-scroller';
import HonneyBtn from './HonneyBtn.vue';
import ChatCard from './ChatCard.vue'
export default { export default {
name: 'chatIndex', // name: 'chatIndex', //
data(){ data(){
return{ return{
searchName: '', searchName: '',
new_msg_nums: 1, new_msg_nums: 1,
chatWith:'', chatWith:'潇潇',
userInfo:{ userInfo:{
name:'我', name:'我',
icon:'@/assets/pictures/chat/UserIcon.png' icon:'/icon/abc.jpg'
}, },
beeing_friends_time: 302,
sendingMsg: '',
// //
// 使assetspublic // 使assetspublic
// iconpublic // iconpublic
// public // public
friendsInfoList: [ friendsInfoList: [
{name:'潇潇',icon:'/icon/UserIcon.png',position:'london',birth:'2004-1-1', {name:'潇潇',icon:'/icon/icon.png',position:'london',birth:'2004-1-1',concern_status:false,black_status:true,
chatHistory:[ chatHistory:[
{name:'潇潇',content:'晚上好呀',time:'2024-11-24 2:11'}, {name:'我',content:'早重中之重做做做做做做做做做做做做做做做做做做做战争之子战争之子做做做做',time:'2024-11-24 1:24'},
{name:'我',content:'你好呀',time:'2025-11-24 1:24'}, {name:'潇潇',content:'中',time:'2024-11-24 2:11'},
{name:'我',content:'晚',time:'2024-11-24 3:24'},
]}, ]},
{name:'小刚','icon':'/icon/UserIcon.png',position:'china',birth:'2003-3-4', {name:'小刚','icon':'/icon/UserIcon.png',position:'china',birth:'2003-3-4',concern_status:false,black_status:false,
chatHistory:[ chatHistory:[
{name:'小刚',content:'hhh',time:'2024-11-25 22:11'},
{name:'我',content:'you are',time:'2024-11-24 22:24'}, {name:'我',content:'you are',time:'2024-11-24 22:24'},
{name:'小刚',content:'hhh',time:'2024-11-25 22:11'},
]}, ]},
{name:'吴伟',icon:'/icon/UserIcon.png',position:'endland',birth:'2004-5-2', {name:'吴伟',icon:'/icon/icon.png',position:'endland',birth:'2004-5-2',concern_status:false,black_status:false,
chatHistory:[ chatHistory:[
{name:'吴伟',content:'iii',time:'2024-12-24 23:11'},
{name:'我',content:'早上好',time:'2024-11-24 22:25'}, {name:'我',content:'早上好',time:'2024-11-24 22:25'},
{name:'吴伟',content:'iii',time:'2024-11-24 23:11'},
]}, ]},
{name:'小闽','icon':'/icon/UserIcon.png',position:'china',birth:'2003-3-4', {name:'小闽','icon':'/icon/UserIcon.png',position:'china',birth:'2003-3-4',concern_status:false,black_status:false,
chatHistory:[ chatHistory:[
{name:'小刚',content:'hhh',time:'2024-11-25 22:11'},
{name:'我',content:'you are',time:'2024-11-24 22:24'}, {name:'我',content:'you are',time:'2024-11-24 22:24'},
{name:'小闽',content:'h',time:'2024-11-25 22:11'},
]}, ]},
], ],
showSearchList: [] showSearchList: [],
recomendList: [
{name:'Amon',icon:'/icon/bird.jpg'},
{name:'果果',icon:'/icon/icon.png'},
{name:'xixi',icon:'/icon/UserIcon.png'},
]
} }
}, },
mounted(){ mounted(){
this.showSearchList = this.friendsInfoList this.showSearchList = this.friendsInfoList
}, },
components:{ components:{
// HonneyBtn, HonneyBtn,
// RecycleScroller,
ChatCard
}, },
methods:{ methods:{
clickFriendList(index){ clickFriendList(index){
let who = this.friendsInfoList[index].name
if(this.chatWith != who){
this.sendingMsg = ''
}
this.chatWith = this.friendsInfoList[index].name this.chatWith = this.friendsInfoList[index].name
console.log(this.chatWith) console.log(this.chatWith)
},
sendMsg(){
const dayjs = require('dayjs')
const formattedTime = dayjs().format('YYYY-MM-DD HH:mm');
console.log(formattedTime)
for(let i=0;i<this.friendsInfoList.length;i++){
if(this.friendsInfoList[i].name == this.chatWith && this.sendingMsg != ''){
this.friendsInfoList[i].chatHistory.push({name:this.userInfo.name,content:this.sendingMsg,time:formattedTime})
break
}
}
this.sendingMsg = ''
} }
}, },
watch:{ watch:{
@ -138,6 +216,55 @@ export default {
console.log(time_content_list) console.log(time_content_list)
return time_content_list return time_content_list
}, },
getHistory(){
let historyChat = []
let newHistoryChat = []
if(this.chatWith != ''){
this.friendsInfoList.map((x) =>{
if(x.name == this.chatWith){
historyChat = x.chatHistory
}
})
//40
newHistoryChat = historyChat.map((y)=>{
let new_content = y.content
let sizeof_length = 0
for(let i=0;i<new_content.length;i++){
let charCode = new_content.charCodeAt(i)
// console.log(charCode)
if(charCode >=0 && charCode <=128 && charCode != '\n'){
sizeof_length += 1
}else{
sizeof_length += 2
}
// console.log(sizeof_length)
if(sizeof_length % 40 == 0){
new_content = new_content.slice(0,i) + '\n' + new_content.slice(i)
}
}
console.log(new_content)
return new_content
})
// console.log(newHistoryChat)
}
newHistoryChat.map((z,index)=>{
historyChat[index].content = z
})
// console.log(historyChat)
return historyChat
},
getFriendObject(){
let FriendObject = {}
if(this.chatWith != ''){
this.friendsInfoList.map((x) =>{
if(x.name == this.chatWith){
FriendObject = x
}
})
}
console.log(FriendObject)
return FriendObject
},
} }
} }
</script> </script>
@ -147,8 +274,10 @@ export default {
.chat-totallayout{ .chat-totallayout{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
height: 600px; height: 85%;
width: 100%; width: 100%;
/* flex-grow: 0;
flex-shrink: 0; */
/* background-color: aqua; */ /* background-color: aqua; */
} }
.chat-leftlayout{ .chat-leftlayout{
@ -159,18 +288,22 @@ export default {
flex-direction: column; flex-direction: column;
} }
.chat-middlelayout{ .chat-middlelayout{
background-color: yellow; background: linear-gradient(to top, #fff9a1 65%, #fcdcd7);
width: 55%; width: 55%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative;
} }
.chat-rightlayout{ .chat-rightlayout{
background-color: red; /* background-color: red; */
position: relative;
width: 20%; width: 20%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center;
margin-top: 3%;
} }
/**************整体布局***************/ /**************整体布局***************/
/*************左边************** *****/ /*************左边************** *****/
@ -246,6 +379,9 @@ export default {
.chat-friends:hover{ .chat-friends:hover{
background-color: #fff2f9; background-color: #fff2f9;
} }
.chat-friends:active{
background-color: #fcb8dd;
}
.chat-friend-text{ .chat-friend-text{
position: relative; position: relative;
width: 60%; width: 60%;
@ -276,4 +412,92 @@ export default {
color: gray; color: gray;
/* background-color: #fdadd8; */ /* background-color: #fdadd8; */
} }
/*****************中间****************** */
.send-msg{
align-self: center;
justify-self: flex-end;
display: flex;
position: absolute;
bottom: 5%;
width: 80%;
}
#send-msg-input{
outline: none;
border: 1px solid #E44B9D;
border-radius: 10px;
width: 90%;
margin: 5px;
}
.search-btn{
background-image: url("@/assets/pictures/chat/SendBtn.png");
background-size: 100% 100%;
width: 40px;
height: 40px;
border: none;
overflow: hidden;
border-radius: 10px;
}
.search-btn:active{
background-image: url("@/assets/pictures/chat/SendBtn.png");
background-size: 100% 100%;
width: 40px;
height: 40px;
border: none;
overflow: hidden;
border-radius: 10px;
background-color: #a75efb;
}
/*****************右边***************************/
.friend-information{
width: 75%;
display: flex;
justify-content: space-around;
color: gray;
position: relative;
top: 0%;
}
.friend-information p{
position: relative;
top: -31%;
}
.chat-special-btn{
display: flex;
justify-content: space-around;
width: 85%;
height: 20%;
}
.chat-home-tree-btn{
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: center;
}
.chat-home-page-btn{
background-color: #f85096;
background-image: url('../../assets/pictures/chat/portrait.png');
background-size: 60% 60%;
background-position: center center;
background-repeat: no-repeat;
height: 60px;width: 60px; border: none; border-radius: 50%;
}
.chat-tree-btn{
background-color: #a75efb;
background-image: url('../../assets/pictures/chat/tree.png');
background-size: 60% 60%;
background-position: center center;
background-repeat: no-repeat;
height: 60px;width: 60px; border: none; border-radius: 50%;
}
.chat-connection{
display: flex;
width: 62%;
justify-content: space-around;
}
.chat-recomend{
display: flex;
flex-direction: row;
justify-content: space-around;
width: 90%;
}
</style> </style>
Loading…
Cancel
Save