forked from hzuapps/wechat-miniprogram-hzc-2017
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hzuapps#84 hzuapps#123 期末作业:开发一个仿微信小程序
- Loading branch information
1 parent
cd6ffc1
commit a46d3eb
Showing
112 changed files
with
997 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,42 @@ | ||
{ | ||
"pages": [ | ||
"pages/index/index", | ||
"pages/comp/scroll", | ||
"pages/form/form", | ||
"pages/example/article/article", | ||
"pages/example/qqweq/qqweq", | ||
"pages/fm/fm" | ||
|
||
], | ||
"window": { | ||
"backgroundTextStyle": "light", | ||
"navigationBarBackgroundColor": "#FF66FF", | ||
"navigationBarTitleText": "黄铃雯", | ||
"navigationBarTextStyle": "while" | ||
}, | ||
"tabBar": { | ||
"color": "#FFF", | ||
"backgroundColor": "#FF66FF", | ||
"list": [ | ||
{ | ||
"pagePath": "pages/index/index", | ||
"iconPath": "pages/image/21.png", | ||
"selectedIconPath": "pages/image/22.png", | ||
|
||
"text": "首页" | ||
}, | ||
{ | ||
"pagePath": "pages/comp/scroll", | ||
"iconPath": "pages/image/21.png", | ||
"selectedIconPath": "pages/image/22.png", | ||
"text": "猫片" | ||
}, | ||
{ | ||
"pagePath": "pages/form/form", | ||
"iconPath": "pages/image/21.png", | ||
"selectedIconPath": "pages/image/22.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,12 @@ | ||
/**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; | ||
|
||
} |
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,121 @@ | ||
// pages/comp/scroll.js | ||
var base64 = require("../example/images/base64"); | ||
|
||
Page({ | ||
|
||
/** | ||
* 页面的初始数据 | ||
*/ | ||
data: { | ||
isEnd: true, | ||
messages: [{ | ||
image:"/pages/image/15.jpg", | ||
name: "傲娇猫", | ||
last: "想要么,想要就求我" | ||
}, { | ||
image: "/pages/image/14.jpg", | ||
name: "委屈猫", | ||
last: "委屈巴巴" | ||
}, { | ||
image: "/pages/image/12.jpg", | ||
name: "猥琐猫", | ||
last: "你老婆在我家" | ||
}, { | ||
image: "/pages/image/13.jpg", | ||
name: "拽拽猫", | ||
last: "求你咋滴" | ||
}, { | ||
image: "/pages/image/b1.jpg", | ||
name: "皇帝猫", | ||
last: "大胆刁民" | ||
}, { | ||
image: "/pages/image/11.jpg", | ||
name: "暴躁猫", | ||
last: "走开,傻逼" | ||
}, { | ||
image: "/pages/image/16.jpg", | ||
name: "智障猫", | ||
last: "略略略" | ||
}, { | ||
image: "/pages/image/t7.png", | ||
name: "魔枪士", | ||
last: "Lancer" | ||
}] | ||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面加载 | ||
*/ | ||
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 () { | ||
|
||
var that = this; | ||
var data = that.data; | ||
that.setData({ | ||
isEnd: true /*, | ||
messages: data.messages.concat([{ | ||
name: "Tom", | ||
last: "Hello!" | ||
}, { | ||
name: "john", | ||
last: "yes." | ||
}]) */ | ||
}); | ||
|
||
} | ||
}) |
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,23 @@ | ||
<!--pages/comp/scroll.wxml--> | ||
<scroll-view class="page" bindtouchend='onEnd' > | ||
<view class="page__bd"> | ||
<view class="weui-panel weui-panel_access"> | ||
<view class="weui-panel__hd"></view> | ||
<view class="weui-panel__bd"> | ||
<navigator 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> |
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/comp/scroll.wxss */ |
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 @@ | ||
Page({}); |
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,15 @@ | ||
<view> | ||
<view>第三位猫优 | ||
</view> | ||
<view>英国短毛猫,体形圆胖,四肢粗短发达,毛短而密,头大脸圆,温柔平静,对人友善,极易饲养。大而圆的眼睛根据被毛不同而呈现各种颜色。作为一个古老的猫品种,其历史可追溯至古罗马时期的家猫,由于拥有悠久的育种历史,可以称得上是猫家族中的典范。 | ||
</view> | ||
<view>让我们一起来撸猫片吧 | ||
</view> | ||
<view> | ||
<image src='/pages/image/7.jpg'></image> | ||
<image src='/pages/image/8.jpg'></image> | ||
<image src='/pages/image/9.jpg'></image> | ||
</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,6 @@ | ||
page{ | ||
background-color: #FFFFFF; | ||
} | ||
image{ | ||
margin: 4px 0; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.
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.
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.
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.
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.
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,8 @@ | ||
var base64 = require("../images/base64"); | ||
Page({ | ||
onLoad: function(){ | ||
this.setData({ | ||
icon: base64.icon20 | ||
}); | ||
} | ||
}); |
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,76 @@ | ||
<view class="page"> | ||
<view class="page__hd"> | ||
<view class="page__title">List</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/index/index'></navigator> | ||
<view class="weui-cell"> | ||
<view class="weui-cell__bd">标题文字</view> | ||
<view class="weui-cell__ft">说明文字</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__hd"> | ||
<image src="{{icon}}" style="margin-right: 5px;vertical-align: middle;width:20px; height: 20px;"></image> | ||
</view> | ||
<view class="weui-cell__bd">标题文字</view> | ||
<view class="weui-cell__ft">说明文字</view> | ||
</view> | ||
<view class="weui-cell"> | ||
<view class="weui-cell__hd"> | ||
<image src="{{icon}}" style="margin-right: 5px;vertical-align: middle;width:20px; height: 20px;"></image> | ||
</view> | ||
<view class="weui-cell__bd">标题文字</view> | ||
<view class="weui-cell__ft">说明文字</view> | ||
</view> | ||
</view> | ||
|
||
<view class="weui-cells__title">带跳转的列表项</view> | ||
<view class="weui-cells weui-cells_after-title"> | ||
<navigator url="/pages/index/index" class="weui-cell weui-cell_access" hover-class="weui-cell_active"> | ||
<view class="weui-cell__bd">cell standard</view> | ||
<view class="weui-cell__ft weui-cell__ft_in-access"></view> | ||
</navigator> | ||
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active"> | ||
<view class="weui-cell__bd">cell standard</view> | ||
<view class="weui-cell__ft weui-cell__ft_in-access"></view> | ||
</navigator> | ||
</view> | ||
|
||
<view class="weui-cells__title">带说明、跳转的列表项</view> | ||
<view class="weui-cells weui-cells_after-title"> | ||
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active"> | ||
<view class="weui-cell__bd">cell standard</view> | ||
<view class="weui-cell__ft weui-cell__ft_in-access">说明文字</view> | ||
</navigator> | ||
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active"> | ||
<view class="weui-cell__bd">cell standard</view> | ||
<view class="weui-cell__ft weui-cell__ft_in-access">说明文字</view> | ||
</navigator> | ||
</view> | ||
|
||
<view class="weui-cells__title">带图标、说明、跳转的列表项</view> | ||
<view class="weui-cells weui-cells_after-title"> | ||
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active"> | ||
<view class="weui-cell__hd"> | ||
<image src="{{icon}}" style="margin-right: 5px;vertical-align: middle;width:20px; height: 20px;"></image> | ||
</view> | ||
<view class="weui-cell__bd">cell standard</view> | ||
<view class="weui-cell__ft weui-cell__ft_in-access">说明文字</view> | ||
</navigator> | ||
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active"> | ||
<view class="weui-cell__hd"> | ||
<image src="{{icon}}" style="margin-right: 5px;vertical-align: middle;width:20px; height: 20px;"></image> | ||
</view> | ||
<view class="weui-cell__bd">cell standard</view> | ||
<view class="weui-cell__ft weui-cell__ft_in-access">说明文字</view> | ||
</navigator> | ||
</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 @@ | ||
/* pages/example/list/list.wxss */ |
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 @@ | ||
Page({}); |
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 @@ | ||
{} |
Oops, something went wrong.