feat:添加登录页面,完善文章目录

This commit is contained in:
橙子
2023-03-18 01:34:07 +08:00
parent 1bb7ce6805
commit c613b185da
8 changed files with 71 additions and 85 deletions

View File

@@ -12,7 +12,7 @@
style="width: 100%; margin-bottom: 0.8rem; margin-left: 0">添加子文章</el-button>
<!--目录在这里 -->
<TreeArticleInfo :data="articleData" @remove="delArticle" @update="updateArticle" @create="addNextArticle"
@handleNodeClick="handleNodeClick" />
@handleNodeClick="handleNodeClick" :currentNodeKey="currentNodeKey"/>
</template>
</InfoCard>
</el-col>
@@ -83,7 +83,8 @@
<InfoCard class="art-info-right" header="目录" hideDivider="true">
<template #content>
<div>
<ul class="art-info-ul">
<el-empty :image-size="100" style="padding: 20px 0;" v-if="catalogueData.length==0" description="无目录" />
<ul v-else class="art-info-ul">
<li v-for="(item, i) in catalogueData" :key="i">
<el-button style="width: 100%; justify-content: left" type="primary" text>{{ `${i + 1} ${item}`
}}</el-button>
@@ -134,23 +135,26 @@ const items = [{ user: "用户1" }, { user: "用户2" }, { user: "用户3" }];
const articleData = ref([]);
//主题内容
const discuss = ref({});
//当前默认选择的子文章
const currentNodeKey=route.params.articleId;
//目录数据
const catalogueData = ref([]);
//子文章初始化
const loadArticleData = async () => {
articleData.value = await articleall(route.params.discussId);
}
//主题初始化
const loadDiscuss = async (isRewrite) => {
if (isRewrite) {
//跳转路由
router.push(`/article/${route.params.discussId}`);
}
discuss.value = await discussGet(route.params.discussId);
if (route.params.articleId != undefined) {
if (route.params.articleId != "") {
const respose = await articleGet(route.params.articleId);
discuss.value.content = respose.content;
}

View File

@@ -125,11 +125,15 @@ const submit = async (formEl) => {
//主题创建
if (route.query.operType == "create") {
await discussAdd(discuss);
const response= await discussAdd(discuss);
var routerPer = { path: `/article/${response.id}` };
router.push(routerPer);
}
//主题更新
else if (route.query.operType == "update") {
await discussUpdate(route.query.discussId, discuss);
var routerPer = { path: `/article/${route.query.discussId}` };
router.push(routerPer);
}
}
@@ -142,16 +146,21 @@ const submit = async (formEl) => {
article.parentId=route.query.parentArticleId
//文章创建
if (route.query.operType == "create") {
await articleAdd(article);
const response= await articleAdd(article);
var routerPer = { path: `/article/${route.query.discussId}/${response.id}` };
router.push(routerPer);
}
//文章更新
else if (route.query.operType == "update") {
await articleUpdate(route.query.articleId, article);
var routerPer = { path: `/article/${route.query.discussId}/${route.query.articleId}` };
router.push(routerPer);
}
}
//添加成功后跳转到该页面
var routerPer = { path: `/discuss/${discuss.plateId}` };
router.push(routerPer);
// var routerPer = { path: `/discuss/${discuss.plateId}` };
// router.push(routerPer);
// ruleFormRef.value.resetFields();
// discuss.plateId = route.query.plateId;
}

View File

@@ -1,8 +1,8 @@
<template>
这个是登录页面
<h2> 登录-欢迎</h2>
<el-input v-model="loginForm.userName" placeholder="用户名" />
<el-input v-model="loginForm.password" placeholder="密码" />
<el-button type="primary" @click="login">登录</el-button>
<el-button class="login-btn" type="primary" @click="login">登录</el-button>
</template>
<script setup>
import { reactive } from 'vue';
@@ -25,4 +25,18 @@ if( response.code==undefined)
}
}
</script>
</script>
<style scoped>
h2{
text-align: center;
}
.el-input
{
margin:0rem 0 0.5rem 0;
}
.login-btn
{
width: 100%;
}
</style>