Skip to content

Commit

Permalink
hzuapps#84 hzuapps#100 期末作业:开发一个仿微信小程序
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjianyangwen committed Oct 25, 2017
1 parent 97abd51 commit 5704388
Show file tree
Hide file tree
Showing 208 changed files with 3,012 additions and 0 deletions.
30 changes: 30 additions & 0 deletions 1517060328/wen/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//app.js
App({
onLaunch: function () {
//调用API从本地缓存中获取数据
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
},
getUserInfo:function(cb){
var that = this
if(this.globalData.userInfo){
typeof cb == "function" && cb(this.globalData.userInfo)
}else{
//调用登录接口
wx.login({
success: function () {
wx.getUserInfo({
success: function (res) {
that.globalData.userInfo = res.userInfo
typeof cb == "function" && cb(that.globalData.userInfo)
}
})
}
})
}
},
globalData:{
userInfo:null
}
})
42 changes: 42 additions & 0 deletions 1517060328/wen/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"pages": [
"pages/index/index",
"pages/comp/scroll",
"pages/logs/logs",
"pages/comp/view",
"pages/example/navbar/navbar",
"pages/example/grid/grid",
"pages/example/list/list",
"pages/example/article/article",
"pages/form/form"

],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#7A67EE",
"navigationBarTitleText": "第一个小程序",
"navigationBarTextStyle": "white"
},
"tabBar": {
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "pages/example/images/17.png",
"selectedIconPath": "pages/example/images/17.png",
"text": "首页"
},
{
"pagePath": "pages/comp/scroll",
"iconPath": "pages/example/images/80.jpg",
"selectedIconPath": "pages/example/images/80.jpg",
"text": "发现"
},
{
"pagePath": "pages/form/form",
"iconPath": "pages/example/images/10.jpg",
"selectedIconPath": "pages/example/images/10.jpg",
"text": "关于"
}
]
}
}
11 changes: 11 additions & 0 deletions 1517060328/wen/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;
}
110 changes: 110 additions & 0 deletions 1517060328/wen/pages/comp/article.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// pages/comp/scroll.js
var base64 = require("../example/images/base64");

Page({

/**
* 页面的初始数据
*/
data: {
isEnd: false,
messages: [{
name: "张三",
last: "您好!"
}, {
name: "李四",
last: "您好!"
}, {
name: "李四",
last: "您好!"
}, {
name: "李四",
last: "您好!"
}, {
name: "李四",
last: "您好!"
}, {
name: "李四",
last: "您好!"
}, {
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 1517060328/wen/pages/comp/article.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 2 additions & 0 deletions 1517060328/wen/pages/comp/article.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!--pages/comp/article.wxml-->
<text>pages/comp/article.wxml</text>
1 change: 1 addition & 0 deletions 1517060328/wen/pages/comp/article.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* pages/comp/article.wxss */
66 changes: 66 additions & 0 deletions 1517060328/wen/pages/comp/form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// pages/comp/form.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 1517060328/wen/pages/comp/form.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 2 additions & 0 deletions 1517060328/wen/pages/comp/form.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!--pages/comp/form.wxml-->
<text>pages/comp/form.wxml</text>
1 change: 1 addition & 0 deletions 1517060328/wen/pages/comp/form.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* pages/comp/form.wxss */
110 changes: 110 additions & 0 deletions 1517060328/wen/pages/comp/scroll.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// pages/comp/scroll.js
var base64 = require("../example/images/base64");

Page({

/**
* 页面的初始数据
*/
data: {
isEnd: false,
messages: [{
name: "斯蒂芬-库里",
last: "勇士!"
}, {
name: "德马尔-德罗赞",
last: "猛龙!"
}, {
name: "乔尔-恩比德",
last: "76人"
}, {
name: "詹姆斯-哈登",
last: "火箭"
}, {
name: "泰森-钱德勒",
last: "太阳"
}, {
name: "扬尼斯-阿德托昆博",
last: "雄鹿"
}, {
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 1517060328/wen/pages/comp/scroll.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading

0 comments on commit 5704388

Please sign in to comment.