community相关的文件被我搞坏了,重新拉去上传一下(还有就是为了运行测试,由于我没有community的css文件所以我在sytle引用那里注释了一下,记得取消一下康康能不能跑)

main
xuan 3 days ago
parent 2306331464
commit 68e09b4f25

@ -0,0 +1,4 @@
> 1%
last 2 versions
not dead
not ie 11

@ -0,0 +1,18 @@
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended'
],
parserOptions: {
parser: '@babel/eslint-parser'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
// 'vue/multi-word-component-names':'off',
}
}

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,24 @@
# demo
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### 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,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}

13400
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,29 @@
{
"name": "demo",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^1.7.7",
"core-js": "^3.8.3",
"element-plus": "^2.8.6",
"vite": "^5.4.10",
"vue": "^3.2.13",
"vue-router": "^4.4.5"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"unplugin-auto-import": "^0.18.3",
"unplugin-vue-components": "^0.27.4"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

@ -0,0 +1,17 @@
<!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>
</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,20 @@
<template>
<router-view/>
</template>
<script setup></script>
<style>
/* 让页面铺满整个屏幕,不出现滚动条 */
html,
body,
#app {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: auto;
}
</style>

@ -0,0 +1,147 @@
.base{
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-image: url("@/assets/pictures/background.png");
background-size: 100%;
}
.loginAndRegist{
position: absolute;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
right:6%;
top:35%;
}
.loginArea{
background-color: rgba(255,255,255,0.8);
opacity: 0.8;
border-top-left-radius: 15px;
border-bottom-left-radius: 15px;
height: 400px;
width: 400px;
z-index: 1;
display: flex;
flex-direction: column;
align-items: center;
overflow: hidden;
}
.registArea{
opacity: 0.8;
border-top-right-radius: 15px;
border-bottom-right-radius: 15px;
height: 400px;
width: 400px;
background-color: rgba(255,255,255,0.8);
z-index: 1;
display: flex;
flex-direction: column;
justify-content:center ;
align-items: center;
}
.showInfo{
border-top-right-radius: 15px;
border-bottom-right-radius: 15px;
position: absolute;
height: 400px;
width: 400px;
z-index:2;
top: 0;
right: 0;
background-image: url("@/assets/pictures/welcome.png");
background-size: 90%;
}
.showInfo:hover{
background-size: 100%;
background-position: -50px -50px;
}
.title{
width: 80%;
flex:1;
border-bottom: 1px solid #E44B9D;
display: flex;
align-items: center;
color: #E44B9D;
font-weight: bold;
font-size: 24px;
display: flex;
justify-content: center;
}
#aaa{
transition: 0.3s linear;
}
.pwdArea{
width: 100%;
flex:2;
display: flex;
flex-direction: column;
color: #E44B9D;
font-size: 20px;
font-weight: bold;
}
.pwdArea input{
height: 30px;
border-radius:15px ;
padding-left: 10px;
font-size: 13px;
}
/* 移除输入框边框 */
.el-input__inner {
border: none !important;
outline: none !important;
}
.pwdArea input:focus{
border: 2px solid #E44B9D;
}
.btnArea{
flex:1;
width: 100%;
display: flex;
justify-content: space-around;
align-items: center;
}
.rigestTitle{
width: 70%;
flex: 1;
color: #E44B9D;
font-weight: bold;
font-size: 24px;
display: flex;
justify-content: center;
align-items: center;
border-bottom: 1px solid #E44B9D;
}
.registForm{
flex: 2;
display: flex;
flex-direction: column;
color: #E44B9D;
font-size: 20px;
font-weight: bold;
}
.registForm input{
outline: none;
height: 30px;
border-radius:13px ;
padding-left: 10px;
font-size: 12px;
border: 1px solid gray;
}
.registForm input:focus{
border: 2px solid #E44B9D;
}
#elselect:focus{
border: 2px solid #E44B9D;
}
.registBtn{
flex: 1;
display: flex;
justify-content: center;
align-items: center;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

@ -0,0 +1,57 @@
<template>
<div class="comment-input">
<textarea v-model="commentText" placeholder="输入评论..." rows="3"></textarea>
<button @click="submitComment"></button>
</div>
</template>
<script>
export default {
data() {
return {
commentText: '', //
};
},
methods: {
submitComment() {
if (this.commentText.trim()) {
this.$emit('submitComment', this.commentText); //
this.commentText = ''; //
this.$emit('updateLikeCount', this.likeCount + 1);
} else {
alert("评论不能为空!");
}
}
}
};
</script>
<style scoped>
.comment-input {
display: flex;
flex-direction: column;
}
textarea {
margin-bottom: 10px;
padding: 10px;
font-size: 14px;
border-radius: 5px;
border: 1px solid #ddd;
}
button {
align-self: flex-end;
padding: 8px 15px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
</style>

@ -0,0 +1,173 @@
<template>
<div class="post-card">
<div class="post-header">
<img :src="avatarUrl" alt="avatar" class="avatar" />
<div class="user-info">
<strong>{{ username }}</strong>
<span>{{ timestamp }}</span>
</div>
</div>
<div class="post-content">
<p>{{ content }}</p>
<div style="display: flex;justify-content: center;">
<img v-if="imageUrl" :src="imageUrl" alt="post image" />
</div>
</div>
<div class="post-footer">
<button @click="increaseLikeCount" :class="{'liked': isLiked}">
<span v-if="isLiked"></span>
<span v-else>🤍</span>
{{ likeCount }}
</button>
<button @click="toggleCommentsVisibility">
{{ isCommentsVisible ? '隐藏评论' : '查看评论' }}
💬
{{ commentCount }}
</button>
</div>
<!-- 评论区的过渡动画 -->
<transition name="fade" @before-enter="beforeEnter" @enter="enter" @leave="leave">
<div v-if="isCommentsVisible" class="comments-section">
<div v-for="(comment, index) in comments" :key="index" class="comment">
<p><strong>{{ comment.username }}:</strong> {{ comment.text }}</p>
</div>
<!-- 发布评论 -->
<CommentInput @submitComment="addComment" />
</div>
</transition>
</div>
</template>
<script>
import CommentInput from './CommentInput.vue';
export default {
components: { CommentInput },
props: {
avatarUrl: String,
username: String,
timestamp: String,
content: String,
imageUrl: String,
likeCount: Number,
commentCount: Number,
isCommentsVisible: Boolean,
comments: Array, //
},
methods: {
increaseLikeCount() {
this.$emit('updateLikeCount', this.likeCount + 1);
this.isLiked = !this.isLiked;
},
increaseCommentCount() {
this.$emit('updateCommentCount', this.commentCount + 1);
},
toggleCommentsVisibility() {
this.$emit('toggleCommentsVisibility');
},
addComment(commentText) {
this.$emit('addComment', commentText); //
},
beforeEnter(el) {
el.style.maxHeight = '0';
},
enter(el, done) {
el.offsetHeight; //
el.style.transition = 'max-height 0.3s ease-in-out';
el.style.maxHeight = `${el.scrollHeight}px`;
done();
},
leave(el, done) {
el.style.transition = 'max-height 0.3s ease-in-out';
el.style.maxHeight = '0';
done();
}
}
};
</script>
<style scoped>
button {
background: none;
border: none;
font-size: 1rem;
cursor: pointer;
outline: none;
padding: 0;
}
/* 点赞后的红色样式 */
@keyframes scaleAnimation {
0% {
transform: scale(1);
}
50% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
/* .liked 类,应用动画 */
.liked {
color: red;
animation: scaleAnimation 0.5s ease-in-out;
}
.post-card {
opacity: 0.95;
margin: 20px;
border: 1px solid #ddd;
padding: 15px;
border-radius: 8px;
background-color: #fff;
}
.post-header {
display: flex;
align-items: center;
}
.avatar {
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 10px;
}
.user-info {
font-size: 14px;
}
.post-footer {
display: flex;
justify-content: space-between;
margin-top: 10px;
}
.comments-section {
margin-top: 15px;
padding: 10px;
background-color: #f9f9f9;
border-radius: 8px;
overflow: hidden; /* 确保在 max-height 动画过程中隐藏溢出的内容 */
}
.comment {
margin-bottom: 10px;
}
/* 过渡效果 */
.fade-enter-active, .fade-leave-active {
transition: max-height 0.3s ease-in-out;
}
.fade-enter, .fade-leave-to {
max-height: 0;
}
</style>

@ -0,0 +1,31 @@
<template>
<div class="main-content">
</div>
</template>
<style>
.main-content {
/* 设置背景为渐变色 */
background:
url('@/assests/pictures/backtree.png') no-repeat center center,linear-gradient(to bottom, rgba(252, 220, 215, 1) 0%, rgba(252, 220, 215, 1) 5%, rgba(255, 249, 161, 1) 25%, rgba(255, 249, 161, 1) 100%);
box-sizing: border-box; /* 使内边距计算在总高度内 */
background-size:auto 90% 60%;
background-position: center; /* 使背景图居中 */
height: 100vh; /* 使主界面高度占满整个视口 */
padding: 20px; /* 添加一些内边距 */
box-sizing: border-box; /* 使内边距计算在总高度内 */
}
</style>
<script>
export default
{
name: 'BackGround', //
//
}
</script>

@ -0,0 +1,88 @@
<template>
<el-menu
:default-active="activeIndex"
class="el-menu-demo"
mode="horizontal"
@select="handleSelect"
background-color="#ffffff"
text-color="#000000"
active-text-color="#FEB2D7"
>
<div class="logo">
<img src="../assets/pictures/Logo.png" alt="Logo" />
</div>
<el-menu-item index="1">智能推荐</el-menu-item>
<el-sub-menu index="2">
<template #title>{{communityName}}</template>
<el-menu-item index="2-1">私信聊天</el-menu-item>
<el-menu-item index="2-2">社区动态</el-menu-item>
</el-sub-menu>
<el-menu-item index="3" disabled>情感助手</el-menu-item>
<el-menu-item index="4">个人空间</el-menu-item>
<div class="tu">
<img src="@/assets/pictures/tu.png" alt="tu" />
</div>
</el-menu>
<div class="h-6" />
</template>
<script setup>
import { useRouter } from 'vue-router'
import { ref,onMounted } from 'vue'
const router = useRouter()
const activeIndex = ref('1') // '1'
const communityName = ref('社区互动')
const handleSelect = (indexPath) => {
if (indexPath === '1') {
router.push('/main/recommend') //
}
else if(indexPath === '2-1') {
router.push('/main/chat')
communityName.value = '私信聊天'
}
else if(indexPath === '2-2') {
router.push('/main/community')
communityName.value = '社区动态'
}
else if(indexPath === '4') {
router.push('/main/space')
}
}
onMounted(() => {
if (window.location.pathname === '/') {
router.push('/main/recommend')
}
})
</script>
<script>
export default {
name: 'HeaderComponent',
}
</script>
<style>
.el-menu-demo {
justify-content: space-between; /* 平铺菜单项 */
font-weight: bold; /* 加粗字体 */
}
/* 取消悬停和选中时的背景色 */
.el-menu--horizontal > .el-menu-item:not(.is-disabled):focus,
.el-menu--horizontal > .el-menu-item:not(.is-disabled):hover,
.el-menu--horizontal > .el-menu-item.is-active {
background-color: transparent !important;
}
.logo img,
.tu img {
height: 50px; /* 根据需要调整高度 */
width: auto; /* 自适应宽度 */
margin-right: 10px; /* 与菜单项的间距 */
}
.el-menu-item {
line-height: 70px; /* 设置菜单项的行高,和菜单高度一致 */
font-weight: bold; /* 加粗字体 */
}
</style>

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

@ -0,0 +1,50 @@
import login from '@/views/login/login.vue'
import main from '../views/Main.vue'
import recommend from '@/views/recommend/index.vue'
import community from '@/views/community/trends.vue'
import chat from '@/views/chat/chat.vue'
import space from '@/views/space/space.vue'
import {createRouter ,createWebHashHistory} from 'vue-router'
const routes = [
{
path : '/',
component : login
},
{
path:'/main',
component : main,
children:[
{
path:'recommend',
component: recommend
},
{
path:'community',
component: community
},
{
path:'chat',
component: chat
},
{
path:'space',
component: space
}
]
},
]
const router = createRouter({
routes,
history:createWebHashHistory()
})
export default router

@ -0,0 +1,18 @@
// 存储、获取、删除token的文件
// 定义 setToken 函数,用于将 token 存储到 localStorage
export function setToken(token) {
localStorage.setItem('authToken', token);
}
// 定义 getToken 函数,用于从 localStorage 获取 token
export function getToken() {
return localStorage.getItem('authToken');
}
// 定义 removeToken 函数,用于从 localStorage 删除 token
export function removeToken() {
localStorage.removeItem('authToken');
}

@ -0,0 +1,64 @@
// axiosConfig.js
import axios from 'axios';
import {getToken} from '@/token/auth' // 注意这里使用了解构赋值来导入getToken函数
// 创建axios实例
const service = axios.create({
baseURL: 'http://47.122.59.26:8080/api', // 配置基础URL
timeout: 5000, // 请求超时时间
});
// 请求拦截器
service.interceptors.request.use(
config => {
// 在发送请求之前做些什么
const token = getToken(); // 获取token的方式取决于你的应用
// console.log('请求拦截器的token是' +token)
console.log('Request Config:', config);
if (token) {
config.headers['Authorization'] = `Bearer ${token}`; // 设置token
// axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
}
config.headers['Accept'] = 'application/json';
return config;
},
error => {
// 对请求错误做些什么
console.error('Request Error:', error);
return Promise.reject(error);
}
);
// 响应拦截器
service.interceptors.response.use(
response => {
// 对响应数据做点什么
// 注意这里返回已经包含data
const res = response.data;
// 你可以根据实际情况在这里添加一些通用的响应处理逻辑
// 例如,根据返回的状态码判断请求是否成功
// if (res.code !== 200) {
// 业务错误处理,比如弹窗提示等
// return Promise.reject(new Error(res.message || 'Error'));
// } else {
return res;
// }
},
error => {
// 对响应错误做点什么
// if (error.response) {
// 请求已发出但服务器响应的状态码不在2xx的范围
// console.error('Error status:', error.response.status);
// console.error('Error data:', error.response.data);
// } else if (error.request) {
// 请求已发出,但没有收到响应
// console.error('Error request:', error.request);
// } else {
// 在设置请求时触发错误
console.error('响应拦截器errorMessage:', error.message);
// }
return Promise.reject(error);
}
);
export default service;

@ -0,0 +1,25 @@
<template>
<heade/>
<div>
<RouterView />
</div>
<router-view/>
</template>
<script setup>
import heade from '../components/header.vue'
// import background from '../components/background.vue'
</script>
<script>
export default {
name: 'MainView', //
//
}
</script>

@ -0,0 +1,279 @@
<template>
<div class="chat-totallayout">
<div class="chat-leftlayout">
<div class="chat-leftline1">
<p>信息</p>
<p>{{ new_msg_nums }}条新信息</p>
</div>
<div class="chat-leftline2">
<img id="chatSearchImg" src="@/assets/pictures/chat/search.png">
<input id="chatSearchInput" type="search" v-model="searchName">
</div>
<div class="chat-leftline3">
<div class="chat-friends" v-for="(item,index) of showSearchList" :key="index" @click="clickFriendList(index)">
<img id="chatIconImg" :src="item.icon" />
<div class="chat-friend-text">
<p id="chatFriendName">{{ item.name }}</p>
<p id="chatFriendMsg">{{ getLatestNew[index][0] }}</p>
</div>
<p id="chatTime">{{ getLatestNew[index][1] }}</p>
</div>
</div>
</div>
<div class="chat-middlelayout"></div>
<div class="chat-rightlayout"></div>
</div>
</template>
<script>
// import HonneyBtn from './HonneyBtn.vue';
export default {
name: 'chatIndex', //
data(){
return{
searchName: '',
new_msg_nums: 1,
chatWith:'',
userInfo:{
name:'我',
icon:'@/assets/pictures/chat/UserIcon.png'
},
//
// 使assetspublic
// iconpublic
// public
friendsInfoList: [
{name:'潇潇',icon:'/icon/UserIcon.png',position:'london',birth:'2004-1-1',
chatHistory:[
{name:'潇潇',content:'晚上好呀',time:'2024-11-24 2:11'},
{name:'我',content:'你好呀',time:'2025-11-24 1:24'},
]},
{name:'小刚','icon':'/icon/UserIcon.png',position:'china',birth:'2003-3-4',
chatHistory:[
{name:'小刚',content:'hhh',time:'2024-11-25 22:11'},
{name:'我',content:'you are',time:'2024-11-24 22:24'},
]},
{name:'吴伟',icon:'/icon/UserIcon.png',position:'endland',birth:'2004-5-2',
chatHistory:[
{name:'吴伟',content:'iii',time:'2024-12-24 23:11'},
{name:'我',content:'早上好',time:'2024-11-24 22:25'},
]},
{name:'小闽','icon':'/icon/UserIcon.png',position:'china',birth:'2003-3-4',
chatHistory:[
{name:'小刚',content:'hhh',time:'2024-11-25 22:11'},
{name:'我',content:'you are',time:'2024-11-24 22:24'},
]},
],
showSearchList: []
}
},
mounted(){
this.showSearchList = this.friendsInfoList
},
components:{
// HonneyBtn,
},
methods:{
clickFriendList(index){
this.chatWith = this.friendsInfoList[index].name
console.log(this.chatWith)
}
},
watch:{
searchName(newvalue){
this.showSearchList = []
if(newvalue == ''){
this.showSearchList = this.friendsInfoList
}
else{
this.friendsInfoList.map((x) =>{
if(x.name.includes(newvalue)){
this.showSearchList.push(x)
}
})
}
}
},
computed:{
getLatestNew(){
let time_list = []
let time_temp = ''
let content_list = []
let content_temp = ''
let time_compare1 = []
let time_compare2 = []
let time_content_list = []
for(let i=0;i<this.friendsInfoList.length;i++){
for(let j=0;j<this.friendsInfoList[i].chatHistory.length;j++){
time_temp =this.friendsInfoList[i].chatHistory[j].time
content_temp =this.friendsInfoList[i].chatHistory[j].content
if(time_list.length == i){
time_list.push(time_temp)
content_list.push(content_temp)
}
else{
time_compare1 = time_temp.split(/[-' ':]/)
time_compare2 = time_list[i].split(/[-' ':]/)
for(let k=0;k<time_compare1.length;k++){
if(parseInt(time_compare1[k])<parseInt(time_compare2[k])){
console.log(time_compare1[k],time_compare2[k])
break
}
else if(parseInt(time_compare1[k])>parseInt(time_compare2[k])){
console.log(time_compare1[k],time_compare2[k])
time_list[i] = time_temp
content_list[i] = content_temp
break
}
}
}
}
}
console.log(time_list,content_list)
content_list.map((x,index)=>{
time_content_list[index] = [x,time_list[index].split(' ')[1]]
})
console.log(time_content_list)
return time_content_list
},
}
}
</script>
<style scoped>
.chat-totallayout{
display: flex;
flex-direction: row;
height: 600px;
width: 100%;
/* background-color: aqua; */
}
.chat-leftlayout{
/* background-color: azure; */
width: 25%;
height: 100%;
display: flex;
flex-direction: column;
}
.chat-middlelayout{
background-color: yellow;
width: 55%;
height: 100%;
display: flex;
flex-direction: column;
}
.chat-rightlayout{
background-color: red;
width: 20%;
height: 100%;
display: flex;
flex-direction: column;
}
/**************整体布局***************/
/*************左边************** *****/
/* 第一行 */
.chat-leftline1{
display: flex;
/* background-color: antiquewhite; */
align-items: center;
margin-left: 30px;
}
.chat-leftlayout :nth-child(1){
flex-shrink: 0;
font-size: 30px;
font-weight: 600;
}
.chat-leftline1 :nth-child(2){
flex-shrink: 0;
font-size: 20px;
font-weight: 600;
color: rgb(61, 243, 243);
margin-left: 15px;
position: relative;
top: 2px;
}
/* 第二行 */
.chat-leftline2{
display: flex;
align-items: center;
}
#chatSearchImg{
height: 16px;
position: relative;
left: 23px;
top: -18px;
z-index: 1;
}
#chatSearchInput{
outline: none;
height: 30px;
width: 300px;
border: 2px solid #E44B9D;
border-radius: 8px;
padding-left: 30px;
position: relative;
top: -18px;
transition: all 0.5s;
}
#chatSearchInput:focus{
border-color: #fdadd8;
}
/* 第三行 */
.chat-leftline3{
display: flex;
flex-direction: column;
/* align-items: center; */
}
.chat-friends{
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid rgb(222, 222, 222);
/* background-color: #E44B9D; */
height: 70px;
width: 90%;
margin: 0 auto;
/* transition: all 0.2ss; */
}
.chat-friends:hover{
background-color: #fff2f9;
}
.chat-friend-text{
position: relative;
width: 60%;
/* background-color: #E44B9D; */
flex-shrink: 0;
}
#chatIconImg{
height: 50px;
width: 50px;
}
/* .chat-friend-text{
background-color: aliceblue;
} */
#chatFriendName{
font-size: medium;
color: black;
line-height: 10px;
}
#chatFriendMsg{
font-size: small;
font-weight: 300;
color: gray;
/* line-height: 0px; */
}
#chatTime{
font-size: small;
font-weight: 300;
color: gray;
/* background-color: #fdadd8; */
}
</style>

