-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from surpershuai/master
- Loading branch information
Showing
31 changed files
with
713 additions
and
0 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
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 | ||
} | ||
}) |
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,36 @@ | ||
{ | ||
"pages":[ | ||
"pages/index/index", | ||
"pages/logs/logs", | ||
"pages/xunzhao/xunzhao", | ||
"pages/form/form", | ||
"pages/dakai/dakai" | ||
], | ||
"window": { | ||
"backgroundTextStyle": "light", | ||
"navigationBarBackgroundColor": "#00000", | ||
"navigationBarTitleText": "内敛的鼻毛", | ||
"navigationBarTextStyle": "white" | ||
}, | ||
"tabBar": { | ||
"list": [ | ||
{ | ||
"pagePath": "pages/index/index", | ||
"iconPath": "pages/image/1.png", | ||
"selectedIconPath": "pages/image/1.png", | ||
"text": "主页" | ||
}, | ||
{ | ||
"pagePath": "pages/xunzhao/xunzhao", | ||
"iconPath": "pages/image/2.png", | ||
"selectedIconPath": "pages/image/2.png", | ||
"text": "发现" | ||
}, | ||
{ | ||
"pagePath": "pages/form/form", | ||
"iconPath": "pages/image/3.png", | ||
"selectedIconPath": "pages/image/3.png", | ||
"text": "设置" | ||
} | ||
] | ||
}} |
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,11 @@ | ||
/**app.wxss**/ | ||
@import 'pages/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; | ||
} |
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,66 @@ | ||
// pages/dakai/dakai.js | ||
Page({ | ||
|
||
/** | ||
* 页面的初始数据 | ||
*/ | ||
data: { | ||
|
||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面加载 | ||
*/ | ||
onLoad: function (options) { | ||
|
||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面初次渲染完成 | ||
*/ | ||
onReady: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面显示 | ||
*/ | ||
onShow: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面隐藏 | ||
*/ | ||
onHide: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面卸载 | ||
*/ | ||
onUnload: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 页面相关事件处理函数--监听用户下拉动作 | ||
*/ | ||
onPullDownRefresh: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 页面上拉触底事件的处理函数 | ||
*/ | ||
onReachBottom: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 用户点击右上角分享 | ||
*/ | ||
onShareAppMessage: function () { | ||
|
||
} | ||
}) |
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 @@ | ||
{} |
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,36 @@ | ||
<!--pages/dakai/dakai.wxml--> | ||
<view class="page"> | ||
<view class="page__hd"> | ||
<view class="page__title">Article</view> | ||
<view class="page__desc">吉他</view> | ||
</view> | ||
<view class="page__bd"> | ||
<view class="weui-article"> | ||
<view class="weui-article__h1">乐器</view> | ||
<view class="weui-article__section"> | ||
<view class="weui-article__title">Guitar</view> | ||
<view class="weui-article__section"> | ||
<view class="weui-article__h3">1.1 节标题</view> | ||
<view class="weui-article__p"> | ||
|
||
适用 | ||
古典音乐,流行音乐,摇滚音乐,蓝调,民歌,弗拉门戈 | ||
吉他被用于多种音乐风格, 它在流行音乐、摇滚音乐、蓝调、民歌、古典、弗拉门戈中常被视为主要乐器。吉他亦有被于用古典音乐,有大量的独奏曲, 室内乐和管弦乐中偶有使用。它通常有六弦,但亦有四弦、八弦、十弦和十二弦。 | ||
|
||
</view> | ||
<view class="weui-article__p"> | ||
<image class="weui-article__img" src="../images/pic_article.png" mode="aspectFit" style="height: 180px" /> | ||
<image class="weui-article__img" src="../images/pic_article.png" mode="aspectFit" style="height: 180px" /> | ||
</view> | ||
</view> | ||
<view class="weui-article__section"> | ||
<view class="weui-article__h3">1.2 节标题</view> | ||
<view class="weui-article__p"> | ||
吉他主要有两大类:一是历史悠久、以木制共鸣箱扩音的民谣吉他,二是二十世纪被发明、以电扩音器扩音的电吉他。原声吉他有四种:平面吉他(在中国也叫民谣吉他),拱面吉他(又名爵士吉他),古典吉他和弗拉门戈吉他。木吉他通常被用于古典音乐、民间音乐及流行音乐。 电吉他则通常被用于摇滚音乐、蓝调及流行音乐。电吉他的发明对西方流行文化及音乐有重要影响。 | ||
另有一点鲜为人知的是,吉他家族中最“贵族”的古典吉他与小提琴、钢琴并列为世界著名三大乐器。 | ||
</view> | ||
</view> | ||
</view> | ||
</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,7 @@ | ||
/* pages/dakai/dakai.wxss */ | ||
page{ | ||
background-color: #FFFFFF; | ||
} | ||
image{ | ||
margin: 4px 0; | ||
} |
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,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://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 | ||
}) | ||
} | ||
}) |
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 @@ | ||
{} |
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 @@ | ||
<!--pages/form/form.wxml--> | ||
<view class="page" xmlns:wx="https://infoaas.com/data/hzc.json"> | ||
<view class="page__hd"> | ||
<view class="page__title">内敛的鼻毛</view> | ||
<view class="page__desc">内敛的鼻毛</view> | ||
</view> | ||
<form bindsubmit="doSubmit"> | ||
<view class="page__bd"> | ||
<view class="weui-toptips weui-toptips_warn" wx:if="{{paragh}}">{{text + ", " + paragh}}</view> | ||
|
||
<view class="weui-cells__title">请输入:</view> | ||
<view class="weui-cells weui-cells_after-title"> | ||
<view class="weui-cell weui-cell_input"> | ||
<view class="weui-cell__bd"> | ||
<input class="weui-input" placeholder="文本域" name="text" value="{{text}}"/> | ||
</view> | ||
</view> | ||
</view> | ||
|
||
<view class="weui-cells__title">请输入:</view> | ||
<view class="weui-cells weui-cells_after-title"> | ||
<view class="weui-cell"> | ||
<view class="weui-cell__bd"> | ||
<textarea name="paragh" class="weui-textarea" placeholder="文本域" style="height: 3.3em" value="{{paragh}}"/> | ||
<view class="weui-textarea-counter">0/200</view> | ||
</view> | ||
</view> | ||
</view> | ||
|
||
<view class="weui-btn-area"> | ||
<button class="weui-btn" type="primary" formType="submit">提交</button> | ||
</view> | ||
</view> | ||
</form> | ||
</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 @@ | ||
/* pages/form/form.wxss */ |
Oops, something went wrong.