创建项目按钮
This commit is contained in:
parent
8af2993f25
commit
d20da2964f
|
@ -9,6 +9,9 @@ users = [
|
||||||
{:name => '杨诏', :password => '123123123', :email => 'lucio.yang@qq.com', :phone => '15652591529', :created_at => "2016/12/27", :updated_at => "2016/12/27"},
|
{:name => '杨诏', :password => '123123123', :email => 'lucio.yang@qq.com', :phone => '15652591529', :created_at => "2016/12/27", :updated_at => "2016/12/27"},
|
||||||
{:name => '陈翊', :password => '123456', :email => '1085730215@qq.com', :phone => '18269771988', :created_at => "2016/12/28", :updated_at => "2016/12/27"}
|
{:name => '陈翊', :password => '123456', :email => '1085730215@qq.com', :phone => '18269771988', :created_at => "2016/12/28", :updated_at => "2016/12/27"}
|
||||||
]
|
]
|
||||||
|
projects = [
|
||||||
|
{:name => 'AAAA',:content => 'i like helloworld',:mission_count => '20',:users_count => '15',:shares_count => '15'}
|
||||||
|
]
|
||||||
|
|
||||||
users.each do |user|
|
users.each do |user|
|
||||||
User.create!(user)
|
User.create!(user)
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
<!-- /.widget-user-image -->
|
<!-- /.widget-user-image -->
|
||||||
<h3 id="cy_template_name" class="widget-user-username">网吧五连座</h3>
|
<h3 id="cy_template_name" class="widget-user-username">网吧五连座</h3>
|
||||||
<h5 id="cy_template_content" class="widget-user-desc">Ruby开发项目</h5>
|
<h5 id="cy_template_content" class="widget-user-desc">Ruby开发项目</h5>
|
||||||
<a class="btn btn-default pull-right project-enter" href="../index.html">
|
<a id="cy_button" class="btn btn-default pull-right project-enter" href="../index.html">
|
||||||
<i class="fa fa-sign-in"></i>
|
<i class="fa fa-sign-in"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -175,6 +175,7 @@
|
||||||
<!-- AdminLTE for demo purposes -->
|
<!-- AdminLTE for demo purposes -->
|
||||||
<script src="../dist/js/demo.js"></script>
|
<script src="../dist/js/demo.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
htmlobj=$.ajax(
|
htmlobj=$.ajax(
|
||||||
{
|
{
|
||||||
|
@ -186,7 +187,7 @@
|
||||||
var bg_color = ["bg-yellow","bg-blue","bg-purple","bg-red"];
|
var bg_color = ["bg-yellow","bg-blue","bg-purple","bg-red"];
|
||||||
var jstr = htmlobj.responseText;
|
var jstr = htmlobj.responseText;
|
||||||
var robj = eval('('+jstr+')');
|
var robj = eval('('+jstr+')');
|
||||||
|
console.log(jstr);
|
||||||
if(robj["code"]==0){
|
if(robj["code"]==0){
|
||||||
var data = robj["data"];
|
var data = robj["data"];
|
||||||
for(var i=data.length-1;i>=0;--i){
|
for(var i=data.length-1;i>=0;--i){
|
||||||
|
@ -225,6 +226,43 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
$("#creat_project").click(function(){
|
||||||
|
$.ajax({
|
||||||
|
type:"post",
|
||||||
|
dataType:"json",
|
||||||
|
url:"/projects.json",
|
||||||
|
data:{
|
||||||
|
"name":$("#exampleName").val(),
|
||||||
|
"content":$("#exampleTextarea").val()
|
||||||
|
},
|
||||||
|
statusCode: {
|
||||||
|
200: function() {// 请求成功
|
||||||
|
alert("创建成功!");
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
401:function(){// 未授权
|
||||||
|
alert("未登录!");
|
||||||
|
window.location.href="login.html";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$("#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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue