diff --git a/1517060319/final/app.js b/1517060319/final/app.js new file mode 100644 index 0000000..b545190 --- /dev/null +++ b/1517060319/final/app.js @@ -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 + } +}) \ No newline at end of file diff --git a/1517060319/final/app.json b/1517060319/final/app.json new file mode 100644 index 0000000..9c6b897 --- /dev/null +++ b/1517060319/final/app.json @@ -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": "设置" + } + ] + } +} \ No newline at end of file diff --git a/1517060319/final/app.wxss b/1517060319/final/app.wxss new file mode 100644 index 0000000..1559ebb --- /dev/null +++ b/1517060319/final/app.wxss @@ -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; +} \ No newline at end of file diff --git a/1517060319/final/pages/comp/scroll.js b/1517060319/final/pages/comp/scroll.js new file mode 100644 index 0000000..5184af9 --- /dev/null +++ b/1517060319/final/pages/comp/scroll.js @@ -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." + }]) */ + }); + + } +}) \ No newline at end of file diff --git a/1517060319/final/pages/comp/scroll.json b/1517060319/final/pages/comp/scroll.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/1517060319/final/pages/comp/scroll.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/1517060319/final/pages/comp/scroll.wxml b/1517060319/final/pages/comp/scroll.wxml new file mode 100644 index 0000000..567cf7b --- /dev/null +++ b/1517060319/final/pages/comp/scroll.wxml @@ -0,0 +1,27 @@ + + + + Tea + 茶类 + + + + + + + + + + + {{item.name}} + {{item.last}} + + + + + + + 正在加载…… + + + \ No newline at end of file diff --git a/1517060319/final/pages/comp/scroll.wxss b/1517060319/final/pages/comp/scroll.wxss new file mode 100644 index 0000000..14343d6 --- /dev/null +++ b/1517060319/final/pages/comp/scroll.wxss @@ -0,0 +1 @@ +/* pages/comp/scroll.wxss */ \ No newline at end of file diff --git a/1517060319/final/pages/comp/view.js b/1517060319/final/pages/comp/view.js new file mode 100644 index 0000000..5fb3fad --- /dev/null +++ b/1517060319/final/pages/comp/view.js @@ -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 () { + + } +}) \ No newline at end of file diff --git a/1517060319/final/pages/comp/view.json b/1517060319/final/pages/comp/view.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/1517060319/final/pages/comp/view.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/1517060319/final/pages/comp/view.wxml b/1517060319/final/pages/comp/view.wxml new file mode 100644 index 0000000..db8855d --- /dev/null +++ b/1517060319/final/pages/comp/view.wxml @@ -0,0 +1,23 @@ + + + + 茶文化 + 介绍 + + + 组件开发 + + + + 茶文化简介 + 打开 + + + + 启动日志 + 打开 + + + + + \ No newline at end of file diff --git a/1517060319/final/pages/comp/view.wxss b/1517060319/final/pages/comp/view.wxss new file mode 100644 index 0000000..fa824f3 --- /dev/null +++ b/1517060319/final/pages/comp/view.wxss @@ -0,0 +1,7 @@ +/* pages/comp/view.wxss */ +page{ + background-color: #efefef; +} +image{ + margin: 4px 0; +} \ No newline at end of file diff --git a/1517060319/final/pages/example/article/article.js b/1517060319/final/pages/example/article/article.js new file mode 100644 index 0000000..f16cc1a --- /dev/null +++ b/1517060319/final/pages/example/article/article.js @@ -0,0 +1 @@ +Page({}); \ No newline at end of file diff --git a/1517060319/final/pages/example/article/article.json b/1517060319/final/pages/example/article/article.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/1517060319/final/pages/example/article/article.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/1517060319/final/pages/example/article/article.wxml b/1517060319/final/pages/example/article/article.wxml new file mode 100644 index 0000000..143e4d9 --- /dev/null +++ b/1517060319/final/pages/example/article/article.wxml @@ -0,0 +1,22 @@ + + + Tea + Culture + + + + + + 茶文化简介 + +  茶文化意为饮茶活动过程中形成的文化特征,包括茶道、茶德、茶精神、茶联、茶书、茶具、茶画、茶学、茶故事、茶艺等等。茶文化起源地为中国。中国是茶的故乡,中国人饮茶,据说始于神农时代,少说也有4700多年了。直到现在,中华同胞还有民以茶代礼的风俗。中国各地对茶的配制是多种多样的:有太湖的熏豆茶、苏州的香味茶、湖南的姜盐茶、蜀山的侠君茶、台湾的冻顶茶、杭州的龙井茶、福建的乌龙茶等。全世界一百多个国家和地区的人喜爱品茶,各国茶文化各不相同,各有千秋;中国茶文化反映出中华民族的悠久的文明和礼仪。 + + + + + + + + + + \ No newline at end of file diff --git a/1517060319/final/pages/example/article/article.wxss b/1517060319/final/pages/example/article/article.wxss new file mode 100644 index 0000000..fa064c6 --- /dev/null +++ b/1517060319/final/pages/example/article/article.wxss @@ -0,0 +1,6 @@ +page{ + background-color: #FFFFFF; +} +image{ + margin: 4px 0; +} \ No newline at end of file diff --git a/1517060319/final/pages/example/images/a1.png b/1517060319/final/pages/example/images/a1.png new file mode 100644 index 0000000..770236e Binary files /dev/null and b/1517060319/final/pages/example/images/a1.png differ diff --git a/1517060319/final/pages/example/images/a2.png b/1517060319/final/pages/example/images/a2.png new file mode 100644 index 0000000..5c0b9fb Binary files /dev/null and b/1517060319/final/pages/example/images/a2.png differ diff --git a/1517060319/final/pages/example/images/b1.png b/1517060319/final/pages/example/images/b1.png new file mode 100644 index 0000000..33fe2f3 Binary files /dev/null and b/1517060319/final/pages/example/images/b1.png differ diff --git a/1517060319/final/pages/example/images/b2.png b/1517060319/final/pages/example/images/b2.png new file mode 100644 index 0000000..8b534c0 Binary files /dev/null and b/1517060319/final/pages/example/images/b2.png differ diff --git a/1517060319/final/pages/example/images/c1.png b/1517060319/final/pages/example/images/c1.png new file mode 100644 index 0000000..a90d3a4 Binary files /dev/null and b/1517060319/final/pages/example/images/c1.png differ diff --git a/1517060319/final/pages/example/images/c2.png b/1517060319/final/pages/example/images/c2.png new file mode 100644 index 0000000..41fe1df Binary files /dev/null and b/1517060319/final/pages/example/images/c2.png differ diff --git a/1517060319/final/pages/example/images/tea culture1.png b/1517060319/final/pages/example/images/tea culture1.png new file mode 100644 index 0000000..fc43457 Binary files /dev/null and b/1517060319/final/pages/example/images/tea culture1.png differ diff --git a/1517060319/final/pages/example/images/tea culture2.png b/1517060319/final/pages/example/images/tea culture2.png new file mode 100644 index 0000000..1ec28df Binary files /dev/null and b/1517060319/final/pages/example/images/tea culture2.png differ diff --git a/1517060319/final/pages/example/images/tea1.png b/1517060319/final/pages/example/images/tea1.png new file mode 100644 index 0000000..8182b86 Binary files /dev/null and b/1517060319/final/pages/example/images/tea1.png differ diff --git a/1517060319/final/pages/example/images/tea2.png b/1517060319/final/pages/example/images/tea2.png new file mode 100644 index 0000000..d812c07 Binary files /dev/null and b/1517060319/final/pages/example/images/tea2.png differ diff --git a/1517060319/final/pages/example/images/tea3.png b/1517060319/final/pages/example/images/tea3.png new file mode 100644 index 0000000..04acb4c Binary files /dev/null and b/1517060319/final/pages/example/images/tea3.png differ diff --git a/1517060319/final/pages/example/images/tea4.png b/1517060319/final/pages/example/images/tea4.png new file mode 100644 index 0000000..8cdb8a2 Binary files /dev/null and b/1517060319/final/pages/example/images/tea4.png differ diff --git a/1517060319/final/pages/example/images/tea5.png b/1517060319/final/pages/example/images/tea5.png new file mode 100644 index 0000000..1b4d5b2 Binary files /dev/null and b/1517060319/final/pages/example/images/tea5.png differ diff --git a/1517060319/final/pages/example/images/tea6.png b/1517060319/final/pages/example/images/tea6.png new file mode 100644 index 0000000..b2a5380 Binary files /dev/null and b/1517060319/final/pages/example/images/tea6.png differ diff --git a/1517060319/final/pages/example/images/tea7.png b/1517060319/final/pages/example/images/tea7.png new file mode 100644 index 0000000..0b83e19 Binary files /dev/null and b/1517060319/final/pages/example/images/tea7.png differ diff --git a/1517060319/final/pages/form/form.js b/1517060319/final/pages/form/form.js new file mode 100644 index 0000000..d73834f --- /dev/null +++ b/1517060319/final/pages/form/form.js @@ -0,0 +1,113 @@ +// pages/form/form.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + text: "Hello" + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var that = this; + /* + wx.getStorage({ + key: 'formData', + success: function (res) { + console.log(res.data) + that.setData({ + text: res.data.text, + paragh: res.data.paragh + }); + } + }) + */ + wx.request({ + url: 'https://api.infoaas.com/data/hzc.json', //仅为示例,并非真实的接口地址 + data: {}, + header: { + 'content-type': 'application/json' // 默认值 + }, + success: function (res) { + console.log(res.data) + that.setData({ + text: res.data.name, + paragh: "任课老师是:" + res.data.teacher + " 2017" + }); + } + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + doSubmit: function (e) { + console.dir(e) + var that = this; + var text = e.detail.value.text; + var paragh = e.detail.value.paragh; + + wx.setStorage({ + key: "formData", + data: { + text: text, + paragh: paragh + } + }) + + wx.showToast({ + title: '成功', + icon: 'success', + duration: 2000 + }) + } +}) \ No newline at end of file diff --git a/1517060319/final/pages/form/form.json b/1517060319/final/pages/form/form.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/1517060319/final/pages/form/form.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/1517060319/final/pages/form/form.wxml b/1517060319/final/pages/form/form.wxml new file mode 100644 index 0000000..f370507 --- /dev/null +++ b/1517060319/final/pages/form/form.wxml @@ -0,0 +1,35 @@ + + + + 给我留言 + 输入留言信息并提交 + +
+ + {{text + ", " + paragh}} + + 意见 + + + + + + + + + 联系方式 + + + +