Skip to content

Commit

Permalink
Merge pull request #125 from lylsy0428/master
Browse files Browse the repository at this point in the history
#84 #102 期末作业
  • Loading branch information
zengsn authored Nov 1, 2017
2 parents 96cd392 + 27e77bd commit 22a7eda
Show file tree
Hide file tree
Showing 38 changed files with 544 additions and 0 deletions.
39 changes: 39 additions & 0 deletions 1517060319/final/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//app.js
App({
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)

// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// 获取用户信息
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo

// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
}
}
})
},
globalData: {
userInfo: null
}
})
39 changes: 39 additions & 0 deletions 1517060319/final/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"pages": [
"pages/comp/scroll",
"pages/index/index",
"pages/logs/logs",
"pages/comp/view",
"pages/example/article/article",
"pages/example/list/list",
"pages/form/form"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#BBDEF8",
"navigationBarTitleText": "第一个小程序",
"navigationBarTextStyle": "white"
},
"tabBar": {
"list": [
{
"pagePath": "pages/comp/scroll",
"iconPath": "pages/example/images/a1.png",
"selectedIconPath": "pages/example/images/a2.png",
"text": "首页"
},
{
"pagePath": "pages/comp/view",
"iconPath": "pages/example/images/b1.png",
"selectedIconPath": "pages/example/images/b2.png",
"text": "发现"
},
{
"pagePath": "pages/form/form",
"iconPath": "pages/example/images/c1.png",
"selectedIconPath": "pages/example/images/c2.png",
"text": "设置"
}
]
}
}
11 changes: 11 additions & 0 deletions 1517060319/final/app.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**app.wxss**/
@import 'style/weui.wxss';
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}
117 changes: 117 additions & 0 deletions 1517060319/final/pages/comp/scroll.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// pages/comp/scroll.js
var base64 = require("../example/images/base64");

Page({

/**
* 页面的初始数据
*/
data: {
isEnd: false,
messages: [ {
image:"/pages/example/images/tea1.png",
name: "绿茶",
last: "绿茶种类",
}, {
image:"/pages/example/images/tea2.png",
name: "白茶",
last: "白茶种类",
}, {
image: "/pages/example/images/tea3.png",
name: "普洱茶",
last: "普洱茶种类"
}, {
image: "/pages/example/images/tea4.png",
name: "功夫茶",
last: "功夫茶种类"
}, {
image: "/pages/example/images/tea5.png",
name: "红茶",
last: "红茶种类"
}, {
image: "/pages/example/images/tea6.png",
name: "花茶",
last: "花茶种类!"
} ,{
image: "/pages/example/images/tea7.png",
name: "乌龙茶",
last: "乌龙茶种类!"
}]
},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
icon20: base64.icon20,
icon60: base64.icon60
});
},

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

},

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

},

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

},

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

},

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

},

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

},

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

},

onEnd: function () {
console.log("onEnd")
var that = this;
var data = that.data;
that.setData({
isEnd: true /*,
messages: data.messages.concat([{
name: "Tom",
last: "Hello!"
}, {
name: "john",
last: "yes."
}]) */
});

}
})
1 change: 1 addition & 0 deletions 1517060319/final/pages/comp/scroll.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
27 changes: 27 additions & 0 deletions 1517060319/final/pages/comp/scroll.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--pages/comp/scroll.wxml-->
<scroll-view class="page" bindtouchend='onEnd'>
<view class="page__hd">
<view class="page__title">Tea</view>
<view class="page__desc">茶类</view>
</view>
<view class="page__bd">
<view class="weui-panel weui-panel_access">
<view class="weui-panel__hd"></view>
<view class="weui-panel__bd">
<navigator url="" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active" wx:for="{{messages}}">
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg">
<image class="weui-media-box__thumb" src="{{item.image}}" />
</view>
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
<view class="weui-media-box__title"> {{item.name}}</view>
<view class="weui-media-box__desc">{{item.last}}</view>
</view>
</navigator>
</view>
</view>
<view class='weui-loadmore' wx:if="{{isEnd}}">
<view class='weui-loading'></view>
<view class='weui-loadmore__tips'>正在加载……</view>
</view>
</view>
</scroll-view>
1 change: 1 addition & 0 deletions 1517060319/final/pages/comp/scroll.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* pages/comp/scroll.wxss */
66 changes: 66 additions & 0 deletions 1517060319/final/pages/comp/view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// pages/comp/view.js
Page({

/**
* 页面的初始数据
*/
data: {

},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {

},

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

},

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

},

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

},

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

},

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

},

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

},

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

}
})
1 change: 1 addition & 0 deletions 1517060319/final/pages/comp/view.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
23 changes: 23 additions & 0 deletions 1517060319/final/pages/comp/view.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--pages/comp/view.wxml-->
<view class="page">
<view class="page__hd">
<view class="page__title">茶文化</view>
<view class="page__desc">介绍</view>
</view>
<view class="page__bd">
<view class="weui-cells__title">组件开发</view>
<view class="weui-cells weui-cells_after-title">

