12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- mui.ready(function() {
-
- var inputEmail = document.getElementById("inputemail");
- var sendCode = document.getElementById("sendcode");
- mui.plusReady(function() {
-
-
- sendCode.addEventListener("tap", function() {
- userEmail();
- });
-
- function userEmail() {
- var gunf = /^\w+@\w+\.((cn)|(com)|(com\.cn))$/;
- if(gunf.test(inputEmail.value)) {
- isReg();
- } else {
- plus.nativeUI.toast("请输入正确的邮箱", toastStyle);
- return;
- }
- }
-
- function isReg() {
- mui.ajax(baseUrl + '/ajax/isReg?key=' + inputEmail.value, {
- dataType: 'json',
- type: 'GET',
- timeout: 10000,
- async: false,
- success: function(data) {
- console.log(data.data);
- if(data.data == false) {
- plus.nativeUI.toast("您的邮箱已被绑定", toastStyle);
- return;
- } else {
- sendEmail();
- }
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- }
- });
- }
-
- function sendEmail() {
- var userId = plus.storage.getItem('userid');
- mui.ajax(baseUrl + '/ajax/reqBindMail', {
- data: {
- "userid": userId,
- "mail": inputEmail.value
- },
- dataType: 'json',
- type: 'GET',
- timeout: 10000,
- success: function(data) {
- if(data.success && data.data) {
- plus.nativeUI.toast("发送成功,请登录邮箱验证", toastStyle);
- mui.currentWebview.close();
- return;
- }
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- return;
- }
- });
- }
-
-
- });
- });
|