program_list.js 3.0 KB
define(['jquery', 'bootstrap', 'frontend', 'form', 'template', 'swiper', 'layer'], function($, undefined, Frontend,
			Form, Template, Swiper, Layer) {
			var Controller = {
				index: function() {
                     // console.log(true)
					 var first_swiper = new Swiper ('#first_swiper', {
					    loop: true, // 循环模式选项
					    // 如果需要分页器
						autoplay:true,
					    pagination: {
					      el: '.swiper-pagination',
					    }
					  })

					// 项目延期
					$("#subject_delay").click(function () {
						var item_id = $(this).data('id');
						var get_url = "/index/program_list/subject_delay";
						layer.prompt({
							formType: 2,
							title: '项目延期申请',
							placeholder:'延期申请',
							area: ['600px', '350px']
						}, function(value, index, elem){
							Fast.api.ajax({url:get_url,data:{item_id:item_id , delay_memo:value}},function (success) {
								layer.msg("申请成功",{icon: 1 , time:1000} , function () {
									window.location.href = success.url;
								}); return false;
							},function (error) {
								layer.msg(error,{icon: 2})
							})
							layer.close(index);
						});
					})

					// 项目终止申请
					$("#subject_ended").click(function () {
						var item_id = $(this).data('id');
						var get_url = "/index/programList/subject_ended";
						layer.prompt({
							formType: 2,
							title: '项目终止申请',
							placeholder:'终止申请',
							area: ['600px', '350px']
						}, function(value, index, elem){
							Fast.api.ajax({url:get_url,data:{item_id:item_id , end_memo:value}},function (success) {
								layer.msg("申请成功",{icon: 1, time:1000} , function () {
									window.location.href = success.url;
								}); return false;
							},function (error) {
								layer.msg(error,{icon: 2})
							})
							layer.close(index);
						});
					})




					  $("#member_declare").click(function(){
						  layer.open({
						    type: 1,
							title:['审核成员','font-size:1rem;'],
							area:['50rem','20rem'],
						  	scrollbar:false,
						    content: $('#modal') 
						  });
					  })
					  $("#apply").click(function(){
						  $(this).addClass("li_active")
						  $("#establish").removeClass("li_active")
						 $("#apply_content").removeClass("taggle")
						  $("#establish_content").addClass("taggle")
					  })
					  $("#establish").click(function(){
						  $(this).addClass("li_active")
						  $("#apply").removeClass("li_active")
					  	 $("#establish_content").removeClass("taggle")
					  	  $("#apply_content").addClass("taggle")
					  })
					  $(".tab_li") .click(function(){
						  if($(this).index()<=$(".main_right").length){
							$(this).addClass("left_active")
							$(this).siblings().removeClass("left_active")
							$(".main_right").each((i,ele)=>{
								if(i+1==$(this).index()){
									console.log(ele)
									$(ele).show()
								}else{
								  $(ele).hide()
								}
							})
						  }
					  })
				},
				}
				return Controller;
			});