main
DESKTOP-CJ7MIKJ\Maos 2 years ago
commit def24dff27

@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead

23
.gitignore vendored

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

@ -0,0 +1,19 @@
# chathome
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>666</title>
<style type="text/css">
.div1{
width: 500px;
height: 300px;
overflow-y: scroll;
margin: auto;
border: 1px solid red;
}
.div2{
width: 200px;
height: 50px;
border: 1px solid red;
}
</style>
</head>
<body>
<div class="div1">
666
</div>
<button type="button" id="btn">添加</button>
<script type="text/javascript">
var div1 = document.querySelector('.div1');
var btn = document.querySelector('#btn');
btn.addEventListener('click',function(){
console.log('66')
var k = div1.innerHTML;
div1.innerHTML = k+"<br/>66";
div1.scrollTop = div1.scrollHeight;
})
</script>
</body>
</html>

@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}

17274
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,25 @@
{
"name": "chathome",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"axios": "^1.3.1",
"core-js": "^3.8.3",
"element-ui": "^2.15.12",
"mockjs": "^1.1.0",
"sass": "^1.56.2",
"sass-loader": "^13.2.0",
"vue": "^2.6.14",
"vue-router": "^3.6.5"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"babel-plugin-component": "^1.1.1",
"vue-template-compiler": "^2.6.14"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<style>
body {
margin: 0;
}
</style>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

@ -0,0 +1,40 @@
<template>
<div id="app">
<Home></Home>
</div>
</template>
<script>
import Home from './view/home.vue'
export default {
name: 'App',
components: {
Home
}
}
</script>
<style lang="scss">
@import url(./assets/font/iconfont.css);
.iconfont {
font-family: "iconfont" !important;
font-style: normal;
font-size: 25px;
vertical-align: middle;
color: rgb(117,120,137);
transition: .3s;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
* {
padding: 0;
margin: 0;
}
#app {
width: 100vw;
height: 100vh;
background-color: rgb(151,157,167);
}
</style>

@ -0,0 +1,21 @@
import base from './index'
let axios = base.axios
let baseUrl = base.baseUrl
// 获取好友
export const getFriend = params => {
return axios({
method: 'post',
baseURL: `${baseUrl}/friend/friendList`,
data: params
}).then(res => res.data)
}
// 获取聊天信息
export const getChatMsg = params => {
return axios({
method: 'post',
baseURL: `${baseUrl}/friend/chatMsg`,
data: params
}).then(res => res.data)
}

@ -0,0 +1,36 @@
import axios from 'axios'
//全局参数,自定义参数可在发送请求时设置
axios.defaults.timeout = 300000000 //超时时间ms
axios.defaults.withCredentials = true
// 请求时的拦截
//回调里面不能获取错误信息
axios.interceptors.request.use(
function (config) {
return config;
},
function (error) {
// 当请求异常时做一些处理
console.log('请求异常:' + JSON.stringify(error));
return Promise.reject(error);
}
);
axios.interceptors.response.use(function (response) {
// Do something with response data
return response
}, function (error) {
// Do something with response error
console.log('响应出错:' + error)
return Promise.reject(error)
})
const base = {
axios: axios,
baseUrl: 'http://localhost:8080'
}
export default base

@ -0,0 +1,539 @@
/* Logo 字体 */
@font-face {
font-family: "iconfont logo";
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834');
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') format('embedded-opentype'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg');
}
.logo {
font-family: "iconfont logo";
font-size: 160px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* tabs */
.nav-tabs {
position: relative;
}
.nav-tabs .nav-more {
position: absolute;
right: 0;
bottom: 0;
height: 42px;
line-height: 42px;
color: #666;
}
#tabs {
border-bottom: 1px solid #eee;
}
#tabs li {
cursor: pointer;
width: 100px;
height: 40px;
line-height: 40px;
text-align: center;
font-size: 16px;
border-bottom: 2px solid transparent;
position: relative;
z-index: 1;
margin-bottom: -1px;
color: #666;
}
#tabs .active {
border-bottom-color: #f00;
color: #222;
}
.tab-container .content {
display: none;
}
/* 页面布局 */
.main {
padding: 30px 100px;
width: 960px;
margin: 0 auto;
}
.main .logo {
color: #333;
text-align: left;
margin-bottom: 30px;
line-height: 1;
height: 110px;
margin-top: -50px;
overflow: hidden;
*zoom: 1;
}
.main .logo a {
font-size: 160px;
color: #333;
}
.helps {
margin-top: 40px;
}
.helps pre {
padding: 20px;
margin: 10px 0;
border: solid 1px #e7e1cd;
background-color: #fffdef;
overflow: auto;
}
.icon_lists {
width: 100% !important;
overflow: hidden;
*zoom: 1;
}
.icon_lists li {
width: 100px;
margin-bottom: 10px;
margin-right: 20px;
text-align: center;
list-style: none !important;
cursor: default;
}
.icon_lists li .code-name {
line-height: 1.2;
}
.icon_lists .icon {
display: block;
height: 100px;
line-height: 100px;
font-size: 42px;
margin: 10px auto;
color: #333;
-webkit-transition: font-size 0.25s linear, width 0.25s linear;
-moz-transition: font-size 0.25s linear, width 0.25s linear;
transition: font-size 0.25s linear, width 0.25s linear;
}
.icon_lists .icon:hover {
font-size: 100px;
}
.icon_lists .svg-icon {
/* 通过设置 font-size 来改变图标大小 */
width: 1em;
/* 图标和文字相邻时,垂直对齐 */
vertical-align: -0.15em;
/* 通过设置 color 来改变 SVG 的颜色/fill */
fill: currentColor;
/* path stroke viewBox IE
normalize.css */
overflow: hidden;
}
.icon_lists li .name,
.icon_lists li .code-name {
color: #666;
}
/* markdown 样式 */
.markdown {
color: #666;
font-size: 14px;
line-height: 1.8;
}
.highlight {
line-height: 1.5;
}
.markdown img {
vertical-align: middle;
max-width: 100%;
}
.markdown h1 {
color: #404040;
font-weight: 500;
line-height: 40px;
margin-bottom: 24px;
}
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
color: #404040;
margin: 1.6em 0 0.6em 0;
font-weight: 500;
clear: both;
}
.markdown h1 {
font-size: 28px;
}
.markdown h2 {
font-size: 22px;
}
.markdown h3 {
font-size: 16px;
}
.markdown h4 {
font-size: 14px;
}
.markdown h5 {
font-size: 12px;
}
.markdown h6 {
font-size: 12px;
}
.markdown hr {
height: 1px;
border: 0;
background: #e9e9e9;
margin: 16px 0;
clear: both;
}
.markdown p {
margin: 1em 0;
}
.markdown>p,
.markdown>blockquote,
.markdown>.highlight,
.markdown>ol,
.markdown>ul {
width: 80%;
}
.markdown ul>li {
list-style: circle;
}
.markdown>ul li,
.markdown blockquote ul>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown>ul li p,
.markdown>ol li p {
margin: 0.6em 0;
}
.markdown ol>li {
list-style: decimal;
}
.markdown>ol li,
.markdown blockquote ol>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown code {
margin: 0 3px;
padding: 0 5px;
background: #eee;
border-radius: 3px;
}
.markdown strong,
.markdown b {
font-weight: 600;
}
.markdown>table {
border-collapse: collapse;
border-spacing: 0px;
empty-cells: show;
border: 1px solid #e9e9e9;
width: 95%;
margin-bottom: 24px;
}
.markdown>table th {
white-space: nowrap;
color: #333;
font-weight: 600;
}
.markdown>table th,
.markdown>table td {
border: 1px solid #e9e9e9;
padding: 8px 16px;
text-align: left;
}
.markdown>table th {
background: #F7F7F7;
}
.markdown blockquote {
font-size: 90%;
color: #999;
border-left: 4px solid #e9e9e9;
padding-left: 0.8em;
margin: 1em 0;
}
.markdown blockquote p {
margin: 0;
}
.markdown .anchor {
opacity: 0;
transition: opacity 0.3s ease;
margin-left: 8px;
}
.markdown .waiting {
color: #ccc;
}
.markdown h1:hover .anchor,
.markdown h2:hover .anchor,
.markdown h3:hover .anchor,
.markdown h4:hover .anchor,
.markdown h5:hover .anchor,
.markdown h6:hover .anchor {
opacity: 1;
display: inline-block;
}
.markdown>br,
.markdown>p>br {
clear: both;
}
.hljs {
display: block;
background: white;
padding: 0.5em;
color: #333333;
overflow-x: auto;
}
.hljs-comment,
.hljs-meta {
color: #969896;
}
.hljs-string,
.hljs-variable,
.hljs-template-variable,
.hljs-strong,
.hljs-emphasis,
.hljs-quote {
color: #df5000;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-type {
color: #a71d5d;
}
.hljs-literal,
.hljs-symbol,
.hljs-bullet,
.hljs-attribute {
color: #0086b3;
}
.hljs-section,
.hljs-name {
color: #63a35c;
}
.hljs-tag {
color: #333333;
}
.hljs-title,
.hljs-attr,
.hljs-selector-id,
.hljs-selector-class,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #795da3;
}
.hljs-addition {
color: #55a532;
background-color: #eaffea;
}
.hljs-deletion {
color: #bd2c00;
background-color: #ffecec;
}
.hljs-link {
text-decoration: underline;
}
/* 代码高亮 */
/* PrismJS 1.15.0
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript */
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
* @author Lea Verou
*/
code[class*="language-"],
pre[class*="language-"] {
color: black;
background: none;
text-shadow: 0 1px white;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"]::-moz-selection,
pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection,
code[class*="language-"] ::-moz-selection {
text-shadow: none;
background: #b3d4fc;
}
pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
text-shadow: none;
background: #b3d4fc;
}
@media print {
code[class*="language-"],
pre[class*="language-"] {
text-shadow: none;
}
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
}
:not(pre)>code[class*="language-"],
pre[class*="language-"] {
background: #f5f2f0;
}
/* Inline code */
:not(pre)>code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: slategray;
}
.token.punctuation {
color: #999;
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #905;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #690;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #9a6e3a;
background: hsla(0, 0%, 100%, .5);
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.function,
.token.class-name {
color: #DD4A68;
}
.token.regex,
.token.important,
.token.variable {
color: #e90;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}

@ -0,0 +1,395 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>iconfont Demo</title>
<link rel="shortcut icon" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg" type="image/x-icon"/>
<link rel="icon" type="image/svg+xml" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg"/>
<link rel="stylesheet" href="https://g.alicdn.com/thx/cube/1.3.2/cube.min.css">
<link rel="stylesheet" href="demo.css">
<link rel="stylesheet" href="iconfont.css">
<script src="iconfont.js"></script>
<!-- jQuery -->
<script src="https://a1.alicdn.com/oss/uploads/2018/12/26/7bfddb60-08e8-11e9-9b04-53e73bb6408b.js"></script>
<!-- 代码高亮 -->
<script src="https://a1.alicdn.com/oss/uploads/2018/12/26/a3f714d0-08e6-11e9-8a15-ebf944d7534c.js"></script>
<style>
.main .logo {
margin-top: 0;
height: auto;
}
.main .logo a {
display: flex;
align-items: center;
}
.main .logo .sub-title {
margin-left: 0.5em;
font-size: 22px;
color: #fff;
background: linear-gradient(-45deg, #3967FF, #B500FE);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
</style>
</head>
<body>
<div class="main">
<h1 class="logo"><a href="https://www.iconfont.cn/" title="iconfont 首页" target="_blank">
<img width="200" src="https://img.alicdn.com/imgextra/i3/O1CN01Mn65HV1FfSEzR6DKv_!!6000000000514-55-tps-228-59.svg">
</a></h1>
<div class="nav-tabs">
<ul id="tabs" class="dib-box">
<li class="dib active"><span>Unicode</span></li>
<li class="dib"><span>Font class</span></li>
<li class="dib"><span>Symbol</span></li>
</ul>
<a href="https://www.iconfont.cn/manage/index?manage_type=myprojects&projectId=3829178" target="_blank" class="nav-more">查看项目</a>
</div>
<div class="tab-container">
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe646;</span>
<div class="name">snapchat</div>
<div class="code-name">&amp;#xe646;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe62e;</span>
<div class="name">文件</div>
<div class="code-name">&amp;#xe62e;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe96c;</span>
<div class="name">24gf-telephone</div>
<div class="code-name">&amp;#xe96c;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe610;</span>
<div class="name">图片</div>
<div class="code-name">&amp;#xe610;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe600;</span>
<div class="name">视频</div>
<div class="code-name">&amp;#xe600;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe601;</span>
<div class="name"></div>
<div class="code-name">&amp;#xe601;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe8b8;</span>
<div class="name">205设置</div>
<div class="code-name">&amp;#xe8b8;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe607;</span>
<div class="name">message</div>
<div class="code-name">&amp;#xe607;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe61b;</span>
<div class="name">闪电</div>
<div class="code-name">&amp;#xe61b;</div>
</li>
</ul>
<div class="article markdown">
<h2 id="unicode-">Unicode 引用</h2>
<hr>
<p>Unicode 是字体在网页端最原始的应用方式,特点是:</p>
<ul>
<li>支持按字体的方式去动态调整图标大小,颜色等等。</li>
<li>默认情况下不支持多色,直接添加多色图标会自动去色。</li>
</ul>
<blockquote>
<p>注意:新版 iconfont 支持两种方式引用多色图标SVG symbol 引用方式和彩色字体图标模式。(使用彩色字体图标需要在「编辑项目」中开启「彩色」选项后并重新生成。)</p>
</blockquote>
<p>Unicode 使用步骤如下:</p>
<h3 id="-font-face">第一步:拷贝项目下面生成的 <code>@font-face</code></h3>
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.woff2?t=1675406501520') format('woff2'),
url('iconfont.woff?t=1675406501520') format('woff'),
url('iconfont.ttf?t=1675406501520') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
<pre><code class="language-css"
>.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面</h3>
<pre>
<code class="language-html"
>&lt;span class="iconfont"&gt;&amp;#x33;&lt;/span&gt;
</code></pre>
<blockquote>
<p>"iconfont" 是你项目下的 font-family。可以通过编辑项目查看默认是 "iconfont"。</p>
</blockquote>
</div>
</div>
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-snapchat"></span>
<div class="name">
snapchat
</div>
<div class="code-name">.icon-snapchat
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-wenjian"></span>
<div class="name">
文件
</div>
<div class="code-name">.icon-wenjian
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-gf-telephone"></span>
<div class="name">
24gf-telephone
</div>
<div class="code-name">.icon-gf-telephone
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-tupian"></span>
<div class="name">
图片
</div>
<div class="code-name">.icon-tupian
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-shipin"></span>
<div class="name">
视频
</div>
<div class="code-name">.icon-shipin
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-shu"></span>
<div class="name">
</div>
<div class="code-name">.icon-shu
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-shezhi"></span>
<div class="name">
205设置
</div>
<div class="code-name">.icon-shezhi
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-xinxi"></span>
<div class="name">
message
</div>
<div class="code-name">.icon-xinxi
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-shandian"></span>
<div class="name">
闪电
</div>
<div class="code-name">.icon-shandian
</div>
</li>
</ul>
<div class="article markdown">
<h2 id="font-class-">font-class 引用</h2>
<hr>
<p>font-class 是 Unicode 使用方式的一种变种,主要是解决 Unicode 书写不直观,语意不明确的问题。</p>
<p>与 Unicode 使用方式相比,具有如下特点:</p>
<ul>
<li>相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。</li>
<li>因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-fontclass-">第一步:引入项目下面生成的 fontclass 代码:</h3>
<pre><code class="language-html">&lt;link rel="stylesheet" href="./iconfont.css"&gt;
</code></pre>
<h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="language-html">&lt;span class="iconfont icon-xxx"&gt;&lt;/span&gt;
</code></pre>
<blockquote>
<p>"
iconfont" 是你项目下的 font-family。可以通过编辑项目查看默认是 "iconfont"。</p>
</blockquote>
</div>
</div>
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-snapchat"></use>
</svg>
<div class="name">snapchat</div>
<div class="code-name">#icon-snapchat</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-wenjian"></use>
</svg>
<div class="name">文件</div>
<div class="code-name">#icon-wenjian</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-gf-telephone"></use>
</svg>
<div class="name">24gf-telephone</div>
<div class="code-name">#icon-gf-telephone</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-tupian"></use>
</svg>
<div class="name">图片</div>
<div class="code-name">#icon-tupian</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-shipin"></use>
</svg>
<div class="name">视频</div>
<div class="code-name">#icon-shipin</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-shu"></use>
</svg>
<div class="name"></div>
<div class="code-name">#icon-shu</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-shezhi"></use>
</svg>
<div class="name">205设置</div>
<div class="code-name">#icon-shezhi</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-xinxi"></use>
</svg>
<div class="name">message</div>
<div class="code-name">#icon-xinxi</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-shandian"></use>
</svg>
<div class="name">闪电</div>
<div class="code-name">#icon-shandian</div>
</li>
</ul>
<div class="article markdown">
<h2 id="symbol-">Symbol 引用</h2>
<hr>
<p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
这种用法其实是做了一个 SVG 的集合,与另外两种相比具有如下特点:</p>
<ul>
<li>支持多色图标了,不再受单色限制。</li>
<li>通过一些技巧,支持像字体那样,通过 <code>font-size</code>, <code>color</code> 来调整样式。</li>
<li>兼容性较差,支持 IE9+,及现代浏览器。</li>
<li>浏览器渲染 SVG 的性能一般,还不如 png。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-symbol-">第一步:引入项目下面生成的 symbol 代码:</h3>
<pre><code class="language-html">&lt;script src="./iconfont.js"&gt;&lt;/script&gt;
</code></pre>
<h3 id="-css-">第二步:加入通用 CSS 代码(引入一次就行):</h3>
<pre><code class="language-html">&lt;style&gt;
.icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
&lt;/style&gt;
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="language-html">&lt;svg class="icon" aria-hidden="true"&gt;
&lt;use xlink:href="#icon-xxx"&gt;&lt;/use&gt;
&lt;/svg&gt;
</code></pre>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$('.tab-container .content:first').show()
$('#tabs li').click(function (e) {
var tabContent = $('.tab-container .content')
var index = $(this).index()
if ($(this).hasClass('active')) {
return
} else {
$('#tabs li').removeClass('active')
$(this).addClass('active')
tabContent.hide().eq(index).fadeIn()
}
})
})
</script>
</body>
</html>

@ -0,0 +1,51 @@
@font-face {
font-family: "iconfont"; /* Project id 3829178 */
src: url('iconfont.woff2?t=1675406501520') format('woff2'),
url('iconfont.woff?t=1675406501520') format('woff'),
url('iconfont.ttf?t=1675406501520') format('truetype');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-snapchat:before {
content: "\e646";
}
.icon-wenjian:before {
content: "\e62e";
}
.icon-gf-telephone:before {
content: "\e96c";
}
.icon-tupian:before {
content: "\e610";
}
.icon-shipin:before {
content: "\e600";
}
.icon-shu:before {
content: "\e601";
}
.icon-shezhi:before {
content: "\e8b8";
}
.icon-xinxi:before {
content: "\e607";
}
.icon-shandian:before {
content: "\e61b";
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,72 @@
{
"id": "3829178",
"name": "chat",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "1080596",
"name": "snapchat",
"font_class": "snapchat",
"unicode": "e646",
"unicode_decimal": 58950
},
{
"icon_id": "6714382",
"name": "文件",
"font_class": "wenjian",
"unicode": "e62e",
"unicode_decimal": 58926
},
{
"icon_id": "7568886",
"name": "24gf-telephone",
"font_class": "gf-telephone",
"unicode": "e96c",
"unicode_decimal": 59756
},
{
"icon_id": "12382329",
"name": "图片",
"font_class": "tupian",
"unicode": "e610",
"unicode_decimal": 58896
},
{
"icon_id": "1283",
"name": "视频",
"font_class": "shipin",
"unicode": "e600",
"unicode_decimal": 58880
},
{
"icon_id": "1412",
"name": "树",
"font_class": "shu",
"unicode": "e601",
"unicode_decimal": 58881
},
{
"icon_id": "1727422",
"name": "205设置",
"font_class": "shezhi",
"unicode": "e8b8",
"unicode_decimal": 59576
},
{
"icon_id": "5744743",
"name": "message",
"font_class": "xinxi",
"unicode": "e607",
"unicode_decimal": 58887
},
{
"icon_id": "15391349",
"name": "闪电",
"font_class": "shandian",
"unicode": "e61b",
"unicode_decimal": 58907
}
]
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

@ -0,0 +1,157 @@
<template>
<div class="emoji-content">
<div class="emoji">
<div class="emoji-wrapper">
<ul class="emoji-list">
<li
class="emoji-item"
v-for="(item, index) in emojiList"
:key="index"
@click="sendEmoji(item)"
>
<img :src="item" alt="" />
</li>
</ul>
</div>
</div>
<div class="mask" @click="closeEmoji"></div>
</div>
</template>
<script>
export default {
data() {
return {
emojiList: [
require("@/assets/img/emoji/slightly-smiling-face.png"),
require("@/assets/img/emoji/smiling-face.png"),
require("@/assets/img/emoji/smiling-face-with-heart-eyes.png"),
require("@/assets/img/emoji/smiling-face-with-sunglasses.png"),
require("@/assets/img/emoji/thinking-face.png"),
require("@/assets/img/emoji/tired-face.png"),
require("@/assets/img/emoji/money-mouth-face.png"),
require("@/assets/img/emoji/loudly-crying-face.png"),
require("@/assets/img/emoji/pouting-face.png"),
require("@/assets/img/emoji/face-screaming-in-fear.png"),
require("@/assets/img/emoji/face-vomiting.png"),
require("@/assets/img/emoji/face-without-mouth.png"),
require("@/assets/img/emoji/face-with-tongue.png"),
require("@/assets/img/emoji/clown-face.png"),
require("@/assets/img/emoji/new-moon-face.png"),
require("@/assets/img/emoji/ghost.png"),
require("@/assets/img/emoji/jack-o-lantern.png"),
require("@/assets/img/emoji/money-bag.png"),
require("@/assets/img/emoji/pile-of-poo.png"),
require("@/assets/img/emoji/shamrock.png"),
require("@/assets/img/emoji/hibiscus.png"),
require("@/assets/img/emoji/lips.png"),
require("@/assets/img/emoji/sparkles.png"),
require("@/assets/img/emoji/star.png"),
require("@/assets/img/emoji/two-hearts.png"),
require("@/assets/img/emoji/rainbow.png"),
require("@/assets/img/emoji/thought-balloon.png"),
],
};
},
methods: {
sendEmoji(item) {
this.$emit("sendEmoji", item);
},
closeEmoji() {
this.$emit("closeEmoji");
}
},
};
</script>
<style lang="scss" scoped>
.emoji-content {
.emoji {
width: 400px;
height: 200px;
background-color: rgb(39, 42, 55);
position: absolute;
top: -220px;
left: -10px;
border-radius: 10px;
transition: 0.3s;
z-index: 3;
&::after {
content: "";
display: block;
width: 0;
height: 0;
border-top: 10px solid rgb(39, 42, 55);
border-right: 10px solid transparent;
border-left: 10px solid transparent;
position: absolute;
bottom: -8px;
left: 15px;
z-index: 100;
}
.emoji-wrapper {
width: 100%;
height: 100%;
overflow-y: scroll;
padding: 10px;
box-sizing: border-box;
position: relative;
&::-webkit-scrollbar {
/*滚动条整体样式*/
width: 4px; /*高宽分别对应横竖滚动条的尺寸*/
height: 1px;
}
&::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
border-radius: 10px;
box-shadow: inset 0 0 5px rgba(97, 184, 179, 0.1);
background: rgb(95, 101, 122);
}
&::-webkit-scrollbar-track {
/*滚动条里面轨道*/
box-shadow: inset 0 0 5px rgba(87, 175, 187, 0.1);
border-radius: 10px;
background: rgb(39, 42, 55);
}
.emoji-list {
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
margin-left: 10px;
.emoji-item {
list-style: none;
width: 50px;
height: 50px;
border-radius: 10px;
margin: 5px;
position: relative;
cursor: pointer;
&:hover {
background-color: rgb(50, 54, 68);
}
img {
width: 35px;
height: 35px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
}
}
}
}
.mask {
width: 100%;
height: 100%;
position: fixed;
background: transparent;
left: 0;
top: 0;
z-index: 1;
}
}
</style>

@ -0,0 +1,81 @@
<template>
<div class="file-card">
<img src="@/assets/img/fileImg/unknowfile.png" alt="" v-if="fileType == 0"/>
<img src="@/assets/img/fileImg/word.png" alt="" v-else-if="fileType == 1"/>
<img src="@/assets/img/fileImg/excel.png" alt="" v-else-if="fileType == 2"/>
<img src="@/assets/img/fileImg/ppt.png" alt="" v-else-if="fileType == 3"/>
<img src="@/assets/img/fileImg/pdf.png" alt="" v-else-if="fileType == 4"/>
<img src="@/assets/img/fileImg/zpi.png" alt="" v-else-if="fileType == 5"/>
<img src="@/assets/img/fileImg/txt.png" alt="" v-else/>
<div class="word">
<span
>{{file.name || '未知'}}</span
>
<span>154kb</span>
</div>
</div>
</template>
<script>
export default {
// props: ["fileType", "file"],
props: {
fileType: Number,
file: File,
default() {
return {};
},
},
watch: {
file() {
console.log(this.file);
},
},
mounted() {
console.log(this.file);
console.log(this.fileType);
}
};
</script>
<style lang="scss" scoped>
.file-card {
width: 250px;
height: 100px;
background-color: rgb(45, 48, 63);
border-radius: 20px;
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
box-sizing: border-box;
cursor: pointer;
&:hover {
background-color: rgb(33, 36, 54);
}
img {
width: 60px;
height: 60px;
}
.word {
width: 60%;
margin-left: 10px;
overflow: hidden;
span {
width: 90%;
display: inline-block;
color: #fff;
}
span:first-child {
font-size: 14px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
span:last-child {
font-size: 12px;
color: rgb(180, 180, 180);
}
}
}
</style>

@ -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,128 @@
<template>
<div class="nav">
<div class="nav-menu-wrapper">
<ul class="menu-list">
<li
v-for="(item, index) in menuList"
:key="index"
:class="{ activeNav: index == current }"
@click="changeMenu(index)"
>
<div class="block"></div>
<span class="iconfont" :class="item"></span>
</li>
</ul>
</div>
<div class="own-pic">
<HeadPortrait :imgUrl="imgUrl"></HeadPortrait>
</div>
</div>
</template>
<script>
import HeadPortrait from "./HeadPortrait.vue";
export default {
components: {
HeadPortrait,
},
data() {
return {
menuList: [
"icon-xinxi",
"icon-shipin",
"icon-shu",
"icon-shandian",
"icon-shezhi",
],
current: 0,
imgUrl: require('@/assets/img/head_portrait.jpg')
};
},
methods: {
changeMenu(index) {
switch (index) {
case 0:
this.$router.push({
name: "ChatHome",
}, () => {});
break;
case 1:
this.$message("该功能还没有开发哦,敬请期待一下吧~🥳");
break;
case 2:
this.$message("该功能还没有开发哦,敬请期待一下吧~🥳");
break;
case 3:
this.$message("该功能还没有开发哦,敬请期待一下吧~🥳");
break;
case 4:
this.$message("该功能还没有开发哦,敬请期待一下吧~🥳");
break;
default:
this.$router.push({
name: "ChatHome",
});
}
this.current = index;
},
},
};
</script>
<style lang="scss" scoped>
.nav {
width: 100%;
height: 90vh;
position: relative;
border-radius: 20px 0 0 20px;
.nav-menu-wrapper {
position: absolute;
top: 40%;
transform: translate(0, -50%);
.menu-list {
margin-left: 10px;
li {
margin: 40px 0 0 30px;
list-style: none;
cursor: pointer;
position: relative;
.block {
background-color: rgb(29, 144, 245);
position: absolute;
left: -40px;
width: 6px;
height: 25px;
transition: 0.5s;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
opacity: 0;
}
&:hover {
span {
color: rgb(29, 144, 245);
}
.block {
opacity: 1;
}
}
}
}
}
.own-pic {
position: absolute;
bottom: 10%;
margin-left: 25px;
}
}
.activeNav {
span {
color: rgb(29, 144, 245);
}
.block {
opacity: 1 !important;
}
}
</style>

@ -0,0 +1,110 @@
<template>
<div class="person-card" :class="{ activeCard: personInfo.id == current }">
<div class="info">
<HeadPortrait :imgUrl="personInfo.headImg"></HeadPortrait>
<div class="info-detail">
<div class="name">{{ personInfo.name }}</div>
<div class="detail">{{ personInfo.lastMsg }}</div>
</div>
</div>
</div>
</template>
<script>
import HeadPortrait from "./HeadPortrait.vue";
export default {
props: {
personInfo: {
default: {
},
},
pcCurrent: {
default: ''
}
},
components: {
HeadPortrait,
},
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,16 @@
import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui';
import VueRouter from 'vue-router'
import 'element-ui/lib/theme-chalk/index.css';
import router from './router/index'
import "./mock/index.js"
Vue.use(VueRouter)
Vue.config.productionTip = false
Vue.use(ElementUI);
new Vue({
router,
render: h => h(App),
}).$mount('#app')

@ -0,0 +1,206 @@
const Mock = require("mockjs");
Mock.mock(/friend\/friendList/, 'post', () => { //三个参数。第一个路径第二个请求方式post/get第三个回调返回值
return friendList
})
Mock.mock(/friend\/chatMsg/, 'post', (config) => { //三个参数。第一个路径第二个请求方式post/get第三个回调返回值
let params = JSON.parse(config.body)
if (params.frinedId == "1002")
return chatMsg1002
if (params.frinedId == "1003")
return chatMsg1003
if (params.frinedId == "1004")
return chatMsg1004
})
let friendList = Mock.mock(
[
{
img: "",
name: "大毛",
detail: "我是大毛",
lastMsg: "to do",
id: "1002",
headImg: require("@/assets/img/head_portrait1.jpg"),
},
{
img: "",
name: "小毛",
detail: "我是小毛",
lastMsg: "dada dw ertgthy j uy",
id: "1003",
headImg: require("@/assets/img/head_portrait2.jpg"),
},
{
img: "",
name: "小王",
detail: "我是小王",
lastMsg: "大萨达萨达所大大萨达",
id: "1004",
headImg: require("@/assets/img/head_portrait3.jpg"),
},
]
)
let chatMsg1002 = Mock.mock(
[
{
headImg: require("@/assets/img/head_portrait.jpg"),
name: "大毛是小白",
time: "0912 AM",
msg: " Same here! Been working project for the past 5 hours despite ofhaving so much to do",
chatType: 0, //信息类型0文字1图片
uid: "1001", //uid
},
{
headImg: require("@/assets/img/head_portrait.jpg"),
name: "大毛是小白",
time: "0912 AM",
msg: require("@/assets/img/emoji/slightly-smiling-face.png"),
chatType: 1, //信息类型0文字1图片
extend: {
imgType: 1, //(1表情2本地图片)
},
uid: "1001",
},
{
headImg: require("@/assets/img/head_portrait1.jpg"),
name: "大毛",
time: "0912 AM",
msg: " Same here! Been working project for the past 5 hours despite ofhaving so much to do",
chatType: 0, //信息类型0文字1图片
uid: "1002", //uid
},
{
headImg: require("@/assets/img/head_portrait.jpg"),
name: "大毛是小白",
time: "0912 AM",
msg: "Same here! Been working project for the past 5 hours despite ofhaving so much to do",
chatType: 0, //信息类型0文字1图片, 2文件
uid: "1001",
},
{
headImg: require("@/assets/img/head_portrait1.jpg"),
name: "大毛",
time: "0912 AM",
msg: "to do",
chatType: 0, //信息类型0文字1图片
uid: "1002", //uid
},
]
)
let chatMsg1003 = Mock.mock(
[
{
headImg: require("@/assets/img/head_portrait.jpg"),
name: "大毛是小白",
time: "0912 AM",
msg: " 的武器的物权法润滑油它具有就该回家该方法回复观后感防护服哈和规范化发同意头发o",
chatType: 0, //信息类型0文字1图片
uid: "1001", //uid
},
{
headImg: require("@/assets/img/head_portrait.jpg"),
name: "大毛是小白",
time: "0912 AM",
msg: require("@/assets/img/emoji/slightly-smiling-face.png"),
chatType: 1, //信息类型0文字1图片
extend: {
imgType: 1, //(1表情2本地图片)
},
uid: "1001",
},
{
headImg: require("@/assets/img/head_portrait2.jpg"),
name: "小毛",
time: "0912 AM",
msg: " 萨达萨达哇大所多谁打我的是否如果突然核桃油还要加㔿fhaving so much to do",
chatType: 0, //信息类型0文字1图片
uid: "1002", //uid
},
{
headImg: require("@/assets/img/head_portrait.jpg"),
name: "大毛是小白",
time: "0912 AM",
msg: "盒饭光和热挺好的返回给都发给顿肉肉人工费大概人刮大风个的个",
chatType: 0, //信息类型0文字1图片, 2文件
uid: "1001",
},
{
headImg: require("@/assets/img/head_portrait2.jpg"),
name: "小毛",
time: "0912 AM",
msg: "frfrgrgtreg gt g fdg dfg drrg f d",
chatType: 0, //信息类型0文字1图片
uid: "1002", //uid
},
{
headImg: require("@/assets/img/head_portrait2.jpg"),
name: "小毛",
time: "0912 AM",
msg: "qwewqewrr hy jy ju juyj ",
chatType: 0, //信息类型0文字1图片
uid: "1002", //uid
},
{
headImg: require("@/assets/img/head_portrait2.jpg"),
name: "小毛",
time: "0912 AM",
msg: "dada dw ertgthy j uy",
chatType: 0, //信息类型0文字1图片
uid: "1002", //uid
},
]
)
let chatMsg1004 = Mock.mock(
[
{
headImg: require("@/assets/img/head_portrait.jpg"),
name: "大毛是小白",
time: "0912 AM",
msg: " sadasdawdas sadsad sad sad as despite ofhaving so much to do",
chatType: 0, //信息类型0文字1图片
uid: "1001", //uid
},
{
headImg: require("@/assets/img/head_portrait.jpg"),
name: "大毛是小白",
time: "0912 AM",
msg: require("@/assets/img/emoji/slightly-smiling-face.png"),
chatType: 1, //信息类型0文字1图片
extend: {
imgType: 1, //(1表情2本地图片)
},
uid: "1001",
},
{
headImg: require("@/assets/img/head_portrait3.jpg"),
name: "小王",
time: "0912 AM",
msg: " 21312大萨达萨达",
chatType: 0, //信息类型0文字1图片
uid: "1002", //uid
},
{
headImg: require("@/assets/img/head_portrait.jpg"),
name: "大毛是小白",
time: "0912 AM",
msg: "111212",
chatType: 0, //信息类型0文字1图片, 2文件
uid: "1001",
},
{
headImg: require("@/assets/img/head_portrait3.jpg"),
name: "小王",
time: "0912 AM",
msg: "大萨达萨达所大大萨达",
chatType: 0, //信息类型0文字1图片
uid: "1002", //uid
},
]
)

@ -0,0 +1,36 @@
import VueRouter from 'vue-router'
import ChatHome from '../view/pages/chatHome/index.vue'
import Video from '../view/pages/video.vue'
import Lingting from '../view/pages/lingting.vue'
import Setting from '../view/pages/setting.vue'
import ChatWindow from '../view/pages/chatHome/chatwindow.vue'
export default new VueRouter({
routes: [
{
path: "/",
redirect: "/ChatHome",
},
{
path: "/ChatHome",
name: "ChatHome",
component: ChatHome,
},
{
path: "/Video",
name: "Video",
component: Video
},
{
path: "/Lingting",
name: "Lingting",
component: Lingting
},
{
path: "/Setting",
name: "Setting",
component: Setting
},
]
})

@ -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',
}
}

@ -0,0 +1,35 @@
<template>
<div class="home">
<el-container height="100%">
<el-aside width="100px">
<Nav></Nav>
</el-aside>
<el-main>
<router-view></router-view>
</el-main>
</el-container>
</div>
</template>
<script>
import Nav from "../components/Nav.vue";
export default {
name: "App",
components: {
Nav,
},
};
</script>
<style lang="scss" scoped>
.home {
width: 90vw;
height: 90vh;
background-color: rgb(39, 42, 55);
border-radius: 15px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
</style>

@ -0,0 +1,536 @@
<template>
<div class="chat-window">
<div class="top">
<div class="head-pic">
<HeadPortrait :imgUrl="frinedInfo.headImg"></HeadPortrait>
</div>
<div class="info-detail">
<div class="name">{{ frinedInfo.name }}</div>
<div class="detail">{{ frinedInfo.detail }}</div>
</div>
<div class="other-fun">
<span class="iconfont icon-shipin" @click="video"> </span>
<span class="iconfont icon-gf-telephone" @click="telephone"></span>
<label for="docFile">
<span class="iconfont icon-wenjian"></span>
</label>
<label for="imgFile">
<span class="iconfont icon-tupian"></span>
</label>
<input
type="file"
name=""
id="imgFile"
@change="sendImg"
accept="image/*"
/>
<input
type="file"
name=""
id="docFile"
@change="sendFile"
accept="application/*,text/*"
/>
<!-- accept="application/*" -->
</div>
</div>
<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>
</el-image>
</div>
<div class="chat-img" v-if="item.chatType == 2">
<div class="word-file">
<FileCard
:fileType="item.extend.fileType"
:file="item.msg"
></FileCard>
</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
>
</el-image>
</div>
<div class="chat-img" v-if="item.chatType == 2">
<div class="word-file">
<FileCard
:fileType="item.extend.fileType"
:file="item.msg"
></FileCard>
</div>
</div>
<div class="info-time">
<span>{{ item.name }}</span>
<span>{{ item.time }}</span>
<img :src="item.headImg" alt="" />
</div>
</div>
</div>
</div>
<div class="chatInputs">
<div class="emoji boxinput" @click="clickEmoji">
<img src="@/assets/img/emoji/smiling-face.png" alt="" />
</div>
<div class="emoji-content">
<Emoji
v-show="showEmoji"
@sendEmoji="sendEmoji"
@closeEmoji="clickEmoji"
></Emoji>
</div>
<input class="inputs" v-model="inputMsg" @keyup.enter="sendText" />
<div class="send boxinput" @click="sendText">
<img src="@/assets/img/emoji/rocket.png" alt="" />
</div>
</div>
</div>
</div>
</template>
<script>
import { animation } from "@/util/util";
import { getChatMsg } from "@/api/getData";
import HeadPortrait from "@/components/HeadPortrait";
import Emoji from "@/components/Emoji";
import FileCard from "@/components/FileCard.vue";
export default {
components: {
HeadPortrait,
Emoji,
FileCard,
},
props: {
frinedInfo: Object,
default() {
return {};
},
},
watch: {
frinedInfo() {
this.getFriendChatMsg();
},
},
data() {
return {
chatList: [],
inputMsg: "",
showEmoji: false,
friendInfo: {},
srcImgList: [],
};
},
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: "0912 AM",
msg: this.inputMsg,
chatType: 0, //01
uid: "1001", //uid
};
this.sendMsg(chatMsg);
this.inputMsg = "";
} else {
this.$message({
message: "消息不能为空哦~",
type: "warning",
});
}
},
//
sendEmoji(msg) {
let chatMsg = {
headImg: require("@/assets/img/head_portrait.jpg"),
name: "大毛是小白",
time: "0912 AM",
msg: msg,
chatType: 1, //01
extend: {
imgType: 1, //(12)
},
uid: "1001",
};
this.sendMsg(chatMsg);
this.clickEmoji();
},
//
sendImg(e) {
let _this = this;
console.log(e.target.files);
let chatMsg = {
headImg: require("@/assets/img/head_portrait.jpg"),
name: "大毛是小白",
time: "0912 AM",
msg: "",
chatType: 1, //01, 2
extend: {
imgType: 2, //(12)
},
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: "0912 AM",
msg: "",
chatType: 2, //01, 2
extend: {
fileType: "", //(1word2excel3ppt4pdf5zpi, 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: 70vh;
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 上SafariChrome隐藏滚动条 */
}
.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,122 @@
<template>
<div class="chatHome">
<div class="chatLeft">
<div class="title">
<h1>大猫聊天室</h1>
</div>
<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"
></PersonCard>
</div>
</div>
</div>
</div>
<div class="chatRight">
<!-- <router-view></router-view> -->
<div v-if="showChatWindow">
<ChatWindow :frinedInfo="chatWindowInfo"></ChatWindow>
</div>
<div class="showIcon" v-else>
<span class="iconfont icon-snapchat"></span>
<!-- <img src="@/assets/img/snapchat.png" alt="" /> -->
</div>
</div>
<!-- <el-col :span="4"><div class="grid-content bg-purple"></div></el-col> -->
</div>
</template>
<script>
import PersonCard from "@/components/PersonCard.vue";
import ChatWindow from "./chatwindow.vue";
import { getFriend } from "@/api/getData";
export default {
name: "App",
components: {
PersonCard,
ChatWindow,
},
data() {
return {
pcCurrent: "",
personList: [],
showChatWindow: false,
chatWindowInfo: {},
};
},
mounted() {
getFriend().then((res) => {
console.log(res);
this.personList = res;
});
},
methods: {
clickPerson(info) {
this.showChatWindow = true;
this.chatWindowInfo = info;
this.personInfo = info;
this.pcCurrent = info.id;
},
},
};
</script>
<style lang="scss" scoped>
.chatHome {
// margin-top: 20px;
display: flex;
.chatLeft {
width: 280px;
.title {
color: #fff;
padding-left: 10px;
}
.online-person {
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;
&::-webkit-scrollbar {
width: 0; /* Safari,Chrome 隐藏滚动条 */
height: 0; /* Safari,Chrome 隐藏滚动条 */
display: none; /* 移动端、pad 上SafariChrome隐藏滚动条 */
}
}
}
}
.chatRight {
flex:1;
padding-right: 30px;
.showIcon {
position: absolute;
top: calc(50% - 150px); /*垂直居中 */
left: calc(50% - 50px); /*水平居中 */
.icon-snapchat {
width: 300px;
height: 300px;
font-size: 300px;
// color: rgb(28, 30, 44);
}
}
}
}
</style>

@ -0,0 +1,13 @@
<template>
</template>
<script>
export default {
}
</script>
<style>
</style>

@ -0,0 +1,15 @@
<template>
<div class="setting">
setting
</div>
</template>
<script>
export default {
}
</script>
<style>
</style>

@ -0,0 +1,15 @@
<template>
<div class="video">
video
</div>
</template>
<script>
export default {
}
</script>
<style>
</style>

@ -0,0 +1,8 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
publicPath: './',
devServer: {
hot: true,//自动保存
},
})
Loading…
Cancel
Save