From 3ef98415b003c156510aecf8fc6aeed0917349b8 Mon Sep 17 00:00:00 2001 From: callmeyan Date: Sun, 23 Jun 2019 11:37:44 +0800 Subject: [PATCH] update --- app.js | 22 ++++---- app.json | 3 +- app.wxss | 8 +++ assets/head.svg | 1 + pages/index/index.js | 14 +++-- pages/index/index.wxml | 10 ++-- pages/user/evaluation.js | 40 ++++++++++++-- pages/user/evaluation.wxml | 13 +++-- pages/user/evaluation.wxss | 8 ++- pages/user/index.js | 62 +++++++-------------- pages/user/index.wxml | 8 +-- pages/user/index.wxss | 4 +- pages/user/result.js | 71 ++++++++++++++++++++++++ pages/user/result.json | 3 ++ pages/user/result.wxml | 50 +++++++++++++++++ pages/user/result.wxss | 108 +++++++++++++++++++++++++++++++++++++ pages/user/vars.wxss | 14 +++++ utils/api.js | 22 ++++++-- 18 files changed, 382 insertions(+), 79 deletions(-) create mode 100644 assets/head.svg create mode 100644 pages/user/result.js create mode 100644 pages/user/result.json create mode 100644 pages/user/result.wxml create mode 100644 pages/user/result.wxss create mode 100644 pages/user/vars.wxss diff --git a/app.js b/app.js index 61dbd80..c58f898 100644 --- a/app.js +++ b/app.js @@ -7,15 +7,18 @@ App({ // var logs = wx.getStorageSync('logs') || [] // logs.unshift(Date.now()) // wx.setStorageSync('logs', logs) - this.globalData.openId = wx.getStorageSync('openId') || ''; + var openId = this.globalData.openId = wx.getStorageSync('openId') || ''; // 登录 - wx.login({ - success: res => { - // 发送 res.code 到后台换取 openId, sessionKey, unionId - console.log('login==>', res); - } - }) + // wx.login({ + // success: res => { + // // 发送 res.code 到后台换取 openId, sessionKey, unionId + // console.log('login==>', res); + // } + // }) + if (openId){ + return; + } // 获取用户信息 wx.getSetting({ success: res => { @@ -25,8 +28,8 @@ App({ wx.getUserInfo({ success: res => { // 可以将 res 发送给后台解码出 unionId - this.globalData.userInfo = res.userInfo - + this.globalData.wxuserInfo = res.userInfo + // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 // 所以此处加入 callback 以防止这种情况 if (this.userInfoReadyCallback) { @@ -40,6 +43,7 @@ App({ }, globalData: { + wxuserInfo:null, userInfo: null, openId: '' } diff --git a/app.json b/app.json index efa2f4e..4ea5238 100644 --- a/app.json +++ b/app.json @@ -1,8 +1,9 @@ { "pages": [ - "pages/user/index", "pages/index/index", + "pages/user/result", "pages/user/evaluation", + "pages/user/index", "pages/init/userinfo", "pages/init/agreement" ], diff --git a/app.wxss b/app.wxss index cc38698..22ce075 100644 --- a/app.wxss +++ b/app.wxss @@ -106,6 +106,14 @@ checkbox .wx-checkbox-input.wx-checkbox-input-checked::before { display: block; margin-bottom: 20rpx; } +.form-group radio{ + margin-right:10rpx; + position: relative; + top:-2rpx; +} +.form-group radio-group label{ + display: inline-block; +} input, .select-input { border-radius: 4px 4px 4px 4px; diff --git a/assets/head.svg b/assets/head.svg new file mode 100644 index 0000000..cf6cd7f --- /dev/null +++ b/assets/head.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 94bb233..dbf813a 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -7,7 +7,9 @@ Page({ data: { motto: 'Hello World', userInfo: { - avatarUrl: 'http://thirdwx.qlogo.cn/mmopen/vi_32/9xkaQhBrbjIsJNJkxKicKayJiajy2ZsKFHM7vhibPjic0sLhn0cxCicxgQUl9VDF9o02NsQlcxZicJPWb4K9RibQJ8ibDQ/132' + avatarUrl: '/assets/head.svg', + realname:'张二娃', + lastEvaluation:'2019-06-23 09:43' }, hasUserInfo: false, canIUse: wx.canIUse('button.open-type.getUserInfo') @@ -25,12 +27,13 @@ Page({ }) }, onLoad: function() { + // 加载 if (app.globalData.userInfo) { this.setData({ userInfo: app.globalData.userInfo, hasUserInfo: true }) - } else if (this.data.canIUse) { + } else if (this.data.canIUse) { // 可以获取用户信息 // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 // 所以此处加入 callback 以防止这种情况 app.userInfoReadyCallback = res => { @@ -54,10 +57,15 @@ Page({ }, getUserInfo: function(e) { console.log(e) - app.globalData.userInfo = e.detail.userInfo + app.globalData.wxuserInfo = e.detail.userInfo this.setData({ userInfo: e.detail.userInfo, hasUserInfo: true }) + }, + gotoEvaluation(){ + wx.navigateTo({ + url: './../user/evaluation', + }) } }) \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 84b7b18..0dc3732 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -1,14 +1,16 @@ -