faet: 添加bbs vue3前端

This commit is contained in:
橙子
2023-03-05 20:30:44 +08:00
parent a55cba4c1f
commit 2d328234a1
16 changed files with 556 additions and 213 deletions

View File

@@ -8,6 +8,7 @@
"name": "yi-bbs",
"version": "0.0.0",
"dependencies": {
"@element-plus/icons-vue": "^2.1.0",
"axios": "^1.3.4",
"element-plus": "^2.2.32",
"pinia": "^2.0.32",
@@ -390,9 +391,9 @@
}
},
"node_modules/@element-plus/icons-vue": {
"version": "2.0.10",
"resolved": "https://registry.npmmirror.com/@element-plus/icons-vue/-/icons-vue-2.0.10.tgz",
"integrity": "sha512-ygEZ1mwPjcPo/OulhzLE7mtDrQBWI8vZzEWSNB2W/RNCRjoQGwbaK4N8lV4rid7Ts4qvySU3njMN7YCiSlSaTQ==",
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/@element-plus/icons-vue/-/icons-vue-2.1.0.tgz",
"integrity": "sha512-PSBn3elNoanENc1vnCfh+3WA9fimRC7n+fWkf3rE5jvv+aBohNHABC/KAR5KWPecxWxDTVT1ERpRbOMRcOV/vA==",
"peerDependencies": {
"vue": "^3.2.0"
}
@@ -3218,9 +3219,9 @@
"integrity": "sha512-/Z3l6pXthq0JvMYdUFyX9j0MaCltlIn6mfh9jLyQwg5aPKxkyNa0PTHtU1AlFXLNk55ZuAeJRcpvq+tmLfKmaQ=="
},
"@element-plus/icons-vue": {
"version": "2.0.10",
"resolved": "https://registry.npmmirror.com/@element-plus/icons-vue/-/icons-vue-2.0.10.tgz",
"integrity": "sha512-ygEZ1mwPjcPo/OulhzLE7mtDrQBWI8vZzEWSNB2W/RNCRjoQGwbaK4N8lV4rid7Ts4qvySU3njMN7YCiSlSaTQ==",
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/@element-plus/icons-vue/-/icons-vue-2.1.0.tgz",
"integrity": "sha512-PSBn3elNoanENc1vnCfh+3WA9fimRC7n+fWkf3rE5jvv+aBohNHABC/KAR5KWPecxWxDTVT1ERpRbOMRcOV/vA==",
"requires": {}
},
"@esbuild/android-arm": {

View File

@@ -8,6 +8,7 @@
"preview": "vite preview"
},
"dependencies": {
"@element-plus/icons-vue": "^2.1.0",
"axios": "^1.3.4",
"element-plus": "^2.2.32",
"pinia": "^2.0.32",

View File

@@ -1,74 +0,0 @@
/* color palette from <https://github.com/vuejs/theme> */
:root {
--vt-c-white: #ffffff;
--vt-c-white-soft: #f8f8f8;
--vt-c-white-mute: #f2f2f2;
--vt-c-black: #181818;
--vt-c-black-soft: #222222;
--vt-c-black-mute: #282828;
--vt-c-indigo: #2c3e50;
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
--vt-c-text-light-1: var(--vt-c-indigo);
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
--vt-c-text-dark-1: var(--vt-c-white);
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
}
/* semantic color variables for this project */
:root {
--color-background: var(--vt-c-white);
--color-background-soft: var(--vt-c-white-soft);
--color-background-mute: var(--vt-c-white-mute);
--color-border: var(--vt-c-divider-light-2);
--color-border-hover: var(--vt-c-divider-light-1);
--color-heading: var(--vt-c-text-light-1);
--color-text: var(--vt-c-text-light-1);
--section-gap: 160px;
}
@media (prefers-color-scheme: dark) {
:root {
--color-background: var(--vt-c-black);
--color-background-soft: var(--vt-c-black-soft);
--color-background-mute: var(--vt-c-black-mute);
--color-border: var(--vt-c-divider-dark-2);
--color-border-hover: var(--vt-c-divider-dark-1);
--color-heading: var(--vt-c-text-dark-1);
--color-text: var(--vt-c-text-dark-2);
}
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
position: relative;
font-weight: normal;
}
body {
min-height: 100vh;
color: var(--color-text);
background: var(--color-background);
transition: color 0.5s, background-color 0.5s;
line-height: 1.6;
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 15px;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

View File

@@ -3,12 +3,15 @@
margin: 0 auto;
font-weight: normal;
} */
body
{
margin: 0 auto;
font-weight: normal;
}
a{
text-decoration: none;
}
/*
#app {
max-width: 1280px;

View File

@@ -0,0 +1,88 @@
<template>
<el-card class="box-card" shadow="never">
<div class="card-header">
<el-avatar :size="50" />
<span class="ml-2">你好</span>
<el-tag class="ml-2" type="warning">V6</el-tag>
<el-tag class="ml-2" type="danger">管理员</el-tag>
</div>
<div class=" item item-title "> <el-link size="100" :underline="false" @click="enterDiscuss">Alibaba Java
技术图谱</el-link></div>
<div class=" item item-description">一个适合新手的Java学习平台</div>
<div class=" item item-tag"><el-tag v-for="i in 4" :key="i">教程</el-tag></div>
<div class=" item item-bottom">
<el-space :size="10" :spacer="spacer">
<div class="item-description">
2022-12-26 15:01:35
</div>
<el-button icon="Pointer" text>
点赞</el-button>
<el-button icon="Star" text>
收藏</el-button>
<el-button icon="ChatDotRound" text>
评论</el-button>
</el-space>
</div>
</el-card>
</template>
<script setup>
import { h, ref } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const spacer = h(ElDivider, { direction: 'vertical' })
const enterDiscuss = () => {
router.push("/article")
}
</script>
<style scoped>
.item-bottom .el-icon {
margin-right: 0.4rem;
}
.card-header {
display: flex;
margin-bottom: 1.5rem;
align-items: center;
}
.item {
font-size: 14px;
margin-bottom: 18px;
}
.box-card {
width: 100%;
min-height: 15rem;
}
.item-title {
/* font-size: var(--el-font-size-large); */
}
.item-description {
font-size: var(--el-font-size-small);
color: #8C8C8C;
}
.item .el-tag {
margin-right: 1rem;
}
.ml-2 {
margin-left: 1.2rem;
}
.el-link {
font-size: initial;
font-weight: 700;
}
</style>

