浏览代码

微信绑定

li 7 年之前
父节点
当前提交
f1e1de0f41
共有 3 个文件被更改,包括 46 次插入6 次删除
  1. 8 0
      app/html/backBindUn.html
  2. 38 5
      app/js/backBindUn.js
  3. 0 1
      app/js/register.js

+ 8 - 0
app/html/backBindUn.html

24
		        <div class="mui-input-row frm-input">
24
		        <div class="mui-input-row frm-input">
25
		            <input type="tel" class="mui-input-clear frmtype" placeholder="请输入手机号码" id="phone">
25
		            <input type="tel" class="mui-input-clear frmtype" placeholder="请输入手机号码" id="phone">
26
		        </div>
26
		        </div>
27
		        <div class="mui-row mui-input-row frm-input">
28
		        	<div class="mui-col-xs-8">
29
		        		<input type="text" class="frmtype" placeholder="请输入图形验证码" id="imgCode">
30
		        	</div>
31
					<div class="mui-col-xs-4">
32
						<img src="http://www.ekexiu.com/ajax/PictureVC" alt="" id="changImage" width="100%" height="48"/>
33
					</div>
34
				</div>
27
		        <div class="mui-row mui-input-row frm-input">
35
		        <div class="mui-row mui-input-row frm-input">
28
		        	<div class="mui-col-xs-8">
36
		        	<div class="mui-col-xs-8">
29
		        		<input type="number" class="frmtype" placeholder="请输入验证码" id="phoneCode">
37
		        		<input type="number" class="frmtype" placeholder="请输入验证码" id="phoneCode">

+ 38 - 5
app/js/backBindUn.js

6
var weiChatName=document.getElementById("weiChatName");
6
var weiChatName=document.getElementById("weiChatName");
7
var setpassword=document.getElementById("setpassword");
7
var setpassword=document.getElementById("setpassword");
8
var binding=document.getElementById("binding");
8
var binding=document.getElementById("binding");
9
var changImage = document.getElementById("changImage")
9
var state = 0;
10
var state = 0;
10
var phoneCode = false;
11
var phoneCode = false;
11
document.getElementById("weiChatName").value=ws.name;
12
document.getElementById("weiChatName").value=ws.name;
20
	}
21
	}
21
})
22
})
22
/*校验提交按钮显示状态*/
23
/*校验提交按钮显示状态*/
23
		mui('.frmboxNew').on('keyup', "#weiChatName,#phone,#phoneCode,#setpassword", function() {
24
		mui('.frmboxNew').on('keyup', "#weiChatName,#imgCode,#phone,#phoneCode,#setpassword", function() {
24
			if(weiChatName.value == "" || phone.value == "" || oPhoneCode.value == "" || setpassword.value == "") {
25
			if(weiChatName.value == "" || phone.value == "" || oPhoneCode.value == "" || setpassword.value == "") {
25
				binding.setAttribute("disabled","disabled");
26
				binding.setAttribute("disabled","disabled");
26
			} else {
27
			} else {
30
				binding.removeAttribute("disabled");
31
				binding.removeAttribute("disabled");
31
			}
32
			}
32
		});
33
		});
33
		
34
		changImage.addEventListener("tap",function(){ 
35
			this.setAttribute("src","http://www.ekexiu.com/ajax/PictureVC?"+new Date().getTime());
36
		})
34
		/*校验手机号*/
37
		/*校验手机号*/
35
		getPhoneCode.addEventListener("tap",function(){
38
		getPhoneCode.addEventListener("tap",function(){
36
			phoneVal();
39
			phoneVal();
37
		})
40
		})
