微信小程序用户名、密码页面设计

.wxml页面

<view class="section">
  <form bindsubmit="bindFormSubmit" bindreset="formReset">
    <text>日期选择</text>
    <view class="textareaT" name="userName">
      <text class="textriqi">{{dateValue}}</text>
      <picker mode="date" value="{{dateValue}}" start="1999-01-01" end="2999-12-12" bindchange="datePickerBindchange">
<image class="imgrili" src="../imges/rili.png"></image>
</picker>
    </view>
    <text>申请人信息</text>
    <view class="textareaT2" name="userName">
      <view class="itemView">用户名:
        <input name="userName" placeholder="请输入用户名" bindinput="userNameInput" />
      </view>
      <view class="lineV"></view>
      <view class="itemView">密码:
        <input name="userName" placeholder="请输入密码" bindinput="pasWInput" />
      </view>
     
    </view>
    <button class="submitClick" formType="submit"> 登 录</button>
  </form>
  <view>{{tip}}</view>
  <view>{{userName}}</view>

</view>






.wxss文件


.textareaT {
  margin-top: 10px;
  height: 60rpx;
  width: 90%;
  font-size: 15px;
  display: flex;
  margin-left: 5%;
  justify-content: space-between;
  border: 1px solid darkgrey;
  border-radius: 3px;
}


.textareaT2 {
  margin-top: 10px;
  width: 90%;
  height: 340rpx;
  margin-left: 5%;
  border: 1px solid darkgrey;
  border-radius: 3px;
}


text {
  margin-top: 40rpx;
  font-size: 13px;
  color: darkgrey;
  width: 90%;
  margin-left: 5%;
}


.submitClick {
  width: 80%;
  color: white;
  background: #06a6e4;
  font-size: 14px;
  margin-top: 10px;
}


.imgrili {
  margin-right: 20rpx;
  margin-top: 10rpx;
  width: 40rpx;
  height: 40rpx;
}


.textriqi {
  margin-top: 15rpx;
  width: 60%;
  height: 30rpx;
}


.itemView {


  height: 60rpx;
  display: flex;
  justify-content: space-around;
  font-size: 13.0px;
  margin-top: 20rpx;
}
.lineV{
  width: 95%;
  height: 2rpx;
  background: darkgrey;
  display: flex;
  margin-left: 2.5%;
  justify-content: space-around;
}



.js文件

Page({
  data: {
    userName: '',
    pasWInput: '',
    dateValue:'2016-10-13'
  },
   datePickerBindchange:function(e){
    this.setData({
      dateValue:e.detail.value
    })
  },
  onLoad: function (options) {
    // 页面初始化 options为页面跳转所带来的参数
  },


  onReady: function () {
    // 页面渲染完成
  },
  onShow: function () {
    // 页面显示
  },
  onHide: function () {
    // 页面隐藏
  },
  onUnload: function () {
    // 页面关闭
  },
  imgClick: function () {


  },
  // 用户名和密码输入框事件
  userNameInput: function (e) {
    this.setData({
      userName: e.detail.value
    })
  },
  pasWInput: function (e) {
    this.setData({
      SFZ: e.detail.value
    })
  },
 
  bindFormSubmit: function (e) {
    if (e.detail.value.userName.length == 0||e.detail.value.pasWInput.length == 0) {
      this.setData({
        tip: '提示:用户信息!',
        userName: '',
        psw: ''
      })
    } else {


    }
  },


})

  • 0
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
微信小程序登录页面源码可以使用WXML、WXSS和JS三种文件进行编写。 首先,在WXML文件中,可以编写如下代码: ```wxml <view class="container"> <image class="logo" src="/images/logo.png"></image> <view class="login-container"> <input class="input-username" type="text" placeholder="请输入用户名"></input> <input class="input-password" type="password" placeholder="请输入密码"></input> <button class="btn-login" bindtap="login">登录</button> </view> </view> ``` 在WXSS文件中,可以编写如下代码: ```wxss .container { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; } .logo { width: 200rpx; height: 200rpx; } .login-container { margin-top: 30rpx; } .input-username, .input-password { width: 500rpx; height: 80rpx; border: 1rpx solid #ccc; border-radius: 10rpx; padding: 10rpx; margin-bottom: 20rpx; } .btn-login { width: 500rpx; height: 80rpx; background-color: #2E8B57; color: #fff; border-radius: 10rpx; } .btn-login:active { background-color: #228B22; } ``` 在JS文件中,可以编写如下代码: ```javascript Page({ login: function() { // 检查用户名密码是否符合要求 const username = this.data.username; const password = this.data.password; if (username === 'admin' && password === '123456') { wx.navigateTo({ url: '/pages/home/home' // 登录成功后跳转到首页 }); } else { wx.showToast({ title: '用户名密码错误', icon: 'none', duration: 2000 }); } } }); ``` 这就是一个简单的微信小程序登录页面的源码示例。其中,WXML文件用于编写页面结构,WXSS文件用于编写页面样式,JS文件用于编写页面逻辑。可以根据实际需求进行修改和扩展。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

冉然

你的鼓励对我很重要

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值