<navigator url="/pages/example/article/article" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__bd">茶文化简介</view>
<view class="weui-cell__ft weui-cell__ft_in-access">打开</view>
</navigator>

<navigator url="/pages/logs/logs" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__bd">启动日志</view>
<view class="weui-cell__ft weui-cell__ft_in-access">打开</view>
</navigator>

</view>
</view>
</view>
7 changes: 7 additions & 0 deletions 1517060319/final/pages/comp/view.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* pages/comp/view.wxss */
page{
background-color: #efefef;
}
image{
margin: 4px 0;
}
1 change: 1 addition & 0 deletions 1517060319/final/pages/example/article/article.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Page({});
1 change: 1 addition & 0 deletions 1517060319/final/pages/example/article/article.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
22 changes: 22 additions & 0 deletions 1517060319/final/pages/example/article/article.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<view class="page">
<view class="page__hd">
<view class="page__title">Tea</view>
<view class="page__desc">Culture</view>
</view>
<view class="page__bd">
<view class="weui-article">
<view class="weui-article__section">
<view class="weui-article__section">
<view class="weui-article__h3">茶文化简介</view>
<view class="weui-article__p">
  茶文化意为饮茶活动过程中形成的文化特征,包括茶道、茶德、茶精神、茶联、茶书、茶具、茶画、茶学、茶故事、茶艺等等。茶文化起源地为中国。中国是茶的故乡,中国人饮茶,据说始于神农时代,少说也有4700多年了。直到现在,中华同胞还有民以茶代礼的风俗。中国各地对茶的配制是多种多样的:有太湖的熏豆茶、苏州的香味茶、湖南的姜盐茶、蜀山的侠君茶、台湾的冻顶茶、杭州的龙井茶、福建的乌龙茶等。全世界一百多个国家和地区的人喜爱品茶,各国茶文化各不相同,各有千秋;中国茶文化反映出中华民族的悠久的文明和礼仪。
</view>
<view class="weui-article__p">
<image class="weui-article__img" src="../images/tea culture1.png" mode="aspectFit" style="height: 180px" />
<image class="weui-article__img" src="../images/tea culture2.png" mode="aspectFit" style="height: 180px" />
</view>
</view>
</view>
</view>
</view>
</view>
6 changes: 6 additions & 0 deletions 1517060319/final/pages/example/article/article.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
page{
background-color: #FFFFFF;
}
image{
margin: 4px 0;
}
Binary file added 1517060319/final/pages/example/images/a1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1517060319/final/pages/example/images/a2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1517060319/final/pages/example/images/b1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1517060319/final/pages/example/images/b2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1517060319/final/pages/example/images/c1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1517060319/final/pages/example/images/c2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1517060319/final/pages/example/images/tea1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1517060319/final/pages/example/images/tea2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1517060319/final/pages/example/images/tea3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1517060319/final/pages/example/images/tea4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1517060319/final/pages/example/images/tea5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1517060319/final/pages/example/images/tea6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1517060319/final/pages/example/images/tea7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 22a7eda

Please sign in to comment.