Skip to content

Commit

Permalink
wanandroid frist commit
Browse files Browse the repository at this point in the history
  • Loading branch information
weidh1990 committed Jul 30, 2018
1 parent d08aac8 commit 471c6d6
Show file tree
Hide file tree
Showing 40 changed files with 1,141 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app.js
@@ -0,0 +1,3 @@
//app.js
App({
})
52 changes: 52 additions & 0 deletions app.json
@@ -0,0 +1,52 @@
{
"pages":[
"pages/index/index",
"pages/knowledge/knowledge",
"pages/navigation/navigation",
"pages/project/project",
"pages/webpage/webpage"
],
"subPackages":[
{
"root": "packageKnowledge",
"pages": [
"pages/knowledgeInfo/knowledgeInfo"
]
}
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#f60",
"navigationBarTitleText": "首页",
"navigationBarTextStyle":"white"
},
"tabBar": {
"color": "#66666666",
"selectedColor": "#f60",
"backgroundColor": "#fff",
"list": [{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "assets/icons/icon_home_pager_not_selected.png",
"selectedIconPath": "assets/icons/icon_home_pager_selected.png"
},
{
"pagePath": "pages/knowledge/knowledge",
"text": "知识体系",
"iconPath": "assets/icons/icon_knowledge_hierarchy_not_selected.png",
"selectedIconPath": "assets/icons/icon_knowledge_hierarchy_selected.png"
},
{
"pagePath": "pages/navigation/navigation",
"text": "导航",
"iconPath": "assets/icons/icon_navigation_not_selected.png",
"selectedIconPath": "assets/icons/icon_navigation_selected.png"
},
{
"pagePath": "pages/project/project",
"text": "项目",
"iconPath": "assets/icons/icon_project_not_selected.png",
"selectedIconPath": "assets/icons/icon_project_selected.png"
}]
}
}
62 changes: 62 additions & 0 deletions app.wxss
@@ -0,0 +1,62 @@
/**app.wxss**/
page{
background-color: rgba(129, 116, 116, 0.068);
}

.row-mid {
display: flex;
flex-direction: row;
align-items: center;
}

.bg-item {
background-color: white;
padding: 20rpx 20rpx;
margin: 20rpx 20rpx;
border: 1rpx solid rgba(0, 0, 0, 0.2);
border-radius: 10rpx;
}

/* 功能封装9:加载更多样式 */

.loadmore {
color: #888;
font-size: 16px;
line-height: 50rpx;
display: block;
text-align: center;
height: 80rpx;
}

.page-body {
padding: 20rpx 0;
}

.loadmore.loading::before {
content: '';
width: 40rpx;
height: 40rpx;
margin-top: -10rpx;
margin-right: 10rpx;
display: inline-block;
vertical-align: middle;
animation: loading 1s steps(12) infinite;
background: transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhb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iLz48L3N2Zz4=) no-repeat;
background-size: 100%;
}

@keyframes loading {
0% {
transform: rotate(0deg);
}

100% {
transform: rotate(-360deg);
}
}

.ell{
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
Binary file added assets/icons/icon_home_pager_not_selected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/icon_home_pager_selected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/icon_navigation_not_selected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/icon_navigation_selected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/icon_project_not_selected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/icon_project_selected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/heart.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/ic_launcher_round.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/right.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/time-circle.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
116 changes: 116 additions & 0 deletions packageKnowledge/pages/knowledgeInfo/knowledgeInfo.js
@@ -0,0 +1,116 @@
Page({

/**
* 页面的初始数据
*/
data: {
projectList:[],
name:"",
hasMore:true,
blogList:[],
pageIndex:-1,
pageSize:20,
blogListId:0
},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options);
if (options.catId){
this.setData({
blogListId: options.catId
})
}

if (options.title){
wx.setNavigationBarTitle({
title: options.title,
})
}

if(options.className){
this.setData({
name: options.className
})
}

this.loadMore();
},

loadMore:function(){
if(!this.data.blogListId){
return;
}
if(!this.data.hasMore){
return ;
}
++this.data.pageIndex;
wx.request({
url: 'http://www.wanandroid.com/article/list/' + this.data.pageIndex +'/json',
data:{
cid: this.data.blogListId
},
success:(res)=>{
var newList = this.data.blogList.concat(res.data.data.datas);
var length = res.data.data.total;
var flag = (this.data.pageIndex + 1) * this.data.pageSize < length;
this.setData({
blogList: newList,
hasMore:flag
})
}
})
},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {

},

/**
* 生命周期函数--监听页面显示
*/
onShow: function () {

},

/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {

},

/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {

},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {

},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.loadMore();

},

/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {

}
})
1 change: 1 addition & 0 deletions packageKnowledge/pages/knowledgeInfo/knowledgeInfo.json
@@ -0,0 +1 @@
{}
24 changes: 24 additions & 0 deletions packageKnowledge/pages/knowledgeInfo/knowledgeInfo.wxml
@@ -0,0 +1,24 @@
<view class="content">
<text class='text-classify'>{{ name }}</text>

<view>
<navigator class='bg-item' wx:for="{{ blogList }}" wx:key="{{ id }}" url='/pages/webpage/webpage?webUrl={{ item.link }}'>
<view class='top-info row-mid'>
<image src='/assets/images/ic_launcher_round.png'></image>
<text class='blog-title'>{{ item.author }}</text>
<text class='blog-desc'>{{ item.superChapterName +"/"+ item.chapterName }}</text>
</view>
<text class='text-mid'>{{ item.title }}</text>
<view class='bottom-info row-mid'>
<image class="heart-img" src='/assets/images/heart.png'></image>
<image class="time-img" src='/assets/images/time-circle.png'></image>
<text class='blog-time'>{{ item.niceDate }}</text>
</view>
</navigator>
</view>

<view class='loadmore loading' wx:if="{{ hasMore }}">
<text>加载更多...</text>
</view>
<view class='loadmore' wx:else>你已经到达我的底线了</view>
</view>
66 changes: 66 additions & 0 deletions packageKnowledge/pages/knowledgeInfo/knowledgeInfo.wxss
@@ -0,0 +1,66 @@
.text-classify{
font-size: 16px;
color: #666;
margin: 20rpx 0rpx;
display: block;
text-align: center;
}

.top-info{
font-size: 8 px;
color: rgba(37, 32, 32, 0.699);
position: relative;
}

.blog-desc{
color: blue;
position: absolute;
right: 0;
margin-right: 40rpx;
font-size: 12px;
}

.top-info image{
width: 50rpx;
height: 50rpx;
margin-right: 20rpx;
}

.blog-title{
font-size: 12px;
}

.text-mid{
color: rgba(37, 32, 32, 0.801);
font-size: 14px;
text-align: center;
display: block;
margin: 10rpx 0rpx;
}

.heart-img{
width: 50rpx;
height: 50rpx;
}

.time-img{
width: 50rpx;
height: 50rpx;
margin-left: 20rpx;
margin-right: 10rpx;
}

.blog-time{
color: rgba(37, 32, 32, 0.801);
font-size: 14px;
}

.new-flag{
position: absolute;
right: 0;
margin-right: 40rpx;
border: 1rpx solid blue;
color: blue;
padding: 0rpx 10rpx;
font-size: 16px;
}

0 comments on commit 471c6d6

Please sign in to comment.