// console.log(show_module_js.show_shops_js); //论坛版块JS function get_module_bbs_forum(id,tag,obj_id){ $.ajax({ url:'/wap/wapAjaxModule.php?username='+user_name+'&module_id='+obj_id+'&ajax_type=4&tag='+tag+'&id='+id, type:'get', success: function(data){ if(data){ $('#bbs_forum_'+obj_id).html(data); } } }) } //论坛帖子JS function get_module_bbs_thread(id,tag,page,append_tag,obj_id,show_style,show_quan){ $.ajax({ url:'/wap/wapAjaxModule.php?username='+user_name+'&ajax_type=3&tag='+tag+'&id='+id+'&page='+page+'&obj_id='+obj_id+'&show_style='+show_style+'&show_quan='+show_quan, type:'get', success: function(data){ if(data){ if(append_tag){ $('#more_link').remove(); $('#bbs_thread_'+obj_id).append(data); }else{ $('#bbs_thread_'+obj_id).html(data); } } } }) } $(function(){ //加载更多 var thread_page=1; $('#more_link a').live('click',function(){ $('#more_link').html(''); var set_id=$('#more_link').data('id'); var thread_tag=$('#more_link').data('tag'); var obj_id=$('#more_link').data('obj_id'); var s_style=$('#more_link').data('show_style'); var show_quan=$('#more_link').data('show_quan'); thread_page++; get_module_bbs_thread(set_id,thread_tag,thread_page,1,obj_id,s_style,show_quan); }); //点赞 $(".icon_a .ev_zan").live("click",function(){ var _this = $(this); var id = _this.attr('rel'); if (!id) return false; var ip=returnCitySN.cip;//通过搜狐IP地址查询接口 var tmp_data=readCookie('THEMEZAN_'+user_name); var cookie_data=tmp_data.split('_'); var tmp_ids=id+'#'+ip; if(cookie_data){ for(var i=0;i'); $.ajax({ url:'/wap/wapAjaxModule.php?username='+user_name+'&ajax_type=5&pageSize='+pageSize+'&page='+page+'&style='+style+'&module_id='+module_id, type:'get', success: function(data){ if(data){ var new_data=data.split('#*&'); $('#fight_group_'+module_id).parent().find('.listMore').remove(); $('#fight_group_'+module_id).append(new_data[0]); $('#fight_group_'+module_id).parent().append(new_data[1]); } } }); } //短视频加载更多 function getShortVideoAjax(module_set_id,module_id){ var page = $('#shortVideo_'+module_id).attr('video_page'); $.ajax({ url:'/wap/wapAjaxModule.php?username='+user_name+'&ajax_type=12&page='+page+'&set_id='+module_set_id+'&module_id='+module_id, type:'get', success:function(data){ var newData = JSON.parse(data); if(newData.str){ $('#shortVideo_'+module_id+'_more').before(newData.str); if(parseInt(newData.show_more)){ $('#shortVideo_'+module_id).attr('video_page',newData.page); showThumbsUpIcon(module_id); showThumbsUpNum(module_id); }else{ $('#shortVideo_'+module_id+'_more').hide(); } } } }) } //短视频点赞 function thumbsUp(vid,mid){ if(!vid){ showAllzz('参数错误!'); return false; } if(!wap_zz_userid){ showAllzz("您未登录,请登录!",{'关闭':'/dom/denglu.php?username='+user_name+'&wap=1'}); return false; } var status = parseInt($('#shortVideo_'+mid+'_'+vid).attr('vstatus')) ? 0 :1; var num = parseInt($.trim($('#shortVideo_'+mid+'_'+vid).find('.praise-num').text())); console.log(num) $.ajax({ url:'http://'+wap_domain+':12701/Frontend/Shortvideo/shortVideoLikeLog?username='+user_name+'&id='+vid+'&status='+status+'&zz_userid='+wap_zz_userid+'&zz_shellCode='+readCookie('zz_shellCode'), type:'get', success:function(res){ //点赞成功后 if(res.code){ $('#shortVideo_'+mid+'_'+vid).attr('vstatus',status); if(!status){ $('#shortVideo_'+mid+'_'+vid).find('.m-praise').removeClass('already'); $('#shortVideo_'+mid+'_'+vid).find('.praise-num').html((num-1) <1 ? 0 :(num-1)); }else{ $('#shortVideo_'+mid+'_'+vid).find('.m-praise').addClass('already'); $('#shortVideo_'+mid+'_'+vid).find('.praise-num').html(num+1); } } } }) } //点赞图标 function showThumbsUpIcon(mid){ $.ajax({ url:'http://'+wap_domain+':12701/Frontend/Shortvideo/currentUserIsLike?username='+user_name+'&zz_userid='+wap_zz_userid+'&zz_shellCode='+readCookie('zz_shellCode'), type:'get', success:function(res){ if(res.code == 200){ if(res.data.user_user_id == wap_zz_userid){ $('#shortVideo_'+mid).find('.shortVideo-item').each(function(){ var this_vid = $(this).data('videoid'); for (var i = 0; i < res.data.like_info.length; i++) { if(res.data.like_info[i].video_id == this_vid){ $('#shortVideo_'+mid+'_'+this_vid).attr('vstatus',res.data.like_info[i].status); if(res.data.like_info[i].status ==1){ $('#shortVideo_'+mid+'_'+this_vid).find('.m-praise').addClass('already'); }else{ $('#shortVideo_'+mid+'_'+this_vid).find('.m-praise').removeClass('already'); } } } }) } } } }) } //点赞数量 function showThumbsUpNum(mid){ $('#shortVideo_'+mid).find('.shortVideo-item').each(function(){ var vid = $(this).data('videoid'); $.ajax({ url:'http://'+wap_domain+':12701/Frontend/Shortvideo/videoLikeInfo?id='+vid+'&username='+user_name+'&zz_userid='+wap_zz_userid+'&zz_shellCode='+readCookie('zz_shellCode'), type:'get', success:function(res){ if(res.code == 200){ if(res.data.user_user_id == wap_zz_userid){ $('#shortVideo_'+mid+'_'+vid).find('.praise-num').html(res.data.likes.zan); } } } }) }) } //OTO模块JS function get_oto_more(module_id,pageSize,style,page){ $('#module_oto_'+module_id).parent().find('.listMore').html('
'); var timestamp=new Date().getTime(); $.ajax({ url:'/wap/wapAjaxModule.php?username='+user_name+'&ajax_type=6&pageSize='+pageSize+'&page='+page+'&style='+style+'&module_id='+module_id+'×tamp='+timestamp, type:'get', success: function(data){ if(data){ var new_data=data.split('#*&'); $('#module_oto_'+module_id).parent().find('.listMore').remove(); $('#module_oto_'+module_id).append(new_data[0]); $('#module_oto_'+module_id).parent().append(new_data[1]); } } }); } //商铺模块JS var tmp_data = []; function shops_data(location_type,default_city,num,chose_type,shop_ids,shops_sort_type,shops_orderby,shops_where,customModuleId,shops_style,param_id){ var t={}; t.shops_where = shops_where; t.shops_sort_type = shops_sort_type; t.location_type = location_type; t.default_city = default_city; t.num = num; t.chose_type = chose_type; t.shop_ids = shop_ids; t.shops_orderby = shops_orderby; t.customModuleId = customModuleId; t.shops_style = shops_style; t.param_id = param_id; var username = user_name, system = {win : false, mac : false, xll : false }, geoc = new BMap.Geocoder(), is_app = wap_is_app, is_ios = wap_is_ios, geolocation = new BMap.Geolocation(), p = navigator.platform; if(num>30){ num=30; } var is_bd=0; if (parseInt(chose_type) && (location_type == 1 || shops_sort_type == 2)){ is_bd=1; system.win = p.indexOf("Win") == 0; system.mac = p.indexOf("Mac") == 0; system.x11 = (p == "X11") || (p.indexOf("Linux") == 0); if(system.win||system.mac||system.xll){ geolocation.getCurrentPosition(function(r){ if (this.getStatus() == BMAP_STATUS_SUCCESS) { var point =r.point; geoc.getLocation(point, function(rs){ var addComp = rs.addressComponents; var result = {name : addComp.city}; myFun(result,num,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); }); } }, { enableHighAccuracy: true } ); }else{ if(is_app){ if(is_ios){ geolocation.getCurrentPosition(function(position){ if (this.getStatus() == BMAP_STATUS_SUCCESS) { var longitude =position.point.lng, latitude = position.point.lat, point =position.point, geoc = new BMap.Geocoder(); if(position.accuracy == null){ if(default_city && default_city !="全国" && location_type==3){ var result = {name : default_city}; myFun(result,num,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); }else{ geoc.getLocation(point, function(rs){ var addComp = rs.addressComponents; var result = {name : addComp.city}; myFun(result,num,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); }); } }else{ if(location_type==1){ geoc.getLocation(point, function(rs){ var addComp = rs.addressComponents; get_shops_list(addComp.city,longitude,latitude,num,location_type,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); }); }else if(default_city && default_city !="全国" && location_type==3){ get_shops_list(default_city,longitude,latitude,num,location_type,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); }else{ get_shops_list(default_city,longitude,latitude,num,location_type,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); } } }else{ alert("请在设置中打开定位功能"); } },{ enableHighAccuracy: true }); }else{ android.getMapPosition(''); } }else{ if(use_wxchat_map){ wx.ready(function(){ var tmp_lat = readCookie('lat_'+user_name); var tmp_lon = readCookie('lon_'+user_name); if(tmp_lat && tmp_lon){ $.ajax({ url:'/wap/wapAjaxModule.php?ajax_type=11&username='+user_name+'&wap=1&longitude='+tmp_lon+'&latitude='+tmp_lat, type:'get', success:function(dataN){ var newArr = dataN.split('$%@'); var longitudeNew = newArr[0],latitudeNew = newArr[1]; if(location_type==1){ var wx_geocoder = new qq.maps.Geocoder({ complete: function (result) { // alert(result.detail.address) var tmp_city = JSON.stringify(result.detail.addressComponents.city); tmp_city = tmp_city.replace(/\"/g, ""); get_shops_list(tmp_city,longitudeNew,latitudeNew,num,location_type,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); } }) var wx_coord = new qq.maps.LatLng(tmp_lat, tmp_lon) wx_geocoder.getAddress(wx_coord); }else if(default_city && default_city !="全国" && location_type==3){ get_shops_list(default_city,longitudeNew,latitudeNew,num,location_type,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); }else{ get_shops_list(default_city,longitudeNew,latitudeNew,num,location_type,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); } } }) }else{ wx.getLocation({ success: function (res) { var lat = res.latitude; //纬度 var lon = res.longitude; //经度 var locationStr = "latitude:"+lat+","+"longitude:"+lon; writeCookie('lat_'+user_name,lat,1000*24); writeCookie('lon_'+user_name,lon,1000*24); $.ajax({ url:'/wap/wapAjaxModule.php?ajax_type=11&username='+user_name+'&wap=1&longitude='+lon+'&latitude='+lat, type:'get', success:function(dataN){ var newArr = dataN.split('$%@'); var longitudeNew = newArr[0],latitudeNew = newArr[1]; if(location_type==1){ var wx_geocoder = new qq.maps.Geocoder({ complete: function (result) { // alert(result.detail.address) var tmp_city = JSON.stringify(result.detail.addressComponents.city); tmp_city = tmp_city.replace(/\"/g, ""); get_shops_list(tmp_city,longitudeNew,latitudeNew,num,location_type,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); } }) var wx_coord = new qq.maps.LatLng(res.latitude, res.longitude) wx_geocoder.getAddress(wx_coord); }else if(default_city && default_city !="全国" && location_type==3){ get_shops_list(default_city,longitudeNew,latitudeNew,num,location_type,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); }else{ get_shops_list(default_city,longitudeNew,latitudeNew,num,location_type,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); } } }) }, cancel: function (res) { alert('用户拒绝授权获取地理位置'); }, fail: function (res) { // alert(JSON.stringify(res)); } }); } }); }else{ geolocation.getCurrentPosition(function(position){ if (this.getStatus() == BMAP_STATUS_SUCCESS) { var longitude =position.point.lng, latitude = position.point.lat, point =position.point, geoc = new BMap.Geocoder(); if(position.accuracy == null){ if(default_city && default_city !="全国" && location_type==3){ var result = {name : default_city}; myFun(result,num,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); }else{ geoc.getLocation(point, function(rs){ var addComp = rs.addressComponents; var result = {name : addComp.city}; myFun(result,num,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); }); } }else{ if(location_type==1){ geoc.getLocation(point, function(rs){ var addComp = rs.addressComponents; get_shops_list(addComp.city,longitude,latitude,num,location_type,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); }); }else if(default_city && default_city !="全国" && location_type==3){ get_shops_list(default_city,longitude,latitude,num,location_type,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); }else{ get_shops_list(default_city,longitude,latitude,num,location_type,shops_orderby,shops_where,"shop_"+customModuleId,shops_style,is_bd); } } }else{ alert("请在设置中打开定位功能"); } },function(error){},{ enableHighAccuracy: true }); } } } t.is_bd=is_bd; tmp_data.push(t); }else{ get_def_shop_info(param_id,customModuleId,shops_style,is_bd); } } //默认加载 function get_def_shop_info(set_id,obj_id,style,bd_tag){ $.ajax({ url:"/wap/wapAjaxModule.php", type:'post', data:{username:user_name,set_id:set_id,is_bd:bd_tag,t:UTCTimeDemo}, success: function(data){ $("#shop_"+obj_id).html(data); if (style==4) { editPicHeight("shop_"+obj_id); } } }) } //根据当前城市获得数据 function myFun(result,num,sortby,filter,obj,style,bd_tag){ var ids = [], linki = "https://api.map.baidu.com/geosearch/v3/local?callback=?", param = { //'region' : cityName, //'page_size' : num, 'geotable_id': 144388, 'ak' : 'l3M8jnzdfgKoAB0uG2YAFIaoyHukxQ7a', //'sortby' : 'is_top:-1|order_sort:-1|shop_id:-1', 'page_index' : 0 }; if(parseInt(num)){ param.page_size= parseInt(num); } param.sortby = sortby; param.filter = filter; param.page_index = 0; $.getJSON(linki,param,function(e) { var content = e.contents; var total = e.total; $.each(content,function(i,item){ var sid = item.shop_id; ids.push(sid); }); var arr= ids.join(","); ajax_shop_list(arr,'',obj,style,bd_tag); }); } //根据定位位置与城市名称获取商铺信息 function get_shops_list(city,longitude,latitude,num,is_show_loc,sortby,filter,obj,style,bd_tag){ var linki = "https://api.map.baidu.com/geosearch/v3/nearby?callback=?", param = { 'location' : $.trim(longitude)+','+$.trim(latitude), //'page_size' : num, 'geotable_id': 144388, //'sortby' : 'distance:1', 'ak' : 'l3M8jnzdfgKoAB0uG2YAFIaoyHukxQ7a', 'radius' : 10000000000000 }, ids = [], distances = []; if(parseInt(num)){ param.page_size= parseInt(num); } param.sortby = sortby; param.filter = filter; if(city != '全国'){ param.tags =city; } param.page_index=0; $.getJSON(linki,param,function(e) { var content = e.contents; var total = e.total; $.each(content,function(i,item){ var sid = item.shop_id; ids.push(sid); distances.push(item.distance); }); var arr= ids.join(","); ajax_shop_list(arr,distances,obj,style,bd_tag); }); } //认领商铺 function havego(id){ $("#shops_"+id).removeAttr("onclick"); $.ajax({ type:'post', url:'/wap/shops/ajax_shops_claim.php', data:'id='+id+'&user_id='+wap_userid, success: function(data){ if(data==0){ showAllzz("您未登录,请登录!",{'关闭':'/dom/denglu.php?username='+user_name+'&wap=1'}); return false; }else if(data==10){ $("#shops_"+id).attr("onclick","havego("+id+");"); showAllzz("认领失败!"); return false; }else if(data==9){ $("#shops_"+id).parents(".ev_t_product").remove(); showAllzz("认领申请发送成功,请在个人中心查看结果!"); return false; }else if(data==8){ $("#shops_"+id).attr("onclick","havego("+id+");"); showAllzz("等级不够,无法认领!"); return false; }else if(data==7){ $("#shops_"+id).attr("onclick","havego("+id+");"); showAllzz("您已有自己的商铺,不能再进行认领!"); return false; }else if(data==72){ $("#shops_"+id).attr("onclick","havego("+id+");"); showAllzz("您的商铺正在审核中,请在个人中心查看结果!"); return false; }else if(data==6){ $("#shops_"+id).attr("onclick","havego("+id+");"); showAllzz("此商铺已被认领,不能再进行认领!"); return false; } } }); } //微商铺模块获取数据 function ajax_shop_list(arr,dis,obj,style,bd_tag){ $.ajax({ url:'/wap/wapAjaxModule.php', type:'post', data:{username:user_name,arr:arr,is_bd:bd_tag,distances:dis,style:style,t:UTCTimeDemo}, success: function(data){ $('#'+obj).html(data); if(style==4){ editPicHeight(obj); } } }); } function editPicHeight(tId){ var t = $("#"+tId), tImg = t.find(".banner_pic"); if(tImg.length){ tImg.css({"height":tImg.width(),"line-height":tImg.width()-4+'px'}); } } //商铺和城市模块定位 if((show_module_js.show_shops_js || 1) || (city_setInfo_json.del_city !=1 && city_setInfo_json.click_type !=undefined && home_index)){ function qddk(au,ps){ var arr = ps.split(','); var longitude = arr[1]; var latitude = arr[0]; var point = new BMap.Point(longitude,latitude); if(show_module_js.show_shops_js){ if(tmp_data){ for(var i=0;i winW){ thisW = 93; var iPicLeftPx = winW-thisW; this_.css({'left':iPicLeftPx+"px"}); }else{ if(isNaN(iPicLeft)){ var iPicLeftPx = winW-thisW; }else if(iPicLeft == 0){ var iPicLeftPx = 0; }else{ var iPicLeftPx = (iPicLeft*winW)-(thisW/2); } this_.css({'left':(iPicLeftPx/320).toFixed(2)+"px"}); } } } } } //容器上传图片回调 function reset_img_url(url,id){ if(id && url){ $('#'+id).find('.FreeImg_max img').attr('src',url); } } function focusFun(o){ var focusId = $("#"+o).find(".focusimg"), focusW = focusId.width(), focusP = focusId.find(".focusPage"), typeN = focusId.attr("type"), focusUl = focusId.find(".focusInfo ul"), focusLi = focusId.find(".focusInfo li"), liLength= focusLi.length, numW = Math.ceil(focusW*liLength), scrollW = focusW, pageH = '', pageN = 0; if(typeN == 1){ for(var i=0; i'; }else{ pageH += ''; } } focusId.find("li").width(focusW); }else if(typeN == 3 || typeN == 4){ if(liLength < 3){ focusUl.append(focusUl.html()); if(liLength < 2){ focusUl.append(focusUl.html()); } } liLength = 4; focusId.find("li").width(focusW/3); focusId.find("li:first").addClass("cur"); focusId.find("li:last").insertBefore(focusId.find("li:first")); scrollW = focusW/3; numW = Math.ceil(focusW*liLength); if(typeN == 4){ for(var i=0; i0 && !home_index){ if(ch_ids.indexOf(css_channel_id) == -1){ $('#header').hide(); } } } } else if (name == 'link') { if ($.trim(myobj.msg)) { $("#blogroll").find(".MoBodyC").html(myobj.msg); } else { $("#blogroll").find(".blogrollTxt").html(myobj.txt); $("#blogroll").find(".blogrollPic").html(myobj.pic); } } else if (name == 'foot_doc') { $("#footer_nav").html(myobj.foot_doc); } else if (name == 'foot') { $("#copyright").html(myobj.foot_con); } else if (name == 'channel') { $("#nav").find(".NMain").html(myobj.channel); } else if (name == 'search') { $("#sysSearch").find('.searchBg i').html(myobj.search_keyword); } } }) } function update_module_con_html(module_id,is_action) { if(!is_action){ is_action = 0; } var timestamp = Date.parse(new Date()); $.post("/wap/ajax_module.php?username="+user_name+"&module_id="+ module_id+'&action='+is_action, function(data) { if ($.trim(data)) { var myobj = JSON.parse(data); $("#Mo_"+module_id).find(".NameTxt").html(myobj.name); $("#Mo_"+module_id).find(".MoMore").html(myobj.mylink); if(myobj.mtype == 32 && !$('#shop_and_city_js').length){ var whenArray = [],head = $('head'); (function(){ var src5 = 'https://api.map.baidu.com/getscript?v=3.0&ak=l3M8jnzdfgKoAB0uG2YAFIaoyHukxQ7a&services=&t='+timestamp, script5 = $.getScript(src5, function(data, textStatus, jqxhr) { if(!$('#shop_and_city_js').length){ var scriptDom = document.createElement('script'); scriptDom.type = 'text/javascript'; scriptDom.id = 'shop_and_city_js'; scriptDom.src = src5; head[0].appendChild(scriptDom); } }); whenArray.push(script5); $.when.apply(this, whenArray).done(function(){ if ($.trim(myobj.con)) $("#Mo_"+module_id).find(".MoBodyC").html(myobj.con); }); })(); }else if(myobj.mtype == 9 && !$('#statistics_js').length && myobj.statistics==1){ $('head').append(''); var whenArray = [],head = $('head'); (function(){ var src4 = '//aimg8.oss-cn-shanghai.aliyuncs.com/plugins/public/dhtmlxChart/dhtmlxchart.min.js', script4 = $.getScript(src4, function(data, textStatus, jqxhr) { if(!$('#statistics_js').length){ var scriptDom = document.createElement('script'); scriptDom.type = 'text/javascript'; scriptDom.id = 'statistics_js'; scriptDom.src = src4; head[0].appendChild(scriptDom); } }); whenArray.push(script4); $.when.apply(this, whenArray).done(function(){ if ($.trim(myobj.con)) $("#Mo_"+module_id).find(".MoBodyC").html(myobj.con); }); })(); }else if(myobj.mtype == 63 && myobj.rid){ if ($.trim(myobj.con)) $("#row_"+myobj.rid).html(myobj.con); // $("#row_"+myobj.rid).find('.classifyTit li').each(function(){ // var classify_mid = $(this).attr('data-classify_mid'); // if(classify_mid == module_id){ // public.changeMo(this); // } // }) }else{ if ($.trim(myobj.con)) $("#Mo_"+module_id).find(".MoBodyC").html(myobj.con); } if ($.trim(myobj.css)) $("#ActionStyle").append(myobj.css); if ($.trim(myobj.css)) $("#Mstyle").append(myobj.css); var motype = $('#Mo_'+module_id).attr('motype'); if($.trim(myobj.js)){ $('#Mo_'+module_id).append(''); } wsf.imgLazyLoading($('#Mo_'+module_id).find('.MoBodyC')); if(motype == 7) { changeModule7PicHeight(module_id); } if(motype == 17){ if(is_action){ curButGroup.editButItem('Mo_'+module_id); } ButGroupLeftPosition(); } } }) } function changeModule7PicHeight(module_id) { var prolist_id = $('#Mo_'+module_id).find(".exhibition_map").attr('id'); prolist_id = $('#'+prolist_id); var li_w = prolist_id.find("li").width(); prolist_id.find("li .pic").css({"height":li_w-10,"line-height":li_w-14+'px'}); prolist_id.find("li.img_c").each(function(){ var P_height = $(this).find(".text_list_bk").height(); $(this).find(".text_list_bk").css("margin-top",-P_height/2); }); } } function updateFormFieldUploadfile(fieldId, filePath) { if (/(.JPG|.GIF|.JPEG|.PNG)(\?\d+)/.test(filePath.toUpperCase()) === false) { $("#field_"+ fieldId +"_box").hide(); } else { $("#field_"+ fieldId +"_box").show(); $("#field_"+ fieldId +"_box span").html(''); } $("#error_"+ fieldId).html(""); $("#field_"+ fieldId).css("background-image", "none"); $("#field_"+ fieldId).val(filePath); $('#formAlertFrame').find(".alt_close_frame").trigger('click'); } //表单方法 function formMo(curDom){ var formAlertFrame = $('#formAlertFrame'); curDom = curDom || $('.inputCustomForm'); curDom.each(function(i, dom){ dom = $(dom); dom.on('click', '.fieldTypeUploadFile,.fieldTypeUploadFileClean',function(){ var $this = $(this), thisId = $this.data("id"); switch(true){ case $this.hasClass('fieldTypeUploadFile'): if (!thisId) { return false; } formAlertFrame.find('iframe').attr("src", "/dom/FormFile.php?username="+user_name+"&wap=1&field_id="+ thisId).load(function(){ formAlertFrame.find(".alt_loading").remove(); }); formAlertFrame.show(); break; case $this.hasClass('fieldTypeUploadFileClean'): if (!(thisId * 1)) { return false; } $("#field_" + thisId + "_box").hide(); $("#field_"+ thisId).val(""); $("#field_"+ thisId).attr("style", $this.data("style")); // formAlertFrame.find(".alt_close_frame").trigger('click'); break; } }); }); if(!formAlertFrame.length && curDom.length){ (function(){ formAlertFrame = $(''); $('body').append(formAlertFrame); formAlertFrame.on({ 'click': function () { formAlertFrame.find("iframe").attr("src",""); formAlertFrame.hide(); } }, '.alt_close_frame'); })(); } } //表单文件上传 /*if(formUploadFile){ function updateFormFieldUploadfile(fieldId, filePath) { if (/(.JPG|.GIF|.JPEG|.PNG)(\?\d+)/.test(filePath.toUpperCase()) === false) { $("#field_"+ fieldId +"_box").hide(); } else { $("#field_"+ fieldId +"_box").show(); $("#field_"+ fieldId +"_box span").html(''); } $("#error_"+ fieldId).html(""); $("#field_"+ fieldId).css("background-image", "none"); $("#field_"+ fieldId).val(filePath); $(".alt_close_frame").trigger('click'); } $(function() { $(".fieldTypeUploadFile").on("click", function() { var id = $(this).data("id"); if (!id) { return false; } $("#alt_iframe").attr("src", "/dom/FormFile.php?username="+user_name+"&wap=1&field_id="+ id).load(function(){ $("#alt_loading").remove(); }); $(".alt_frame").show(); }); $(".fieldTypeUploadFileClean").on("click", function() { var id = parseInt($(this).data("id")); if (!id) { return false; } $("#field_"+ id +"_box").hide(); $("#field_"+ id).val(""); $("#field_"+ id).attr("style", $(this).data("style")); $(".alt_close_frame").trigger('click'); }); $(".alt_close_frame").on("click", function() { $(".alt_frame").hide(); $("#alt_iframe").attr("src",""); }); }); }*/ //容器模块JS if(show_module_js.show_container_js || is_bianji){ $(function(){ var max_w = $("#add_container").width(); var min_int = (( max_w / 750 )*100 ).toFixed(4); $("#add_container").parents("html").css("font-size",min_int+"px"); }); $(window).resize(function(){ var max_w = $("#add_container").width(); var min_int = (( max_w / 750 )*100 ).toFixed(4); $("#add_container").parents("html").css("font-size",min_int+"px"); }); // 标签容器标签宽度rem计算 function classifyRem(obj){ $("#"+obj).find(".titfont").each(function(){ var W = parseInt($(this).css("width")), mini_W = W / 44.93, Small_W = mini_W.toFixed(4); var H = parseInt($(this).css("height")), mini_H = H / 44.93, Small_H = mini_H.toFixed(4); $(this).css({"width":Small_W+"rem","height":Small_H+"rem","line-height":Small_H+"rem"}); }); } // 自由容器宽高计算 function containerWandH(obj){ var max_H = parseInt($("#"+obj).find(".freeRoom_Mo").css("height")), Mod = max_H / 44.93, Mod_H = Mod.toFixed(4); $("#"+obj).find(".freeRoom_Mo").css("height",Mod_H+"rem"); $("#"+obj).find(".freeMo").each(function(){ var Top_int = parseInt($(this).css("top")), num_T = Top_int / 44.93, int_T = num_T.toFixed(4); var Left_int = parseInt($(this).css("left")), num_L = Left_int / 44.93, int_L = num_L.toFixed(4); $(this).css({"top":int_T+"rem","left":int_L+"rem"}); var W = parseInt($(this).find(".editModuleBox").css("width")), mini_W = W / 44.93, Small_W = mini_W.toFixed(4); var H = parseInt($(this).find(".editModuleBox").css("height")), mini_H = H / 44.93, Small_H = mini_H.toFixed(4); $(this).find(".editModuleBox").css({"width":Small_W+"rem","height":Small_H+"rem"}); }); } } //页面初始化执行的方法 $(function() { var document_h = $(window).height(); $("#wrapper").css({ "min-height": document_h + 'px' }); (function() { var rollIconMo = $('.rollIconMo'); if(rollIconMo.length){ rollIconMo.each(function(i, dom) { dom = $(dom); dom.find(".swiper-slide").width(dom.width()); dom.find(".rollMain").width(dom.width() * dom.find(".swiper-slide").length); dom.find(".pic").each(function() { var size = $(this).parent().parent().width(); $(this).css({ "width": size, "height": size }); }); }); var swiper = new Swiper(".rollbox", { pagination: { el: ".touch_dot" } }); } window.indexArr = []; setDownTime(); })(); // 表单方法 formMo(); }); function countDownTime (thisS, startTime, endTime, index) { var thisTime = (Date.parse(new Date())/1000); var str = ""; if (typeof thisS == "undefined") { return false; } if (endTime < thisTime) { // 活动已结束 thisS.html("已结束"); } else { var surplusTime = 0; var sign = false, target = false; if (!target) { if (startTime > thisTime) { // 还未开始 surplusTime = startTime - thisTime; sign = true; } else { // 正在进行 surplusTime = endTime - thisTime; sign = false; } } window.indexArr[index] = setInterval(function() { if (surplusTime <= 0) { if (sign) { surplusTime = endTime - thisTime; if (surplusTime <= 0) { clearInterval(window.indexArr[index]); thisS.html("已结束"); } else { target = true; // 不在对剩余时间重新赋值 } } else { // 结束 clearInterval(window.indexArr[index]); thisS.html("已结束"); } } else { if (sign) { var tmp = "距开团"; if (target) { tmp = "距结束"; } } else { var tmp = "距结束"; } var day = Math.floor(surplusTime / (24 * 3600)); var hour = Math.floor((surplusTime - day * 24 * 3600) / 3600); var minute = Math.floor((surplusTime - day * 24 * 3600 - hour * 3600) / 60); var second = surplusTime - day * 24 * 3600 - hour * 3600 - minute * 60; var dayStr = day>0 ? '' + day + '天' :''; var hourStr = hour>0 ? '' + hour + '时' :''; var minuteStr = minute>0 ? '' + minute + '分' :''; if(tmp == '距结束' && thisS.parent().find('.now a').html() !='立即抢购'){ thisS.parent().find('.now a').html('立即抢购'); thisS.parent().find('.now').removeClass('disable'); } var str = [ tmp + ':', dayStr, hourStr, minuteStr, '' + second + '秒'].join(""); thisS.html(str); surplusTime--; } }, 1000); } } function setDownTime(){ $('.article').each(function(index, dom) { dom = $(dom); if(!dom.data('downtime')){ var timDom = dom.find('.countDownTime'), startTime = parseInt(timDom.data("start")), endTime = parseInt(timDom.data("end")); window.indexArr[index] = null; countDownTime(timDom, startTime, endTime, index); dom.data('downtime',1); } }); } function get_tuan_module_list(obj_id,set_id,page){ $('#Mo_'+obj_id).find('.tuan_more').html(''); var t = Date.parse(new Date()); $.ajax({ url:'/wap/wapAjaxModule.php?ajax_type=7&username='+user_name+'&page='+page+'&module_id='+obj_id+'&set_id='+set_id+'&t='+t, type:'get', success:function(data){ $('#Mo_'+obj_id).find('.tuan_more').remove(); if(data){ $('#Mo_'+obj_id).find('.section').append(data); setDownTime(); } } }) } function wapFileDown(id,channel_id){ var zz_userid = readCookie('zz_userid'); var is_wx = is_weixn(); $.ajax({ url:'/wap/wapAjaxModule.php?username='+user_name+'&wap=1&ajax_type=9&channel_id='+channel_id+'&doc_id='+id, type:'get', success:function(data){ var newData = $.parseJSON(data); var tag = (newData.tag)*1, appendStr ='', down_method = parseInt(newData.down_method), down_price = parseFloat(newData.down_price), title = newData.title, detail_url = newData.detail_url; if (!parseInt(tag)) { if(!is_wx){ $("#downLoadDemo").show(); return false; } }else{ if(!zz_userid){ var loginUrl = '/dom/denglu.php?username='+user_name+'&wap=1'; showAllzz('您还没有登录!',{'登录':loginUrl,'关闭':'###'}); return false; } } if(down_method == 2){ appendStr= ''; }else if(!down_method){ appendStr = ''; } var ua = navigator.userAgent.toLowerCase(); if(ua.match(/MicroMessenger/i)=="micromessenger") { $(".webBody").append(''); return false; } if(parseInt(tag)){ if (parseInt(tag) == 2) { //跳转到订单详细页 window.location.href = detail_url; } else if (parseInt(tag) == 3) { //跳转到支付页面 window.location.href = '/wap/downFile.php?username='+user_name+'&channel_id='+channel_id+'&doc_id='+id; } else if (parseInt(tag) == 1) { //显示弹窗 $('.webBody').append(appendStr); } }else{ window.location.href='/wap/downFile.php?username='+user_name+'&channel_id='+channel_id+'&doc_id='+id; } } }) } /*论坛帖子图片计算*/ function luntan_pic(id){ var curDom = $('#Mo_'+id), Three_div = curDom.find("div.Three_div"); if(Three_div.length){ var H_img = curDom.find(".Three_div").find("li").eq(0).width(); Three_div.find("label").css("height",H_img+"px"); Three_div.find("img").each(function(){ var img_ = new Image(), that = $(this), pw = that.parent().width(), ph = that.parent().height(); img_.src = $(this).attr("src"); img_.onload = function(){ var min_img = (ph*this.width)/this.height; if(pw <= min_img){ var l_ = min_img - pw; that.css("margin-left",-(l_/2)); }else{ var min_img_H = ((pw*this.height)/this.width)- ph; that.css({"width":pw,"height":"initial","margin-top":-(min_img_H/2)}); } }; }); } } function wap_doc_down_sub(wap_doc_down_method){ var pwd=$.trim($('#pwd').val()); var id=$('#doc_id').val(); if (!parseInt(wap_doc_down_method)) { if(pwd){ $('#error_msg').html(''); $('#error_msg').hide(); $('#check_pwd').submit(); }else{ $('#error_msg').html('密码不能为空!'); $('#error_msg').show(); return false; } } else if (parseInt(wap_doc_down_method) == 2) { $('#error_msg').hide(); $('#check_pwd').submit(); } } function del_appAlt(){ $("#app_login").remove(); } function img_size(id, pic_size,pic_w){ var obj = $("#prolist_"+id); obj.find(".demo1").css("float","none"); var li_w = obj.find("li .inner").width(); var tmp_set=parseInt(pic_size); if(tmp_set){ li_w=pic_w; obj.find(".pic img").css("height",li_w+"px"); obj.find("li .pic").css({"height":li_w}); }else{ var img = obj.find("li .pic img")[0]; var tmp_w=obj.find("li .pic").width(); img.onload = function(){ //方法一 getImgNaturalDimensions(img, function(dimensions){ obj.find("li .pic").height(dimensions.h/dimensions.w*tmp_w); }); } } obj.find("li.img_c").each(function(){ var P_height = $(this).find(".text_list_bk").height(); $(this).find(".text_list_bk").css("margin-top",-P_height/2); }); } function getImgNaturalDimensions(oImg, callback) { var nWidth, nHeight; if (!oImg.naturalWidth) { // 现代浏览器 nWidth = oImg.naturalWidth; nHeight = oImg.naturalHeight; callback({w: nWidth, h:nHeight}); } else { // IE6/7/8 var nImg = new Image(); nImg.onload = function() { var nWidth = nImg.width, nHeight = nImg.height; callback({w: nWidth, h:nHeight}); } nImg.src = oImg.src; } } function wap_module_location(url){ if(!url) return false; window.location.href=url; }