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;
}
},
}