@ -0,0 +1,164 @@
<template>
<div class=base>
<div class=leftinfo>
<div class=focus style="position: absolute; font-weight: bold; font-size: 18px; left:8%;top:1%">
你的关注
</div>
<div class=num style="position:absolute; font-size: 14px; right:20%; top:1.5%; color: #45D4CF;">
{{myfollows.weidu}}条新动态
</div>
<div class=followslist style="position:absolute;display: flex;flex-direction: column;top:7%;width:100%;gap:7%">
<div>
<div class= "alldongtai" style="display: flex; flex-direction: row;justify-content:center; position: relative; align-items: center;">
<el-icon color="#45D4CF" size="30px"> <Grid /></el-icon>
<div style="margin-left: 40px; font-weight: bold; font-size: 16px;">全部动态</div>
</div>
<hr style="width: 100%; height: 0.001px; background-color: #D8D8D8;margin-top: 3%;">
</div>
<div v-for="(follow, index) in myfollows.list" :key="index" style="margin-top: 8%;">
<div class="follows" style="display: flex; flex-direction: row; justify-content: center; align-items: center; position: relative;width: 100%;">
<img class="touxiang" src="../../assets/pictures/touxiang.png" style="width: 18%; height: auto;" />
<div style="margin-left: 40px; font-weight: bold; font-size: 16px;">{{ follow.name }}</div>
</div>
<hr style="width: 100%; height: 0.001px; background-color: #D8D8D8; margin-top: 5%;">
</div>
</div>
</div>
<div class=middle>
<div class="post-list">
<div
v-for="(post, index) in posts"
:key="index"
class="post-card"
>
<PostCard
:avatarUrl="post.avatarUrl"
:username="post.username"
:timestamp="post.timestamp"
:content="post.content"
:imageUrl="post.imageUrl"
:likeCount="post.likeCount"
:commentCount="post.commentCount"
:isCommentsVisible="post.isCommentsVisible"
:comments="post.comments"
@updateLikeCount="updateLikeCount(index, $event)"
@updateCommentCount="updateCommentCount(index, $event)"
@toggleCommentsVisibility="toggleCommentsVisibility(index)"
@addComment="addComment(index, $event)"
/>
</div>
</div>
</div>
<div class=rightheat style="display: flex;flex-direction:column;">
<div style="position:relative; top:1%; display: flex;flex-direction:row;justify-content:center;gap:15px">
<el-icon color="red" size="30px"><Odometer /></el-icon>
<div style="font-weight:550; font-size: 18px;">热门动态</div>
</div>
<div class= heatlist style="margin-top:20px;display: flex;flex-direction:row;">
<div style="position:relative; display: flex;flex-direction:column; color: white; font-weight: bold;margin-left: 20px ;gap:11px">
<div class=Hotsearchnum style="background-color:red;">1</div>
<div class=Hotsearchnum style="background-color:#FF7E38;">2</div>
<div class=Hotsearchnum style="background-color:#FFC74F;">3</div>
<div class=Hotsearchnum style="background-color:gray;">4</div>
<div class=Hotsearchnum style="background-color:gray;">5</div>
<div class=Hotsearchnum style="background-color:gray;">6</div>
<div class=Hotsearchnum style="background-color:gray;">7</div>
</div>
<div style=" font-size: 14px;font-weight:500;margin-left: 30px;display: flex;flex-direction:column;gap:17px">
<li style="list-style-type: none;" v-for="(item, index) in HotsearchList" :key="index">{{ item }}</li>
</div>
</div>
<div style="width: 100%; height: 1px; background: linear-gradient(to right, transparent, gray, transparent);margin-top: 20px"></div>
<div style="position:relative; top:1%; display: flex;flex-direction:row;justify-content:center;gap:15px">
<el-icon color="#FEB7D9" size="25px"><Notebook /></el-icon>
<div style="font-weight:550; font-size: 18px;">热门家族故事</div>
</div>
<div class="familystorelist" style="margin-top: 20px; display: flex; justify-content: center; flex-direction: column; gap: 10px;">
<div v-for="(story, index) in familystories" :key="index" class="familystore" style="width: 95%; height: 70px; background-color: rgba(255, 225, 240, 0.7); border-radius: 10%; position: relative;">
<img class="touxiang" src="../../assets/pictures/touxiang.png" />
<div class="familytitle">{{ story.title }}</div>
<div class="familycontent">{{ story.content }}</div>
</div>
</div>
</div>
</div>
</template>
<style>
/* @import url('../../assets/css/community/community.css'); */
</style>
<script>
import PostCard from '../../components/PostCard.vue';
export default {
name: 'CommunityIndex', //
components: { PostCard },
//
data() {
return {
isLiked: false,
HotsearchList: ["麦琳爱吃烧鸡","马思唯收官战","国足绝杀","再见爱人","杨子黄圣依","黄磊的豆角","邪恶栀子花计划"],
familystories: [
{ title: '我是怎么起家的', content: '我的父母来自于印度,后面通过自己的打拼...' },
{ title: '我的祖父', content: '我的祖父曾经参加过二战,有一次在诺曼底...' },
{ title: '我竟然是皇室成员!', content: '在我的18岁生日上妈妈告诉我祖母其实是...' },
],
myfollows:{weidu:7,list:[{name:'乔一鱼'},{name:'邓紫棋'},{name:'马思唯'},{name:'陶喆'}]},
posts: [
{
avatarUrl: 'https://via.placeholder.com/40',
username: '小明',
timestamp: '1小时前',
content: '今天的天气真好,适合出去玩!',
imageUrl: 'https://via.placeholder.com/400x200',
likeCount: 24,
commentCount: 6,
isCommentsVisible: false,
comments: [] //
},
{
avatarUrl: 'https://via.placeholder.com/40',
username: '小红',
timestamp: '2小时前',
content: '刚看完一场电影,真是太感人了!',
imageUrl: '',
likeCount: 36,
commentCount: 12,
isCommentsVisible: false,
comments: [] //
},
]
};
},
methods: {
updateLikeCount(index, newLikeCount) {
this.posts[index].likeCount = newLikeCount;
},
updateCommentCount(index, newCommentCount) {
this.posts[index].commentCount = newCommentCount;
},
toggleCommentsVisibility(index) {
this.posts[index].isCommentsVisible = !this.posts[index].isCommentsVisible;
},
addComment(index, commentText) {
this.posts[index].comments.push({
username: '匿名用户',
text: commentText
});
this.posts[index].commentCount += 1;
}
}
}
</script>

