作者 v_bairong06

支付功能优化,投稿奖项设置

<admintpl file="header" />
<style type="text/css">
.pic-list li {
margin-bottom: 5px;
}
</style>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li><a href="{:U('WillMissionPrize/index',array('mid'=>$mid))}">奖项列表</a></li>
<li class="active"><a target="_self">添加奖项</a></li>
</ul>
<form action="{:U('WillMissionPrize/add_post',array('mid'=>$mid))}" method="post" class="form-horizontal js-ajax-forms" enctype="multipart/form-data">
<div class="row-fluid">
<div class="span9">
<table class="table table-bordered">
<tr>
<th width="150">奖项名称</th>
<td>
<input type="text" style="width:400px;" name="name" id="name" required placeholder="请输入奖项名称"/>
<span class="form-required">*</span>
<input type="hidden" name="mid" value="{$mid}"/>
</td>
</tr>
<tr>
<th>奖项级别</th>
<td>
<input type="text" style="width:400px;" name="level" id="level" required placeholder="请输入奖项级别"/>
<span class="form-required">*</span>
</td>
</tr>
<tr>
<th>奖项人数</th>
<td>
<input type="text" style="width:400px;" name="num" id="num" required placeholder="请输入奖项人数" autocomplete="off"/>
<span class="form-required">*</span>
</td>
</tr>
</table>
</div>
<div class="span3">
<table class="table table-bordered">
<tr>
<th><b>缩略图</b></th>
</tr>
<tr>
<td>
<div style="text-align: center;">
<input type="hidden" name="thumb" id="thumb">
<a href="javascript:upload_one_image('图片上传','#thumb');">
<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="thumb-preview" width="135" style="cursor: hand" />
</a>
<input type="button" class="btn btn-small" onclick="$('#thumb-preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');$('#thumb').val('');return false;" value="取消图片">
</div>
</td>
</tr>
</table>
</div>
</div>
<div class="form-actions">
<button class="btn btn-primary js-ajax-submit" type="submit">提交</button>
<a class="btn" href="{:U('WillMissionPrize/index',array('mid'=>$mid))}">返回</a>
</div>
</form>
</div>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript">
$(function() {
$(".js-ajax-close-btn").on('click', function(e) {
e.preventDefault();
Wind.use("artDialog", function() {
art.dialog({
id : "question",
icon : "question",
fixed : true,
lock : true,
background : "#CCCCCC",
opacity : 0,
content : "您确定需要关闭当前页面嘛?",
ok : function() {
setCookie("refersh_time", 1);
window.close();
return true;
}
});
});
});
/////---------------------
Wind.use('validate', 'ajaxForm', 'artDialog', function() {
//javascript
var form = $('form.js-ajax-forms');
//ie处理placeholder提交问题
if ($.browser && $.browser.msie) {
form.find('[placeholder]').each(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
}
});
}
var formloading = false;
//表单验证开始
form.validate({
//是否在获取焦点时验证
onfocusout : false,
//是否在敲击键盘时验证
onkeyup : false,
//当鼠标掉级时验证
onclick : false,
//验证错误
showErrors : function(errorMap, errorArr) {
//errorMap {'name':'错误信息'}
//errorArr [{'message':'错误信息',element:({})}]
try {
$(errorArr[0].element).focus();
art.dialog({
id : 'error',
icon : 'error',
lock : true,
fixed : true,
background : "#CCCCCC",
opacity : 0,
content : errorArr[0].message,
cancelVal : '确定',
cancel : function() {
$(errorArr[0].element).focus();
}
});
} catch (err) {
}
},
//验证规则
rules : {
'name' : {
required : 1
}
},
//验证未通过提示消息
messages : {
'name' : {
required : '请输入名称'
}
},
//给未通过验证的元素加效果,闪烁等
highlight : false,
//是否在获取焦点时验证
onfocusout : false,
//验证通过,提交表单
submitHandler : function(forms) {
if (formloading)
return;
$(forms).ajaxSubmit({
url : form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
dataType : 'json',
beforeSubmit : function(arr, $form, options) {
formloading = true;
},
success : function(data, statusText, xhr, $form) {
formloading = false;
if (data.status) {
setCookie("refersh_time", 1);
//添加成功
Wind.use("artDialog", function() {
art.dialog({
id : "succeed",
icon : "succeed",
fixed : true,
lock : true,
background : "#CCCCCC",
opacity : 0,
content : data.info,
button : [ {
name : '继续添加?',
callback : function() {
reloadPage(window);
return true;
},
focus : true
}, {
name : '返回列表页',
callback : function() {
location = "{:U('WillMissionPrize/index',array('mid'=>$mid))}";
return true;
}
} ]
});
});
} else {
artdialog_alert(data.info);
}
}
});
}
});
});
////-------------------------
});
</script>
</body>
</html>
\ No newline at end of file
... ...
<admintpl file="header" />
<style type="text/css">
.pic-list li {
margin-bottom: 5px;
}
</style>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li><a href="{:U('WillMissionPrize/index',array('mid'=>$mid))}">奖项列表</a></li>
<li class="active"><a target="_self">编辑奖项</a></li>
</ul>
<form action="{:U('WillMissionPrize/edit_post',array('mid'=>$mid))}" method="post" class="form-horizontal js-ajax-forms" enctype="multipart/form-data">
<div class="row-fluid">
<div class="span9">
<table class="table table-bordered">
<tr>
<th width="150">奖项名称</th>
<td>
<input type="text" style="width:400px;" name="name" id="name" value="{$post.name}" required placeholder="请输入奖项名称"/>
<span class="form-required">*</span>
<input type="hidden" name="id" value="{$post.id}"/>
<input type="hidden" name="mid" value="{$mid}"/>
</td>
</tr>
<tr>
<th>奖项级别</th>
<td>
<input type="text" style="width:400px;" name="level" id="level" value="{$post.level}" required placeholder="请输入奖项级别"/>
<span class="form-required">*</span>
</td>
</tr>
<tr>
<th>奖项人数</th>
<td>
<input type="text" style="width:400px;" name="num" value="{$post.num}" id="num" required placeholder="请输入奖项人数" autocomplete="off"/>
<span class="form-required">*</span>
</td>
</tr>
</table>
</div>
<div class="span3">
<table class="table table-bordered">
<tr>
<th><b>缩略图</b></th>
</tr>
<tr>
<td>
<div style="text-align: center;">
<input type="hidden" name="thumb" id="thumb" value="{$post.thumb|default=''}">
<a href="javascript:upload_one_image('图片上传','#thumb');">
<if condition="empty($post['thumb'])">
<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="thumb-preview" width="135" style="cursor: hand" />
<else />
<img src="{:sp_get_image_preview_url($post['thumb'])}" id="thumb-preview" width="135" style="cursor: hand"/>
</if>
</a>
<input type="button" class="btn btn-small" onclick="$('#thumb-preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');$('#thumb').val('');return false;" value="取消图片">
</div>
</td>
</tr>
</table>
</div>
</div>
<div class="form-actions">
<button class="btn btn-primary js-ajax-submit" type="submit">提交</button>
<a class="btn" href="{:U('WillMissionPrize/index',array('mid'=>$mid))}">返回</a>
</div>
</form>
</div>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript">
$(function() {
$(".js-ajax-close-btn").on('click', function(e) {
e.preventDefault();
Wind.use("artDialog", function() {
art.dialog({
id : "question",
icon : "question",
fixed : true,
lock : true,
background : "#CCCCCC",
opacity : 0,
content : "您确定需要关闭当前页面嘛?",
ok : function() {
setCookie("refersh_time", 1);
window.close();
return true;
}
});
});
});
/////---------------------
Wind.use('validate', 'ajaxForm', 'artDialog', function() {
//javascript
//编辑器
editorcontent = new baidu.editor.ui.Editor();
editorcontent.render('content');
try {
editorcontent.sync();
} catch (err) {
}
//增加编辑器验证规则
jQuery.validator.addMethod('editorcontent', function() {
try {
editorcontent.sync();
} catch (err) {
}
return editorcontent.hasContents();
});
var form = $('form.js-ajax-forms');
//ie处理placeholder提交问题
if ($.browser && $.browser.msie) {
form.find('[placeholder]').each(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
}
});
}
var formloading = false;
//表单验证开始
form.validate({
//是否在获取焦点时验证
onfocusout : false,
//是否在敲击键盘时验证
onkeyup : false,
//当鼠标掉级时验证
onclick : false,
//验证错误
showErrors : function(errorMap, errorArr) {
//errorMap {'name':'错误信息'}
//errorArr [{'message':'错误信息',element:({})}]
try {
$(errorArr[0].element).focus();
art.dialog({
id : 'error',
icon : 'error',
lock : true,
fixed : true,
background : "#CCCCCC",
opacity : 0,
content : errorArr[0].message,
cancelVal : '确定',
cancel : function() {
$(errorArr[0].element).focus();
}
});
} catch (err) {
}
},
//验证规则
rules : {
'name' : {
required : 1
}
},
//验证未通过提示消息
messages : {
'name' : {
required : '请输入名称'
}
},
//给未通过验证的元素加效果,闪烁等
highlight : false,
//是否在获取焦点时验证
onfocusout : false,
//验证通过,提交表单
submitHandler : function(forms) {
if (formloading)
return;
$(forms).ajaxSubmit({
url : form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
dataType : 'json',
beforeSubmit : function(arr, $form, options) {
formloading = true;
},
success : function(data, statusText, xhr, $form) {
formloading = false;
if (data.status) {
setCookie("refersh_time", 1);
//添加成功
Wind.use("artDialog", function() {
art.dialog({
id : "succeed",
icon : "succeed",
fixed : true,
lock : true,
background : "#CCCCCC",
opacity : 0,
content : data.info,
button : [ {
name : '继续编辑?',
callback : function() {
return true;
},
focus : true
}, {
name : '返回列表页',
callback : function() {
location = "{:U('WillMissionPrize/index',array('mid'=>$mid))}";
return true;
}
} ]
});
});
} else {
artdialog_alert(data.info);
}
}
});
}
});
});
////-------------------------
});
</script>
</body>
</html>
\ No newline at end of file
... ...
<admintpl file="header" />
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">奖项列表</a></li>
<li><a href="{:U('WillMissionPrize/add',array('mid'=>$mid))}" target="_self">添加奖项</a></li>
</ul>
<form class="well form-search" method="post" action="{:U('WillMissionPrize/index',array('mid'=>$mid))}">
时间:
<input type="text" name="start_time" class="js-datetime" value="{$formget.start_time|default=''}" style="width: 120px;" autocomplete="off">-
<input type="text" class="js-datetime" name="end_time" value="{$formget.end_time|default=''}" style="width: 120px;" autocomplete="off"> &nbsp; &nbsp;
关键字:
<input type="text" name="keyword" style="width: 200px;" value="{$formget.keyword|default=''}" placeholder="请输入关键字...">
<input type="submit" class="btn btn-primary" value="搜索" />
<a class="btn btn-danger" href="{:U('WillMissionPrize/index',array('mid'=>$mid))}">清空</a>
</form>
<form class="js-ajax-form" action="" method="post">
<div class="table-actions">
<button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:U('WillMissionPrize/delete',array('mid'=>$mid))}" data-subcheck="true" data-msg="你确定删除吗?">{:L('DELETE')}</button>
</div>
<table class="table table-hover table-bordered table-list">
<thead>
<tr>
<th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
<th width="50">ID</th>
<th>奖项名称</th>
<th>奖项</th>
<th>奖项人数</th>
<th width="150">添加时间</th>
<!--<th width="50">{:L('STATUS')}</th>-->
<th width="70">{:L('ACTIONS')}</th>
</tr>
</thead>
<foreach name="posts" item="vo">
<tr>
<td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]" value="{$vo.id}" title="ID:{$vo.id}"></td>
<td><b>{$vo.id}</b></td>
<td>{$vo.name}</td>
<td>{$vo.level}</td>
<td>{$vo.num}</td>
<td>{:date('Y-m-d H:i',$vo['ctime'])}</td>
<td>
<a href="{:U('WillMissionPrize/edit',array('id'=>$vo['id'],'mid'=>$mid))}">{:L('EDIT')}</a> |
<a href="{:U('WillMissionPrize/delete',array('id'=>$vo['id'],'mid'=>$mid))}" class="js-ajax-delete">{:L('DELETE')}</a>
</td>
</tr>
</foreach>
<tfoot>
<tr>
<th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
<th width="50">ID</th>
<th>奖项名称</th>
<th>奖项</th>
<th>奖项人数</th>
<th width="150">添加时间</th>
<!--<th width="50">{:L('STATUS')}</th>-->
<th width="70">{:L('ACTIONS')}</th>
</tr>
</tfoot>
</table>
<div class="table-actions">
<button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:U('WillMissionPrize/delete',array('mid'=>$mid))}" data-subcheck="true" data-msg="你确定删除吗?">{:L('DELETE')}</button>
</div>
<div class="pagination">{$page}</div>
</form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script>
function refersh_window() {
var refersh_time = getCookie('refersh_time');
if (refersh_time == 1) {
window.location = "{:U('WillMissionPrize/index',$formget)}";
}
}
setInterval(function() {
refersh_window();
}, 2000);
$(function() {
setCookie("refersh_time", 0);
});
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -39,8 +39,8 @@
<tr>
<th>报名开始时间 - 结束时间</th>
<td>
<input type="text" name="post[starttime]" class="js-datetime" style="width: 120px;" autocomplete="off">-
<input type="text" class="js-datetime" name="post[endtime]" style="width: 120px;" autocomplete="off">
<input type="text" name="post[starttime]" class="js-date" style="width: 120px;" autocomplete="off">-
<input type="text" class="js-date" name="post[endtime]" style="width: 120px;" autocomplete="off">
<span class="form-required">*</span>
</td>
</tr>
... ...
... ... @@ -39,8 +39,8 @@
<tr>
<th>报名开始时间 - 结束时间</th>
<td>
<input type="text" name="post[starttime]" class="js-datetime" style="width: 120px;" autocomplete="off">-
<input type="text" class="js-datetime" name="post[endtime]" style="width: 120px;" autocomplete="off">
<input type="text" name="post[starttime]" class="js-date" style="width: 120px;" autocomplete="off">-
<input type="text" class="js-date" name="post[endtime]" style="width: 120px;" autocomplete="off">
<span class="form-required">*</span>
</td>
</tr>
... ...
... ... @@ -39,8 +39,8 @@
<tr>
<th>报名开始时间 - 结束时间</th>
<td>
<input type="text" name="post[starttime]" class="js-datetime" style="width: 120px;" autocomplete="off">-
<input type="text" class="js-datetime" name="post[endtime]" style="width: 120px;" autocomplete="off">
<input type="text" name="post[starttime]" class="js-date" style="width: 120px;" autocomplete="off">-
<input type="text" class="js-date" name="post[endtime]" style="width: 120px;" autocomplete="off">
<span class="form-required">*</span>
</td>
</tr>
... ...
... ... @@ -40,8 +40,8 @@
<tr>
<th>开始时间 - 结束时间</th>
<td>
<input type="text" name="post[starttime]" class="js-datetime" value="{$post.starttime}" style="width: 120px;" autocomplete="off">-
<input type="text" class="js-datetime" name="post[endtime]" value="{$post.endtime}" style="width: 120px;" autocomplete="off">
<input type="text" name="post[starttime]" class="js-date" value="{$post.starttime}" style="width: 120px;" autocomplete="off">-
<input type="text" class="js-date" name="post[endtime]" value="{$post.endtime}" style="width: 120px;" autocomplete="off">
<span class="form-required">*</span>
</td>
</tr>
... ...
... ... @@ -40,8 +40,8 @@
<tr>
<th>开始时间 - 结束时间</th>
<td>
<input type="text" name="post[starttime]" class="js-datetime" value="{$post.starttime}" style="width: 120px;" autocomplete="off">-
<input type="text" class="js-datetime" name="post[endtime]" value="{$post.endtime}" style="width: 120px;" autocomplete="off">
<input type="text" name="post[starttime]" class="js-date" value="{$post.starttime}" style="width: 120px;" autocomplete="off">-
<input type="text" class="js-date" name="post[endtime]" value="{$post.endtime}" style="width: 120px;" autocomplete="off">
<span class="form-required">*</span>
</td>
</tr>
... ...
... ... @@ -40,8 +40,8 @@
<tr>
<th>开始时间 - 结束时间</th>
<td>
<input type="text" name="post[starttime]" class="js-datetime" value="{$post.starttime}" style="width: 120px;" autocomplete="off">-
<input type="text" class="js-datetime" name="post[endtime]" value="{$post.endtime}" style="width: 120px;" autocomplete="off">
<input type="text" name="post[starttime]" class="js-date" value="{$post.starttime}" style="width: 120px;" autocomplete="off">-
<input type="text" class="js-date" name="post[endtime]" value="{$post.endtime}" style="width: 120px;" autocomplete="off">
<span class="form-required">*</span>
</td>
</tr>
... ...
... ... @@ -51,6 +51,7 @@
<td>{:date('Y-m-d H:i',$vo['ctime'])}</td>
<td>
<a href="{:U('AdminWillMission/edit',array('id'=>$vo['id']))}">{:L('EDIT')}</a> |
<a href="{:U('Admin/WillMissionPrize/index',array('mid'=>$vo['id']))}">奖项设置</a> |
<a href="{:U('AdminWillMission/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:L('DELETE')}</a>
</td>
</tr>
... ...
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/5/13 0013
* Time: 13:37
*/
namespace Admin\Controller;
use Common\Controller\AdminbaseController;
class WillMissionPrizeController extends AdminbaseController {
protected $will_mission_model;
protected $will_mission_prize_model;
function _initialize() {
parent::_initialize();
$this->will_mission_model = D("Common/WillMission");
$this->will_mission_prize_model = D("Common/WillMissionPrize");
}
// 列表
public function index(){
$mid = I('get.mid',0,'intval');
$this->assign('mid',$mid);
$this->_lists(array("is_del"=>0,'mid'=>$mid));
$this->display();
}
// 添加
public function add(){
$mid = I('get.mid',0,'intval');
$this->assign('mid',$mid);
$this->display();
}
// 添加提交
public function add_post(){
if (IS_POST) {
$info = I('post.');
$info['ctime'] = time();
if(!$this->will_mission_prize_model->create($info)) {
$this->error($this->will_mission_prize_model->getError());
}
$result=$this->will_mission_prize_model->add($info);
if ($result) {
$this->success("添加成功!");
} else {
$this->error("添加失败!");
}
}
}
// 在线调查编辑
public function edit(){
$id= I("get.id",0,'intval');
$mid = I('get.mid',0,'intval');
$this->assign('mid',$mid);
$post=$this->will_mission_prize_model->where(array("id=$id"))->find();
$this->assign("post",$post);
$this->display();
}
// 在线调查编辑提交
public function edit_post(){
if (IS_POST) {
$info = I('post.');
$info['utime'] = time();
if(!$this->will_mission_prize_model->create($info)) {
$this->error($this->will_mission_prize_model->getError());
}
$result=$this->will_mission_prize_model->where(array('id'=>I('post.id')))->save($info);
if ($result) {
$this->success("添加成功!");
} else {
$this->error("添加失败!");
}
}
}
/**
* 在线调查列表处理方法,根据不同条件显示不同的列表
* @param array $where 查询条件
*/
private function _lists($where=array()){
$start_time = I('request.start_time');
if(!empty($start_time)){
$where['ctime']=array(
array('EGT',$start_time)
);
}
$end_time = I('request.end_time');
if(!empty($end_time)){
if(empty($where['ctime'])){
$where['ctime']=array();
}
array_push($where['ctime'], array('ELT',$end_time));
}
$keyword = I('request.keyword');
if(!empty($keyword)){
$where['name']=array('like',"%$keyword%");
}
$this->will_mission_prize_model
->where($where);
$count = $this->will_mission_prize_model->count();
$page = $this->page($count, 20);
$posts = $this->will_mission_prize_model
->where($where)
->limit($page->firstRow , $page->listRows)
->order("ctime DESC")
->select();
$this->assign("page", $page->show('Admin'));
$this->assign("formget",array_merge($_GET,$_POST));
$this->assign("posts",$posts);
}
// 排序
public function listorders() {
$status = parent::_listorders($this->will_mission_prize_model);
if ($status) {
$this->success("排序更新成功!");
} else {
$this->error("排序更新失败!");
}
}
// 删除
public function delete(){
if(isset($_POST['ids'])){
$ids = array_map("intval", $_POST['ids']);
$data=array("dtime"=>time(),"is_del"=>1);
if ($this->will_mission_prize_model->where(array("id"=>array("in"=>$ids)))->save($data)) {
$this->success("删除成功!");
} else {
$this->error("删除失败!");
}
}else{
if(isset($_GET['id'])){
$id = I("get.id",0,'intval');
$data=array("id"=>$id,"dtime"=>time(),"is_del"=>1);
if ($this->will_mission_prize_model->save($data)) {
$this->success("删除成功!");
} else {
$this->error("删除失败!");
}
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -37,7 +37,12 @@
<span>还剩 <i class="px-num">3</i> 个名额</span>
<span>活动收费:<i class="px-price">{$vo.price}</i></span>
</div>
<a href="" class="btn-singup"><span>立即报名</span></a>
<eq name="vo.is_apply" value="0">
<a href="#myModal" data-toggle="modal" class="btn-singup"><span>立即报名</span></a>
</eq>
<eq name="vo.is_apply" value="1">
<a href="javascript:;" class="btn-singup"><span>已报名</span></a>
</eq>
</div>
<div class="px-footer">
<a href="{:U('detail',array('id'=>$vo['id']))}"><san>查看详情 ></san></a>
... ...
... ... @@ -37,7 +37,12 @@
<span>还剩 <i class="px-num">3</i> 个名额</span>
<span>活动收费:<i class="px-price">{$vo.price}</i></span>
</div>
<a href="" class="btn-singup"><span>立即报名</span></a>
<eq name="vo.is_apply" value="0">
<a href="#myModal" data-toggle="modal" class="btn-singup"><span>立即报名</span></a>
</eq>
<eq name="vo.is_apply" value="1">
<a href="javascript:;" class="btn-singup"><span>已报名</span></a>
</eq>
</div>
<div class="px-footer">
<a href="{:U('detail',array('id'=>$vo['id']))}"><san>查看详情 ></san></a>
... ...
... ... @@ -79,8 +79,11 @@
<script src="__TMPL__Public/assets/js/shop.js"></script>
<script>
$(function(){
setTimeout(searchStatus(),1000);
function searchStatus() {
checkStatus();
setInterval(function() {
checkStatus();
},1000);
function checkStatus() {
$.ajax({
url:"{:U('Portal/Notify/searchStatus')}",
type:"POST",
... ... @@ -89,15 +92,12 @@
},
dateType:"json",
success:function (data) {
console.log(data);
if(data.status) {
location.href = "{:U('User/Center/index')}";
} else {
alert(data.msg);
}
}
});
};
}
});
</script>
<tc_include file="Public:script"/>
... ...