|
@@ -1,21 +1,18 @@
|
|
|
import '../style/style';
|
|
|
import '../style/login';
|
|
|
import $ from 'jquery';
|
|
|
-
|
|
|
-const telStr = /^[1](([3][0-9])|([4][5-9])|([5][0-3,5-9])|([6][5,6])|([7][0-8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$/;
|
|
|
+import { fail } from 'assert';
|
|
|
let code = '';
|
|
|
let num = 10;
|
|
|
let flag = true;
|
|
|
$('.jurisdiction').hide();
|
|
|
+if(window.localStorage.getItem('uid')) {
|
|
|
+ $('.login').hide();
|
|
|
+ $('.jurisdiction').show();
|
|
|
+}
|
|
|
$('#sendCode').click(function () {
|
|
|
const phoneNum = $('#phoneNum').val().replace(/\s/ig,'');
|
|
|
- if(!phoneNum) {
|
|
|
- alert('请输入手机号')
|
|
|
- }else if (!(telStr.test(phoneNum))) {
|
|
|
- alert('手机号码输入不规范');
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(flag) {
|
|
|
+ if(proving(phoneNum) && flag) {
|
|
|
|
|
|
$.get(`${process.env.BASE_API}sharedWhiteBoard/wx/user/sendMag`, {
|
|
|
phoneNum
|
|
@@ -31,27 +28,30 @@ $('#login').click(function () {
|
|
|
const mobile = $('#phoneNum').val().replace(/\s/ig,'');
|
|
|
const sign = $('#phoneCode').val().replace(/\s/ig,'');
|
|
|
|
|
|
- $.ajax({
|
|
|
- url:`${process.env.BASE_API}sharedWhiteBoard/wx/user/loginByPhone`,
|
|
|
- type: 'POST',
|
|
|
- data: JSON.stringify({
|
|
|
- mobile,
|
|
|
- sign
|
|
|
- }),
|
|
|
- contentType: "application/json",
|
|
|
- dataType: "json",
|
|
|
- success: function (res) {
|
|
|
- console.log(res)
|
|
|
- if(res.code == 200) {
|
|
|
- console.log(res.data.id)
|
|
|
- window.localStorage.setItem('uid', res.data.id);
|
|
|
- $('.login').hide();
|
|
|
- $('.jurisdiction').show();
|
|
|
- }else if (res.code == 600) {
|
|
|
- console.log(res.message)
|
|
|
+ if(proving(mobile)) {
|
|
|
+ $.ajax({
|
|
|
+ url:`${process.env.BASE_API}sharedWhiteBoard/wx/user/loginByPhone`,
|
|
|
+ type: 'POST',
|
|
|
+ data: JSON.stringify({
|
|
|
+ mobile,
|
|
|
+ sign
|
|
|
+ }),
|
|
|
+ contentType: "application/json",
|
|
|
+ dataType: "json",
|
|
|
+ success: function (res) {
|
|
|
+ console.log(res)
|
|
|
+ if(res.code == 200) {
|
|
|
+ console.log(res.data.id)
|
|
|
+ window.localStorage.setItem('uid', res.data.id);
|
|
|
+ $('.login').hide();
|
|
|
+ $('.jurisdiction').show();
|
|
|
+ }else if (res.code == 600) {
|
|
|
+ console.log(res.message);
|
|
|
+ alert(res.message)
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -81,9 +81,9 @@ $('#ok').click(function () {
|
|
|
dataType: "json",
|
|
|
success: function (res) {
|
|
|
if(res.code == 200) {
|
|
|
- const shareTask = JSON.stringify(res.data.shareTask);
|
|
|
- window.sessionStorage.setItem('shareTask', shareTask);
|
|
|
- window.location.href="/index.html"
|
|
|
+ const shareTask = JSON.stringify(res.data);
|
|
|
+ window.sessionStorage.setItem('dataList', shareTask);
|
|
|
+ window.location.href="./index.html"
|
|
|
}else if (res.code == 600) {
|
|
|
console.log(res.message)
|
|
|
alert(res.message)
|
|
@@ -92,7 +92,7 @@ $('#ok').click(function () {
|
|
|
});
|
|
|
})
|
|
|
|
|
|
-
|
|
|
+
|
|
|
const time = function () {
|
|
|
setTimeout(function () {
|
|
|
flag = false;
|
|
@@ -106,4 +106,15 @@ const time = function () {
|
|
|
$('#sendCode').html('发送验证码').removeClass('color')
|
|
|
}
|
|
|
},1000)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+const proving = (phone) => {
|
|
|
+
|
|
|
+ const telStr = /^[1](([3][0-9])|([4][5-9])|([5][0-3,5-9])|([6][5,6])|([7][0-8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$/;
|
|
|
+ if (!(telStr.test(phone))) {
|
|
|
+ alert('手机号码输入不规范');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|