Authored by 邱骏

登录页

@@ -43,6 +43,7 @@ Page({ @@ -43,6 +43,7 @@ Page({
43 isShow: 0, 43 isShow: 0,
44 referer: '', 44 referer: '',
45 needBind: 1, 45 needBind: 1,
  46 + showLogin: 0
46 }, 47 },
47 onLoad: function(options) { 48 onLoad: function(options) {
48 let that = this; 49 let that = this;
@@ -64,6 +65,18 @@ Page({ @@ -64,6 +65,18 @@ Page({
64 }); 65 });
65 } 66 }
66 67
  68 + if (app.getUid()) {
  69 + setTimeout(() => {
  70 + this.setData({ // 用来防止总是闪出登录界面后再显示限购码
  71 + showLogin: 1
  72 + });
  73 + }, 1000);
  74 + } else {
  75 + this.setData({ // 用来防止总是闪出登录界面后再显示限购码
  76 + showLogin: 1
  77 + });
  78 + }
  79 +
67 yas = new Yas(app); // 实例化埋点 80 yas = new Yas(app); // 实例化埋点
68 yas.pageOpenReport(); 81 yas.pageOpenReport();
69 event.on('user-login-success', this.showBindUserInfo); 82 event.on('user-login-success', this.showBindUserInfo);
@@ -78,10 +91,15 @@ Page({ @@ -78,10 +91,15 @@ Page({
78 91
79 }, 92 },
80 onShow: function() { 93 onShow: function() {
  94 + let that = this;
  95 +
81 setTimeout(() => { 96 setTimeout(() => {
82 app = app || getApp(); 97 app = app || getApp();
83 - this.showBindUserInfo();  
84 - }, app ? 0 : 1000); 98 +
  99 + that.showBindUserInfo();
  100 + }, app ? 0 : 500);
  101 +
  102 +
85 }, 103 },
86 onReady: function() { 104 onReady: function() {
87 105
@@ -188,8 +206,8 @@ Page({ @@ -188,8 +206,8 @@ Page({
188 query.select('.out-login').boundingClientRect(); 206 query.select('.out-login').boundingClientRect();
189 query.exec(result => { 207 query.exec(result => {
190 208
191 - let topHeight = result[0].height || 0;  
192 - let bottomHeight = result[1].height || 0; 209 + let topHeight = result[0] && result[0].height || 0;
  210 + let bottomHeight = result[1] && result[1].height || 0;
193 let containerHeight = (windowHeight - topHeight - bottomHeight - 20 - 30) + 'px'; 211 let containerHeight = (windowHeight - topHeight - bottomHeight - 20 - 30) + 'px';
194 212
195 that.setData({ 213 that.setData({
1 <wxs src="../../wxs/helper.wxs" module="helper" /> 1 <wxs src="../../wxs/helper.wxs" module="helper" />
2 2
3 <view class="home-coupon-index"> 3 <view class="home-coupon-index">
4 - <view class="user-info-bar" hidden='{{isBound}}'> <!--不需要显示用户信息了-->  
5 - <view class='login-container' wx:if="{{!isBound}}">  
6 - <image class="logo" src="../../static/images/home-logo.png"></image>  
7 - <view class='login-buttons'>  
8 - <view class='to-login'>{{loginText}}</view>  
9 - <login-button class="login-area auto-btn" openType="{{loginButtonType}}"></login-button>  
10 - </view>  
11 - <view class='login-tips'>{{loginTips}}</view>  
12 - </view>  
13 - <view wx:if="{{isBound}}">  
14 - <image wx:if="{{userInfo.avatarUrl == ''}}" class="avatar" src="../../static/images/icons/avatar@2x.png"></image>  
15 - <image wx:if="{{userInfo.avatarUrl != '' && userInfo.defaultAvatar}}" class="avatar"  
16 - src="{{userInfo.avatarUrl}}"></image>  
17 - <image wx:if="{{userInfo.avatarUrl != '' && !userInfo.defaultAvatar}}" class="avatar"  
18 - src="{{helper.image(userInfo.avatarUrl, 108, 108)}}"></image>  
19 - <text class="phone">{{userInfo.nickName || userInfo.phoneNum}}</text>  
20 - <text class="coin">积分:<text class="num">{{coinNum}}</text></text>  
21 - </view>  
22 - </view>  
23 - <!-- 我的限购码 --> 4 +<!-- 我的限购码 -->
24 <view wx:if="{{isBound}}" class='container {{!limitCodes.invalidCodes.length && !limitCodes.codes.length ? "no-code" : ""}}' style='{{!limitCodes.invalidCodes.length && !limitCodes.codes.length ? "height:" + containerHeight : ""}}'> 5 <view wx:if="{{isBound}}" class='container {{!limitCodes.invalidCodes.length && !limitCodes.codes.length ? "no-code" : ""}}' style='{{!limitCodes.invalidCodes.length && !limitCodes.codes.length ? "height:" + containerHeight : ""}}'>
25 <!--限购码介绍--> 6 <!--限购码介绍-->
26 <view class='desc-container'> 7 <view class='desc-container'>
@@ -112,6 +93,25 @@ @@ -112,6 +93,25 @@
112 </block> 93 </block>
113 </view> 94 </view>
114 </view> 95 </view>
  96 + <view wx:if='{{showLogin}}' class="user-info-bar" hidden='{{isBound}}'> <!--不需要显示用户信息了-->
  97 + <view class='login-container' wx:if="{{!isBound}}">
  98 + <image class="logo" src="../../static/images/home-logo.png"></image>
  99 + <view class='login-buttons'>
  100 + <view class='to-login'>{{loginText}}</view>
  101 + <login-button class="login-area auto-btn" openType="{{loginButtonType}}"></login-button>
  102 + </view>
  103 + <view class='login-tips'>{{loginTips}}</view>
  104 + </view>
  105 + <view wx:if="{{isBound}}">
  106 + <image wx:if="{{userInfo.avatarUrl == ''}}" class="avatar" src="../../static/images/icons/avatar@2x.png"></image>
  107 + <image wx:if="{{userInfo.avatarUrl != '' && userInfo.defaultAvatar}}" class="avatar"
  108 + src="{{userInfo.avatarUrl}}"></image>
  109 + <image wx:if="{{userInfo.avatarUrl != '' && !userInfo.defaultAvatar}}" class="avatar"
  110 + src="{{helper.image(userInfo.avatarUrl, 108, 108)}}"></image>
  111 + <text class="phone">{{userInfo.nickName || userInfo.phoneNum}}</text>
  112 + <text class="coin">积分:<text class="num">{{coinNum}}</text></text>
  113 + </view>
  114 + </view>
115 <!--不用显示退出登录了--> 115 <!--不用显示退出登录了-->
116 <view class="out-login" bindtap="outLogin" wx:if="{{userInfo.uid}}" hidden='true'>退出登录</view> 116 <view class="out-login" bindtap="outLogin" wx:if="{{userInfo.uid}}" hidden='true'>退出登录</view>
117 </view> 117 </view>