区块链、APP、公众号、小程序、物联网、智能硬件、网站开发新模式,安全,超速,可控。
当前位置:首页 > 资源中心 > 登录界面
资源详情

登录界面


index.wxml


<view class="container">  
  <view class="usermotto">  
    <text class="user-motto">{{motto}}</text>  
    用户名:  
    <input type="text" bindinput="userNameInput"/>  
    密码:  
    <input type="text" bindinput="userPasswordInput" password="true"/>  
    <button bindtap="logIn">登录</button>  
  </view>  
</view>  

index.js


var app = getApp()  
Page({  
  data: {  
    motto: '欢迎登录WXapp',  
    userName:'',  
    userPassword:'',  
    id_token:'',//方便存在本地的locakStorage  
    response:'' //存取返回数据  
  },  
  userNameInput:function(e){  
    this.setData({  
      userName: e.detail.value  
    })  
  },  
  userPasswordInput:function(e){  
    this.setData({  
      userPassword: e.detail.value  
    })  
    console.log(e.detail.value)  
  },  
  logIn:function(){  
    var that = this  
    wx.request({  
      url: 'http://localhost:8000/admin',  
      data: {  
        username: this.data.userName,  
        password: this.data.userPassword,  
      },  
      method: 'GET',  
      success: function (res) {  
        that.setData({  
          id_token: res.data.id_token,  
          response:res  
        })  
        try {  
          wx.setStorageSync('id_token', res.data.id_token)  
        } catch (e) {  
        }  
        wx.navigateTo({  
          url: '../components/welcome/welcome'  
        })  
        console.log(res.data);  
      },  
      fail: function (res) {  
        console.log(res.data);  
        console.log('is failed')  
      }  
    })  
  }  
})  



资源介绍
旋风小子 来源者
资源名称:登录界面
格式:zip
大小:844K
颜色:绿色、灰色
风格:简洁
上传时间:2018-01-29
资源价格:
0.00
你可能在找这些资源