Skip to content

Commit

Permalink
hzuapps#84 hzuapps#123 期末作业:开发一个仿微信小程序
Browse files Browse the repository at this point in the history
  • Loading branch information
huanglingwen committed Oct 25, 2017
1 parent cd6ffc1 commit a46d3eb
Show file tree
Hide file tree
Showing 112 changed files with 997 additions and 0 deletions.
39 changes: 39 additions & 0 deletions 1516090218/bb/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
}
})
42 changes: 42 additions & 0 deletions 1516090218/bb/app.json
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": "我的"
}
]
}
}
12 changes: 12 additions & 0 deletions 1516090218/bb/app.wxss
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;

}
121 changes: 121 additions & 0 deletions 1516090218/bb/pages/comp/scroll.js
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."
}]) */
});

}
})
23 changes: 23 additions & 0 deletions 1516090218/bb/pages/comp/scroll.wxml
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>
1 change: 1 addition & 0 deletions 1516090218/bb/pages/comp/scroll.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* pages/comp/scroll.wxss */
1 change: 1 addition & 0 deletions 1516090218/bb/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 1516090218/bb/pages/example/article/article.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
15 changes: 15 additions & 0 deletions 1516090218/bb/pages/example/article/article.wxml
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>
6 changes: 6 additions & 0 deletions 1516090218/bb/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;
}
4 changes: 4 additions & 0 deletions 1516090218/bb/pages/example/images/base64.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 1516090218/bb/pages/example/images/icon_intro.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.
Binary file added 1516090218/bb/pages/example/images/icon_nav_form.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 1516090218/bb/pages/example/images/icon_nav_nav.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.
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 1516090218/bb/pages/example/images/logo.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 1516090218/bb/pages/example/images/pic_160.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 1516090218/bb/pages/example/images/pic_article.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 1516090218/bb/pages/example/images/vcode.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions 1516090218/bb/pages/example/list/list.js
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
});
}
});
1 change: 1 addition & 0 deletions 1516090218/bb/pages/example/list/list.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
76 changes: 76 additions & 0 deletions 1516090218/bb/pages/example/list/list.wxml
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>
1 change: 1 addition & 0 deletions 1516090218/bb/pages/example/list/list.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* pages/example/list/list.wxss */
1 change: 1 addition & 0 deletions 1516090218/bb/pages/example/qqweq/qqweq.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Page({});
1 change: 1 addition & 0 deletions 1516090218/bb/pages/example/qqweq/qqweq.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading

0 comments on commit a46d3eb

Please sign in to comment.