@ -0,0 +1,287 @@
<template>
<div class="base">
<!-- 注册登录界面 -->
<div class="loginAndRegist">
<!--登录表单-->
<div class="loginArea">
<transition
name="animate__animated animate__bounce"
enter-active-class="animate__fadeInUp"
leave-active-class="animate__zoomOut"
appear
>
<!-- 标语 -->
<div v-show="isShow" class="title">
登录
</div>
</transition>
<transition
name="animate__animated animate__bounce"
enter-active-class="animate__fadeInUp"
leave-active-class="animate__zoomOut"
appear
>
<!-- 密码框和用户名框 -->
<div v-show="isShow" class="pwdArea">
<div style="flex: 1;justify-content: center;display: flex;align-items: center">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;
<el-input class="username" v-model="loginUser.name" style="width: 185px;" placeholder="请输入用户名"></el-input>
</div>
<div style="flex: 1;justify-content: center;display: flex;align-items: center">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;
<el-input placeholder="请输入密码" v-model="loginUser.password" style="width: 185px" show-password></el-input>
</div>
<div style="flex: 1;justify-content: center;display: flex;align-items: center">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;
<el-input placeholder="请输入验证码" v-model="loginUser.code" style="width: 125px" ></el-input>
<img src="../../assets/pictures/yanzheng.png" style="width: 60px" alt="假验证码" />
</div>
</div>
</transition>
<transition
name="animate__animated animate__bounce"
enter-active-class="animate__fadeInUp"
leave-active-class="animate__zoomOut"
appear
>
<!-- 登录注册按钮 -->
<div v-show="isShow" class="btnArea">
<el-button
type="success"
round
style="background-color: #E44B9D; letter-spacing: 5px; height: 40px; width: 100px; font-size: 14px;"
@click="UserLogin">
登录
</el-button>
</div>
</transition>
</div>
<!-- 注册表单 -->
<div class="registArea">
<transition
name="animate__animated animate__bounce"
enter-active-class="animate__fadeInUp"
leave-active-class="animate__zoomOut"
appear
>
<!-- 注册表头-->
<div v-show="!isShow" class="rigestTitle">
注册
</div>
</transition>
<transition
name="animate__animated animate__bounce"
enter-active-class="animate__fadeInUp"
leave-active-class="animate__zoomOut"
appear
>
<!-- 注册表单-->
<div v-show="!isShow" class="registForm">
<div style="flex: 1;display: flex;justify-content: center;align-items: center">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
<el-input
placeholder="请输入用户名"
v-model="regUser.regUsername"
style="width: 165px;margin-left: 10px"
clearable
>
</el-input>
</div>
<div style="flex: 1;display: flex;justify-content: center;align-items: center">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
<el-input placeholder="请输入密码" style="width: 165px;margin-left: 10px" v-model="regUser.regPwd" show-password></el-input>
</div>
<div style="flex: 1;display: flex;justify-content: center;align-items: center;">
&nbsp;&nbsp;&nbsp;:
<el-input placeholder="请再次输入密码" style="width: 165px;margin-left: 10px" v-model="regUser.regRePwd" show-password></el-input>
</div>
<div style="flex: 1;display: flex;align-items: center">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
<el-input placeholder="请输入验证码" v-model="regUser.code" style="width: 105px;margin-left: 10px"></el-input>
<img src="../../assets/pictures/yanzheng.png" style="width: 60px;" alt="假验证码" />
</div>
</div>
</transition>
<transition
name="animate__animated animate__bounce"
enter-active-class="animate__fadeInUp"
leave-active-class="animate__zoomOut"
appear
>
<!-- 注册按钮-->
<div v-show="!isShow" class="registBtn">
<el-button type="success" round style="background-color: #E44B9D;letter-spacing: 5px ;height: 40px; width: 100px; font-size: 14px" @click="userRegister"></el-button>
</div>
</transition>
</div>
<!-- 信息展示界面 -->
<div id="aaa" class="showInfo"
:style="{
borderTopRightRadius:styleObj.bordertoprightradius,
borderBottomRightRadius:styleObj.borderbottomrightradius,
borderTopLeftRadius:styleObj.bordertopleftradius,
borderBottomLeftRadius:styleObj.borderbottomleftradius,
right:styleObj.rightDis
}"
ref="showInfoView">
<transition
name="animate__animated animate__bounce"
enter-active-class="animate__fadeInUp"
leave-active-class="animate__zoomOut"
appear
>
<!-- 没有用户输入用户名或者找不到用户名的时候 -->
<div v-show="isShow" style="display: flex;flex-direction: column;align-items: center;justify-content: center;width: 100%;height: 100%">
<!-- 欢迎语 -->
<div style="flex: 2;display: flex;align-items: center;font-size: 22px;color: #E44B9D;font-weight: bold">
欢迎你加入恋爱森林
</div>
<!-- 欢迎图片 -->
<div style="flex: 2">
<el-button type="success" style="background-color:#E44B9D;border: 1px solid #ffffff; height: 40px; width: 180px; font-size: 14px" round @click="changeToRegiest"></el-button>
</div>
</div>
</transition>
<!-- 用户输入用户名时展示头像以及姓名 -->
<!-- <div>-->
<!-- </div>-->
<transition
name="animate__animated animate__bounce"
enter-active-class="animate__fadeInUp"
leave-active-class="animate__zoomOut"
appear
>
<!-- 用户注册的时候展示信息 -->
<div v-show="!isShow" style="display: flex;flex-direction: column;align-items: center;justify-content: center;width: 100%;height: 100%">
<!-- 欢迎语 -->
<div style="flex: 2;display: flex;align-items: center;font-size: 22px;color: #E44B9D;font-weight: bold">
欢迎注册
</div>
<!-- 欢迎图片 -->
<div style="flex: 2">
<el-button type="success" style="background-color:#E44B9D;border: 1px solid #ffffff;height: 40px; width: 180px; font-size: 14px" round @click="changeToLogin"></el-button>
</div>
</div>
</transition>
</div>
</div>
</div>
</template>
<script>
// import 'animate.css';
// eslint-disable-next-line no-unused-vars
import {Axios as request} from "axios";
import axios from '@/utils/axiosConfig';
import {setToken} from '@/token/auth';
export default {
name:'loginIndex',
data(){
return{
//
loginUser:{
name:"",
password:"",
code:'',
},
admins:{},
////
regUser:{
regUsername:'',
regRePwd:'',
regPwd:'',
code:'',
},
styleObj:{
bordertoprightradius:'15px',
borderbottomrightradius: '15px',
bordertopleftradius:'0px',
borderbottomleftradius:'0px',
rightDis:'0px'
},
isShow:true
}
},
methods:{
changeToRegiest(){
this.styleObj.bordertoprightradius= '0px'
this.styleObj.borderbottomrightradius='0px'
this.styleObj.bordertopleftradius='15px'
this.styleObj.borderbottomleftradius='15px'
this.styleObj.rightDis='50%'
this.isShow = !this.isShow
},
changeToLogin(){
this.styleObj.bordertoprightradius= '15px'
this.styleObj.borderbottomrightradius='15px'
this.styleObj.bordertopleftradius='0px'
this.styleObj.borderbottomleftradius='0px'
this.styleObj.rightDis='0px'
this.isShow = !this.isShow
},
async UserLogin() {
this.$router.push('/main');
if(this.loginUser.code === 'Yj98') {
try {
const response = await axios.post('', null, {
params: {
username: this.loginUser.name,
password: this.loginUser.password
}
});
console.log('登录成功', response)
// tokendata
// !!!
const token = response.token;
// token
setToken(token);
// console.log( 'token' + getToken() )
//
this.$router.push('/main');
} catch (error) {
//
console.error('登录错误:', error);
}
}else{
alert("验证码错误")
}
},
async userRegister() {
if (this.regUser.regPwd !== this.regUser.regRePwd) {
alert('两次输入的密码不一致');
return;
}
if (this.regUser.code !== 'Yj98') {
alert('验证码错误')
}
try {
//
const response = await axios.post('', null, {
params:{
username: this.regUser.regUsername,
password: this.regUser.regPwd,
}
});
//
alert('注册成功');
console.log('注册成功', response);
} catch (error) {
//
console.error('注册失败', error);
}
}
},
}
</script>
<style>
@import url('../../assets/css/login/login.css');
</style>

@ -0,0 +1,9 @@
<template>
智能推荐
</template>
<script>
export default {
name: 'RecommendIndex', //
//
}
</script>

@ -0,0 +1,9 @@
<template>
个人空间
</template>
<script>
export default {
name: 'spaceIndex', //
//
}
</script>

@ -0,0 +1,4 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
})
Loading…
Cancel
Save