Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
uniquexiaobai
committed
Oct 11, 2016
1 parent
157322c
commit 8943727
Showing
6 changed files
with
100 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const services = require('../../utils/services.js'); | ||
|
||
Page({ | ||
data: { | ||
loading_hidden: true | ||
}, | ||
|
||
onLoad (options) { | ||
this.setData({ | ||
repo_full_name: options.repo_full_name, | ||
loading_hidden: false | ||
}); | ||
this.fetchRepoData(this._reloadUrl()); | ||
}, | ||
|
||
_reloadUrl () { | ||
const basic_url = 'https://api.github.com/repos/'; | ||
return basic_url + this.data.repo_full_name; | ||
}, | ||
|
||
fetchRepoData (url) { | ||
services.fetch(url).then(res => { | ||
this.setData({ | ||
repo: res.data, | ||
loading_hidden: true | ||
}); | ||
}); | ||
}, | ||
|
||
onReady () { | ||
wx.setNavigationBarTitle({ | ||
title: this.data.repo_full_name | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<view class="container col"> | ||
<loading hidden="{{loading_hidden}}"> | ||
玩命加载中... | ||
</loading> | ||
<view class="repo"> | ||
<view class="row repo_top"> | ||
<view class="row align_center repo_top_item"> | ||
<image class="avatar" mode="aspectFit" src="{{repo.owner.avatar_url}}"></image> | ||
<view class="owner_name">{{repo.owner.login}}</view> | ||
</view> | ||
<view class="row align_center repo_top_item"> | ||
<view class="watch">Watch</view> | ||
<view class="watch_number">{{repo.subscribers_count}}</view> | ||
</view> | ||
<view class="row align_center repo_top_item"> | ||
<view class="watch">Star</view> | ||
<view class="watch_number">{{repo.watchers_count}}</view> | ||
</view> | ||
</view> | ||
<view class="repo_desc">{{repo.description}}</view> | ||
</view> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.container { | ||
height: 100%; | ||
} | ||
.repo_top { | ||
justify-content: space-between; | ||
padding: 5rpx; | ||
border-bottom: 1rpx solid #CCC; | ||
} | ||
.repo_top_item { | ||
} | ||
.avatar { | ||
width: 50rpx; | ||
height: 50rpx; | ||
margin-right: 10rpx; | ||
} | ||
.owner_name { | ||
font-size: 20rpx; | ||
} | ||
.watch { | ||
font-size: 20rpx; | ||
background: #EDEDED; | ||
margin-right: 10rpx; | ||
padding: 5rpx; | ||
} | ||
.watch_number { | ||
font-size: 20rpx; | ||
} |