Skip to content

Commit

Permalink
图书馆登录页面与账号登录统一,处理登录逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
iwh718 committed Nov 16, 2019
1 parent 786f5f0 commit 94dbeb9
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 30 deletions.
26 changes: 21 additions & 5 deletions pages/me/me.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// pages/me/me.js
// import {showToast} from "./index";

var util = require("../../utils/util.js")
Page({

/**
* 页面的初始数据
*/
data: {
loginStatus:false,
loginStatus:wx.getStorageSync('ifbind'),
emailStatus:false,
},

Expand All @@ -29,7 +31,9 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {

this.setData({
loginStatus:qq.getStorageSync('ifbind')
})
},

/**
Expand Down Expand Up @@ -67,9 +71,21 @@ Page({

},
navigateToLogin: function(){
console.log('111')
var ifbind = wx.getStorageSync("ifbind")
if(ifbind == ""){
console.log(this.data.loginStatus)
if(!this.data.loginStatus){
qq.setStorageSync('ifbind','')
qq.showToast({
title:"已退出!"
});
this.setData({
loginStatus:""
})
return
}

var ifbind = wx.getStorageSync("ifbind");

if(ifbind === ""){
wx.navigateTo({
url: '/pages/login/login',
})
Expand Down
23 changes: 2 additions & 21 deletions pages/me/me.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,14 @@
<view class="user_top"></view>
<view class="user_box">
<!--头像-->
<view class="user_head"><image mode="widthFix" src="../../images/fake_user.png"></image></view>
<view class="user_head"><open-data type="userAvatarUrl"></open-data></view>
<!--用户名-->
<view class="user_op_box">
<view class="user_nick" ><text>{{loginStatus ? "您已登录":"hello,你还未登录!"}}</text><switch bindtap="navigateToLogin" style="color: #6f89c5!important" color="#6f89c5" checked="{{loginStatus}}" bindchange="login"></switch></view>
<view class="user_nick" ><open-data type="userNickName"></open-data><text>{{loginStatus ? "您已登录":"未登录!"}}</text><switch bindtap="navigateToLogin" style="color: #6f89c5!important" color="#6f89c5" checked="{{loginStatus === 'yes'}}" bindchange="login"></switch></view>
</view>
</view>
<!--登录临时放到这里,按照你可以按照原有逻辑,使用switch来控制登录页面跳转-->



<!--<view class="padding text-center">-->
<!--<view class="padding-xl radius shadow-warp bg-white margin-top">-->
<!--<button class="cu-btn bg-blue lg" style="width: 90%;" bindtap="navigateToLogin">登录</button>-->
<!--<view class="padding"></view>-->
<!--<button class="cu-btn bg-red lg" style="width: 90%;" bindtap="quit">退出登录</button>-->
<!--</view>-->
<!--</view>-->

<!--我的页面功能-->
<view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg radius">
<view hidden="{{!loginStatus}}" class="user_nick email_service"><text>{{emailStatus ? "已开启人文邮件服务":"已关闭人文邮件服务"}}</text><switch color="#6f89c5" checked="{{emailStatus}}" bindchange="emailsSwitch"></switch></view>
Expand Down Expand Up @@ -52,15 +42,6 @@
<button class="join_us" style="width: 90%;" open-type="openGroupProfile" group-id="805769614">加入果壳儿交流群</button>
</view>
</view>
<!--<view class="padding text-center">-->
<!--<view class="padding-xl radius shadow-warp bg-white margin-top">-->
<!--<button class="cu-btn bg-blue lg" style="width: 90%;" bindtap="navigateToAdvice">提建议</button>-->
<!--<view class="padding"></view>-->
<!--<button class="cu-btn bg-blue lg" style="width: 90%;" open-type="openGroupProfile" group-id="805769614">加入果壳儿交流群</button>-->
<!--</view>-->
<!--</view>-->


<!---->
<view class="footer"><text>果壳小组[email protected]</text></view>

33 changes: 30 additions & 3 deletions pages/me/me.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,48 @@ page{


}
.user_head image{
.user_head {
width: 150rpx;
background: #fff;
display: block;
margin: 0 auto;
overflow: hidden;
height: 150rpx;
-webkit-border-radius: 70%;
-moz-border-radius: 70%;
border-radius: 70%;


}
.user_head{
padding-bottom: 40rpx;
.user_head open-data{
width: 150rpx;
height: 150rpx;
mso-border-right-alt: 80%;
}
.user_nick open-data{
padding: 5rpx 10rpx;
/*background: #6f89c5;*/
/*text-align: center;*/
/*color:#fff;*/
/*-webkit-border-radius: 20rpx;*/
/*-moz-border-radius: 20rpx;*/
/*border-radius: 20rpx;*/
width: 100%;
-webkit-box-sizing: border-box;
overflow: hidden;
white-space: nowrap;
-ms-text-overflow: ellipsis;
text-overflow: ellipsis;
-ms-word-wrap: normal;
word-wrap: normal;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.user_nick text{
width: 100%;

}

.user_op_box:first-child{
margin-top: 15rpx;
}
Expand Down
2 changes: 1 addition & 1 deletion project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"list": []
},
"miniprogram": {
"current": 3,
"current": 1,
"list": [
{
"id": 0,
Expand Down

0 comments on commit 94dbeb9

Please sign in to comment.