From 48944e917725ea0a4c83ae95128156854440888f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=9E=E4=B8=9C=E6=97=AD?= <850374051@qq.com> Date: Mon, 6 Mar 2023 16:31:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E6=9D=83=E4=BA=A4=E6=98=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/api/index.js | 1 + static/js/project/index.js | 30 +++++++++++++++++----- static/js/project/user/login.js | 44 ++++++++++++++++++++++++++++++++- view/login/login.html | 16 ++++++------ 4 files changed, 76 insertions(+), 15 deletions(-) diff --git a/static/js/api/index.js b/static/js/api/index.js index b847406..bd43319 100644 --- a/static/js/api/index.js +++ b/static/js/api/index.js @@ -2,6 +2,7 @@ * 获取用户、登录、注册相关 -----------------*/ var captchaImage_get = '/captchaImage'; //图形验证码接口 +var getSmsCode = '/sms/code'; //手机验证码接口 var login_post = '/login'; //用户登录接口 var getInfo_get = '/getInfo' //获取用户信息 diff --git a/static/js/project/index.js b/static/js/project/index.js index eaab306..f4567b0 100644 --- a/static/js/project/index.js +++ b/static/js/project/index.js @@ -340,10 +340,10 @@ define(['jquery', "template", "Tools", "echarts", 'swiper'], function ($, templa //标的物类型 module.deptType = function (data) { if (data.code == 200) { - var content = [] ; - for (var i = 0 ; i < 4 ; i++){ - content[i] = data.data[i]; - } + var content = data.data ; + // for (var i = 0 ; i < 4 ; i++){ + // content[i] = data.data[i]; + // } module.data.deptTypeList = content; var deptTypeData = template('deptTypeData', module.data); $("#deptTypeContent").html(deptTypeData); @@ -391,7 +391,23 @@ define(['jquery', "template", "Tools", "echarts", 'swiper'], function ($, templa if (data.code == 200) { module.data.serverApi = serverApi; var content = data.data; - module.data.landListList = content; + for (let i = 0 ; i < 5 ; i++){ + if (content[i]==undefined){ + module.data.landListList.push({ + projectShowStatus:'', + projectName :'', + price :'', + unit :'', + outName :'', + signupStopTime :'', + biddingStopTime :'', + locationName:'', + }); + }else{ + module.data.landListList.push(content[i]); + } + } + // module.data.landListList = content; var landListData = template('landListData', module.data); $("#landListContent").html(landListData); } @@ -458,6 +474,7 @@ define(['jquery', "template", "Tools", "echarts", 'swiper'], function ($, templa //土地林地四荒地 goListingChange = function (id) { + module.data.landListList = []; $('#deptTypeContent').children('span').removeClass('active') ; document.getElementById('tab'+id).className = 'm-r-20 active'; if (id == 0){ @@ -470,7 +487,8 @@ define(['jquery', "template", "Tools", "echarts", 'swiper'], function ($, templa //土地林地四荒地 goListingChanges = function (id) { - $('#deptTypeContent1').children('span').removeClass('active') ; + module.data.collectiveAssetsList = []; + $('#deptTypeContent1').children('span').removeClass('active'); document.getElementById('tabs'+id).className = 'm-r-20 active'; tools.doGet(needProjectList, {projectNumber:id==0?'':id,pageSize:'5',pageNum:'1'}, module.itemLists, true); } diff --git a/static/js/project/user/login.js b/static/js/project/user/login.js index cac21ec..f72b14e 100644 --- a/static/js/project/user/login.js +++ b/static/js/project/user/login.js @@ -6,7 +6,9 @@ define(['jquery', "Tools","user"], function ($, Tools) { //数据存储 var module = { - uuid: '' //验证码uuid + uuid: '', //验证码uuid + computeTime:60, + timer:null }; //自定义公共方法 var tools = new Tools(); @@ -17,8 +19,14 @@ define(['jquery', "Tools","user"], function ($, Tools) { $('#login-submit').on('click', module.login) //点击图形验证码 $('#graphicImg').on('click', module.verificationCode) + //点击图形验证码 + $('#mobileGraphicImg').on('click', module.verificationCode1) + //点击发送验证码 + $('#getSmsCode').on('click', module.getSmsCode) //图形验证码加载 module.verificationCode() + //图形验证码加载 + module.verificationCode1() //背景高度 module.register() //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号) @@ -31,6 +39,24 @@ define(['jquery', "Tools","user"], function ($, Tools) { }; }; + module.getSmsCode = function () { + var mobile = $('#mobile').val(); + tools.doPost(getSmsCode, {mobile:mobile,code:$('#mobileCode').val(),uuid:module.uuid}, module.getSmsCodeAjax, true) + } + + module.getSmsCodeAjax = function (data) { + module.uuid = data.uuid; + module.computeTime = 60; + module.timer = setInterval(() => { + module.computeTime--; + document.getElementById('getSmsCode').value = module.computeTime; + if (module.computeTime <= 0) { + clearInterval(module.timer); + document.getElementById('getSmsCode').value = '发送验证码'; + } + }, 1000); + } + //底部友情链接 module.bottomFriendsLinks = function (data) { if (data.code == 200) { @@ -47,6 +73,11 @@ define(['jquery', "Tools","user"], function ($, Tools) { document.getElementById('loginTab').style.display = 'none' document.getElementById('phoneTab').style.display = 'none' document.getElementById(type+'Tab').style.display = 'block' + + + $('#loginBtn').attr('class','') + $('#phoneBtn').attr('class','') + $('#'+type+'Btn').attr('class','active') } //背景高度 module.register = function(){ @@ -62,6 +93,17 @@ define(['jquery', "Tools","user"], function ($, Tools) { module.uuid = data.uuid; } } + + //图形验证码 + module.verificationCode1 = function () { + tools.doGet(captchaImage_get, {}, module.verificationAjax1, true) + } + module.verificationAjax1 = function (data) { + if (data.code == 200) { + $('#mobileGraphicImg').attr('src', 'data:image/gif;base64,' + data.img) + module.uuid = data.uuid; + } + } //用户登录 module.login = function () { if (module.check()) { diff --git a/view/login/login.html b/view/login/login.html index ec026a5..e43c183 100644 --- a/view/login/login.html +++ b/view/login/login.html @@ -54,7 +54,7 @@ -
+

@@ -134,17 +134,17 @@ - + - - - + + + - - - + + +