View File

@@ -0,0 +1,55 @@
<script setup>
import { ref } from 'vue'
const props = defineProps(['items','header','text'])
</script>
<template>
<el-card class="box-card" shadow="never">
<template #header>
<div class="card-header">
<span>{{props.header}}</span>
<el-link :underline="false" type="primary">{{props.text}}</el-link>
</div>
</template>
<slot name="content" />
<div v-for="(item,i) in props.items " >
<div class="text item">
<slot name="item" v-bind="item"/>
</div>
<el-divider v-if="i!=props.items.length-1" />
</div>
</el-card>
</template>
<style scoped>
.el-divider
{
margin: 0.2rem 0;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.text {
font-size: 14px;
}
.item {
margin: 0.5rem 0;
}
.box-card {
width: 100%;
}
</style>

View File

@@ -0,0 +1,48 @@
<template>
<el-row>
<el-col
>
<el-card :body-style="{ padding: '0px' }" shadow="never">
<img
src=""
class="image"
/>
<div style="padding: 14px">
<span>学习教程</span>
<div class="bottom">
<time class="remarks">{{ remarks }}</time>
<RouterLink to="/discuss"> <el-button text class="button" type="primary">进入<el-icon><CaretRight /></el-icon></el-button> </RouterLink>
</div>
</div>
</el-card>
</el-col>
</el-row>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
const remarks = "关于学习的教程"
</script>
<style>
.remarks {
font-size: 12px;
color: #999;
}
.bottom {
margin-top: 13px;
line-height: 12px;
display: flex;
justify-content: space-between;
align-items: center;
}
.image {
width: 100%;
display: block;
}
</style>

View File

@@ -1,85 +0,0 @@
<template>
<div class="item">
<i>
<slot name="icon"></slot>
</i>
<div class="details">
<h3>
<slot name="heading"></slot>
</h3>
<slot></slot>
</div>
</div>
</template>
<style scoped>
.item {
margin-top: 2rem;
display: flex;
}
.details {
flex: 1;
margin-left: 1rem;
}
i {
display: flex;
place-items: center;
place-content: center;
width: 32px;
height: 32px;
color: var(--color-text);
}
h3 {
font-size: 1.2rem;
font-weight: 500;
margin-bottom: 0.4rem;
color: var(--color-heading);
}
@media (min-width: 1024px) {
.item {
margin-top: 0;
padding: 0.4rem 0 1rem calc(var(--section-gap) / 2);
}
i {
top: calc(50% - 25px);
left: -26px;
position: absolute;
border: 1px solid var(--color-border);
background: var(--color-background);
border-radius: 8px;
width: 50px;
height: 50px;
}
.item:before {
content: ' ';
border-left: 1px solid var(--color-border);
position: absolute;
left: 0;
bottom: calc(50% + 25px);
height: calc(50% - 25px);
}
.item:after {
content: ' ';
border-left: 1px solid var(--color-border);
position: absolute;
left: 0;
top: calc(50% + 25px);
height: calc(50% - 25px);
}
.item:first-of-type:before {
display: none;
}
.item:last-of-type:after {
display: none;
}
}
</style>

View File

@@ -1,13 +1,10 @@
<template class="back-color">
<div class="body-main">
<div class="content-main">
<RouterView />
</div>
</div>
</template>
<style scoped>
@@ -19,7 +16,7 @@ background-color:#F0F2F5;
}
.content-main{
max-width:1100px;
max-width:1200px;
margin: 0 auto;
}
</style>

