diff --git a/1614080902227/wx/app.js b/1614080902227/wx/app.js index b54519049..dc2fc883c 100644 --- a/1614080902227/wx/app.js +++ b/1614080902227/wx/app.js @@ -1,39 +1,32 @@ //app.js App({ + + /** + * 当小程序初始化完成时,会触发 onLaunch(全局只触发一次) + */ onLaunch: function () { - // 展示本地存储能力 - var logs = wx.getStorageSync('logs') || [] - logs.unshift(Date.now()) - wx.setStorageSync('logs', logs) + }, + + /** + * 当小程序启动,或从后台进入前台显示,会触发 onShow + */ + onShow: function (options) { + }, - // 登录 - 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 + /** + * 当小程序从前台进入后台,会触发 onHide + */ + onHide: function () { + }, - // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 - // 所以此处加入 callback 以防止这种情况 - if (this.userInfoReadyCallback) { - this.userInfoReadyCallback(res) - } - } - }) - } - } - }) + /** + * 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息 + */ + onError: function (msg) { + }, - globalData: { - userInfo: null + + appData : { + userinfo : null, } -}) \ No newline at end of file +}) diff --git a/1614080902227/wx/app.json b/1614080902227/wx/app.json index cd5786bc5..fe411afd0 100644 --- a/1614080902227/wx/app.json +++ b/1614080902227/wx/app.json @@ -1,27 +1,35 @@ { - "pages":[ + "pages": [ "pages/index/index", "pages/logs/logs", - "pages/setpage/setpage" + "pages/setpage/setpage", + "pages/login/login" ], - "window":{ - "backgroundTextStyle":"light", + "window": { + "backgroundTextStyle": "light", "navigationBarBackgroundColor": "#fff", "navigationBarTitleText": "电子书阅读", - "navigationBarTextStyle":"black" + "navigationBarTextStyle": "black" }, "tabBar": { + "selectedColor": "#1afa29", "list": [ { "pagePath": "pages/index/index", + "iconPath": "image/zhuye.png", + "selectedIconPath": "image/zhuyes.png", "text": "主页" }, { "pagePath": "pages/logs/logs", + "iconPath": "image/shequ.png", + "selectedIconPath": "image/shequs.png", "text": "社区" }, { - "pagePath": "pages/logs/logs", + "pagePath": "pages/setpage/setpage", + "iconPath": "image/geren.png", + "selectedIconPath": "image/gerens.png", "text": "个人" } ] @@ -34,4 +42,4 @@ "navigateToMiniProgramAppIdList": [ "wxe5f52902cf4de896" ] -} +} \ No newline at end of file diff --git a/1614080902227/wx/image/geren.png b/1614080902227/wx/image/geren.png new file mode 100644 index 000000000..758fe40ac Binary files /dev/null and b/1614080902227/wx/image/geren.png differ diff --git a/1614080902227/wx/image/gerens.png b/1614080902227/wx/image/gerens.png new file mode 100644 index 000000000..fa971533d Binary files /dev/null and b/1614080902227/wx/image/gerens.png differ diff --git a/1614080902227/wx/image/p2.png b/1614080902227/wx/image/p2.png new file mode 100644 index 000000000..152979ea3 Binary files /dev/null and b/1614080902227/wx/image/p2.png differ diff --git a/1614080902227/wx/image/qianbao.png b/1614080902227/wx/image/qianbao.png new file mode 100644 index 000000000..f3b855d6e Binary files /dev/null and b/1614080902227/wx/image/qianbao.png differ diff --git a/1614080902227/wx/image/shequ.png b/1614080902227/wx/image/shequ.png new file mode 100644 index 000000000..2d1f34b11 Binary files /dev/null and b/1614080902227/wx/image/shequ.png differ diff --git a/1614080902227/wx/image/shequs.png b/1614080902227/wx/image/shequs.png new file mode 100644 index 000000000..66f30b1d3 Binary files /dev/null and b/1614080902227/wx/image/shequs.png differ diff --git a/1614080902227/wx/image/shezhi.png b/1614080902227/wx/image/shezhi.png new file mode 100644 index 000000000..4283f4ee5 Binary files /dev/null and b/1614080902227/wx/image/shezhi.png differ diff --git a/1614080902227/wx/image/shujia.png b/1614080902227/wx/image/shujia.png new file mode 100644 index 000000000..5ab5bb8e2 Binary files /dev/null and b/1614080902227/wx/image/shujia.png differ diff --git a/1614080902227/wx/image/timg.png b/1614080902227/wx/image/timg.png new file mode 100644 index 000000000..1d555f5ea Binary files /dev/null and b/1614080902227/wx/image/timg.png differ diff --git a/1614080902227/wx/image/yonghu.png b/1614080902227/wx/image/yonghu.png new file mode 100644 index 000000000..3fe26496d Binary files /dev/null and b/1614080902227/wx/image/yonghu.png differ diff --git a/1614080902227/wx/image/zhuye.png b/1614080902227/wx/image/zhuye.png new file mode 100644 index 000000000..c744c195e Binary files /dev/null and b/1614080902227/wx/image/zhuye.png differ diff --git a/1614080902227/wx/image/zhuyes.png b/1614080902227/wx/image/zhuyes.png new file mode 100644 index 000000000..cb58eaa59 Binary files /dev/null and b/1614080902227/wx/image/zhuyes.png differ diff --git a/1614080902227/wx/image/zuji.png b/1614080902227/wx/image/zuji.png new file mode 100644 index 000000000..851aed95d Binary files /dev/null and b/1614080902227/wx/image/zuji.png differ diff --git a/1614080902227/wx/pages/index/index.js b/1614080902227/wx/pages/index/index.js index 608a282e7..1cee340a4 100644 --- a/1614080902227/wx/pages/index/index.js +++ b/1614080902227/wx/pages/index/index.js @@ -3,52 +3,79 @@ const app = getApp() Page({ + + /** + * 页面的初始数据 + */ data: { - motto: 'Hello World', - userInfo: {}, - hasUserInfo: false, - canIUse: wx.canIUse('button.open-type.getUserInfo') - }, - //事件处理函数 - bindViewTap: function() { - wx.navigateTo({ - url: '../logs/logs' - }) - }, - onLoad: function () { - if (app.globalData.userInfo) { - this.setData({ - userInfo: app.globalData.userInfo, - hasUserInfo: true - }) - } else if (this.data.canIUse){ - // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 - // 所以此处加入 callback 以防止这种情况 - app.userInfoReadyCallback = res => { - this.setData({ - userInfo: res.userInfo, - hasUserInfo: true - }) - } - } else { - // 在没有 open-type=getUserInfo 版本的兼容处理 - wx.getUserInfo({ - success: res => { - app.globalData.userInfo = res.userInfo - this.setData({ - userInfo: res.userInfo, - hasUserInfo: true - }) - } - }) - } - }, - getUserInfo: function(e) { - console.log(e) - app.globalData.userInfo = e.detail.userInfo - this.setData({ - userInfo: e.detail.userInfo, - hasUserInfo: true - }) + imageWidth:0, + imgUrls: [ + 'http://img0.pcgames.com.cn/pcgames/1809/19/7223032_1.jpg', + 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1543338932740&di=7be8bb583eca9d84d285a0f98ec8638b&imgtype=0&src=http%3A%2F%2Fpic.rmb.bdstatic.com%2Fd89b47363ca61f00848f63086f4a8a9a.jpeg', + 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1543337618033&di=1f1ea878a88f9129f000ca401fe79065&imgtype=0&src=http%3A%2F%2Ff.hiphotos.baidu.com%2Fzhidao%2Fwh%253D450%252C600%2Fsign%3Da24f2299412309f7e73aa516473e20c5%2Ffaedab64034f78f01a33adfe7e310a55b3191c86.jpg', + 'https://img.52z.com/upload/news/image/20180505/20180505060619_23197.jpg', + + ], + indicatorDots : true, + autoplay : true, + interval : 2000, + duration : 500, + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({imageWidth : wx.getSystemInfoSync().windowWidth}); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + } }) diff --git a/1614080902227/wx/pages/index/index.json b/1614080902227/wx/pages/index/index.json index 9e26dfeeb..cdf5e4330 100644 --- a/1614080902227/wx/pages/index/index.json +++ b/1614080902227/wx/pages/index/index.json @@ -1 +1,6 @@ -{} \ No newline at end of file +{ + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "首页", + "navigationBarTextStyle": "black" +} \ No newline at end of file diff --git a/1614080902227/wx/pages/index/index.wxml b/1614080902227/wx/pages/index/index.wxml index 80475b205..95b2f2cbb 100644 --- a/1614080902227/wx/pages/index/index.wxml +++ b/1614080902227/wx/pages/index/index.wxml @@ -1,14 +1,98 @@ - - - - - - {{userInfo.nickName}} + + + + + + + + + + + + - - {{motto}} + + + 精品推荐 + + + + + + 楚留香新传 + + + + 天煞魔君 + + + + 诛仙 + + + + 大主宰 + + + + 莽荒纪 + + + + 全职法师 + + + + + + 火热新书 + + + + + + + + 玄阳天尊 + 玄幻奇幻 | 环城路飙车 + “天下悠悠众口何以能尽数堵住,尽是一些道貌岸然的无胆鼠辈,当吾君临天下、主宰四合八荒之时..” + + + + + + + + 鸿武战神 + 其它 | 千朽千沉 + “千年古墓坍塌,情势危急,齐浊皓躲入了古墓中的一口神异棺材中!当他再次醒来时,赫然发现..” + + + + + + + + 血色的青春 + 军事 | 寒麟灏 + “我们愿秉承先烈遗志,为了世界百姓的安宁,抛头颅,撒热血,为我们心中的理想奋斗一生。就算我们..” + + - + diff --git a/1614080902227/wx/pages/index/index.wxss b/1614080902227/wx/pages/index/index.wxss index ce30de019..cd9d09112 100644 --- a/1614080902227/wx/pages/index/index.wxss +++ b/1614080902227/wx/pages/index/index.wxss @@ -1,21 +1,89 @@ /**index.wxss**/ -.userinfo { +.view1{ + background-color: white; + height: 100%; + width: 100% +} +.image1{ + height: 90%; + width: 100%; +} +.image2{ + height: 100%; + width: 100%; +} +.view-head{ + margin-top: 5px; + display: flex; + border-left:3px solid green; + justify-content: space-between; + align-items: center; +} +.view-content{ + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: center; + +} +.content-item{ display: flex; flex-direction: column; + height: 270rpx; + width: 200rpx; + margin: 12px; align-items: center; } - -.userinfo-avatar { - width: 128rpx; - height: 128rpx; - margin: 20rpx; - border-radius: 50%; +.button-more{ + background-color: white; + margin-right: 2px; + display: flex; + height: 70rpx; + width: 150rpx; + justify-content: right; + align-items: center + +} +.text-introduce{ + height: 70rpx; +} +.text-introduce2{ + height: 130rpx; + font-size: 12px; } - -.userinfo-nickname { - color: #aaa; +.button-more::after{ + border: none; } - -.usermotto { - margin-top: 200px; +.text-head{ + margin-left: 3px; +} +.text-more{ + font-size: 10px; +} +.text-image{ + font-size: 13px; + padding: 3px; +} +.type{ + margin-top: 3px; + margin-bottom: 3px; + height: 35px; + width: 100%; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center +} +.button1{ + display: flex; + height: 70rpx; + width: 160rpx; + justify-content: right; + align-items: center; + border-radius: 70px; +} +.view-content-text{ + display: flex; + flex-direction: column; + width: 60%; } \ No newline at end of file diff --git a/1614080902227/wx/pages/login/login.js b/1614080902227/wx/pages/login/login.js new file mode 100644 index 000000000..0abf4d478 --- /dev/null +++ b/1614080902227/wx/pages/login/login.js @@ -0,0 +1,100 @@ +// pages/login/login.js +var app = getApp(); + +Page({ + + /** + * 页面的初始数据 + */ + data: { + username : null, + password : null, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + onclick1: function () { + /** + * 登录点击 + * 省略了服务器验证账户密码 + */ + app.appData.userinfo = {username : this.data.username,password : this.data.password} + if(this.data.username != null && this.data.password != null){ + wx.switchTab({ + url: '../setpage/setpage', + }); + }else{ + console.log("用户名为空"); + } + }, + + getusername:function(event){ + /** + * 获取用户名 + */ + this.setData({username : event.detail.value}); + }, + + + + getpassword:function(event){ + /** + * 获取密码 + */ + this.setData({password : event.detail.value}); + }, +}) \ No newline at end of file diff --git a/1614080902227/wx/pages/login/login.json b/1614080902227/wx/pages/login/login.json new file mode 100644 index 000000000..3f401989e --- /dev/null +++ b/1614080902227/wx/pages/login/login.json @@ -0,0 +1,6 @@ +{ + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "登录", + "navigationBarTextStyle": "black" +} \ No newline at end of file diff --git a/1614080902227/wx/pages/login/login.wxml b/1614080902227/wx/pages/login/login.wxml new file mode 100644 index 000000000..674a19e3b --- /dev/null +++ b/1614080902227/wx/pages/login/login.wxml @@ -0,0 +1,19 @@ + + + + + + + + 用户名 + + + + 密码 + + + + + + + diff --git a/1614080902227/wx/pages/login/login.wxss b/1614080902227/wx/pages/login/login.wxss new file mode 100644 index 000000000..cc93cbae3 --- /dev/null +++ b/1614080902227/wx/pages/login/login.wxss @@ -0,0 +1,37 @@ +/* pages/login/login.wxss */ +.input1{ + width: 98%; + margin-top: 30rpx; + border: 1px solid #888; + flex-grow:1; + display: flex; + flex-direction: column; + justify-content: flex-end; + padding-bottom: 20rpx; +} +.text1{ + color: #888; + font-size: 10sp; +} +.view1{ + margin-top: 15rpx; +} +.image1{ + width: 150rpx; + height: 150rpx; +} +.item1{ + width: 100%; + height: 200rpx; + display: flex; + justify-content: center; + align-items: center; +} +.button1{ + width: 80%; + color: white; + background-color: green; + border-radius: 1; + font-size: 14px; + margin-top: 100rpx +} \ No newline at end of file diff --git a/1614080902227/wx/pages/logs/logs.js b/1614080902227/wx/pages/logs/logs.js index b2b967d8e..389c0a4f6 100644 --- a/1614080902227/wx/pages/logs/logs.js +++ b/1614080902227/wx/pages/logs/logs.js @@ -1,15 +1,70 @@ //logs.js const util = require('../../utils/util.js') +var app = getApp(); Page({ + + /** + * 页面的初始数据 + */ data: { - logs: [] - }, - onLoad: function () { - this.setData({ - logs: (wx.getStorageSync('logs') || []).map(log => { - return util.formatTime(new Date(log)) - }) - }) + username : null, + password : null, + }, + + /** + * 生命周期函数--监听页面加载 + */ + 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/1614080902227/wx/pages/logs/logs.json b/1614080902227/wx/pages/logs/logs.json index 28379bccc..f3d0cfa52 100644 --- a/1614080902227/wx/pages/logs/logs.json +++ b/1614080902227/wx/pages/logs/logs.json @@ -1,3 +1,6 @@ { - "navigationBarTitleText": "查看启动日志" + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "社区", + "navigationBarTextStyle": "black" } \ No newline at end of file diff --git a/1614080902227/wx/pages/logs/logs.wxml b/1614080902227/wx/pages/logs/logs.wxml index b5a85ac67..0dd6e67df 100644 --- a/1614080902227/wx/pages/logs/logs.wxml +++ b/1614080902227/wx/pages/logs/logs.wxml @@ -1,6 +1,2 @@ - - - {{index + 1}}. {{log}} - - + diff --git a/1614080902227/wx/pages/setpage/setpage.js b/1614080902227/wx/pages/setpage/setpage.js index d78af5a5e..f0546156c 100644 --- a/1614080902227/wx/pages/setpage/setpage.js +++ b/1614080902227/wx/pages/setpage/setpage.js @@ -1,30 +1,73 @@ -App({ +var app = getApp(); +Page({ /** - * 当小程序初始化完成时,会触发 onLaunch(全局只触发一次) + * 页面的初始数据 */ - onLaunch: function () { + data: { + username : null + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + if (app.appData.userinfo == null) { + wx.redirectTo({ + url: '../login/login', + }) + }else{ + this.setData({username : app.appData.userinfo.username}) + } + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { }, /** - * 当小程序启动,或从后台进入前台显示,会触发 onShow + * 生命周期函数--监听页面显示 */ - onShow: function (options) { + onShow: function () { }, /** - * 当小程序从前台进入后台,会触发 onHide + * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** - * 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息 + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 */ - onError: function (msg) { + onShareAppMessage: function () { } -}) +}) \ No newline at end of file diff --git a/1614080902227/wx/pages/setpage/setpage.json b/1614080902227/wx/pages/setpage/setpage.json index 9e26dfeeb..713d65113 100644 --- a/1614080902227/wx/pages/setpage/setpage.json +++ b/1614080902227/wx/pages/setpage/setpage.json @@ -1 +1,6 @@ -{} \ No newline at end of file +{ + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "个人", + "navigationBarTextStyle": "black" +} \ No newline at end of file diff --git a/1614080902227/wx/pages/setpage/setpage.wxml b/1614080902227/wx/pages/setpage/setpage.wxml index e69de29bb..fe2b36e0f 100644 --- a/1614080902227/wx/pages/setpage/setpage.wxml +++ b/1614080902227/wx/pages/setpage/setpage.wxml @@ -0,0 +1,36 @@ + + + + + + + + + 头像 + + + + {{username}} + + + + + + 钱包 + + + + 我的书架 + + + + 最近浏览 + + + + + + 设置 + + + \ No newline at end of file diff --git a/1614080902227/wx/pages/setpage/setpage.wxss b/1614080902227/wx/pages/setpage/setpage.wxss index da4afff81..f39eb079f 100644 --- a/1614080902227/wx/pages/setpage/setpage.wxss +++ b/1614080902227/wx/pages/setpage/setpage.wxss @@ -1 +1,94 @@ -/* pages/mainpage/mainpage.wxss */ \ No newline at end of file +/* pages/mainpage/mainpage.wxss */ +.image1{ + height: 400rpx; + width: 100%; +} +.image2{ + width: 16rpx; + height: 16rpx; + padding: 10rpx +} +.image3{ + width: 32px; + height: 32px; + padding: 15px +} +.background{ + background: #EEEEEE +} +.circle{ + width: 140rpx; + height: 140rpx; + display: flex; + border: 1px solid rgb(7, 7, 7); + border-radius: 500px; + background: white; + align-items: center; + justify-content: center; + margin-left: 20px +} +.text1{ + width: 70px; + height: 70px; + display: flex; + align-items: center; + justify-content: center; +} +.text2{ + width: 70px; + height: 70px; + display: flex; + align-items: center; + justify-content: center; + font-size: 20px; + margin-left: 20px +} + +.weui-cells{ + display: flex; + flex-direction: row; + margin-top:10px; + background-color:#FFFFFF; + line-height:1.47058824; + font-size:17px; + overflow:hidden; + position:relative; +} +.weui-cells-ver{ + display: flex; + flex-direction:column; + margin-top:10px; + background-color:#FFFFFF; + line-height:1.47058824; + font-size:17px; + overflow:hidden; + position:relative; + } +.weui-cell__hd{ + padding-right:0.35em; + display: flex; + align-self: center; +} +.weui-cell__bd{ + -webkit-box-flex:1; + -webkit-flex:1; + flex:1; +} +.weui-cell__bd2{ + margin-left: 20px; + -webkit-box-flex:1; + -webkit-flex:1; + flex:1; + +} +.weui-cell__ft{ + text-align:right; + color:#999999; +} +.direction{ + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + border-bottom: 1px solid #E6E6E6; +} \ No newline at end of file