|
@@ -1,3 +1,106 @@
|
|
|
import '../style/style';
|
|
|
import '../style/login';
|
|
|
-console.log(2222)
|
|
|
+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}$/;
|
|
|
+let code = '';
|
|
|
+let num = 10;
|
|
|
+let flag = true;
|
|
|
+$('.login').hide();
|
|
|
+$('#sendCode').click(function () {
|
|
|
+ const phoneNum = $('#phoneNum').val().replace(/\s/ig,'');
|
|
|
+ if(!phoneNum) {
|
|
|
+ alert('请输入手机号')
|
|
|
+ }else if (!(telStr.test(phoneNum))) {
|
|
|
+ alert('手机号码输入不规范');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(flag) {
|
|
|
+
|
|
|
+ $.get(`${process.env.BASE_API}sharedWhiteBoard/wx/user/sendMag`, {
|
|
|
+ phoneNum
|
|
|
+ }, function (res) {
|
|
|
+ if(res.code == 200) {
|
|
|
+ code = res.data;
|
|
|
+ time();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+})
|
|
|
+$('#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)
|
|
|
+ $('.login').hide();
|
|
|
+ $('.jurisdiction').show();
|
|
|
+ }else if (res.code == 600) {
|
|
|
+ console.log(res.message)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+})
|
|
|
+
|
|
|
+$('#ok').click(function () {
|
|
|
+ const title = $('#title').val().replace(/\s/ig,'');
|
|
|
+ const code = $('.auth-code').val().replace(/\s/ig,'');
|
|
|
+ if(!title) {
|
|
|
+ alert('请输入分会场名称')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(!code) {
|
|
|
+ alert('请输入授权码')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ url:`${process.env.BASE_API}sharedWhiteBoard/shareJoin`,
|
|
|
+ type: 'POST',
|
|
|
+ data: JSON.stringify({
|
|
|
+ uid: 1557972582753973,
|
|
|
+ title,
|
|
|
+ code
|
|
|
+ }),
|
|
|
+ contentType: "application/json",
|
|
|
+ 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"
|
|
|
+ }else if (res.code == 600) {
|
|
|
+ console.log(res.message)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
+const time = function () {
|
|
|
+ setTimeout(function () {
|
|
|
+ flag = false;
|
|
|
+ $('#sendCode').html(`${num}秒后重新发送`).addClass('color');
|
|
|
+ num--;
|
|
|
+ if(num > 0) {
|
|
|
+ time();
|
|
|
+ }else {
|
|
|
+ num = 10;
|
|
|
+ flag = true;
|
|
|
+ $('#sendCode').html('发送验证码').removeClass('color')
|
|
|
+ }
|
|
|
+ },1000)
|
|
|
+}
|