feat: fetch github contributors in about page.

pull/3445/head
ruibaby 2020-01-31 16:10:27 +08:00
parent cde0d1333d
commit 93d53938bf
1 changed files with 45 additions and 105 deletions

View File

@ -55,10 +55,10 @@
href="https://github.com/halo-dev" href="https://github.com/halo-dev"
target="_blank" target="_blank"
style="margin-right: 10px;" style="margin-right: 10px;"
>开源地址 >开源组织
<a-icon type="link" /></a> <a-icon type="link" /></a>
<a <a
href="https://halo.run/guide" href="https://halo.run"
target="_blank" target="_blank"
style="margin-right: 10px;" style="margin-right: 10px;"
>用户文档 >用户文档
@ -75,39 +75,26 @@
title="开发者" title="开发者"
:bordered="false" :bordered="false"
:bodyStyle="{ padding: '16px' }" :bodyStyle="{ padding: '16px' }"
:loading="contributorsLoading"
> >
<a <a
:href="item.github" :href="item.html_url"
v-for="(item,index) in developers" v-for="(item,index) in contributors"
:key="index" :key="index"
target="_blank" target="_blank"
> >
<a-tooltip <a-tooltip
placement="top" placement="top"
:title="item.name" :title="item.login"
> >
<a-avatar <a-avatar
size="large" size="large"
:src="item.avatar" :src="item.avatar_url"
:style="{ marginRight: '10px' }" :style="{ marginRight: '10px',marginBottom: '10px'}"
/> />
</a-tooltip> </a-tooltip>
</a> </a>
</a-card> </a-card>
<a-card
title="时间轴"
:bordered="false"
:bodyStyle="{ padding: '16px' }"
>
<a-timeline>
<a-timeline-item>...</a-timeline-item>
<a-timeline-item
v-for="(item, index) in steps"
:key="index"
>{{ item.date }} {{ item.content }}</a-timeline-item>
</a-timeline>
</a-card>
</a-card> </a-card>
</a-col> </a-col>
</a-row> </a-row>
@ -122,97 +109,36 @@ export default {
return { return {
adminVersion: this.VERSION, adminVersion: this.VERSION,
environments: {}, environments: {},
developers: [ contributors: [
{ {
name: 'Ryan Wang', login: '',
avatar: '//cn.gravatar.com/avatar/7cc7f29278071bd4dce995612d428834?s=256&d=mm', id: 0,
website: 'https://ryanc.cc', node_id: '',
github: 'https://github.com/ruibaby' avatar_url: '',
}, gravatar_id: '',
{ url: '',
name: 'John Niang', html_url: '',
avatar: '//cn.gravatar.com/avatar/1dcf60ef27363dae539385d5bae9b2bd?s=256&d=mm', followers_url: '',
website: 'https://johnniang.me', following_url: '',
github: 'https://github.com/johnniang' gists_url: '',
}, starred_url: '',
{ subscriptions_url: '',
name: 'Aquan', organizations_url: '',
avatar: '//cn.gravatar.com/avatar/3958035fa354403fa9ca3fca36b08068?s=256&d=mm', repos_url: '',
website: 'https://blog.eunji.cn', events_url: '',
github: 'https://github.com/aquanlerou' received_events_url: '',
}, type: '',
{ site_admin: false,
name: 'appdev', contributions: 0
avatar: '//cn.gravatar.com/avatar/08cf681fb7c6ad1b4fe70a8269c2103c?s=256&d=mm',
website: 'https://www.apkdv.com',
github: 'https://github.com/appdev'
},
{
name: 'guqing',
avatar: '//cn.gravatar.com/avatar/ad062ba572c8b006bfd2cbfc43fdee5e?s=256&d=mm',
website: 'http://www.guqing.xyz',
github: 'https://github.com/guqing'
}
],
steps: [
{
date: '2019-09-11',
content: 'Halo v1.1.0 发布'
},
{
date: '2019-07-09',
content: 'Halo v1.0.3 发布'
},
{
date: '2019-07-08',
content: 'Star 数达到 6500'
},
{
date: '2019-06-01',
content: '1.0 正式版发布'
},
{
date: '2019-05-03',
content: 'Star 数达到 3300'
},
{
date: '2019-01-30',
content: 'John Niang 加入开发'
},
{
date: '2018-10-18',
content: '构建镜像到 Docker hub'
},
{
date: '2018-09-22',
content: 'Star 数达到 800'
},
{
date: '2018-05-02',
content: '第一条 Issue'
},
{
date: '2018-05-01',
content: 'Star 数达到 100'
},
{
date: '2018-04-29',
content: '第一个 Pull request'
},
{
date: '2018-04-28',
content: '正式开源'
},
{
date: '2018-03-21',
content: '确定命名为 Halo并上传到 Github'
} }
], ],
contributorsLoading: true,
updating: false updating: false
} }
}, },
created() { created() {
this.getEnvironments() this.getEnvironments()
this.fetchContributors()
this.checkServerUpdate() this.checkServerUpdate()
this.checkAdminUpdate() this.checkAdminUpdate()
}, },
@ -246,7 +172,7 @@ export default {
Admin 版本${this.adminVersion} Admin 版本${this.adminVersion}
数据库${this.environments.database} 数据库${this.environments.database}
运行模式${this.environments.mode} 运行模式${this.environments.mode}
UA 信息${navigator.userAgent}` User Agent${navigator.userAgent}`
this.$copyText(text) this.$copyText(text)
.then(message => { .then(message => {
this.$log.debug('copy', message) this.$log.debug('copy', message)
@ -257,6 +183,20 @@ UA 信息:${navigator.userAgent}`
this.$message.error('复制失败!') this.$message.error('复制失败!')
}) })
}, },
async fetchContributors() {
this.contributorsLoading = true
const _this = this
axios
.get('https://api.github.com/repos/halo-dev/halo/contributors')
.then(response => {
console.log(response.data)
_this.contributors = response.data
this.contributorsLoading = false
})
.catch(function(error) {
console.error('Fetch contributors error', error)
})
},
async checkServerUpdate() { async checkServerUpdate() {
const _this = this const _this = this