微调/完善

This commit is contained in:
2023-07-05 02:02:38 +08:00
parent 0946e22f85
commit 03110a9b1e
8 changed files with 105 additions and 67 deletions

View File

@@ -15,7 +15,8 @@
<el-menu-item class="menu-item" index="/paper"><i class="el-icon-s-management" style="color: #5b6bc9"></i> </el-menu-item> <el-menu-item class="menu-item" index="/paper"><i class="el-icon-s-management" style="color: #5b6bc9"></i> </el-menu-item>
</el-menu> </el-menu>
<SearchInput class="HeaderInput"></SearchInput> <SearchInput class="HeaderInput"></SearchInput>
<el-button class="HeaderSubmitBtn" type="success" round icon="el-icon-thumb">提交项目</el-button> <el-button v-if="this.$route.path!=='/paper'" class="HeaderSubmitBtn" type="success" round icon="el-icon-thumb">提交项目</el-button>
<el-button v-if="this.$route.path ==='/paper'" class="HeaderSubmitBtn" type="primary" round icon="el-icon-edit">发布文章</el-button>
</div> </div>
</template> </template>

View File

@@ -4,7 +4,7 @@
<img :src="projectLists.projectIco" style="width: 5vw;height: 5vw;margin-left: 10px;border-radius: 10px"> <img :src="projectLists.projectIco" style="width: 5vw;height: 5vw;margin-left: 10px;border-radius: 10px">
</div> </div>
<div style="height: 12vh;margin-left: 5px;width: auto;display: flex;flex-direction: column;justify-content: space-between"> <div style="height: 12vh;margin-left: 5px;width: auto;display: flex;flex-direction: column;justify-content: space-between">
<div class="ProjectTitle"> <div class="ProjectTitle" style="font-size: 16px;font-weight: bold;">
<span>{{projectLists.projectTitle}}</span> <span>{{projectLists.projectTitle}}</span>
</div> </div>
<div class="summary"> <div class="summary">

View File

