进入项目按钮更改

This commit is contained in:
chenyi 2016-12-29 16:23:12 +00:00
parent d20da2964f
commit 17c2072661
1 changed files with 17 additions and 25 deletions

View File

@ -85,9 +85,9 @@
<!-- /.widget-user-image -->
<h3 id="cy_template_name" class="widget-user-username">网吧五连座</h3>
<h5 id="cy_template_content" class="widget-user-desc">Ruby开发项目</h5>
<a id="cy_button" class="btn btn-default pull-right project-enter" href="../index.html">
<button id="cy_template_enterbtn" class="btn btn-default pull-right project-enter">
<i class="fa fa-sign-in"></i>
</a>
</button>
</div>
<div class="box-footer no-padding">
<ul class="nav nav-stacked">
@ -193,23 +193,26 @@
for(var i=data.length-1;i>=0;--i){
var template = $("#cy_template");
var tp = template.clone("true");
var id = data[i]["id"];
tp.find("#cy_template_name").html(data[i]["name"]);
tp.find("#cy_template_content").html(data[i]["content"]);
tp.find("#cy_template_mission_count").html(data[i]["mission_count"]);
tp.find("#cy_template_users_count").html(data[i]["users_count"]);
tp.find("#cy_template_shares_count").html(data[i]["shares_count"]);
tp.find("#cy_template_enterbtn").attr("onclick","cy_enter("+id+");");
tp.find("#cy_template_name").attr("id","cy_name_"+i);
tp.find("#cy_template_content").attr("id","cy_content_"+i);
tp.find("#cy_template_mission_count").attr("id","cy_mission_count_"+i);
tp.find("#cy_template_users_count").attr("id","cy_users_count_"+i);
tp.find("#cy_template_shares_count").attr("id","cy_shares_count_"+i);
tp.find("#cy_template_name").attr("id","cy_name_"+id);
tp.find("#cy_template_content").attr("id","cy_content_"+id);
tp.find("#cy_template_mission_count").attr("id","cy_mission_count_"+id);
tp.find("#cy_template_users_count").attr("id","cy_users_count_"+id);
tp.find("#cy_template_shares_count").attr("id","cy_shares_count_"+id);
tp.find("#cy_template_enterbtn").attr("id","cy_enter_"+id);
tp.find("#cy_template_bg").attr("class","widget-user-header "+bg_color[Math.floor(Math.random()*4)]);
tp.find("#cy_template_bg").attr("id","cy_bg_"+i);
tp.find("#cy_template_bg").attr("id","cy_bg_"+id);
tp.attr("id","cy_project_"+i);
tp.attr("id","cy_project_"+id);
tp.css("display","block");
@ -246,22 +249,11 @@
}
}
});
$("#cy_button").click(function(){
$.ajax({
type:"get",
dataType:"json",
url:"/projects.json",
statusCode: {
200: function() {// 进入成功
LoginUserInfo.selectProject=projects[id];
window.location.href="../index.html";
},
401:function(){// 未授权
alert("未登录!");
window.location.href="login.html";
function cy_enter(id){
LoginUserInfo.selectProject=id;
console.log(id);
//window.location.href="../index.html";
}
}
});
});
</script>
</body>