微信小程序中怎么實(shí)現(xiàn)一個(gè)登錄頁面

微信小程序中怎么實(shí)現(xiàn)一個(gè)登錄頁面,相信很多沒有經(jīng)驗(yàn)的人對此束手無策,為此本文總結(jié)了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個(gè)問題。

十多年的浦口網(wǎng)站建設(shè)經(jīng)驗(yàn),針對設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。網(wǎng)絡(luò)營銷推廣的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整浦口建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)公司從事“浦口網(wǎng)站設(shè)計(jì)”,“浦口網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。

目錄結(jié)構(gòu):

微信小程序中怎么實(shí)現(xiàn)一個(gè)登錄頁面

圖片資源:

name.png

微信小程序中怎么實(shí)現(xiàn)一個(gè)登錄頁面

key.png

微信小程序中怎么實(shí)現(xiàn)一個(gè)登錄頁面

loginLog.jpg

微信小程序中怎么實(shí)現(xiàn)一個(gè)登錄頁面

login.wxml:

<view class="container"> 
 <view class="login-icon"> 
 <image class="login-img" src="../images/loginLog.jpg"></image> 
 </view> 
 <view class="login-from"> 
 
 <!--賬號--> 
 <view class="inputView"> 
 <image class="nameImage" src="../images/name.png"></image> 
 <label class="loginLab">賬號</label> 
 <input class="inputText" placeholder="請輸入賬號" bindinput="phoneInput" /> 
 </view> 
 <view class="line"></view> 
 
 <!--密碼--> 
 <view class="inputView"> 
 <image class="keyImage" src="../images/key.png"></image> 
 <label class="loginLab">密碼</label> 
 <input class="inputText" password="true" placeholder="請輸入密碼" bindinput="passwordInput" /> 
 </view> 
 
 <!--按鈕--> 
 <view class="loginBtnView"> 
 <button class="loginBtn" type="primary" size="{{primarySize}}" loading="{{loading}}" plain="{{plain}}" disabled="{{disabled}}" bindtap="login">登錄</button> 
 </view> 
 </view> 
</view>

login.wxss:

page{ 
 height: 100%; 
} 
 
.container { 
 height: 100%; 
 display: flex; 
 flex-direction: column; 
 padding: 0; 
 box-sizing: border-box; 
 background-color: #f2f2f2 
} 
 
/*登錄圖片*/ 
.login-icon{ 
 flex: none; 
} 
.login-img{ 
 width: 750rpx; 
} 
 
/*表單內(nèi)容*/ 
.login-from { 
 margin-top: 20px; 
 flex: auto; 
 height:100%; 
} 
 
.inputView { 
 background-color: #fff; 
 line-height: 44px; 
} 
/*輸入框*/ 
.nameImage, .keyImage { 
 margin-left: 22px; 
 width: 14px; 
 height: 14px 
} 
 
.loginLab { 
 margin: 15px 15px 15px 10px; 
 color: #545454; 
 font-size: 14px 
} 
.inputText { 
 flex: block; 
 float: right; 
 text-align: right; 
 margin-right: 22px; 
 margin-top: 11px; 
 color: #cccccc; 
 font-size: 14px 
} 
 
.line { 
 width: 100%; 
 height: 1px; 
 background-color: #cccccc; 
 margin-top: 1px; 
} 
/*按鈕*/ 
.loginBtnView { 
 width: 100%; 
 height: auto; 
 background-color: #f2f2f2; 
 margin-top: 0px; 
 margin-bottom: 0px; 
 padding-bottom: 0px; 
} 
 
.loginBtn { 
 width: 80%; 
 margin-top: 35px; 
}

login.js:

Page({ 
 data: { 
 phone: '', 
 password:'' 
 }, 
 
// 獲取輸入賬號 
 phoneInput :function (e) { 
 this.setData({ 
 phone:e.detail.value 
 }) 
 }, 
 
// 獲取輸入密碼 
 passwordInput :function (e) { 
 this.setData({ 
 password:e.detail.value 
 }) 
 }, 
 
// 登錄 
 login: function () { 
 if(this.data.phone.length == 0 || this.data.password.length == 0){ 
 wx.showToast({ 
 title: '用戶名和密碼不能為空', 
 icon: 'loading', 
 duration: 2000 
 }) 
}else { 
 // 這里修改成跳轉(zhuǎn)的頁面 
 wx.showToast({ 
 title: '登錄成功', 
 icon: 'success', 
 duration: 2000 
 }) 
 } 
 } 
})

看完上述內(nèi)容,你們掌握微信小程序中怎么實(shí)現(xiàn)一個(gè)登錄頁面的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!

新聞名稱:微信小程序中怎么實(shí)現(xiàn)一個(gè)登錄頁面
文章網(wǎng)址:http://bm7419.com/article14/gighde.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google軟件開發(fā)、網(wǎng)站內(nèi)鏈、商城網(wǎng)站、電子商務(wù)動(dòng)態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司