@@ -36,7 +36,6 @@ export default {
}, },
mounted() { mounted() {
this.getRandomProject(); this.getRandomProject();
console.log(this.randomProjectList);
}, },
methods:{ methods:{
getRandomProject(){ getRandomProject(){

View File

@@ -0,0 +1,35 @@
<template>
<div style="display: flex;margin-left: 20px;margin-top: 7vh;flex-direction: column">
<el-card class="box-card" style="width: 15vw;height: auto;border: none">
<el-button type="info" plain @click="openLogin" v-show="this.$cookie.get('username')==null"> </el-button>
<LoginDialog :login-dialog-visible.sync="loginDialogVisible"></LoginDialog>
<UserInfo></UserInfo>
</el-card>
<RandomProjects style="margin-top: 20px"></RandomProjects>
</div>
</template>
<script>
import UserInfo from "@/components/Home/UserInfo.vue";
import LoginDialog from "@/components/Home/LoginDialog.vue";
import RandomProjects from "@/components/Home/RandomProjects.vue";
export default {
name: "RightTools",
components: {RandomProjects, LoginDialog, UserInfo},
data(){
return{
loginDialogVisible:false
}
},
methods:{
openLogin(){
this.loginDialogVisible=true;
},
}
}
</script>
<style scoped>
</style>

View File

@@ -22,7 +22,7 @@
<el-tiptap style="margin-top: 20px" v-model="ArticleContent" :readonly="true" :showMenubar="false" :extensions="extensions" /> <el-tiptap style="margin-top: 20px" v-model="ArticleContent" :readonly="true" :showMenubar="false" :extensions="extensions" />
</div> </div>
</div> </div>
<RightTools></RightTools>
</div> </div>
</template> </template>
@@ -41,9 +41,11 @@ import {
Text, Text,
Underline Underline
} from "element-tiptap"; } from "element-tiptap";
import RightTools from "@/components/Home/RightTools.vue";
export default { export default {
name: "ArticleDetail", name: "ArticleDetail",
components: {RightTools},
data(){ data(){
return{ return{
extensions: [ extensions: [
@@ -62,6 +64,7 @@ export default {
ArticleContent:null, ArticleContent:null,
ArticleTitle:null, ArticleTitle:null,
articleico:'', articleico:'',
loginDialogVisible:false,
} }
}, },

View File

@@ -1,8 +1,8 @@
<template> <template>
<div class="articleList" @click="goArticleDetail"> <div class="articleList" @click="goArticleDetail">
<div style="display: flex;flex-direction: column;"> <div style="display: flex;flex-direction: column;">
<div style="display: flex;justify-content: flex-start"> <div class="articleTitle" style="display: flex;justify-content: flex-start">
<span style="font-size: 16px;color: black;font-weight: bold">{{articleList.ArticleTitle}}</span> <span style="font-size: 16px;color: black;font-weight: bold">{{articleList.ArticleTitle}}</span>
</div> </div>
<span v-text="brief" style="display: flex;justify-content:flex-start;text-align: left;margin-top: 10px;font-size: 13px;color: #9ca3af"> <span v-text="brief" style="display: flex;justify-content:flex-start;text-align: left;margin-top: 10px;font-size: 13px;color: #9ca3af">
@@ -71,7 +71,10 @@ export default {
cursor: pointer; cursor: pointer;
overflow: hidden; overflow: hidden;
} }
.articleList:hover{ .articleList:hover {
background-color: #eeeeee; background-color: #eeeeee;
} }
.articleTitle :hover{
color: #42b983;
}
</style> </style>

View File

@@ -47,28 +47,19 @@
</el-tabs> </el-tabs>
</div> </div>
</div> </div>
<div style="display: flex;margin-left: 20px;margin-top: 7vh;flex-direction: column"> <RightTools></RightTools>
<el-card class="box-card" style="width: 15vw;height: auto;border: none">
<el-button type="info" plain @click="openLogin" v-show="this.$cookie.get('username')==null"> </el-button>
<LoginDialog :login-dialog-visible.sync="loginDialogVisible"></LoginDialog>
<UserInfo></UserInfo>
</el-card>
<RandomProjects style="margin-top: 20px"></RandomProjects>
</div>
</div> </div>
</template> </template>
<script> <script>
import axios from "axios"; import axios from "axios";
import ArticleList from "@/components/Paper/ArticleList.vue"; import ArticleList from "@/components/Paper/ArticleList.vue";
import UserInfo from "@/components/Home/UserInfo.vue"; import RightTools from "@/components/Home/RightTools.vue";
import LoginDialog from "@/components/Home/LoginDialog.vue";
import RandomProjects from "@/components/Home/RandomProjects.vue";
export default { export default {
name: "PaperComponent", name: "PaperComponent",
components: {RandomProjects, LoginDialog, UserInfo, ArticleList}, components: {RightTools, ArticleList},
data(){ data(){
return{ return{
avtiveName:'last', avtiveName:'last',
@@ -91,9 +82,7 @@ export default {
}, },
methods: { methods: {
openLogin(){
this.loginDialogVisible=true;
},
goBack() { goBack() {
window.history.go(-1); window.history.go(-1);
}, },

View File

@@ -140,7 +140,8 @@
<div class="text item"> <div class="text item">
<div style="display: flex;flex-direction: row;flex-wrap: nowrap"> <div style="display: flex;flex-direction: row;flex-wrap: nowrap">
<div style="width: 50px;height: 50px"> <div style="width: 50px;height: 50px">
<el-avatar :size="50">{{this.$cookie.get('username')}}</el-avatar> <el-avatar v-if="this.$cookie.get('username')!=null" :size="50">{{this.$cookie.get('username')}}</el-avatar>
<el-avatar v-if="this.$cookie.get('username')==null" :size="50">未登录</el-avatar>
</div> </div>
<el-input <el-input
style="margin-left: 10px" style="margin-left: 10px"
@@ -169,7 +170,7 @@
</div> </div>
<el-divider></el-divider> <el-divider></el-divider>
<div style="display: flex;flex-direction: column;flex-wrap: nowrap;margin-top: 20px"> <div v-if="isRouterAlive" style="display: flex;flex-direction: column;flex-wrap: nowrap;margin-top: 20px">
<div style="display: flex;flex-direction: row;align-items: center;flex-wrap: nowrap;justify-content: space-between"> <div style="display: flex;flex-direction: row;align-items: center;flex-wrap: nowrap;justify-content: space-between">
<span style="font-size: 16px;font-weight: bold">{{ commentNum }} 条精选评论</span> <span style="font-size: 16px;font-weight: bold">{{ commentNum }} 条精选评论</span>
<el-button-group> <el-button-group>
@@ -215,23 +216,13 @@
</el-card> </el-card>
</div> </div>
</div> </div>
<div style="display: flex;margin-left: 20px;margin-top: 7vh;flex-direction: column"> <RightTools></RightTools>
<el-card class="box-card" style="width: 15vw;height: auto;border: none">
<el-button type="info" plain @click="openLogin" v-show="this.$cookie.get('username')==null"> </el-button>
<LoginDialog :login-dialog-visible.sync="loginDialogVisible"></LoginDialog>
<UserInfo></UserInfo>
</el-card>
<RandomProjects style="margin-top: 20px"></RandomProjects>
</div>
</div> </div>
</template> </template>
<script> <script>
import axios from "axios"; import axios from "axios";
import UserInfo from "@/components/Home/UserInfo.vue";
import LoginDialog from "@/components/Home/LoginDialog.vue";
import Vue from "vue"; import Vue from "vue";
import RandomProjects from "@/components/Home/RandomProjects.vue";
import { import {
// 罗列出需要的功能按钮 // 罗列出需要的功能按钮
Doc, Doc,
@@ -246,10 +237,11 @@ import {
BulletList, BulletList,
OrderedList, OrderedList,
} from 'element-tiptap'; } from 'element-tiptap';
import RightTools from "@/components/Home/RightTools.vue";
export default { export default {
name: "ProjectDetail", name: "ProjectDetail",
components: {RandomProjects, LoginDialog, UserInfo}, components: {RightTools},
data(){ data(){
return{ return{
starValue:null, starValue:null,
@@ -282,14 +274,15 @@ export default {
new Text(), new Text(),
new Paragraph(), new Paragraph(),
new Heading({ level: 5 }), // 支持多级标题设置为5级 new Heading({ level: 5 }), // 支持多级标题设置为5级
new Bold({ bubble: true }), // 在气泡菜单中渲染菜单按钮 new Bold({ bubble: false }), // 在气泡菜单中渲染菜单按钮
new Underline({ bubble: true, menubar: false }), // 在气泡菜单而不在菜单栏中渲染菜单按钮 new Underline({ bubble: false, menubar: false }), // 在气泡菜单而不在菜单栏中渲染菜单按钮
new Italic(), new Italic(),
new Strike(), new Strike(),
new ListItem(), new ListItem(),
new BulletList(), new BulletList(),
new OrderedList(), new OrderedList(),
], ],
isRouterAlive:true,
} }
}, },
mounted() { mounted() {
@@ -333,8 +326,11 @@ export default {
}); });
}, },
openLogin(){ reload() {
this.loginDialogVisible=true; this.isRouterAlive = false;
this.$nextTick(function () {
this.isRouterAlive = true;
});
}, },
getComment(){ getComment(){
@@ -354,33 +350,45 @@ export default {
}, },
publishComment(){ publishComment(){
var that=this; var that=this;
axios({ if(this.$cookie.get('username')!=null){
method: 'post', axios({
// 请求的地址 method: 'post',
url: 'http://localhost:8082/helloGithub_war_exploded/comment', // 请求的地址
// URL 中的查询参数 url: 'http://localhost:8082/helloGithub_war_exploded/comment',
params: { // URL 中的查询参数
id:that.$route.query.id, params: {
star:that.startValue, id:that.$route.query.id,
content:that.textarea, star:that.startValue,
isUsed: that.radio, content:that.textarea,
} isUsed: that.radio,
}).then(function (res) { }
if (res.data.code === 200) { }).then(function (res) {
Vue.prototype.$notify({ if (res.data.code === 200) {
title: '成功', Vue.prototype.$notify({
message: ('i', {style: 'color: teal'}, res.data.msg), title: '成功',
type: 'success', message: ('i', {style: 'color: teal'}, res.data.msg),
offset: 50 type: 'success',
}); offset: 50
} else { });
Vue.prototype.$notify.error({ that.getComment();
title: '错误', that.reload();
message: res.data.msg, } else {
offset: 50 Vue.prototype.$notify.error({
}); title: '错误',
} message: res.data.msg,
}); offset: 50
});
}
});
}else{
Vue.prototype.$notify.error({
title: '错误',
message: "你还未登录!",
offset: 50
});
}
}, },
} }