|
楼主 |
发表于 2019-7-9 16:40:40
|
显示全部楼层
加载的js:
- <script type="text/javascript">
- var prj = {};
- //按钮上几个点的loading效果
- prj.loadingAnimation = function(container){
- var loading = '<ul class="clearfix loadingpoint"><li class="active"></li><li></li><li></li><li></li><li></li></ul>';
- var loadingpoint = jQuery(container).find('.loadingpoint');
- if(loadingpoint.length == 0){
- //需要先加入,再选择
- jQuery(container).append(loading);
- }
- var num = 0;
- var el = $('.loadingpoint li');
- setInterval(function () {
- num++;
- num %= jQuery(el).length;
- $(el[num]).addClass('active').siblings('li').removeClass();
- }, 500);
- }
- prj.btnloading = function (btn, loadingword) {
- var loadingword = typeof !loadingword ? '提交中' : loadingword;
- //复制一个副本
- var cloneBtn = btn.clone(true);
- /*
- 按钮克隆,需要单例
- */
- btn.hide();
- btn.siblings('.btnloading').remove();
- cloneBtn.insertAfter(btn);
- cloneBtn.addClass('disable btnloading').html(loadingword);
- //loading效果
- prj.loadingAnimation(cloneBtn);
- //透明度为0的遮罩
- // this.newloading();
- }
- prj.singleWay = (function () {
- var fgs = {},
- kit = {
- resolve: function (key) {
- fgs[key] = false;
- }
- };
- return function (key, func) {
- if (fgs[key] === true) {
- return;
- } else {
- fgs[key] = true;
- func.call(kit, key);
- }
- }
- })();
- if(!String.prototype.trim){
- String.prototype.trim = function(){
- return this.replace(/^\s*|\s*&/g,"");
- }
- }
- jQuery(function(jQuery){
- var active=jQuery('#login_bbsactive').text(); //0:无论坛账号 非0:有账号
- var urls=window.location.search;
- var urlone=urls.split("?");
- if(urlone !=""){
- var urlstyle=urlone[1].split("=")
- var scookie=jQuery.cookie('cookieispop');
- if(scookie!=undefined && urlstyle[0]=='ispop'){
- if (active!=0) {
- jQuery('.index_tkbg').addClass('hide');
- }else{
- jQuery('.index_tkbg').removeClass('hide');
- }
- };
- }
- jQuery(document).on('blur','#username',function(){
- var floag=0;
- var inp=document.getElementById('username');
- var username=inp.value;
- if (username.length<3) {
- jQuery('.warn_tk').text('账号的长度为3-15位');
- return;
- }else{
- for(var i=0;i<username.length;i++){
- var reg=/^[a-z0-9A-Z\u4e00-\u9fa5]*$/;
- if(reg.test(username[i])==false){
- floag=1;
- jQuery('.warn_tk').text('昵称不能包含特殊字符');
- return;
- }
- }
- }
- if (floag==0) {
- var cookies = document.cookie.split(';');
- var iscookie=';'
- for(var i = 0;i<cookies.length;i++){
- var name='cookieispop'+'=';
- var ca=cookies[i].trim();
- if (ca.indexOf(name)==0) {
- iscookie=ca.substring(name.length,ca.length)
- };
- };
- var urls=window.location.search;
- if(urls !=""){
- var urlstyle=urls.split("=")
- uels=urlstyle[1];
- }
- jQuery.ajax({
- type: "POST",
- url: "bbslink.php?mod=linkregister",
- data: {
- 'nickname':username,
- 'ispop':uels,
- 'cookieispop':iscookie,
- 'step':1
- },
- success: function (res) {
- var res=JSON.parse(res);
- if(res.status==0){
- jQuery('.warn_tk').text("昵称已存在");
- jQuery('#subname').attr('disabled',true)
- }else if(res.status==-1){
- jQuery('.warn_tk').text("已存在对应论坛账号");
- jQuery('#subname').attr('disabled',true)
- }else if(res.status==-2){
- jQuery('.warn_tk').text("昵称不符合规则");
- jQuery('#subname').attr('disabled',true)
- }else if(res.status==-3){
- jQuery('.warn_tk').text("请求路径非法");
- jQuery('#subname').attr('disabled',true)
- }else if(res.status==-4){
- jQuery('.warn_tk').text("昵称长度不符合");
- jQuery('#subname').attr('disabled',true)
- }else{
- jQuery('.warn_tk').text("");
- jQuery('#subname').attr('disabled',false);
- jQuery('#subname').removeClass('disable');
- prj.singleWay('subname-key',function(key){
- var kit = this;
- jQuery(document).on('click','#subname',function(){
- var that = jQuery('#subname');
- if(that.hasClass('disable')){
- return;
- }
- jQuery.ajax({
- type: "POST",
- url: "bbslink.php?mod=linkregister",
- data: {
- 'nickname':username,
- 'ispop':uels,
- 'cookieispop':iscookie,
- 'step':2
- },
- success: function (res) {
- kit.resolve(key);
- location.href="forum.php"
- jQuery('#subname').attr('disabled',true);
- },
- error:function(){
- kit.resolve(key);
- alert('网络异常,请稍后重试')
- },
- beforeSend: function () {
- prj.btnloading(that, '');
- }
- })
- });
- });
- }
- },
- error:function(){
- alert('网络异常,请稍后重试')
- }
- })
- };
- });
- jQuery('.tk_close').on('click',function(){
- jQuery('.index_tkbg').addClass('hide');
- jQuery('.login_tkbg').addClass('hide');
- })
- jQuery('#login_bth').on('click',function(){
- if($('ls_username').value == '' || $('ls_password').value == '') {
- var urltwo=location.href
- var acurl=jQuery('#login_bbslink').text();
- if (acurl=='develop') {
- window.open('http://t.e03.com/index.htm?returncode='+urltwo+'');
- jQuery('.login_tkbg').addClass('hide');
- }else if(acurl=='online'){
- window.location.+urltwo+'';
- }else{
- window.location.+urltwo+'';
- }
- } else {
- }
- });
- jQuery('#login_know').on('click',function(){
- jQuery('.login_tkbg').addClass('hide');
- })
- });
- </script>
- <div id="wp" class="wp">
复制代码 |
|