添加其他数据/完善其他功能

This commit is contained in:
2023-07-06 21:51:28 +08:00
parent 5d0c1856a4
commit 18c6e28ba7
11 changed files with 90533 additions and 66 deletions

View File

@@ -9,7 +9,7 @@
<span><i class="el-icon-menu"></i> 热门标签</span>
</div>
<div class="bottom clearfix">
<el-scrollbar style="height:50vh">
<el-scrollbar style="height:60vh">
<el-tabs v-model="currentTabName" tab-position="left" @tab-click="typeChange" lazy>
<el-tab-pane v-for="(tag,index) in tags" :key="index" :index="tag.categoryId" :name="tag.categoryName" >
<span slot="label" style="border-radius: 10px;align-items: center;display: flex;flex-direction: row;justify-content: flex-start" v-html="tag.category"></span>
@@ -76,28 +76,40 @@
<el-card class="box-card" style="margin-top: 20px;width: 15vw">
<div slot="header" class="clearfix">
<el-statistic group-separator="," :precision="0" decimal-separator="." :value="userTotal" title="用户总数">
<template slot="prefix">
<i class="el-icon-s-flag" style="color: red"></i>
</template>
<template slot="suffix">
<i class="el-icon-s-flag" style="color: blue"></i>
</template>
</el-statistic>
<div style="display: flex;flex-direction: row;flex-wrap: nowrap;justify-content: space-between">
<div style="display: flex;flex-direction: column;flex-wrap: nowrap">
<span style="font-size: 16px;color: #9ca3af;font-weight: bold">用户总数</span>
<span style="font-size: 30px">{{userTotal}}</span>
</div>
<div style="display: flex;flex-direction: column;flex-wrap: nowrap">
<span style="font-size: 16px;color: #9ca3af;font-weight: bold">开源项目</span>
<span style="font-size: 30px">{{projectTotal}}</span>
</div>
</div>
<!-- <el-statistic group-separator="," :precision="0" decimal-separator="." :value="userTotal" title="用户总数">-->
<!-- <template slot="prefix">-->
<!-- <i class="el-icon-s-flag" style="color: red"></i>-->
<!-- </template>-->
<!-- <template slot="suffix">-->
<!-- <i class="el-icon-s-flag" style="color: blue"></i>-->
<!-- </template>-->
<!-- </el-statistic>-->
<el-statistic group-separator="," :precision="0" decimal-separator="." :value="projectTotal" title="项目总数">
<template slot="prefix">
<i class="el-icon-s-flag" style="color: red"></i>
</template>
<template slot="suffix">
<i class="el-icon-s-flag" style="color: blue"></i>
</template>
</el-statistic>
<!-- <el-statistic group-separator="," :precision="0" decimal-separator="." :value="projectTotal" title="项目总数">-->
<!-- <template slot="prefix">-->
<!-- <i class="el-icon-s-flag" style="color: red"></i>-->
<!-- </template>-->
<!-- <template slot="suffix">-->
<!-- <i class="el-icon-s-flag" style="color: blue"></i>-->
<!-- </template>-->
<!-- </el-statistic>-->
</div>
<div class="text item">
<div style="font-size: 18px;color: #9ca3af;font-weight: bold"> 关于本站 </div>
<span>
HelloGitHub 是一个发现和分享有趣入门级开源项目的平台 希望大家能够在这里找到编程的快乐 轻松搞定问题的技术方案 大呼过瘾的开源神器 顺其自然地开启开源之旅
<div style=";font-size: 16px;color: #9ca3af;display: flex;flex-direction: row;justify-content: flex-start"> 关于本站 </div>
<span style="margin-top: 10px;font-size: 15px;display: flex;flex-direction: row;justify-content: flex-start;text-align: left; line-height: 1.8;">
HelloGitHub 是一个发现和分享有趣入门级开源项目的平台
希望大家能够在这里找到编程的快乐 轻松搞定问题的技术方案 大呼过瘾的开源神器
顺其自然地开启开源之旅
</span>
</div>
</el-card>

View File