38
		function phoneVal() {
41
		function phoneVal() {
42
			if(imgCode.value=="") {
43
				plus.nativeUI.toast("请输入图形验证码", toastStyle);
44
				return;
45
			}
39
			var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
46
			var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
40
			if(hunPhone.test(phone.value)) {
47
			if(hunPhone.test(phone.value)) {
41
				isReg();
48
				isReg();
80
		}
87
		}
81
		/*手机发送验证码*/
88
		/*手机发送验证码*/
82
		function sendAuthentication() {
89
		function sendAuthentication() {
83
			console.log("send code")
84
			mui.ajax(baseUrl + '/ajax/regmobilephone_onlyphone', {
90
			var cookieValue=plus.navigator.getCookie("http://www.ekexiu.com/ajax/PictureVC");
91
			console.log(cookieValue)
92
			mui.ajax(baseUrl + '/ajax/regmobilephone', {
93
				header:{
94
					"Cookie":cookieValue
95
				},
85
				data: {
96
				data: {
86
					mobilePhone: phone.value
97
					mobilePhone: phone.value,
98
					vcode: imgCode.value
87
				},
99
				},
88
				dataType: 'json', //数据格式类型
100
				dataType: 'json', //数据格式类型
89
				type: 'GET', //http请求类型
101
				type: 'GET', //http请求类型
95
						state = data.data;
107
						state = data.data;
96
						console.log(state);
108
						console.log(state);
97
						doClick();
109
						doClick();
110
					}else{
111
						if(data.code==20001) {
112
							plus.nativeUI.toast("请输入正确的图形验证码", toastStyle);
113
							changImage.setAttribute("src","http://www.ekexiu.com/ajax/PictureVC?"+new Date().getTime());
114
						}
98
					}
115
					}
99
				},
116
				},
100
				error: function() {
117
				error: function() {
120
					getPhoneCode.style.display = "block";
137
					getPhoneCode.style.display = "block";
121
					getCodeOff.style.display = "none";
138
					getCodeOff.style.display = "none";
122
					getPhoneCode.value = "获取验证码";
139
					getPhoneCode.value = "获取验证码";
140
					changImage.setAttribute("src","http://www.ekexiu.com/ajax/PictureVC?"+new Date().getTime());
123
				}
141
				}
124
			}, 1000);
142
			}, 1000);
125
		}
143
		}
175
				plus.nativeUI.toast("请输入正确的手机号码", toastStyle);
193
				plus.nativeUI.toast("请输入正确的手机号码", toastStyle);
176
				return;
194
				return;
177
			}
195
			}
196
			if(imgCode.value.length==0) {
197
				plus.nativeUI.toast("请输入图形验证码", toastStyle);
198
				return;
199
			}else if(imgCode.value.length==4){
200
				
201
			}else{
202
				plus.nativeUI.toast("图形验证码4位", toastStyle);
203
				return;
204
			}
178
			if(!oNum.test(oPhoneCode.value)) {
205
			if(!oNum.test(oPhoneCode.value)) {
179
				plus.nativeUI.toast("验证码为4位数字", toastStyle);
206
				plus.nativeUI.toast("验证码为4位数字", toastStyle);
180
				return;
207
				return;
220
								aniShow: "slide-in-right"
247
								aniShow: "slide-in-right"
221
							}
248
							}
222
						});
249
						});
250
					}else{
251
						if(data.code==-1){
252
							plus.nativeUI.toast("验证码已过期,请重新获取", toastStyle);
253
						}else if(data.code==-2 || data.code==-3 ||data.code==0){
254
							plus.nativeUI.toast("验证码错误,请检查后重试", toastStyle);
255
						}
223
					}
256
					}
224
				},
257
				},
225
				error: function() {
258
				error: function() {

+ 0 - 1
app/js/register.js

250
					if(data.success) {
250
					if(data.success) {
251
						var userId = data.data;
251
						var userId = data.data;
252
						plus.storage.setItem('userid', userId);
252
						plus.storage.setItem('userid', userId);
253
						client()
254
						plus.storage.setItem('name', name.value);
253
						plus.storage.setItem('name', name.value);
255
						plus.nativeUI.toast("已完成注册,请填写个人信息", toastStyle);
254
						plus.nativeUI.toast("已完成注册,请填写个人信息", toastStyle);
256
						mui.openWindow({
255
						mui.openWindow({