@ -1,26 +1,75 @@
|
||||
<template >
|
||||
<div class="app">
|
||||
<Login/>
|
||||
|
||||
<div class="header">
|
||||
|
||||
<!-- 展示在页面最上方 -->
|
||||
<div>
|
||||
<!-- 跳转路由 图片点击跳转到首页 -->
|
||||
<RouterLink to="/home">
|
||||
<img src="./assets/img/index.png" alt="点击回到主页">
|
||||
</RouterLink>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<!-- 跳转路由 跳转到登录 或者个人页面-->
|
||||
<RouterLink :to="loginRoute">
|
||||
<img src="./assets/img/deLogin.png" alt="点击登录">
|
||||
</RouterLink>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<!-- 展示区 -->
|
||||
<RouterView></RouterView>
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
<script lang="ts" setup name="App">
|
||||
import { RouterView,RouterLink } from 'vue-router';
|
||||
import { ref } from 'vue';
|
||||
import { useLoginStore } from './stores/login';
|
||||
//定义登录路由Personal space & login
|
||||
const loginStore = useLoginStore();
|
||||
const loginRoute = ref({path: '/login'});
|
||||
|
||||
import Login from './views/Login.vue';
|
||||
export default {
|
||||
components: {
|
||||
Login
|
||||
if(loginStore.isLogin){
|
||||
loginRoute.value = {path: '/personalSpace'}
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
console.log('App.vue')
|
||||
console.log(loginStore.userInfo.avatarurl);
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.app {
|
||||
background-color: #3a896b;
|
||||
box-shadow: 0 0 10px;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
}
|
||||
|
||||
#app {
|
||||
height: 100%;
|
||||
position: relative; /* 确保子元素可以相对于此进行定位 */
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: rgba(220, 221, 214, 0.8); /* 半透明背景色,以便文字可见 */
|
||||
color: white;
|
||||
padding: 10px 20px;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
||||
z-index: 10; /* 确保头部在其他内容之上 */
|
||||
}
|
||||
img {
|
||||
width: 30px; /* 设置图片宽度 */
|
||||
height:30px; /* 设置图片高度 */
|
||||
}
|
||||
</style>
|
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 225 KiB |
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,55 @@
|
||||
<template>
|
||||
|
||||
<h2>个人空间</h2>
|
||||
<div class="profile-info">
|
||||
<img src="" alt="Avatar" class="avatar" />
|
||||
<p><strong>用户名:</strong> Le</p>
|
||||
<p><strong>ID:</strong> 001</p>
|
||||
|
||||
</div>
|
||||
<button @click="">登出</button>
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useLoginStore } from '@/stores/login';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-profile {
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.profile-info {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.login-prompt {
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 10px 20px;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<div class="paper-container">
|
||||
<h1>{{ paperStore.paper.title }}</h1>
|
||||
<p><strong>作者:</strong> {{ paperStore.paper.writer }}</p>
|
||||
<p><strong>发布时间:</strong> {{ paperStore.paper.publishedDate }}</p>
|
||||
<div class="interaction-buttons">
|
||||
<button @click="toggleLike" :class="{ active: isLiked }">
|
||||
<img :src="likeIconSrc" alt="Like" class="icon">
|
||||
点赞数
|
||||
</button>
|
||||
<button @click="toggleDislike" :class="{ active: isDisliked }">
|
||||
<img :src="dislikeIconSrc" alt="Dislike" class="icon">
|
||||
|
||||
</button>
|
||||
<button @click="handleShare">
|
||||
<img src="../../assets/img/zhuanfa.svg" alt="Share" class="icon">
|
||||
|
||||
</button>
|
||||
</div>
|
||||
<div v-html="compiledMarkdown"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { marked } from 'marked';
|
||||
import { usePaperStore } from '@/stores/paper';
|
||||
import likeIcon from '@/assets/img/like.svg';
|
||||
import delikeIcon from '@/assets/img/delike.svg';
|
||||
import abhorIcon from '@/assets/img/abhor.svg';
|
||||
import deabhorIcon from '@/assets/img/deabhor.svg';
|
||||
|
||||
const paperStore = usePaperStore();
|
||||
|
||||
const compiledMarkdown = computed(() => {
|
||||
return marked(paperStore.paper.text);
|
||||
});
|
||||
|
||||
const isLiked = ref(false);
|
||||
const isDisliked = ref(false);
|
||||
|
||||
const likeIconSrc = computed(() => isLiked.value ? likeIcon : delikeIcon);
|
||||
const dislikeIconSrc = computed(() => isDisliked.value ? abhorIcon : deabhorIcon);
|
||||
|
||||
const toggleLike = () => {
|
||||
isLiked.value = !isLiked.value;
|
||||
isDisliked.value = false;
|
||||
// 执行点赞逻辑
|
||||
};
|
||||
|
||||
const toggleDislike = () => {
|
||||
isDisliked.value = !isDisliked.value;
|
||||
isLiked.value = false;
|
||||
// 执行点踩逻辑
|
||||
};
|
||||
|
||||
const handleShare = () => {
|
||||
// 执行转发逻辑
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.paper-container {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.interaction-buttons {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.interaction-buttons button {
|
||||
margin-right: 10px;
|
||||
padding: 5px 10px;
|
||||
border: none;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s, border-color 0.3s;
|
||||
}
|
||||
|
||||
.interaction-buttons button.active {
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-right: 5px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,47 @@
|
||||
<!-- CustomButton.vue -->
|
||||
<template>
|
||||
<button class="custom-button" @click="handleClick">
|
||||
{{ buttonText }}
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { defineProps } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
const router = useRouter();
|
||||
const props = defineProps({
|
||||
buttonText: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
});
|
||||
|
||||
const handleClick = () => {
|
||||
// 这里可以添加点击事件的逻辑
|
||||
//判断是否是登录状态
|
||||
|
||||
//跳转到书写页面
|
||||
router.push('/writing');
|
||||
console.log('Custom button clicked');
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.custom-button {
|
||||
position: fixed;
|
||||
bottom: 60px; /* 调整位置以固定在回到顶部按钮上方 */
|
||||
right: 20px;
|
||||
padding: 10px 20px;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
|
||||
z-index: 1000; /* 确保按钮在最上层 */
|
||||
}
|
||||
|
||||
.custom-button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,113 @@
|
||||
<!-- writing.vue 写作页面-->
|
||||
<template>
|
||||
<div class="writing-container">
|
||||
<div class="editor-container">
|
||||
<textarea v-model="markdownContent" class="markdown-editor" placeholder="输入 Markdown 内容..."></textarea>
|
||||
</div>
|
||||
<div class="preview-container">
|
||||
<h2>实时预览</h2>
|
||||
<div class="preview-content" v-html="compiledMarkdown"></div>
|
||||
</div>
|
||||
<button class="scroll-to-top" @click="scrollToTop">保存并发布</button>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { marked } from 'marked';
|
||||
|
||||
// 定义一个响应式变量来存储 Markdown 内容
|
||||
const markdownContent = ref('');
|
||||
|
||||
// 使用 marked 库将 Markdown 内容转换为 HTML
|
||||
const compiledMarkdown = computed(() => {
|
||||
return marked(markdownContent.value);
|
||||
});
|
||||
|
||||
|
||||
const scrollToTop = () => {
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
background-color: #f0f0f0; /* 可以根据需要调整背景颜色 */
|
||||
}
|
||||
|
||||
.writing-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
padding: 20px;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
box-sizing: border-box;
|
||||
position: relative; /* 添加相对定位,以便子元素绝对定位 */
|
||||
}
|
||||
|
||||
.editor-container {
|
||||
width: 48%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.preview-container {
|
||||
width: 48%;
|
||||
height: 100%;
|
||||
border-left: 1px solid #ccc;
|
||||
padding-left: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.markdown-editor {
|
||||
width: 100%;
|
||||
height: calc(100% - 40px); /* 减去 padding 的高度 */
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
font-family: monospace;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
resize: vertical; /* 允许垂直调整大小 */
|
||||
}
|
||||
|
||||
.preview-content {
|
||||
height: calc(100% - 60px); /* 减去 h2 的高度和 padding */
|
||||
overflow-y: auto;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 按钮样式 */
|
||||
.scroll-to-top {
|
||||
position: absolute; /* 使用绝对定位 */
|
||||
bottom: 100px;
|
||||
right: 20px;
|
||||
padding: 10px 20px;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
|
||||
z-index: 1000; /* 确保按钮在最上层 */
|
||||
}
|
||||
|
||||
/* 按钮悬停效果 */
|
||||
.scroll-to-top:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
</style>
|
@ -1,11 +1,17 @@
|
||||
import { createApp } from 'vue';
|
||||
import App from './App.vue';
|
||||
import router from './router';
|
||||
|
||||
import { createPinia } from 'pinia';
|
||||
import ElementPlus from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
// 引入路由器
|
||||
import router from './router/index'
|
||||
|
||||
const app = createApp(App);
|
||||
|
||||
app.use(router);
|
||||
//使用路由
|
||||
app.use(router)
|
||||
app.use(createPinia());
|
||||
app.use(ElementPlus);
|
||||
|
||||
app.mount('#app');
|
@ -0,0 +1,65 @@
|
||||
<!-- 公告栏 -->
|
||||
<!-- Announcement.vue -->
|
||||
<template>
|
||||
<div class="announcement-container">
|
||||
<div v-for="(announcement, index) in announcements" :key="index" class="announcement-item">
|
||||
<h3>{{ announcement.title }}</h3>
|
||||
<p class="announcement-time">{{ announcement.time }}</p>
|
||||
<div v-html="announcement.content" class="announcement-content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
const announcements = ref([
|
||||
{
|
||||
title: '公告一',
|
||||
time: '2023-10-01 12:00',
|
||||
content: `<p>这是第一条公告的内容。</p>`
|
||||
},
|
||||
{
|
||||
title: '公告二',
|
||||
time: '2023-10-02 14:30',
|
||||
content: `<p>这是第二条公告的内容,支持 <strong>HTML</strong> 格式。</p>`
|
||||
}
|
||||
]);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.announcement-container {
|
||||
border-top: 2px solid #ffcc00; /* 黄色边框 */
|
||||
padding: 20px;
|
||||
background-color: #fff9c4; /* 浅黄色背景 */
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 阴影效果 */
|
||||
border-radius: 8px; /* 圆角 */
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
.announcement-item {
|
||||
margin-bottom: 20px;
|
||||
padding: 10px;
|
||||
background-color: #fff; /* 白色背景 */
|
||||
border: 1px solid #ffcc00; /* 黄色边框 */
|
||||
border-radius: 4px; /* 圆角 */
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); /* 阴影效果 */
|
||||
}
|
||||
|
||||
.announcement-item h3 {
|
||||
color: #e65100; /* 橙色标题 */
|
||||
font-size: 1.2em;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.announcement-time {
|
||||
color: #888;
|
||||
font-size: 0.9em;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.announcement-content {
|
||||
margin-top: 10px;
|
||||
color: #333; /* 深色内容 */
|
||||
}
|
||||
</style>
|
@ -1,29 +0,0 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router';
|
||||
import Home from '../views/Home.vue';
|
||||
import Login from '../views/Login.vue';
|
||||
import Register from '../views/Register.vue';
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'Home',
|
||||
component: Home,
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
component: Login,
|
||||
},
|
||||
{
|
||||
path: '/register',
|
||||
name: 'Register',
|
||||
component: Register,
|
||||
},
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes,
|
||||
});
|
||||
|
||||
export default router;
|
@ -0,0 +1,80 @@
|
||||
// 创建一个路由器,暴露出去
|
||||
// 导入路由组件
|
||||
import { createRouter, createWebHashHistory,createWebHistory } from 'vue-router'
|
||||
//引入每个可能要呈现的组件
|
||||
// 引入首页
|
||||
import Home from '@/page/Home.vue'
|
||||
// 引入登录页
|
||||
import Login from '@/page/Login.vue'
|
||||
// 引入文章详情页
|
||||
import Paper from '@/components/utils/paper.vue'
|
||||
// 引入书写页面
|
||||
import Writing from '@/components/writeBlog/Writing.vue'
|
||||
// 引入找回密码和注册
|
||||
import RetrievePassword from '@/components/login/RetrievePassword.vue'
|
||||
import Registered from '@/components/login/Registered.vue'
|
||||
// 创建路由
|
||||
|
||||
const router = createRouter({
|
||||
// 路由模式
|
||||
history:createWebHistory(),
|
||||
routes:[
|
||||
// 路由配置规则
|
||||
|
||||
{
|
||||
path:'/home',
|
||||
component:Home
|
||||
},
|
||||
{
|
||||
path:'/login',
|
||||
component:Login
|
||||
},
|
||||
// 文章详情页
|
||||
{
|
||||
path:'/paper',
|
||||
component:Paper
|
||||
},
|
||||
// 书写页面
|
||||
{
|
||||
path:'/writing',
|
||||
component:Writing
|
||||
},
|
||||
//找回密码
|
||||
{
|
||||
path:'/retrievePassword',
|
||||
component:RetrievePassword
|
||||
},
|
||||
|
||||
//注册
|
||||
{
|
||||
path:'/registered',
|
||||
component:Registered
|
||||
},
|
||||
//个人空间
|
||||
{
|
||||
path:'/personalSpace',
|
||||
component:()=>import('@/components/login/PersonalSpace.vue')
|
||||
},
|
||||
|
||||
|
||||
// 重定向到首页
|
||||
{
|
||||
path:'/',
|
||||
redirect:'/home'
|
||||
}
|
||||
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 暴露出去
|
||||
export default router
|
@ -1,32 +0,0 @@
|
||||
// src/services/authService.js
|
||||
import axios from 'axios';
|
||||
|
||||
const API_URL = 'https://yourapi.com/api'; // 替换为你的API地址
|
||||
|
||||
export const login = async (email, password) => {
|
||||
try {
|
||||
const response = await axios.post(`${API_URL}/auth/login`, { email, password });
|
||||
if (response.data && response.data.token) {
|
||||
localStorage.setItem('user', JSON.stringify(response.data)); // 假设返回的数据包含一个token
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (error) {
|
||||
console.error('Login failed:', error);
|
||||
throw error; // 或者你可以选择返回一个错误消息
|
||||
}
|
||||
};
|
||||
|
||||
export const register = async (email, password) => {
|
||||
try {
|
||||
const response = await axios.post(`${API_URL}/auth/register`, { email, password });
|
||||
if (response.data) {
|
||||
// 注册成功后的逻辑
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (error) {
|
||||
console.error('Register failed:', error);
|
||||
throw error;
|
||||
}
|
||||
};
|
@ -1,16 +0,0 @@
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
export const useAuthStore = defineStore('auth', {
|
||||
state: () => ({
|
||||
isAuthenticated: false,
|
||||
}),
|
||||
actions: {
|
||||
login() {
|
||||
// 模拟登录过程
|
||||
this.isAuthenticated = true;
|
||||
},
|
||||
logout() {
|
||||
this.isAuthenticated = false;
|
||||
},
|
||||
},
|
||||
});
|
@ -0,0 +1,17 @@
|
||||
import { defineStore } from 'pinia';
|
||||
//全局登录状态管理
|
||||
export const useLoginStore = defineStore('login', {
|
||||
state() {
|
||||
return {
|
||||
isLogin: false,
|
||||
userInfo: {
|
||||
id: '',
|
||||
// 头像,默认值是未登录
|
||||
avatarurl: '../../assets/img/未登录头像.png',
|
||||
username: '',
|
||||
token: ''
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
@ -1,9 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>Welcome to the Home Page!</h1>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// 可以在这里添加需要的逻辑
|
||||
</script>
|
@ -1,32 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2>Login</h2>
|
||||
<form @submit.prevent="handleLogin">
|
||||
<input type="email" v-model="email" placeholder="Email" required />
|
||||
<input type="password" v-model="password" placeholder="Password" required />
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useAuthStore } from '../stores/auth';
|
||||
import { login } from '../services/authService';
|
||||
|
||||
const email = ref('');
|
||||
const password = ref('');
|
||||
const router = useRouter();
|
||||
const authStore = useAuthStore();
|
||||
|
||||
async function handleLogin() {
|
||||
try {
|
||||
await login(email.value, password.value);
|
||||
authStore.login(); // 更新状态管理
|
||||
router.push({ name: 'Home' }); // 登录成功后跳转到首页
|
||||
} catch (error) {
|
||||
alert('Invalid credentials'); // 处理错误
|
||||
}
|
||||
}
|
||||
</script>
|
@ -1,27 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2>Register</h2>
|
||||
<form @submit.prevent="handleRegister">
|
||||
<input type="email" v-model="email" placeholder="Email" required />
|
||||
<input type="password" v-model="password" placeholder="Password" required />
|
||||
<button type="submit">Register</button>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useAuthStore } from '../stores/auth';
|
||||
|
||||
const email = ref('');
|
||||
const password = ref('');
|
||||
const router = useRouter();
|
||||
const authStore = useAuthStore();
|
||||
|
||||
function handleRegister() {
|
||||
// 这里可以添加实际的注册逻辑
|
||||
// 注册成功后也可以调用authStore.login()方法并跳转到首页
|
||||
router.push({ name: 'Login' }); // 注册成功后重定向到登录页面
|
||||
}
|
||||
</script>
|
@ -0,0 +1,8 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
<profile name="Annotation profile for demo" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<processorPath>
|
||||
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/unknown/lombok-unknown.jar" />
|
||||
</processorPath>
|
||||
<module name="demo" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="demo" options="-parameters" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="@localhost" uuid="8098fefc-b8f1-4fe7-8e21-212341f63071">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>top.lejings</groupId>
|
||||
<artifactId>demo</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>demo</name>
|
||||
<description>demo</description>
|
||||
<url/>
|
||||
<licenses>
|
||||
<license/>
|
||||
</licenses>
|
||||
<developers>
|
||||
<developer/>
|
||||
</developers>
|
||||
<scm>
|
||||
<connection/>
|
||||
<developerConnection/>
|
||||
<tag/>
|
||||
<url/>
|
||||
</scm>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>3.0.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.24</version> <!-- 确保使用最新版本 -->
|
||||
<scope>provided</scope> <!-- 如果是用于编译期处理,可以使用 provided -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter-test</artifactId>
|
||||
<version>3.0.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,13 @@
|
||||
package top.lejings.demo;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class DemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DemoApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package top.lejings.demo.controller;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.lejings.demo.pojo.Announcements;
|
||||
import top.lejings.demo.pojo.Result;
|
||||
import top.lejings.demo.service.AnnouncementsService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* 公告响应
|
||||
* 对前端对于公告的所有请求接收
|
||||
* */
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class AnnouncementsController {
|
||||
|
||||
@Autowired
|
||||
private AnnouncementsService announcementsService;
|
||||
|
||||
@GetMapping("/announcements")
|
||||
public Result AnnouncementsAll(){
|
||||
log.info("查询所有公告数据");
|
||||
List<Announcements> announcementsList = announcementsService.announcementsAll();
|
||||
return Result.success(announcementsList);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package top.lejings.demo.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import top.lejings.demo.pojo.Posts;
|
||||
import top.lejings.demo.pojo.Result;
|
||||
import top.lejings.demo.service.PostsService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/post")
|
||||
public class PostsController {
|
||||
@Autowired
|
||||
private PostsService postsService;
|
||||
|
||||
//概览 Overview
|
||||
@GetMapping("/overview")
|
||||
public Result PostsOverview() {
|
||||
log.info("查询文章所有概览");
|
||||
List<Posts> postsOverviewList = postsService.postsOverview();
|
||||
return Result.success(postsOverviewList);
|
||||
}
|
||||
//具体文章,接收参数 文章id essay
|
||||
//请求url:127.0.0.1:8080/post/essay/4
|
||||
@GetMapping("/essay/{post_id}")
|
||||
public Result PostsEssay(@PathVariable Integer post_id){
|
||||
log.info("查询id为{}的文章",post_id);
|
||||
Posts posts = postsService.postsEssay(post_id);
|
||||
return Result.success(posts);
|
||||
}
|
||||
|
||||
//新建文章,前端传来user_id,title,content
|
||||
@PostMapping("/new")
|
||||
public Result PostsNew(@RequestBody Posts posts){
|
||||
log.info("新建文章");
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package top.lejings.demo.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import top.lejings.demo.pojo.Announcements;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AnnouncementsMapper {
|
||||
|
||||
@Select("select announcement_id,title,content,updated_at from announcements order by updated_at desc ")
|
||||
List<Announcements> announcementsAll();
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package top.lejings.demo.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import top.lejings.demo.pojo.Posts;
|
||||
|
||||
import java.util.List;
|
||||
@Mapper
|
||||
public interface PostsMapper {
|
||||
|
||||
List<Posts> postsOverview();
|
||||
|
||||
|
||||
Posts postsEssay(Integer post_id);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package top.lejings.demo.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Announcements {
|
||||
private Integer announcement_id;
|
||||
private String title;
|
||||
private String content;
|
||||
private LocalDateTime updated_at; //修改时间
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package top.lejings.demo.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Posts {
|
||||
private Integer post_id;
|
||||
private Integer user_id;
|
||||
private String title;
|
||||
private String content;
|
||||
private LocalDateTime updated_at; //修改时间
|
||||
private Integer priority;//优先级
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package top.lejings.demo.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Users {
|
||||
private Integer user_id;
|
||||
private String username;
|
||||
private String email;
|
||||
private String password;
|
||||
private String status;//账号状态:
|
||||
private LocalDateTime created_at;
|
||||
private LocalDateTime updated_at; //修改时间
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package top.lejings.demo.service;
|
||||
|
||||
import top.lejings.demo.pojo.Announcements;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AnnouncementsService {
|
||||
List<Announcements> announcementsAll();
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package top.lejings.demo.service;
|
||||
|
||||
import top.lejings.demo.pojo.Posts;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PostsService {
|
||||
List<Posts> postsOverview();
|
||||
|
||||
Posts postsEssay(Integer post_id);
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package top.lejings.demo.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import top.lejings.demo.mapper.AnnouncementsMapper;
|
||||
import top.lejings.demo.pojo.Announcements;
|
||||
import top.lejings.demo.service.AnnouncementsService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AnnouncementsServiceImpl implements AnnouncementsService {
|
||||
@Autowired
|
||||
private AnnouncementsMapper announcementsMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<Announcements> announcementsAll() {return announcementsMapper.announcementsAll();}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package top.lejings.demo.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import top.lejings.demo.mapper.PostsMapper;
|
||||
import top.lejings.demo.pojo.Posts;
|
||||
import top.lejings.demo.service.PostsService;
|
||||
|
||||
import java.util.List;
|
||||
@Service
|
||||
public class PostsServiceImpl implements PostsService {
|
||||
|
||||
@Autowired
|
||||
private PostsMapper postsMapper;
|
||||
|
||||
@Override
|
||||
public List<Posts> postsOverview() {return postsMapper.postsOverview();}
|
||||
|
||||
@Override
|
||||
public Posts postsEssay(Integer post_id) {return postsMapper.postsEssay(post_id);}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/blog
|
||||
|
||||
spring.datasource.username=root
|
||||
|
||||
spring.datasource.password=123456
|
||||
|
||||
|
||||
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
|
@ -0,0 +1,13 @@
|
||||
package top.lejings.demo;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class DemoApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/blog
|
||||
|
||||
spring.datasource.username=root
|
||||
|
||||
spring.datasource.password=123456
|
||||
|
||||
|
||||
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
|