This commit is contained in:
2023-07-10 17:13:20 +08:00
parent 21c4e96cc2
commit df89d8df5c
3 changed files with 610 additions and 20 deletions

View File

@@ -16,12 +16,12 @@
<div style="display: flex;flex-direction: row;">
<el-avatar style="background-color: transparent" shape="square" :size="70" :src="github.avatar_url"></el-avatar>
<div style="display: flex;flex-direction: column;justify-content: space-between;margin-left: 10px">
<span v-if="projectName" style="font-size: 30px;color: black;font-weight: bold;display: flex;justify-content: flex-start">
{{ projectName }}
</span>
<span style="text-align: left;display: flex;flex-direction:row;justify-content: flex-start;font-size: 20px;color: rgb(107 114 128);">
{{projectTitle}}
</span>
<span v-if="projectName" style="font-size: 30px;color: black;font-weight: bold;display: flex;justify-content: flex-start;text-align: left">
{{ briefTopName }}
</span>
<span style="text-align: left;display: flex;flex-direction:row;justify-content: flex-start;font-size: 20px;color: rgb(107 114 128);">
{{projectTitle}}
</span>
</div>
</div>
<div style="display: flex;flex-direction: row;justify-content: space-between">
@@ -62,7 +62,7 @@
<div style="display: flex;flex-direction: row;flex-wrap: nowrap;margin-top: 10px;justify-content: space-between">
<div style="display: flex;flex-direction: row;flex-wrap: nowrap;align-items: center" >
<span>开源</span><div style="width: 8px;height: 8px;background-color: #9ca3af;border-radius: 50px;margin-left: 5px"></div>
<span style="margin-left: 5px;color: #00b2ff">{{github.license}}</span>
<span v-if="github.license" style="margin-left: 5px;color: #00b2ff">{{github.license}}</span>
</div>
<div style="display: flex;flex-direction: row;flex-wrap: nowrap;">
<el-link :underline="false" @click="toComment('#comment')" icon="el-icon-chat-dot-square">评论</el-link>
@@ -83,12 +83,12 @@
<th style="width: 10vw;color: #9ca3af;font-size: 15px;font-weight: bold">订阅者</th>
</tr>
<tr>
<td style="font-size: 20px;color: black;font-weight: bold">{{formatNumber(github.starNum)}}</td>
<td v-if="github.starNum" style="font-size: 20px;color: black;font-weight: bold">{{formatNumber(github.starNum)}}</td>
<td v-if="github.name!==null" style="font-size: 20px;color: black;font-weight: bold;">{{briefName}}</td>
<td v-if="github.language!==null" style="font-size: 20px;color: black;font-weight: bold">{{brief}}</td>
<td v-if="github.allow_forking" style="font-size: 20px;color: black;font-weight: bold"></td>
<td v-if="!github.allow_forking" style="font-size: 20px;color: black;font-weight: bold"></td>
<td style="font-size: 20px;color: black;font-weight: bold">{{formatNumber(github.subscribers_count)}}</td>
<td v-if="github.subscribers_count" style="font-size: 20px;color: black;font-weight: bold">{{formatNumber(github.subscribers_count)}}</td>
</tr>
</table>
</template>
@@ -102,12 +102,12 @@
<th style="width: 10vw;color: #9ca3af;font-size: 15px;font-weight: bold">协议</th>
</tr>
<tr>
<td style="font-size: 20px;color: black;font-weight: bold">{{github.open_issues_count}}</td>
<td v-if="github.open_issues_count" style="font-size: 20px;color: black;font-weight: bold">{{github.open_issues_count}}</td>
<td v-if="github.organization==='Organization'" style="font-size: 20px;color: black;font-weight: bold"></td>
<td v-else-if="github.organization!=='Organization'" style="font-size: 20px;color: black;font-weight: bold"></td>
<td style="font-size: 20px;color: black;font-weight: bold">{{github.default_branch}}</td>
<td style="font-size: 20px;color: black;font-weight: bold">{{formatNumber(github.forks_count)}}</td>
<td style="font-size: 20px;color: black;font-weight: bold">{{github.license}}</td>
<td v-if="github.default_branch" style="font-size: 20px;color: black;font-weight: bold">{{github.default_branch}}</td>
<td v-if="github.forks_count" style="font-size: 20px;color: black;font-weight: bold">{{formatNumber(github.forks_count)}}</td>
<td v-if="github.license" style="font-size: 20px;color: black;font-weight: bold">{{github.license}}</td>
</tr>
</table>
</div>
@@ -702,14 +702,23 @@ export default {
}).then((res)=>{
if(res.data){
that.github.starNum=res.data.stargazers_count;
that.github.language=res.data.language;
if(res.data.language===null){
that.github.language='无';
}else {
that.github.language=res.data.language;
}
that.github.watchers_count=res.data.watchers_count;
that.github.subscribers_count=res.data.subscribers_count;
that.github.allow_forking=res.data.allow_forking;
that.github.open_issues_count=res.data.open_issues_count;
that.github.forks_count=res.data.forks_count;
that.github.organization=res.data.owner.type;
that.github.license=res.data.license.spdx_id;
if(!res.data.license){
that.github.license='无';
}else{
that.github.license=res.data.license.spdx_id;
}
that.github.name=res.data.name;
that.github.default_branch=res.data.default_branch;
that.github.avatar_url=res.data.owner.avatar_url;
@@ -850,12 +859,30 @@ export default {
},
// 截取文章内容的前 35 个字,并加上省略号
brief: function() {
return this.github.language.substr(0, 7)+'...';
if(this.github.language){
return this.github.language.substr(0, 7)+'...';
}else{
return false;
}
},
briefName: function() {
return this.github.name.substr(0, 7)+'...';
if(this.github.name){
return this.github.name.substr(0, 7)+'...';
}else{
return false;
}
},
briefTopName: function() {
if(this.projectName){
return this.projectName.substr(0, 20)+'...';
}else{
return false;
}
},
}

View File

@@ -1,12 +1,270 @@
<template>
<div>
评论管理
<el-table
border
stripe
:data="dataTable"
style="width: 100%;margin-top: 20px">
<el-table-column
prop="commentId"
label="ID"
sortable
width="50"
align="center"
>
</el-table-column>
<el-table-column
prop="userId"
align="center"
width="70"
label="用户ID">
</el-table-column>
<el-table-column
prop="projectId"
align="center"
show-overflow-tooltip
label="项目ID">
</el-table-column>
<el-table-column
prop="content"
align="center"
show-overflow-tooltip
label="评论内容">
</el-table-column>
<el-table-column
prop="isUsed"
align="center"
show-overflow-tooltip
label="是否使用过">
</el-table-column>
<el-table-column
prop="commentTime"
align="center"
show-overflow-tooltip
label="评论时间">
</el-table-column>
<el-table-column
prop="star"
show-overflow-tooltip
align="center"
label="项目评分">
</el-table-column>
<el-table-column
prop="likeNum"
align="center"
label="点赞数">
</el-table-column>
<el-table-column
prop="commentTime"
align="center"
label="评论时间">
</el-table-column>
<el-table-column
prop="isValid"
align="center"
label="是否有效">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isValid"
:active-value="1"
:inactive-value="0"
active-color="#13ce66"
inactive-color="#ff4949"
>
</el-switch>
</template>
</el-table-column>
<el-table-column
align="center"
fixed="right"
label="操作">
<template slot-scope="scope">
<el-button type="primary" icon="el-icon-edit" @click="handleEdit(scope.row)" size="small" circle></el-button>
<el-button type="danger" icon="el-icon-delete" @click="handleDelete(scope.row)" circle size="small"></el-button>
</template>
</el-table-column>
</el-table>
<el-dialog title="编辑" :visible.sync="dialogVisible" width="45%"
append-to-body
:close-on-click-modal="false"
>
<el-form ref="ruleForm" class="login_container" :model="form" status-icon label-width="80px">
<el-form-item label="ID" prop="commentId">
<el-input v-model="form.commentId" placeholder='ID' clearable disabled></el-input>
</el-form-item>
<el-form-item label="用户名ID" prop="userId">
<el-input v-model="form.userId" placeholder='用户ID' clearable></el-input>
</el-form-item>
<el-form-item label="项目ID" prop="projectId">
<el-input v-model="form.projectId"
placeholder='项目ID'
clearable></el-input>
</el-form-item>
<el-form-item label="评论内容" prop="content">
<el-input type="textarea" v-model="form.content" placeholder="评论内容" :rows="5"></el-input>
</el-form-item>
<el-form-item label="是否使用过" prop="isUsed">
<el-input v-model="form.isUsed" placeholder='是否使用过' clearable></el-input>
</el-form-item>
<el-form-item label="评论时间" prop="commentTime">
<el-input v-model="form.commentTime" placeholder='评论时间' clearable></el-input>
</el-form-item>
<el-form-item label="评分" prop="star">
<el-input v-model="form.star" placeholder='评分' clearable></el-input>
</el-form-item>
<el-form-item label="点赞数" prop="fileAddress">
<el-input v-model="form.likeNum" placeholder='点赞数' clearable></el-input>
</el-form-item>
<el-form-item label="是否有效" prop="isValid">
<el-radio-group v-model="form.isValid">
<el-radio :label="1">有效</el-radio>
<el-radio :label="0">无效</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<div style="display: flex;flex-direction: row;align-items: center;flex-wrap: nowrap;justify-content: space-between">
<el-button @click="resetForm('ruleForm')">重置</el-button>
<el-button @click="submit('ruleForm')" type="primary" style=";margin-top:10px">提交</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import axios from "axios";
import Vue from "vue";
export default {
name: "commentManage"
name: "commentManage",
data(){
return{
dataTable:[],
dialogVisible:false,
form:{
commentId:'',
userId:'',
projectId:'',
content:'',
isUsed:'',
commentTime:'',
isValid:'',
star:'',
likeNum:'',
}
}
},
methods:{
getAllComment(){
var that=this;
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/selectComment',
// URL 中的查询参数
params: {
}
}).then(function (res) {
that.dataTable=res.data;
})
},
openDialog(){
this.dialogVisible=true;
},
handleEdit(index) {
this.openDialog();
// 深拷贝
this.form = index;
},
submit() {
var _this = this;
//调用方法提交
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/updateComment',
// URL 中的查询参数
params: this.form
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
_this.dialogVisible = false;
_this.getAllComment();
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "更新成功!"),
type: 'success',
offset: 50
});
}
});
},
handleDelete(index) {
var that=this;
this.$confirm('此操作将永久删除该用户, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/deleteComment',
// URL 中的查询参数
params: {
id: index.commentId,
}
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "删除成功"),
type: 'success',
offset: 50
});
that.getAllComment();
}
});
}).catch(() => {
// 点击取消:不删除了
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
},
mounted() {
this.getAllComment();
},
}
</script>