View File

@@ -4,29 +4,57 @@
class="el-menu-demo"
mode="horizontal"
@select="handleSelect"
>
<el-menu-item index="1">Processing Center</el-menu-item>
<RouterLink to="/index"> <el-menu-item class="logo" @click="enterIndex"> Logo</el-menu-item></RouterLink>
<RouterLink to="/index"><el-menu-item index="1" @click="enterIndex">主页</el-menu-item></RouterLink>
<el-sub-menu index="2">
<template #title>Workspace</template>
<template #title>学习</template>
<el-menu-item index="2-1">item one</el-menu-item>
<el-menu-item index="2-2">item two</el-menu-item>
<el-menu-item index="2-3">item three</el-menu-item>
<el-sub-menu index="2-4">
<template #title>item four</template>
<el-menu-item index="2-4-1">item one</el-menu-item>
<el-menu-item index="2-4-2">item two</el-menu-item>
<el-menu-item index="2-4-3">item three</el-menu-item>
</el-sub-menu>
</el-sub-menu>
<el-menu-item index="3" disabled>Info</el-menu-item>
<el-menu-item index="4">Orders</el-menu-item>
<el-sub-menu index="3">
<template #title>资源</template>
<el-menu-item index="3-1">item one</el-menu-item>
<el-menu-item index="3-2">item two</el-menu-item>
<el-menu-item index="3-3">item three</el-menu-item>
</el-sub-menu>
<el-sub-menu index="4">
<template #title>问答</template>
<el-menu-item index="4-1">item one</el-menu-item>
<el-menu-item index="4-2">item two</el-menu-item>
<el-menu-item index="4-3">item three</el-menu-item>
</el-sub-menu>
<div class="flex-grow" />
<RouterLink to="/discuss"> <el-menu-item index="5">搜索</el-menu-item></RouterLink>
<el-menu-item index="6">学习</el-menu-item>
<el-sub-menu index="7">
<template #title>分享</template>
<el-menu-item index="7-1">item one</el-menu-item>
<el-menu-item index="7-2">item two</el-menu-item>
<el-menu-item index="7-3">item three</el-menu-item>
</el-sub-menu>
</el-menu>
</template>
<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const activeIndex = ref('1')
const handleSelect = (key, keyPath) => {
console.log(key, keyPath)
}
</script>
</script>
<style scoped>
.logo{
min-width: 14rem;
}
.flex-grow {
flex-grow: 1;
}
</style>

