推荐部分整合与修改

main
hxz 1 month ago
parent 61ab1d2c55
commit 4a5b127262

@ -0,0 +1,34 @@
<template>
<div id="app">
<!-- Navbar 固定显示 -->
<Navbar />
<!-- router-view 会根据路由动态切换组件 -->
<router-view />
</div>
</template>
<script>
import Navbar from './components/Navbar.vue';
export default {
name: 'App',
components: {
Navbar
}
};
</script>
<style scoped>
#app {
position: relative;
}
.Navbar {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 9999;
}
</style>

@ -15,56 +15,12 @@
<el-menu-item index="4">个人空间</el-menu-item>
</el-menu>
</el-header>
<!-- 中部内容区域 -->
<section class="intro">
<!-- 背景图片 -->
<div class="background-container">
<img src="/picture/bg1.png" class="background-image bg1" alt="背景图片1" />
<img src="/picture/bg2.png" class="background-image bg2" alt="背景图片2" />
<img src="/picture/bg3.png" class="background-image bg3" alt="背景图片3" />
<img src="/picture/bg4.png" class="background-image bg4" alt="背景图片4" />
</div>
<!-- 内容 -->
<h1>填写你的恋爱偏好</h1>
<div class="card-container">
<el-card class="card" v-for="card in cards" :key="card.title">
<div class="card-image">
<img :src="`/picture/${card.image}`" alt="卡片图片" />
</div>
<h3>{{ card.title }}</h3>
<p>{{ card.description }}</p>
</el-card>
</div>
</section>
</div>
</template>
<script>
export default {
name: "MainPage",
data() {
return {
cards: [
{
title: "恋爱偏好",
description: "为了找到与你的心动嘉宾,请你诚实填写你的恋爱偏好",
image: "tu1.png"
},
{
title: "查看结果",
description: "查看你的恋爱树,了解你的恋爱类型",
image: "tu2.png"
},
{
title: "释放潜力",
description: "与你的心动嘉宾开始聊天,勇敢追求真爱",
image: "tu3.png"
},
],
};
},
};
</script>
@ -114,90 +70,4 @@ export default {
.menu .el-menu-item:hover {
color: #ffdbdb;
}
/* 中部内容样式 */
.intro {
position: relative; /* 确保背景图片和内容可以叠加 */
padding: 60px 20px;
text-align: center;
background: linear-gradient(to bottom, #fffacd, #ffe4e1);
overflow: hidden; /* 确保背景图片不超出区域 */
}
.intro h1 {
font-size: 28px;
color: #333;
margin-bottom: 30px;
position: relative; /* 内容相对于背景定位 */
z-index: 2; /* 确保内容在背景图片之上 */
}
.card-container {
display: flex;
justify-content: center;
gap: 30px;
position: relative; /* 内容层级 */
z-index: 2;
}
.card {
width: 250px;
text-align: center;
padding: 20px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 10px;
background: #fff;
}
.card-image {
height: 100px;
width: 100px;
background: #f0f0f0;
border-radius: 50%;
margin: 0 auto 15px auto;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.card-image img {
width: 100%;
height: 100%;
object-fit: cover;
}
.card h3 {
font-size: 20px;
color: #ff77a9;
margin-bottom: 10px;
}
.card p {
font-size: 14px;
color: #555;
}
/* 背景图片样式 */
.background-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1; /* 背景层级 */
pointer-events: none; /* 确保背景不影响内容的交互 */
}
.background-image {
position: absolute;
width: 200px;
height: auto;
opacity: 0.8;
}
.bg1 {
top: 20px;
left: 50px;
}
.bg2 {
bottom: 30px;
right: 80px;
}
.bg3 {
top: 50%;
left: 40%;
transform: translate(-50%, -50%);
}
</style>

@ -1,5 +1,27 @@
<template>
<div>
<section class="intro">
<!-- 背景图片 -->
<div class="background-container">
<img src="/picture/bg1.png" class="background-image bg1" alt="背景图片1" />
<img src="/picture/bg2.png" class="background-image bg2" alt="背景图片2" />
<img src="/picture/bg3.png" class="background-image bg3" alt="背景图片3" />
<img src="/picture/bg4.png" class="background-image bg4" alt="背景图片4" />
</div>
<!-- 内容 -->
<h1>填写你的恋爱偏好</h1>
<div class="card-container">
<el-card class="card" v-for="card in cards" :key="card.title">
<div class="card-image">
<img :src="`/picture/${card.image}`" alt="卡片图片" />
</div>
<h3>{{ card.title }}</h3>
<p>{{ card.description }}</p>
</el-card>
</div>
</section>
</div>
<el-form class="form" ref="form" :model="formData" :rules="rules">
<fieldset>
<legend style="color: #ff77a9">- 基本属性 -</legend>
@ -175,7 +197,7 @@
</el-form-item>
</fieldset>
<el-button type="primary" class="submit-button" @click="handleSubmit"></el-button>
<el-button type="primary" class="submit-button" @click="handleSubmit" >生成恋爱树</el-button>
</el-form>
</template>
@ -211,6 +233,24 @@ export default {
senseOfHumor: "",
honesty: ""
},
cards: [
{
title: "恋爱偏好",
description: "为了找到与你的心动嘉宾,请你诚实填写你的恋爱偏好",
image: "tu1.png"
},
{
title: "查看结果",
description: "查看你的恋爱树,了解你的恋爱类型",
image: "tu2.png"
},
{
title: "释放潜力",
description: "与你的心动嘉宾开始聊天,勇敢追求真爱",
image: "tu3.png"
},
],
rules: {
gender: [{ required: true, message: '请选择性别', trigger: 'change' }],
@ -286,10 +326,12 @@ export default {
},
//
handleSubmit() {
this.$refs.form.validate((valid) => {
if (valid) {
//
this.submitData(this.formData);
this.$router.push("/result");
} else {
this.$message.error("请检查表单填写是否正确");
}
@ -305,6 +347,7 @@ export default {
});
}
},
};
</script>
@ -358,7 +401,91 @@ fieldset {
.submit-button:hover {
background-color: #ff3d7f;
}
/* 中部内容样式 */
.intro {
position: relative; /* 确保背景图片和内容可以叠加 */
padding: 60px 20px;
text-align: center;
background: linear-gradient(to bottom, #fffacd, #ffe4e1);
overflow: hidden; /* 确保背景图片不超出区域 */
}
.intro h1 {
font-size: 28px;
color: #333;
margin-bottom: 30px;
position: relative; /* 内容相对于背景定位 */
z-index: 2; /* 确保内容在背景图片之上 */
}
.card-container {
display: flex;
justify-content: center;
gap: 30px;
position: relative; /* 内容层级 */
z-index: 2;
}
.card {
width: 250px;
text-align: center;
padding: 20px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 10px;
background: #fff;
}
.card-image {
height: 100px;
width: 100px;
background: #f0f0f0;
border-radius: 50%;
margin: 0 auto 15px auto;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.card-image img {
width: 100%;
height: 100%;
object-fit: cover;
}
.card h3 {
font-size: 20px;
color: #ff77a9;
margin-bottom: 10px;
}
.card p {
font-size: 14px;
color: #555;
}
/* 背景图片样式 */
.background-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1; /* 背景层级 */
pointer-events: none; /* 确保背景不影响内容的交互 */
}
.background-image {
position: absolute;
width: 200px;
height: auto;
opacity: 0.8;
}
.bg1 {
top: 20px;
left: 50px;
}
.bg2 {
bottom: 30px;
right: 80px;
}
.bg3 {
top: 50%;
left: 40%;
transform: translate(-50%, -50%);
}
legend {
font-size: 22px;
color: #ff77a9;

@ -0,0 +1,306 @@
<template>
<div class="recommenduser-container">
<div class="content">
<div class="rectangle-box">
<h1 class="title">推荐用户</h1>
<p class="subtitle">根据你的恋爱偏好为您推荐以下用户</p>
<button class="add-button">添加</button>
<div class="user-card">
<img class="avatar" src="@/assets/pictures/touxiang.png" alt="用户头像">
<div class="user-info">
<div class="name-gender">
<span class="name">Alan</span>
<span class="gender"></span>
</div>
<div class="job-location">
<span class="job">软件开发工程师</span>
<span class="location">福州</span>
</div>
<div class="details">
<span>月薪10K-15K</span>
<span>188cm</span>
<span>健身</span>
<span>幽默</span>
</div>
</div>
</div>
<div class="user-card second-card">
<img class="avatar" src="@/assets/pictures/touxiang.png" alt="用户头像">
<div class="user-info">
<div class="name-gender">
<span class="name">Alan</span>
<span class="gender"></span>
</div>
<div class="job-location">
<span class="job">软件开发工程师</span>
<span class="location">福州</span>
</div>
<div class="details">
<span>月薪10K-15K</span>
<span>188cm</span>
<span>健身</span>
<span>幽默</span>
</div>
</div>
</div>
<div class="user-card right-card">
<img class="avatar" src="@/assets/pictures/touxiang.png" alt="用户头像">
<div class="user-info">
<div class="name-gender">
<span class="name">Alan</span>
<span class="gender"></span>
</div>
<div class="job-location">
<span class="job">软件开发工程师</span>
<span class="location">福州</span>
</div>
<div class="details">
<span>月薪10K-15K</span>
<span>188cm</span>
<span>健身</span>
<span>幽默</span>
</div>
</div>
</div>
<div class="user-card right-card second-card">
<img class="avatar" src="@/assets/pictures/touxiang.png" alt="用户头像">
<div class="user-info">
<div class="name-gender">
<span class="name">Alan</span>
<span class="gender"></span>
</div>
<div class="job-location">
<span class="job">软件开发工程师</span>
<span class="location">福州</span>
</div>
<div class="details">
<span>月薪10K-15K</span>
<span>188cm</span>
<span>健身</span>
<span>幽默</span>
</div>
</div>
</div>
<div class="user-card right-card-2">
<img class="avatar" src="@/assets/pictures/touxiang.png" alt="用户头像">
<div class="user-info">
<div class="name-gender">
<span class="name">Alan</span>
<span class="gender"></span>
</div>
<div class="job-location">
<span class="job">软件开发工程师</span>
<span class="location">福州</span>
</div>
<div class="details">
<span>月薪10K-15K</span>
<span>188cm</span>
<span>健身</span>
<span>幽默</span>
</div>
</div>
</div>
<div class="user-card right-card-2 second-card">
<img class="avatar" src="@/assets/pictures/touxiang.png" alt="用户头像">
<div class="user-info">
<div class="name-gender">
<span class="name">Alan</span>
<span class="gender"></span>
</div>
<div class="job-location">
<span class="job">软件开发工程师</span>
<span class="location">福州</span>
</div>
<div class="details">
<span>月薪10K-15K</span>
<span>188cm</span>
<span>健身</span>
<span>幽默</span>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'RecommendUserPage',
data() {
return {
//
}
}
}
</script>
<style scoped>
.recommenduser-container {
width: 100%;
min-height: 100vh;
background-image: url('@/assets/pictures/recommenduser.png');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
position: relative;
}
.content {
position: absolute;
bottom: 39px;
left: 0;
right: 0;
display: flex;
justify-content: center;
align-items: center;
}
.rectangle-box {
width: 1313px;
height: 400px;
border-radius: 30px;
border: 1px solid #FE4E96;
background: rgba(255, 225, 240, 0.7);
flex-shrink: 0;
position: relative;
}
.title {
position: absolute;
left: -400px;
top: 26px;
color: #FE4E96;
font-family: "Nunito Sans";
font-size: 32px;
font-style: normal;
font-weight: 600;
line-height: normal;
margin: 0;
text-decoration: none;
border-bottom: none;
-webkit-text-decoration: none;
-moz-text-decoration: none;
-ms-text-decoration: none;
}
.title:hover,
.title:active,
.title:visited {
text-decoration: none;
border-bottom: none;
}
.subtitle {
position: absolute;
left: 220px;
top: 30px;
color: #FEB2EE;
font-family: "Nunito Sans";
font-size: 24px;
font-style: normal;
font-weight: 400;
line-height: normal;
margin: 0;
}
.add-button {
position: absolute;
right: 30px;
top: 26px;
width: 142.625px;
height: 52.748px;
border-radius: 30px;
background: #FE4E96;
border: none;
color: white;
font-family: "Nunito Sans";
font-size: 24px;
font-weight: 400;
line-height: normal;
cursor: pointer;
flex-shrink: 0;
}
.add-button:hover {
background: #ff3a8b;
}
.user-card {
position: absolute;
left: 35px;
top: 95px;
width: 370px;
height: 103px;
padding: 15px;
background: white;
border-radius: 10px;
display: flex;
align-items: center;
gap: 15px;
flex-shrink: 0;
}
.avatar {
width: 70px;
height: 70px;
border-radius: 50%;
object-fit: cover;
}
.user-info {
flex: 1;
display: flex;
flex-direction: column;
gap: 5px;
}
.name-gender {
display: flex;
align-items: center;
gap: 10px;
}
.name {
font-size: 24px;
font-weight: bold;
color: #333;
}
.gender {
font-size: 18px;
color: #666;
}
.job-location {
display: flex;
gap: 10px;
color: #666;
font-size: 16px;
}
.details {
display: flex;
gap: 15px;
color: #666;
font-size: 16px;
}
.second-card {
top: 240px;
}
.right-card {
left: 455px;
}
.right-card-2 {
left: 875px;
}
</style>

@ -0,0 +1,34 @@
// src/router/index.js
import { createRouter, createWebHistory } from 'vue-router';
// 导入页面组件
import HomePage from '../components/index.vue';
import PreferencePage from '../components/PreferenceForm.vue';
import ResultPage from '../components/Recommenduser.vue';
// 定义路由规则
const routes = [
{
path: '/', // 默认主页
name: 'Home',
component: HomePage,
},
{
path: '/preference', // 恋爱偏好页
name: 'Preference',
component: PreferencePage,
},
{
path: '/result', // 查看结果页
name: 'Result',
component: ResultPage,
},
];
// 创建路由实例
const router = createRouter({
history: createWebHistory(),
routes, // 确保包含路由配置
});
export default router;

@ -0,0 +1,55 @@
<template>
<div class="recommend-container">
<div class="content">
<!-- 添加 @click 事件监听器 -->
<button class="start-btn" @click="navigateToForm"></button>
</div>
</div>
</template>
<script>
export default {
name: 'RecommendIndex',
methods: {
// navigateToForm
navigateToForm() {
this.$router.push("/preference");
}
}
}
</script>
<style scoped>
.recommend-container {
width: 100%;
min-height: calc(100vh - 60px);
background-image: url('../assets/pictures/recommendbg.png');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
display: flex;
justify-content: center;
align-items: center;
}
.content {
text-align: center;
padding: 20px;
}
.start-btn {
background-color: #E5579B;
color: white;
border: none;
padding: 12px 40px;
font-size: 18px;
border-radius: 25px;
cursor: pointer;
transition: all 0.3s ease;
}
.start-btn:hover {
transform: scale(1.05);
background-color: #d94b8b;
}
</style>

@ -0,0 +1,10 @@
import { createApp } from 'vue';
import App from './App.vue';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import router from './router';
const app = createApp(App); // 创建 Vue 应用实例
app.use(ElementPlus); // 注册 ElementPlus
app.use(router); // 挂载路由
app.mount('#app'); // 挂载应用
Loading…
Cancel
Save