大理市民卡小程序1.0提交
diff --git a/pages/wxlogin/wxlogin.js b/pages/wxlogin/wxlogin.js
new file mode 100644
index 0000000..d830a76
--- /dev/null
+++ b/pages/wxlogin/wxlogin.js
@@ -0,0 +1,139 @@
+// pages/wxlogin/wxlogin.js
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ phone: '',
+ password: ''
+
+ },
+
+ setPhone: function(e) {
+ this.setData({
+ phone: e.detail.value
+ })
+ },
+ setPassword: function(e) {
+ this.setData({
+ password: e.detail.value
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function(options) {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function() {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function() {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function() {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function() {
+
+ },
+ toRegister: function() {
+ wx.navigateTo({
+ url: '../register/register',
+ })
+ },
+ doLogin: function() {
+ var phone = this.data.phone;
+ var pwd = this.data.password;
+ if (wx.$isEmpty(phone) || wx.$isEmpty(pwd)) {
+ return;
+ }
+ //loadingElement('loginBtn', '登录中...')
+ wx.showLoading({
+ title: '登录中',
+ })
+ var platform = wx.getStorageInfoSync('platform')
+ var param = {
+ "username": phone,
+ "password": pwd,
+ "platform": platform
+ }
+ wx.$doPost('/login', param, function(ok, ret) {
+ wx.hideLoading();
+
+ if (ok) {
+ if (ret.data.code != 200) {
+ wx.showModal({
+ title: '错误',
+ content: ret.data.msg ,
+ duration: 2000
+ })
+
+
+ } else {
+ console.log(ret.data);
+ wx.setStorageSync("phone", phone);
+ wx.setStorageSync("phoneX", ret.data.phone);
+ wx.setStorageSync("token", ret.data.token);
+ wx.setStorageSync("uid", ret.data.uid);
+ wx.setStorageSync("tenantid", ret.data.tenantid);
+ wx.setStorageSync("tokenexpire", ret.data.expire);
+ wx.setStorageSync("tokentime", ret.data.now);
+ wx.setStorageSync("userid", ret.data.userid);
+ wx.setStorageSync("signed", ret.data.signed);
+ wx.setStorageSync("paypwdset", ret.data.paypwdset);
+ wx.setStorageSync("name", ret.data.name);
+ wx.redirectTo({
+ url: '../index/index',
+ })
+ }
+ } else {
+ wx.showModal({
+ title: '错误',
+ content: "请求失败了" + ret.status + ",请稍后再试",
+ duration: 2000
+ })
+ }
+ })
+
+ }
+})
\ No newline at end of file
diff --git a/pages/wxlogin/wxlogin.json b/pages/wxlogin/wxlogin.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/pages/wxlogin/wxlogin.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/pages/wxlogin/wxlogin.wxml b/pages/wxlogin/wxlogin.wxml
new file mode 100644
index 0000000..5f2d5ba
--- /dev/null
+++ b/pages/wxlogin/wxlogin.wxml
@@ -0,0 +1,16 @@
+<view class="container">
+
+ <view class="global-background">
+ <view class="page-top">
+ <text class="title">大理市民卡</text>
+ </view>
+
+ <input class="weui-input input-bar" bindinput="setPhone" placeholder="请输入手机号" style=""></input>
+ <input class="weui-input input-bar" bindinput="setPassword" placeholder="请输入密码" password="true" style=""></input>
+
+ <button class="long-btn" style="width: 90%;" bindtap="doLogin">登录</button>
+ <view class="signin-btn" bindtap="toRegister">新用户注册</view>
+
+ </view>
+
+</view>
\ No newline at end of file
diff --git a/pages/wxlogin/wxlogin.wxss b/pages/wxlogin/wxlogin.wxss
new file mode 100644
index 0000000..a05de8b
--- /dev/null
+++ b/pages/wxlogin/wxlogin.wxss
@@ -0,0 +1,27 @@
+/* pages/wxlogin/wxlogin.wxss */
+
+.title {
+ display: flex;
+ justify-content: center;
+ padding-top: 15%;
+ color: white;
+ font-size: 60rpx;
+ margin: 0;
+}
+
+.input-bar {
+ height: 2rem;
+ border: 1px solid rgb(240, 240, 240);
+ border-style: solid none none none;
+ background-color: white;
+}
+
+.signin-btn {
+ margin-top: 30rpx;
+ color: gray;
+ float: right;
+ margin-right: 30rpx;
+ font-size: 28rpx;
+}
+
+