View File

@@ -21,5 +21,7 @@ import AppBody from "./AppBody.vue"
.el-main{
margin: 0;
padding: 0;
min-height: 10rem;
background-color: #F0F2F5;
}
</style>

View File

@@ -5,9 +5,11 @@ import App from './App.vue'
import router from './router'
import './assets/main.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(createPinia())
app.use(router)

View File

@@ -15,6 +15,16 @@ const router = createRouter({
path: '/index',
component: () => import('../views/Index.vue')
},
{
name:'article',
path: '/article',
component: () => import('../views/Article.vue')
},
{
name:'discuss',
path: '/discuss',
component: () => import('../views/Discuss.vue')
},
]
},
{ path: '/:pathMatch(.*)*', name: 'NotFound', component: NotFound },

View File

@@ -0,0 +1,108 @@
<template>
<el-row :gutter="20" class="top-div">
<el-col :span="17">
<el-row class="left-div">
<el-col :span="24">
作者信息
<el-divider />
<h2>面试题挑战</h2>
文章详情
<el-divider class="tab-divider" />
<el-space :size="10" :spacer="spacer">
<el-button icon="Pointer" text>
4</el-button>
<el-button icon="Star" text>
0</el-button>
<el-button icon="Share" text>
分享</el-button>
<el-button icon="Operation" text>
操作</el-button>
</el-space>
</el-col>
<el-col :span="24">
文章评论
</el-col>
</el-row>
</el-col>
<el-col :span="7">
<el-row class="right-div">
<el-col :span="24">
</el-col>
<el-col :span="24">
</el-col>
<el-col :span="24">
</el-col>
<el-col :span="24">
</el-col>
<el-col :span="24">
</el-col>
</el-row>
</el-col>
</el-row>
</template>
<script setup>
import { h, ref } from 'vue'
const spacer = h(ElDivider, { direction: 'vertical' })
</script>
<style scoped >
.left-div .el-col {
background-color: #FFFFFF;
min-height: 12rem;
margin-bottom: 1rem;
}
.right-div .el-col {
background-color: #FFFFFF;
min-height: 10rem;
margin-bottom: 1rem;
}
.left-top-div .el-col {
min-height: 2rem;
background-color: #FAFAFA;
margin-bottom: 1rem;
margin-left: 10px;
}
.top-div {
padding-top: 1rem;
}
.left-top-div {
font-size: small;
text-align: center;
line-height: 2rem;
}
h2 {
margin-bottom: .5em;
color: rgba(0, 0, 0, .85);
font-weight: 600;
font-size: 30px;
line-height: 1.35;
}
.left-div .el-col {
padding: 1.4rem 1.4rem 0.5rem 1.4rem;
}
.el-space {
display: flex ;
vertical-align: top ;
justify-content: space-evenly ;
}
.tab-divider
{
margin-bottom: 0.5rem;
}
</style>

View File

@@ -0,0 +1,117 @@
<template>
<div class="body-div">
<div class="header">
<el-form :inline="true" >
<el-form-item label="标签:" >
<el-input placeholder="请输入标签"
:suffix-icon="Calendar"></el-input>
</el-form-item>
<el-form-item label="内容:">
<el-input
placeholder="搜索当下分类下的内容"
:suffix-icon="Calendar"
/>
</el-form-item>
<div class="form-right">
<el-button>重置</el-button>
<el-button type="primary">查询</el-button>
<el-dropdown>
<span class="el-dropdown-link">
展开
<el-icon class="el-icon--right">
<arrow-down />
</el-icon>
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>Action 1</el-dropdown-item>
<el-dropdown-item>Action 2</el-dropdown-item>
<el-dropdown-item>Action 3</el-dropdown-item>
<el-dropdown-item disabled>Action 4</el-dropdown-item>
<el-dropdown-item divided>Action 5</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</el-form>
</div>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="推荐" name="first"> </el-tab-pane>
<el-tab-pane label="最新" name="second"> </el-tab-pane>
<el-tab-pane label="最热" name="third"> </el-tab-pane>
</el-tabs>
<div class="div-item" v-for="i in 10" >
<DisscussCard/>
</div>
</div>
</template>
<script setup>
import DisscussCard from '@/components/DisscussCard.vue'
import { ref } from 'vue'
const activeName = ref('first')
const handleClick = (tab, event) => {
console.log(tab, event)
}
</script>
<style scoped>
.body-div{
min-height: 1000px;
}
.el-dropdown-link {
cursor: pointer;
color: var(--el-color-primary);
display: flex;
align-items: center;
}
.header{
background-color: #FFFFFF;
padding: 1rem;
margin: 2rem 0rem 1rem 0rem;
}
.header .el-input
{
}
.el-tabs
{
background-color: #FFFFFF;
padding-left: 2rem;
}
.el-tabs >>> .el-tabs__header
{
margin-bottom: 0;
}
.div-item
{
margin-bottom: 1rem;
}
.el-form {
--el-form-label-font-size: var(--el-font-size-base);
display: flex;
align-items: center;
}
.el-form-item
{padding-top: 0.8rem;}
.form-right
{
align-items: center;
display: flex;
margin-left: auto;
}
.form-right .el-button
{
margin-right: 0.6rem;
}
.header .el-input
{
width:20rem;
}
</style>