View File

@@ -1,12 +1,317 @@
<template>
<div>
<el-table
border
stripe
:data="dataTable"
style="width: 100%;margin-top: 20px">
<el-table-column
prop="projectId"
label="ID"
sortable
width="50"
align="center"
>
</el-table-column>
<el-table-column
prop="userId"
align="center"
width="70"
label="用户ID">
</el-table-column>
<el-table-column
prop="projectName"
align="center"
show-overflow-tooltip
label="项目名称">
</el-table-column>
<el-table-column
prop="projectUrl"
align="center"
show-overflow-tooltip
label="项目地址">
</el-table-column>
<el-table-column
prop="projectIco"
align="center"
show-overflow-tooltip
label="图标">
</el-table-column>
<el-table-column
prop="projectTitle"
align="center"
show-overflow-tooltip
label="项目标题">
</el-table-column>
<el-table-column
prop="projectDescription"
show-overflow-tooltip
align="center"
label="项目描述">
</el-table-column>
<el-table-column
prop="startNum"
align="center"
label="点赞数">
</el-table-column>
<el-table-column
prop="submitTime"
align="center"
label="提交时间">
</el-table-column>
<el-table-column
prop="categoryId"
align="center"
label="主要标签">
</el-table-column>
<el-table-column
prop="lookCount"
align="center"
label="查看次数">
</el-table-column>
<el-table-column
prop="periodicals"
align="center"
width="50"
label="期刊">
</el-table-column>
<el-table-column
prop="fileAddress"
align="center"
show-overflow-tooltip
label="文件地址">
</el-table-column>
<el-table-column
prop="isValid"
align="center"
label="是否有效">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isValid"
:active-value="1"
:inactive-value="0"
active-color="#13ce66"
inactive-color="#ff4949"
>
</el-switch>
</template>
</el-table-column>
<el-table-column
align="center"
fixed="right"
label="操作">
<template slot-scope="scope">
<el-button type="primary" icon="el-icon-edit" @click="handleEdit(scope.row)" size="small" circle></el-button>
<el-button type="danger" icon="el-icon-delete" @click="handleDelete(scope.row)" circle size="small"></el-button>
</template>
</el-table-column>
</el-table>
<el-dialog title="编辑" :visible.sync="dialogVisible" width="45%"
append-to-body
:close-on-click-modal="false"
>
<el-form ref="ruleForm" class="login_container" :model="form" status-icon label-width="70px">
<el-form-item label="ID" prop="projectId">
<el-input v-model="form.projectId" placeholder='ID' clearable disabled></el-input>
</el-form-item>
<el-form-item label="用户名" prop="userId">
<el-input v-model="form.userId" placeholder='用户ID' clearable></el-input>
</el-form-item>
<el-form-item label="项目名称" prop="projectTitle">
<el-input v-model="form.projectName"
placeholder='项目名称'
clearable></el-input>
</el-form-item>
<el-form-item label="项目地址" prop="projectIco">
<el-input v-model="form.projectUrl" placeholder='项目地址' clearable></el-input>
</el-form-item>
<el-form-item label="项目图标" prop="projectIco">
<el-input v-model="form.projectIco" placeholder='项目图标' clearable></el-input>
</el-form-item>
<el-form-item label="标题" prop="projectTitle">
<el-input v-model="form.projectTitle" placeholder='标题' clearable></el-input>
</el-form-item>
<el-form-item label="项目描述" prop="projectDescription">
<el-input type="textarea" v-model="form.projectDescription" placeholder="项目描述" :rows="5"></el-input>
</el-form-item>
<el-form-item label="点赞数" prop="startNum">
<el-input v-model="form.startNum" placeholder='点赞数' clearable></el-input>
</el-form-item>
<el-form-item label="提交时间" prop="submitTime">
<el-input v-model="form.submitTime" placeholder='提交时间' clearable></el-input>
</el-form-item>
<el-form-item label="标签" prop="categoryId">
<el-input v-model="form.categoryId" placeholder='标签' clearable></el-input>
</el-form-item>
<el-form-item label="文件地址" prop="fileAddress">
<el-input v-model="form.fileAddress" placeholder='文件地址' clearable></el-input>
</el-form-item>
<el-form-item label="期刊" prop="periodicals">
<el-input v-model="form.periodicals" placeholder='期刊' clearable></el-input>
</el-form-item>
<el-form-item label="查看数" prop="lookCount">
<el-input v-model="form.lookCount" placeholder='查看数' clearable></el-input>
</el-form-item>
<el-form-item label="是否有效" prop="isValid">
<el-radio-group v-model="form.isValid">
<el-radio :label="1">有效</el-radio>
<el-radio :label="0">无效</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<div style="display: flex;flex-direction: row;align-items: center;flex-wrap: nowrap;justify-content: space-between">
<el-button @click="resetForm('ruleForm')">重置</el-button>
<el-button @click="submit('ruleForm')" type="primary" style=";margin-top:10px">提交</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import axios from "axios";
import Vue from "vue";
export default {
name: "projectManage"
name: "projectManage",
data(){
return {
dataTable:[],
dialogVisible:false,
form:{
projectId:'',
userId:'',
projectName:'',
projectUrl:'',
projectIco:'',
projectTitle:'',
projectDescription:'',
startNum:'',
submitTime:'',
categoryId:'',
isValid:'',
fileAddress:'',
periodicals:'',
lookCount:'',
}
}
},
methods:{
getAllProject(){
var that=this;
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/selectProject',
// URL 中的查询参数
params: {
}
}).then(function (res) {
that.dataTable=res.data;
})
},
submit() {
var _this = this;
//调用方法提交
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/updateProject',
// URL 中的查询参数
params: this.form
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
_this.dialogVisible = false;
_this.getAllProject();
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "更新成功!"),
type: 'success',
offset: 50
});
}
});
},
openDialog(){
this.dialogVisible=true;
},
handleEdit(index) {
this.openDialog();
// 深拷贝
this.form = index;
},
handleDelete(index) {
var that=this;
this.$confirm('此操作将永久删除该用户, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/deleteProject',
// URL 中的查询参数
params: {
id: index.projectId,
}
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "删除成功"),
type: 'success',
offset: 50
});
that.getAllProject();
}
});
}).catch(() => {
// 点击取消:不删除了
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
},
mounted() {
this.getAllProject();
}
}
</script>