var name = ''; var regionCode = ''; var token = ''; var nextName = ''; var nextCode = ''; var httpStr = ''; $().ready(function() { var qs = parseQueryString(window.location.href); console.log(qs) name = qs.name; regionCode = qs.code; token = qs.token; httpStr = qs.httpStr; cituInfoData(); goBack(); goNextStep(); }) //初始 function init () { $(".typeListRight").css('background','#D7D7D7') .find('.disc').css('background','#FFFFFF'); $(".typeListRight").eq(0).css('background','#5D7DFF') .find('.disc').css('background','#5D7DFF'); $(".nextStep").css({'background':'#5D7DFF','box-shadow':' 0 0 6px 0 rgba(93, 125, 255, 0.7)','-webkit-box-shadow':' 0 0 6px 0 rgba(93, 125, 255, 0.7)'}); $(".nextStep").removeAttr('disabled'); nextCode = $(".typeListRight").eq(0).parent().attr('data-code'); nextName = $(".typeListRight").eq(0).parent().attr('data-nextname'); } //点击进行公积金类型选择 function selectionTypes () { $(".typeListRight").click(function () { $(".typeListRight").css('background','#D7D7D7') .find('.disc').css('background','#FFFFFF'); $(this).css('background','#5D7DFF') .find('.disc').css('background','#5D7DFF'); nextCode = $(this).parent().attr('data-code'); nextName = $(this).parent().attr('data-nextname'); }) } //nav返回上一页 function goBack () { $("nav i").click(function () { history.go(-1) }) } //公积金类型数据 function cituInfoData () { console.log(name) $.ajax({ type:"POST", url: "/api/city/info", headers:{ 'token': '5dac206be8b1f5736285fc03a08adb3c' }, data:{ 'region': name }, success: function (res) { console.log(res) if(res.errno == 0 && res.rst.data){ var list = res.rst.data.list; var html = ''; if(list.length > 0){ for(var i = 0 ; i < list.length ; i++){ html += `

${list[i].region}

${list[i].parent_region}

` } $(".list").html(html); init(); selectionTypes(); } }else{ $(".nextStep").css({'background':'#CCCCCC','box-shadow':'none'}); $(".nextStep").attr('disabled','disabled'); } } }); } //下一步 function goNextStep () { $(".nextStep").click(function () { console.log('ffff') console.log(httpStr) window.location.href = httpStr + '&name=' + nextName + '&code=' + nextCode + '&token=' + token }) }