View File

@@ -1,57 +1,91 @@
<template>
<el-row :gutter="20" class="top-div">
<el-col :span="18">
<el-col :span="17">
<el-row class="left-top-div" :gutter="20" >
<el-row class="left-top-div" :gutter="20">
<el-col v-for="i in 9" :key="i" :span="2">
最新
</el-col>
</el-row>
<el-row class="left-div" >
<el-col :span="24">
</el-col>
<el-col :span="24">
</el-col>
<el-col :span="24">
</el-col>
<el-col :span="24">
</el-col>
<el-col :span="24">
</el-col>
<el-col :span="24">
<el-row class="left-div">
<el-col :span="8" v-for="i in 6" class="plate" :style="{ 'padding-left': i%3==1?0:0.2+'rem','padding-right': i%3==0?0:0.2+'rem'}" >
<PlateCard/>
</el-col>
<el-col :span="24" v-for="i in 10" :key="i">
<DisscussCard/>
</el-col>
</el-row>
</el-col>
<el-col :span="6">
<el-col :span="7">
<el-row class="right-div">
<el-col :span="24">
<el-col :span="24" >
<InfoCard header="其他" text="详情">
<template #content>
等待入驻
</template>
</InfoCard>
</el-col>
<el-col :span="24">
</el-col>
<el-col :span="24">
</el-col>
<el-col :span="24">
</el-col>
<el-col :span="24">
<el-col :span="24" >
<InfoCard header="用户" text="详情">
<template #content>
你好啊好兄弟
</template>
</InfoCard>
</el-col>
<el-col :span="24" >
<InfoCard :items=items header="本月排行" text="更多">
<template #item="temp">
{{temp}}
</template>
</InfoCard>
</el-col>
<el-col :span="24" >
<InfoCard :items=items header="推荐好友" text="更多">
<template #item="temp">
{{temp}}
</template>
</InfoCard>
</el-col>
</el-row>
</el-col>
</el-row>
</template>
<script setup>
import DisscussCard from '@/components/DisscussCard.vue'
import InfoCard from '@/components/InfoCard.vue'
import PlateCard from '@/components/PlateCard.vue'
const items=[{user:"用户1"},{user:"用户2"},{user:"用户3"}]
</script>
<style scoped >
.plate
{
background: transparent !important;
}
.left-div .el-col{
background-color: #FFFFFF;
min-height: 12rem;
margin-bottom: 1rem;
}
.right-div .el-col
{
background-color:#FFFFFF;
min-height: 10rem;
margin-bottom: 1rem;
}
@@ -59,13 +93,21 @@ margin-bottom: 1rem;
.left-top-div .el-col
{
min-height: 2rem;
background-color:#f21b1b;
background-color:#FAFAFA;
margin-bottom: 1rem;
margin-right :10px;
margin-left :10px;
margin-left: 0.6rem;
}
.top-div
{
padding-top: 1rem;
}
.left-top-div
{
font-size:small;
text-align: center;
line-height: 2rem;
}
</style>