105 lines
2.2 KiB
JavaScript
105 lines
2.2 KiB
JavaScript
$(function(){
|
||
$(".show_detail").hover(function(){
|
||
$(this).find(".detail_info").show();
|
||
},function(){
|
||
$(this).find(".detail_info").hide();
|
||
})
|
||
$(".detail_info").on("click",".info_txt",function(){
|
||
var key = $(this).attr("data-key");
|
||
$(".search-input-item").removeClass("active");
|
||
$("."+key).addClass("active");
|
||
if(key === "voice"){
|
||
$(".voicePanel").addClass("active");
|
||
}
|
||
})
|
||
|
||
$(".carouselBottom").on("click",".bottomItem",function(){
|
||
$(".bottomItem").removeClass("active");
|
||
$(this).addClass("active");
|
||
})
|
||
|
||
// 放大banner图
|
||
$(".photo_icon").on("click",function(){
|
||
if($(this).parents(".slider_panel").hasClass("active")){
|
||
$(this).parents(".slider_panel").removeClass("active");
|
||
}else{
|
||
$(this).parents(".slider_panel").addClass("active");
|
||
}
|
||
})
|
||
})
|
||
|
||
// 取消语音录入
|
||
function cancelVoice(){
|
||
$(".voicePanel").removeClass("active");
|
||
}
|
||
|
||
// 语音,点击确定
|
||
function sureVoice(){
|
||
var name = "洞朗";
|
||
$(".fixed-left").addClass("collpased").css({left:"0px"});
|
||
window.initial && window.initial(name);
|
||
cancelVoice();
|
||
}
|
||
// ajax请求
|
||
function ajax(mJson)
|
||
{
|
||
var type=mJson.type||'get';
|
||
var url=mJson.url;
|
||
var data=mJson.data;
|
||
var success=mJson.success;
|
||
var error=mJson.error;
|
||
var dataStr='';
|
||
|
||
//console.log(data);
|
||
|
||
//请求数据封装
|
||
if(data)
|
||
{
|
||
var arr = Object.keys(data);//获取key,数组以便获取长度
|
||
var len = arr.length;
|
||
var i = 0;
|
||
|
||
for (var key in data)
|
||
{
|
||
dataStr+=key+'='+data[key];
|
||
|
||
if (++i<len)
|
||
{
|
||
dataStr+='&';
|
||
}
|
||
}
|
||
|
||
if(type.toLowerCase()=='get')
|
||
{
|
||
url+='?'+dataStr;
|
||
}
|
||
|
||
// dataStr+=new Date().getTime();//设计时需要发送时间。。。
|
||
// if(type.toLowerCase()=='get')
|
||
// {
|
||
// url+='?'+dataStr;
|
||
// }
|
||
}
|
||
|
||
//console.log(url);
|
||
|
||
var xhr=new XMLHttpRequest();
|
||
xhr.open(type,url,true);
|
||
xhr.setRequestHeader('content-type' , 'application/x-www-form-urlencoded');
|
||
xhr.send(null);
|
||
|
||
xhr.onreadystatechange=function()
|
||
{
|
||
if(xhr.readyState==4)
|
||
{
|
||
if(xhr.status>=200&&xhr.status<300)
|
||
{
|
||
success&&success(xhr.responseText);
|
||
}
|
||
else
|
||
{
|
||
error&&error(xhr.status);
|
||
}
|
||
}
|
||
}
|
||
} |