网友真实露脸自拍10p,成人国产精品秘?久久久按摩,国产精品久久久久久无码不卡,成人免费区一区二区三区

小程序模板網

小程序學習筆記《四》用戶登錄

發布時間:2018-02-10 11:29 所屬欄目:小程序開發教程

利用quickstart工程,實現用戶登錄過程,并簡單校驗用戶名和密碼是否正確。

1.底部有兩個tabBar(首頁/個人中心) 
2.個人中心顯示用戶信息。 
首次切換到個人中心,需要先登錄,才能看到個人信息。登錄后,就一直顯示用戶信息。

改app.json文件,添加tabBar

 

  1. app.json
    {
    "pages":[
    "pages/index/index",
    "pages/user/user",
    "pages/login/login"
    ],
    "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "WeChat",
    "navigationBarTextStyle":"black"
    },
    "tabBar": {
    "list": [{
    "pagePath": "pages/index/index",
    "text": "首頁"
    },{
    "pagePath": "pages/user/user",
    "text": "個人中心"
    }]
    }
    }

添加用戶登錄頁面login  兩個輸入框(用戶名和密碼)  一個按鈕  當點擊按鈕時,驗證用戶名和密碼是否正確,如果正確,則跳轉到用戶頁面(用戶的個人信息)。  否則在登錄頁面有個錯誤提示"請輸入正確的用戶名和密碼"。

login.wxml

 

  1. <view class="mcontainer">
    <view class="item">
    <view class="login-item">
    <view class="login-item-info">用戶名</view>
    <view><input /></view>
    </view>
    <view class="login-item">
    <view class="login-item-info">密碼</view>
    <view class="login-pwd">
    <input style="flex-grow:1" password="true" />
    <text> 忘記密碼 </text>
    </view>
    </view>
    <view class="login-item bottom">
    <button class="login-btn" >登錄</button>
    </view>
    <view class="login-item bottom">
    <text> 用戶名或密碼錯誤 </text>
    </view>
    </view>
    </view>

login.wxss

 

  1. .mcontainer {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    }
    .item{
    flex-grow:1;
    height: 30%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: 96%;
    padding: 0 2%;
    }
    .login-item{
    width: 90%;
    margin-top: 30rpx;
    border-bottom: 1px solid #eee;
    flex-grow:1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 20rpx;
    }
    
    .bottom{
    border-bottom: 0px;
    }
    
    .login-item-info{
    font-size: 8px;
    color: #888;
    padding-bottom: 20rpx;
    }
    
    .login-pwd{
    display: flex;
    justify-content: space-between;
    flex-grow: 1;
    align-items: center;
    
    }
    
    .login-pwd text{
    height: 100%;
    font-size: 14px;
    color: #888;
    display: flex;
    
    }
    .login-btn{
    width: 80%;
    color: white;
    background-color: green;
    border-radius: 0;
    font-size: 14px;
    
    }
    .login-btn:hover{
    width: 80%;
    color: white;
    border-radius: 0;
    
    }

綁定bindinput事件

 

  1. usernameInput


易優小程序(企業版)+靈活api+前后代碼開源 碼云倉庫:starfork
本文地址:http://www.xiuhaier.com/wxmini/doc/course/21940.html 復制鏈接 如需定制請聯系易優客服咨詢:800182392 點擊咨詢
QQ在線咨詢
AI智能客服 ×