@@ -39,7 +39,7 @@
</div>
<div style="margin-top: 10px">
<div style="display: flex;flex-direction: row;justify-content: space-between">
<span class="title">搜索结果</span>
<span class="title">搜索结果: {{JSON.parse(JSON.stringify(searchResults)).length}} </span>
<span class="clear" @click="clearSearchResults"><i class="el-icon-circle-close"></i>清空</span>
</div>
<div>
@@ -203,6 +203,10 @@ export default {
type:"success",
offset: 50
});
setTimeout(() => {
that.visible = true;
that.gethistorySearch();
}, 200);
}
});
}else{
@@ -230,12 +234,7 @@ export default {
this.gethistorySearch();
},
created() {
setTimeout(() => {
this.visible = true;
this.gethistorySearch();
}, 200);
},
};
</script>

View File

@@ -12,14 +12,14 @@
</div>
<div class="PageContent">
<el-card class="box-card" style="border: none">
<div style="display: flex;flex-direction: row;align-items: center;justify-content: space-between">
<div style="display: flex;flex-direction: row;align-items: center;">
<div style="display: flex;flex-direction: row;justify-content: space-between">
<div style="display: flex;flex-direction: row;">
<el-avatar shape="square" :size="70" :src="projectIco"></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="font-size: 20px;color: rgb(107 114 128);">
<span style="display: flex;flex-direction:row;justify-content: flex-start;font-size: 20px;color: rgb(107 114 128);">
{{projectTitle}}
</span>
</div>
@@ -30,9 +30,10 @@
<span style="font-size: 14px;color: #6b7280;display: flex;justify-content: flex-start">
HelloGitHub 评分
</span>
<el-rate v-model="starValue" style="display: flex;justify-content: flex-start" disabled show-score></el-rate>
<el-rate v-model="totalStar" style="display: flex;justify-content: flex-start" disabled show-score text-color="#ff9900"
score-template="{value}"></el-rate>
<span style="font-size: 12px;color: #59A3A4;display: flex;justify-content: flex-start">
0 评分
{{ commentNum }} 评分
</span>
</div>
</div>
@@ -40,7 +41,7 @@
</div>
<div style="display: flex;flex-direction: row;margin-top: 10px;justify-content: space-between">
<div style="width: 250px;height: 60px;background-color: #59A3A4">
<img :src="'https://starchart.cc/'+projectName+'.svg'" style="width: 250px;height: 60px;">
</div>
<div style="display: flex;flex-direction: row;align-items: center;">
<el-dropdown>
@@ -48,8 +49,9 @@
访问<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item><el-link :href="projectUrl">源码</el-link></el-dropdown-item>
<el-dropdown-item>下载</el-dropdown-item>
<el-dropdown-item><el-link :underline="false" @click="goTo(projectUrl)">源码</el-link></el-dropdown-item>
<el-dropdown-item> <el-link :underline="false" @click="goTo('https://github.com/'+projectName+'/releases')">官方下载</el-link></el-dropdown-item>
<el-dropdown-item> <el-link :underline="false">快速下载</el-link></el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button v-show="isRouterAlive" v-if="Like===0" @click="addStar" style="height: 60px;width: 150px;margin-left: 10px" icon="el-icon-star-off" type="success"> {{startNum}}</el-button>
@@ -60,11 +62,11 @@
<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">Apache-2.0</span>
<span style="margin-left: 5px;color: #00b2ff">{{github.license}}</span>
</div>
<div style="display: flex;flex-direction: row;flex-wrap: nowrap;">
<el-link icon="el-icon-chat-dot-square">评论</el-link>
<el-link icon="el-icon-share" style="margin-left: 5px">分享 </el-link>
<el-link :underline="false" @click="toComment('#comment')" icon="el-icon-chat-dot-square">评论</el-link>
<el-link :underline="false" @click="copyText" icon="el-icon-share" style="margin-left: 5px">分享 </el-link>
</div>
</div>
@@ -75,17 +77,18 @@
<table>
<tr>
<th style="width: 10vw;color: #9ca3af;font-size: 15px;font-weight: bold">星数</th>
<th style="width: 10vw;color: #9ca3af;font-size: 15px;font-weight: bold">中文</th>
<th style="width: 10vw;color: #9ca3af;font-size: 15px;font-weight: bold">名称</th>
<th style="width: 10vw;color: #9ca3af;font-size: 15px;font-weight: bold">主语言</th>
<th style="width: 10vw;color: #9ca3af;font-size: 15px;font-weight: bold">活跃</th>
<th style="width: 10vw;color: #9ca3af;font-size: 15px;font-weight: bold">贡献</th>
<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">512</td>
<td style="font-size: 20px;color: black;font-weight: bold"></td>
<td style="font-size: 20px;color: black;font-weight: bold">C++</td>
<td style="font-size: 20px;color: black;font-weight: bold"></td>
<td style="font-size: 20px;color: black;font-weight: bold">28</td>
<td style="font-size: 20px;color: black;font-weight: bold">{{formatNumber(github.starNum)}}</td>
<td style="font-size: 20px;color: black;font-weight: bold;">{{briefName}}</td>
<td 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>
</tr>
</table>
</template>
@@ -94,16 +97,16 @@
<tr>
<th style="width: 10vw;color: #9ca3af;font-size: 15px;font-weight: bold">Issues</th>
<th style="width: 10vw;color: #9ca3af;font-size: 15px;font-weight: bold">组织</th>
<th style="width: 10vw;color: #9ca3af;font-size: 15px;font-weight: bold">最新版本</th>
<th style="width: 10vw;color: #9ca3af;font-size: 15px;font-weight: bold">默认分支</th>
<th style="width: 10vw;color: #9ca3af;font-size: 15px;font-weight: bold">Forks</th>
<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">4</td>
<td style="font-size: 20px;color: black;font-weight: bold"></td>
<td style="font-size: 20px;color: black;font-weight: bold">1.6.7</td>
<td style="font-size: 20px;color: black;font-weight: bold">92</td>
<td style="font-size: 20px;color: black;font-weight: bold">Apache-2.0</td>
<td 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 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>
</tr>
</table>
</div>
@@ -136,7 +139,7 @@
<el-card class="box-card" style="margin-top: 10px;border: none">
<div slot="header" class="clearfix" style="display: flex;justify-content: flex-start">
<span style="font-size: 24px;font-weight: bold">评论</span>
<span id="comment" style="font-size: 24px;font-weight: bold">评论</span>
</div>
<div class="text item">
<div style="display: flex;flex-direction: row;flex-wrap: nowrap">
@@ -297,7 +300,7 @@ export default {
data(){
return{
starValue:null,
activeNames: ['1'],
activeNames: [],
activeName:'first',
activeCommentName:'last',
loginDialogVisible:false,
@@ -315,6 +318,7 @@ export default {
projectTitle:null,
projectUrl:null,
startNum:null,
num:null,
projectDescription:null,
projectIco:null,
periodicals:null,
@@ -342,13 +346,29 @@ export default {
checked:false,
tabCheckedLast:true,
tabCheckedHot:false,
averageStarNum:0,
github:{
starNum:null,
language:'',
watchers_count:null,
subscribers_count:null,
allow_forking:null,
open_issues_count:null,
forks_count:null,
organization:null,
license:null,
name:'',
default_branch:null,
},
totalStar:3.7,
Content:'',
}
},
mounted() {
this.getProjectDetail();
this.getLastComment();
this.isStart();
},
watch: {
$route () {
@@ -358,6 +378,16 @@ export default {
}
},
methods:{
toComment(id){
document.querySelector(id).scrollIntoView(true)
var auchor=this.$el.querySelector(id)
document.body.scrollTop=auchor.offsetTop
},
goTo(url){
window.open(url);
},
goBack() {
window.history.go(-1);
},
@@ -372,7 +402,6 @@ export default {
id:this.$route.query.id
}
}).then(function (res) {
// console.log(res);
that.CategoryName=res.data.CategoryName;
that.projectName=res.data.project.projectName;
that.projectTitle=res.data.project.projectTitle;
@@ -383,7 +412,8 @@ export default {
that.periodicals=res.data.project.periodicals;
that.userId=res.data.project.userId;
that.projectId=res.data.project.projectId;
that.num=res.data.project.num;
that.getDetailByGitHub();
});
},
reload() {
@@ -405,6 +435,7 @@ export default {
trait:tab.name
}
}).then(function (res) {
console.log(res);
that.commentContent=res.data;
that.commentNum=Object.keys(that.commentContent).length;
if(tab.name==='last'){
@@ -457,10 +488,12 @@ export default {
});
}
}else{
Vue.prototype.$notify.error({
title: '错误',
message: "请先登录!",
offset: 50
});
}
@@ -597,10 +630,74 @@ export default {
})
}
})
},
getDetailByGitHub(){
var that=this;
axios({
method: 'get',
// 请求的地址
url: '/api/'+this.projectName,
// URL 中的查询参数
params: {
}
}).then((res)=>{
// console.log(res)
that.github.starNum=res.data.stargazers_count;
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.organization.type;
that.github.license=res.data.license.spdx_id;
that.github.name=res.data.name;
that.github.default_branch=res.data.default_branch;
});
},
copyText(){
this.Content=this.projectName+' : ' +this.projectTitle+', 更多详情尽在 : '+this.projectUrl;
var input = document.createElement("input"); // js创建一个input输入框
input.value = this.Content; // 将需要复制的文本赋值到创建的input输入框中
document.body.appendChild(input); // 将输入框暂时创建到实例里面
input.select(); // 选中输入框中的内容
document.execCommand("Copy"); // 执行复制操作
document.body.removeChild(input); // 最后删除实例中临时创建的input输入框完成复制操作
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "项目信息已复制,快去分享吧~"),
type: 'success',
offset: 50
});
},
},
computed: {
// 对时间进行格式化
formatTime: function() {
if (this.projectLists) {
const dt = new Date(this.projectLists.submitTime)
const year=dt.getFullYear()
const month = dt.getMonth()
const date = dt.getDate()
return `${year}-${month}-${date}`
}
return '';
},
// 截取文章内容的前 35 个字,并加上省略号
brief: function() {
return this.github.language.substr(0, 7)+'...';
},
briefName: function() {
return this.github.name.substr(0, 7)+'...';
},
}

