Commit ae0ffc864cdabd1edffa1fc217894c6492b8fa3a
1 parent
7fa2adca87
Exists in
master
and in
2 other branches
no message
Showing 9 changed files with 224 additions and 71 deletions
littleApp_child/app.json
View file @
ae0ffc8
littleApp_child/pages/.js
View file @
ae0ffc8
1 | -// pages/.js | |
2 | -Page({ | |
3 | - | |
4 | - /** | |
5 | - * 页面的初始数据 | |
6 | - */ | |
7 | - data: { | |
8 | - | |
9 | - }, | |
10 | - | |
11 | - /** | |
12 | - * 生命周期函数--监听页面加载 | |
13 | - */ | |
14 | - onLoad: function (options) { | |
15 | - | |
16 | - }, | |
17 | - | |
18 | - /** | |
19 | - * 生命周期函数--监听页面初次渲染完成 | |
20 | - */ | |
21 | - onReady: function () { | |
22 | - | |
23 | - }, | |
24 | - | |
25 | - /** | |
26 | - * 生命周期函数--监听页面显示 | |
27 | - */ | |
28 | - onShow: function () { | |
29 | - | |
30 | - }, | |
31 | - | |
32 | - /** | |
33 | - * 生命周期函数--监听页面隐藏 | |
34 | - */ | |
35 | - onHide: function () { | |
36 | - | |
37 | - }, | |
38 | - | |
39 | - /** | |
40 | - * 生命周期函数--监听页面卸载 | |
41 | - */ | |
42 | - onUnload: function () { | |
43 | - | |
44 | - }, | |
45 | - | |
46 | - /** | |
47 | - * 页面相关事件处理函数--监听用户下拉动作 | |
48 | - */ | |
49 | - onPullDownRefresh: function () { | |
50 | - | |
51 | - }, | |
52 | - | |
53 | - /** | |
54 | - * 页面上拉触底事件的处理函数 | |
55 | - */ | |
56 | - onReachBottom: function () { | |
57 | - | |
58 | - }, | |
59 | - | |
60 | - /** | |
61 | - * 用户点击右上角分享 | |
62 | - */ | |
63 | - onShareAppMessage: function () { | |
64 | - | |
65 | - } | |
66 | -}) |
littleApp_child/pages/.json
View file @
ae0ffc8
1 | -{} |
littleApp_child/pages/.wxml
View file @
ae0ffc8
littleApp_child/pages/.wxss
View file @
ae0ffc8
1 | -/* pages/.wxss */ |
littleApp_child/pages/login/login.js
View file @
ae0ffc8
1 | + | |
2 | +// 网络请求工具类 | |
3 | +var networkUtil = require('../../utils/network_util.js') | |
4 | +var numberUtil = require('../../utils/numberUtil.js') | |
5 | +var api = require('../../utils/apiFile.js') | |
6 | + | |
7 | +var timeCount = 60; | |
8 | +var timer; | |
9 | +var phone; | |
10 | +var name; | |
11 | +var isFirst=true | |
12 | +Page({ | |
13 | + data: { | |
14 | + inputFocus: { codeInput: false }, | |
15 | + time: '60s', | |
16 | + }, | |
17 | + | |
18 | + // 获取验证码 | |
19 | + getVerifyCode: function (e) { | |
20 | + if (timeCount < 60) { | |
21 | + return | |
22 | + } | |
23 | + | |
24 | + var that = this | |
25 | + networkUtil._post(api.bindDoc, { username: name, phone: phone }, function (res) { | |
26 | + | |
27 | + }, function (res) { | |
28 | + // timeCount = 60 | |
29 | + // clearTimeout(timer); | |
30 | + // that.setData({ | |
31 | + // time: '0s' | |
32 | + // }) | |
33 | + // networkUtil.showErrorToast('获取验证码失败,请稍后再试') | |
34 | + }) | |
35 | + if (timeCount == 60) { | |
36 | + this.keepTime() | |
37 | + } | |
38 | + // if (numberUtil.IsTelPhoneNumber(phone)) { | |
39 | + | |
40 | + // } else { | |
41 | + // wx.showToast({ | |
42 | + // title: '请输入正确手机号码', | |
43 | + // }) | |
44 | + // return | |
45 | + // } | |
46 | + | |
47 | + | |
48 | + }, | |
49 | + // 计时器 | |
50 | + keepTime: function () { | |
51 | + var that = this | |
52 | + timeCount-- | |
53 | + that.setData({ | |
54 | + time: timeCount + 's' | |
55 | + }) | |
56 | + if (timeCount == 0) { | |
57 | + timeCount = 60 | |
58 | + clearTimeout(timer); | |
59 | + return | |
60 | + } | |
61 | + timer = setTimeout(function () { | |
62 | + that.keepTime() | |
63 | + }, 1000) | |
64 | + }, | |
65 | + blurInput: function (e) { | |
66 | + console.log(e) | |
67 | + phone = e.detail.value | |
68 | + }, | |
69 | + // 提交表单 | |
70 | + formSubmit: function (e) { | |
71 | + | |
72 | + var self = this | |
73 | + if (e.detail.value.code == "") { | |
74 | + wx.showModal({ | |
75 | + title: '提示', | |
76 | + content: '请输入验证码', | |
77 | + showCancel: false, | |
78 | + success: function (res) { | |
79 | + } | |
80 | + }) | |
81 | + return | |
82 | + } | |
83 | + networkUtil.showLoading() | |
84 | + var param = { code: e.detail.value.code, phone: phone } | |
85 | + if (getApp().globalData.openInfo.mpid) { | |
86 | + param.gzopenid = getApp().globalData.openInfo.mpid | |
87 | + console.log('绑定mpid', param) | |
88 | + } | |
89 | + if (getApp().globalData.openInfo.code) { | |
90 | + param.jscode = getApp().globalData.openInfo.code | |
91 | + console.log('绑定code', param) | |
92 | + } | |
93 | + networkUtil._get(api.verifyCode, param, function (res) { | |
94 | + console.log(res) | |
95 | + self.loginSuccess(res.data) | |
96 | + }, function (res) { | |
97 | + networkUtil.showErrorToast(res.errormsg) | |
98 | + }) | |
99 | + }, | |
100 | + loginSuccess(data) { | |
101 | + console.log(data) | |
102 | + wx.setStorageSync('userToken', data.token) | |
103 | + wx.setStorageSync('hxName', data.hxName) | |
104 | + wx.setStorageSync('hxPassWord', data.hxPassWord) | |
105 | + getApp().globalData.token = data.token | |
106 | + // wx.navigateTo({ | |
107 | + // url: '../HasDocumentedVerifySuccess/HasDocumentedVerifySuccess?name=' + name | |
108 | + // }) | |
109 | + } | |
110 | +} | |
111 | + | |
112 | +) |
littleApp_child/pages/login/login.json
View file @
ae0ffc8
littleApp_child/pages/login/login.wxml
View file @
ae0ffc8
1 | +<view> | |
2 | + <form catchsubmit="formSubmit"> | |
3 | + | |
4 | + <view class="record-input-constainer"> | |
5 | + <view class="record-input_bg" style="border-color:{{inputFocus.nameInput ? '#f4879b' : '#e8eae5'}}"> | |
6 | + <label class="record-input_title">姓名</label> | |
7 | + <input class="input" id = "name" name="name" maxlength="12" placeholder="请输入建档姓名" value="" placeholder-class="input-placeholder" bindfocus="getFocus" /> | |
8 | + </view> | |
9 | + <view class="record-input_bg" style="margin-top:15px;border-color:{{inputFocus.phoneInput ? '#f4879b' : '#e8eae5'}}"> | |
10 | + <label class="record-input_title">手机号</label> | |
11 | + <input class="input" id="phone" name="phone" type="number" placeholder="请输入建档手机号" maxlength="11" placeholder-class="input-placeholder" bindfocus="getFocus" value="" bindblur="blurInput"/> | |
12 | + </view> | |
13 | + | |
14 | + <view class="record-input_bg" style="margin-top:15px;border-color:{{inputFocus.codeInput ? '#f4879b' : '#e8eae5'}}"> | |
15 | + <label class="record-input_title" style="padding-left:20px;padding-right:20px;">验证码</label> | |
16 | + <input class="input" id = "code" name="code" maxlength="12" placeholder="请输入验证码" value="" placeholder-class="input-placeholder" bindfocus="getFocus" /> | |
17 | + <label class="record-time-text" bindtap="getVerifyCode">{{time == '0s' ? '点击获取' : time}}</label> | |
18 | + </view> | |
19 | + </view> | |
20 | + | |
21 | + | |
22 | + <button class="record-submit-btn" formType="submit">下一步</button> | |
23 | + </form> | |
24 | +</view> |
littleApp_child/pages/login/login.wxss
View file @
ae0ffc8
1 | + | |
2 | +.input-placeholder { | |
3 | + font-size: 13px; | |
4 | + color: #979797; | |
5 | +} | |
6 | + | |
7 | +page { | |
8 | + background-color: white; | |
9 | +} | |
10 | + | |
11 | +.record-topbar { | |
12 | + width: 100%; | |
13 | + height: 45px; | |
14 | + background: #ffd5dd; | |
15 | + font-size: 12px; | |
16 | + color: #ee7289; | |
17 | + text-align: center; | |
18 | + line-height: 45px; | |
19 | +} | |
20 | + | |
21 | +.record-input-constainer { | |
22 | + margin: 40px 25px 0 25px; | |
23 | +} | |
24 | + | |
25 | +.record-input_bg { | |
26 | + /*background: beige;*/ | |
27 | + display: flex; | |
28 | + align-items: center; | |
29 | + justify-content: flex-start; | |
30 | + height: 45px; | |
31 | + border: solid 1px; | |
32 | + border-radius: 5px; | |
33 | +} | |
34 | + | |
35 | +.record-input_title { | |
36 | + /*background-color: green;*/ | |
37 | + width: 100px; | |
38 | + height: 20px; | |
39 | + text-align: center; | |
40 | + line-height: 20px; | |
41 | + font: medium; | |
42 | + font-size: 14px; | |
43 | + color: #ee7289; | |
44 | + border-right: solid #e8eae5 1px; | |
45 | +} | |
46 | + | |
47 | +.input { | |
48 | + /*background-color: red;*/ | |
49 | + font-size: 13px; | |
50 | + color: #5e5e5e; | |
51 | + margin-left: 20px; | |
52 | + width: 180px; | |
53 | + margin-top: 3px; | |
54 | +} | |
55 | + | |
56 | +.record-submit-btn { | |
57 | + font: medium; | |
58 | + font-size: 20px; | |
59 | + color: white; | |
60 | + width: 200px; | |
61 | + height: 45px; | |
62 | + line-height: 45px; | |
63 | + border-radius: 22.5px; | |
64 | + background-color: #f4879b; | |
65 | + position: absolute; | |
66 | + bottom: 100px; | |
67 | + left: 50%; | |
68 | + transform: translateX(-50%); | |
69 | + text-align: center; | |
70 | +} | |
71 | + | |
72 | +.record-time-text { | |
73 | + margin-right: 20px; | |
74 | + font: lighter; | |
75 | + font-size: 13px; | |
76 | + color: #979797; | |
77 | + width: 110px; | |
78 | + text-align: right; | |
79 | + margin-top: 2px; | |
80 | + /*background-color: rgba(1, 1, 1, 1);*/ | |
81 | +} |