diff --git a/1514080901211/pages/index/index.js b/1514080901211/pages/index/index.js index 5520deca..7ad4ae1c 100644 --- a/1514080901211/pages/index/index.js +++ b/1514080901211/pages/index/index.js @@ -1,82 +1,23 @@ -//index.js -//获取应用实例 const app = getApp() - -Page({ + + Page({ data: { - motto: 'Hello HZU', - userInfo: {}, - hasUserInfo: false, - textColor: 'red', - textClass: 'description', - showScroll: true, - canIUse: wx.canIUse('button.open-type.getUserInfo') - }, - //事件处理函数 - bindViewTap: function() { - console.dir('bindViewTap') - wx.navigateTo({ - url: '../logs/logs' - }) - }, - changeColor: function() { - //console.log('changeColor') - var me = this; - if (me.data.textClass == 'description') { - this.setData({ - textClass: 'blue' - }) - } else { - this.setData({ - textClass: 'description' - }) - } - //this.data.textColor = 'blue' - }, - naviToView: function() { - wx.navigateTo({ - url: "../comp/view" - }) - }, - naviToScrollView: function () { - wx.navigateTo({ - url: "../comp/scroll" + result: [] + }, + + onLoad: function () { + var that = this; + wx.request({ + url: 'https://infoaas.com/data/hzc.json', + method: 'GET', + header: { + 'content-type': 'application/json' + }, + success: function (res) { + that.setData({ + result: res.data + }) + } }) - }, - 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 - }) - } }) diff --git a/1514080901211/pages/index/index.wxml b/1514080901211/pages/index/index.wxml index 084dc89a..2d86eca6 100644 --- a/1514080901211/pages/index/index.wxml +++ b/1514080901211/pages/index/index.wxml @@ -1,33 +1,5 @@ - - - - 不签到!?谁知道你读书了啊喂??? - - - - - - 考试签到 - 抢个前排! - - - - - - - 考试倒计时 - 别说没提醒你? - - - - - - - 考试TIPS - 万一有用呢? - - - - - - \ No newline at end of file + + + {{index}}:{{item}} + + diff --git a/1514080901211/pages/index/index.wxss b/1514080901211/pages/index/index.wxss index 4f198d05..ce30de01 100644 --- a/1514080901211/pages/index/index.wxss +++ b/1514080901211/pages/index/index.wxss @@ -1,10 +1,21 @@ /**index.wxss**/ -.page__hd { - padding: 20px; +.userinfo { + display: flex; + flex-direction: column; + align-items: center; } -.page__title { - text-align: left; - font-size: 35px; - font-weight: 400; +.userinfo-avatar { + width: 128rpx; + height: 128rpx; + margin: 20rpx; + border-radius: 50%; } + +.userinfo-nickname { + color: #aaa; +} + +.usermotto { + margin-top: 200px; +} \ No newline at end of file