View File

@@ -9,7 +9,7 @@
<el-avatar :size="40" :src="item.projectIco"></el-avatar>
</div>
<div style="display: flex;flex-direction: column;flex-wrap: nowrap;justify-content: left">
<span style="margin-left: 10px;font-size: 14px;font-weight: bold;display: flex;flex-direction: row;justify-content: flex-start">{{item.projectName}}</span>
<span style="margin-left: 10px;font-size: 14px;font-weight: bold;display: flex;flex-direction: row;justify-content: flex-start">{{brief(item.projectName)}}</span>
<div style=";margin-left:10px;margin-top: 5px;display: flex;flex-direction: row;justify-content: space-between;flex-wrap: nowrap">
<div style="align-items: center;font-size: 12px;color: #9ca3af">
<i class="el-icon-star-off"></i> <span>{{formatNumber(item.lookCount)}}</span>
@@ -37,6 +37,7 @@ export default {
mounted() {
this.getRandomProject();
},
methods:{
getRandomProject(){
var that=this;
@@ -63,6 +64,9 @@ export default {
}})
// console.log(this.$route.query.id)
},
brief(content) {
return content.substr(0, 16) + '...';
},
}
}
</script>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,46 @@
[{
"license": "mit",
"count": "1551711"
}, {
"license": "apache-2.0",
"count": "455316"
}, {
"license": "gpl-2.0",
"count": "376453"
}, {
"license": "gpl-3.0",
"count": "284761"
}, {
"license": "bsd-3-clause",
"count": "161041"
}, {
"license": "bsd-2-clause",
"count": "57412"
}, {
"license": "unlicense",
"count": "43899"
}, {
"license": "lgpl-3.0",
"count": "38213"
}, {
"license": "agpl-3.0",
"count": "38034"
}, {
"license": "cc0-1.0",
"count": "28600"
}, {
"license": "epl-1.0",
"count": "24074"
}, {
"license": "lgpl-2.1",
"count": "23872"
}, {
"license": "isc",
"count": "17690"
}, {
"license": "mpl-2.0",
"count": "17421"
}, {
"license": "artistic-2.0",
"count": "9413"
}]

View File

@@ -5,9 +5,9 @@
</el-header>
<el-container>
<el-main>
<!-- <keep-alive>-->
<keep-alive>
<router-view></router-view>
<!-- </keep-alive>-->
</keep-alive>
</el-main>
</el-container>
</el-container>

View File

@@ -8,12 +8,12 @@ module.exports = {
// 关闭语法检查
lintOnSave:false,
devServer: {
host: 'localhost', // 本地域名/ip地址
port: '8080', // 端口号
// host: 'localhost', // 本地域名/ip地址
// port: '8080', // 端口号
proxy: {
'/api': {
//后端接口的baseurl
target: 'http://localhost/helloGithub_war_exploded/',
target: 'https://api.github.com/repos',
//是否允许跨域
changeOrigin: true,
pathRewrite: {