作者 v_bairong06

鹿鸣会、体验培训提交功能及后台管理制作

<admintpl file="header" />
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">体验培训报名列表</a></li>
</ul>
<form class="well form-search" method="post" action="{:U('TrainApply/index')}">
时间:
<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="{$keyword|default=''}" placeholder="请输入关键字...">
<input type="submit" class="btn btn-primary" value="搜索" />
<a class="btn btn-danger" href="{:U('TrainApply/index')}">清空</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('TrainApply/delete')}" 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>用户id</th>
<th width="50">报名人姓名</th>
<th>所在省市</th>
<th>出生年份</th>
<th>性别</th>
<th>手机号码</th>
<th>邮箱</th>
<th width="100">提交时间</th>
<th width="70">操作</th>
</tr>
</thead>
<foreach name="list" 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.user_id}</td>
<td>{$vo.name}</td>
<td>{$vo.province}{$vo.city}</td>
<td>{$vo.birth}</td>
<td><eq name="vo.sex" value="1"></eq><eq name="vo.sex" value="2"></eq></td>
<td>{$vo.mobile}</td>
<td>{$vo.email}</td>
<td>{:date('Y-m-d H:i',$vo['ctime'])}</td>
<td>
<a href="{:U('TrainApply/view',array('id'=>$vo['id']))}">查看</a> |
<a href="{:U('TrainApply/delete',array('id'=>$vo['id']))}" class="js-ajax-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>用户id</th>
<th width="50">报名人姓名</th>
<th>所在省市</th>
<th>出生年份</th>
<th>性别</th>
<th>手机号码</th>
<th>邮箱</th>
<th width="50">提交时间</th>
<th width="70">操作</th>
</tr>
</tfoot>
</table>
<div class="table-actions">
<button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:U('TrainApply/delete')}" data-subcheck="true" data-msg="你确定删除吗?">{:L('DELETE')}</button>
</div>
<div class="pagination">{$page}</div>
</form>
</div>
<script src="__PUBLIC__/js/common.js"></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><a href="{:U('TrainApply/index')}">体验培训报名列表</a></li>
<li class="active"><a href="">体验培训报名详情</a></li>
</ul>
<form action="" method="post" class="form-horizontal js-ajax-forms">
<div class="row-fluid">
<div class="span9">
<table class="table table-bordered">
<tr>
<th width="80">用户ID</th>
<td>{$user_id}</td>
</tr>
<tr>
<th>姓名</th>
<td>{$name}</td>
</tr>
<tr>
<th>所在省市</th>
<td>{$province}{$city}</td>
</tr>
<tr>
<th>出生年份</th>
<td>{$birth}</td>
</tr>
<tr>
<th>性别</th>
<td>
<eq name="sex" value="1"></eq>
<eq name="sex" value="2"></eq>
</td>
</tr>
<tr>
<th>手机号码</th>
<td>{$mobile}</td>
</tr>
<tr>
<th>邮箱</th>
<td>{$email}</td>
</tr>
<tr>
<th>个人感兴趣的培训课程(文化之旅目的地)简要描述</th>
<td>{$lesson}</td>
</tr>
<tr>
<th>个人感兴趣的体验方式(文化项目)简要描述</th>
<td>{$experience}</td>
</tr>
<tr>
<th>个人感兴趣的旅行方式简要描述(文化之旅)</th>
<td>{$travel}</td>
</tr>
<tr>
<th>提交时间</th>
<td>{:date('Y-m-d H:i',$ctime)}</td>
</tr>
</table>
</div>
</div>
<div class="form-actions">
<a class="btn" href="{:U('TrainApply/index')}">返回</a>
</div>
</form>
</div>
<script src="__PUBLIC__/js/common.js"></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>
</ul>
<form class="well form-search" method="post" action="{:U('WillMissionApply/index')}">
时间:
<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="{$keyword|default=''}" placeholder="请输入关键字...">
<input type="submit" class="btn btn-primary" value="搜索" />
<a class="btn btn-danger" href="{:U('WillMissionApply/index')}">清空</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('WillMissionApply/delete')}" 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>用户id</th>
<th width="50">投稿人姓名</th>
<th>所在省市</th>
<th>出生年份</th>
<th>性别</th>
<th>高校</th>
<th>专业</th>
<th>手机号码</th>
<th>年级</th>
<th>邮箱</th>
<th width="100">提交时间</th>
<th width="70">操作</th>
</tr>
</thead>
<foreach name="list" 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.user_id}</td>
<td>{$vo.name}</td>
<td>{$vo.province}{$vo.city}</td>
<td>{$vo.birth}</td>
<td><eq name="vo.sex" value="1"></eq><eq name="vo.sex" value="2"></eq></td>
<td>{$vo.school}</td>
<td>{$vo.major}</td>
<td>{$vo.mobile}</td>
<td>{$vo.classes}</td>
<td>{$vo.email}</td>
<td>{:date('Y-m-d H:i',$vo['ctime'])}</td>
<td>
<a href="{:U('WillMissionApply/view',array('id'=>$vo['id']))}">查看</a> |
<a href="{:U('WillMissionApply/delete',array('id'=>$vo['id']))}" class="js-ajax-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>用户id</th>
<th width="50">投稿人姓名</th>
<th>所在省市</th>
<th>出生年份</th>
<th>性别</th>
<th>高校</th>
<th>专业</th>
<th>手机号码</th>
<th>年级</th>
<th>邮箱</th>
<th width="50">提交时间</th>
<th width="70">操作</th>
</tr>
</tfoot>
</table>
<div class="table-actions">
<button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:U('WillMissionApply/delete')}" data-subcheck="true" data-msg="你确定删除吗?">{:L('DELETE')}</button>
</div>
<div class="pagination">{$page}</div>
</form>
</div>
<script src="__PUBLIC__/js/common.js"></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><a href="{:U('WillMissionApply/index')}">任务投稿提交列表</a></li>
<li class="active"><a href="">任务投稿提交详情</a></li>
</ul>
<form action="" method="post" class="form-horizontal js-ajax-forms">
<div class="row-fluid">
<div class="span9">
<table class="table table-bordered">
<tr>
<th width="80">用户ID</th>
<td>{$user_id}</td>
</tr>
<tr>
<th>姓名</th>
<td>{$name}</td>
</tr>
<tr>
<th>所在省市</th>
<td>{$province}{$city}</td>
</tr>
<tr>
<th>出生年份</th>
<td>{$birth}</td>
</tr>
<tr>
<th>性别</th>
<td>
<eq name="sex" value="1"></eq>
<eq name="sex" value="2"></eq>
</td>
</tr>
<tr>
<th>高校</th>
<td>{$school}</td>
</tr>
<tr>
<th>专业</th>
<td>{$major}</td>
</tr>
<tr>
<th>手机号码</th>
<td>{$mobile}</td>
</tr>
<tr>
<th>年级</th>
<td>{$classes}</td>
</tr>
<tr>
<th>邮箱</th>
<td>{$email}</td>
</tr>
<tr>
<th>相关专业经验(绘画、设计、广告、文创、营销等)简要描述</th>
<td>{$experience}</td>
</tr>
<tr>
<th>相关创作或获奖作品简要描述</th>
<td>{$product}</td>
</tr>
<tr>
<th>作品描述</th>
<td>{$product_description}</td>
</tr>
<tr>
<th>提交时间</th>
<td>{:date('Y-m-d H:i',$ctime)}</td>
</tr>
</table>
</div>
</div>
<div class="form-actions">
<a class="btn" href="{:U('WillMissionApply/index')}">返回</a>
</div>
</form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -3,20 +3,20 @@
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">双创项目提交列表</a></li>
<li class="active"><a href="javascript:;">入会申请提交列表</a></li>
</ul>
<form class="well form-search" method="post" action="{:U('WillProduceApply/index')}">
<form class="well form-search" method="post" action="{:U('WillUserApply/index')}">
时间:
<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="{$keyword|default=''}" placeholder="请输入关键字...">
<input type="submit" class="btn btn-primary" value="搜索" />
<a class="btn btn-danger" href="{:U('WillProduceApply/index')}">清空</a>
<a class="btn btn-danger" href="{:U('WillUserApply/index')}">清空</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('WillProduceApply/delete')}" data-subcheck="true" data-msg="您确定删除吗?">{:L('DELETE')}</button>
<button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:U('WillUserApply/delete')}" data-subcheck="true" data-msg="您确定删除吗?">{:L('DELETE')}</button>
</div>
<table class="table table-hover table-bordered table-list">
<thead>
... ... @@ -24,7 +24,7 @@
<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>用户id</th>
<th width="50">投稿人姓名</th>
<th width="50">申请人姓名</th>
<th>所在省市</th>
<th>年龄</th>
<th>性别</th>
... ... @@ -58,9 +58,8 @@
<eq name="vo.status" value="3">审核不通过</eq><eq name="vo.status" value="4">重新提交审核</eq>
</td>
<td>
<a href="{:U('WillProduceApply/view',array('id'=>$vo['id']))}">查看</a> |
<eq name="vo.is_issue" value="0"><a href="{:U('WillProduceApply/send',array('id'=>$vo['id']))}">发布</a> |</eq>
<a href="{:U('WillProduceApply/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">删除</a>
<a href="{:U('WillUserApply/view',array('id'=>$vo['id']))}">查看</a> |
<a href="{:U('WillUserApply/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">删除</a>
</td>
</tr>
</foreach>
... ... @@ -69,7 +68,7 @@
<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>用户id</th>
<th width="50">投稿人姓名</th>
<th width="50">申请人姓名</th>
<th>所在省市</th>
<th>年龄</th>
<th>性别</th>
... ... @@ -85,7 +84,7 @@
</tfoot>
</table>
<div class="table-actions">
<button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:U('WillProduceApply/delete')}" data-subcheck="true" data-msg="你确定删除吗?">{:L('DELETE')}</button>
<button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:U('WillUserApply/delete')}" data-subcheck="true" data-msg="你确定删除吗?">{:L('DELETE')}</button>
</div>
<div class="pagination">{$page}</div>
</form>
... ...
... ... @@ -3,8 +3,8 @@
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li><a href="{:U('WillProduceApply/index')}">双创项目提交列表</a></li>
<li class="active"><a href="">双创项目提交详情</a></li>
<li><a href="{:U('WillUserApply/index')}">入会申请提交列表</a></li>
<li class="active"><a href="">入会申请提交详情</a></li>
</ul>
<form action="" method="post" class="form-horizontal js-ajax-forms">
<div class="row-fluid">
... ... @@ -13,6 +13,7 @@
<tr>
<th width="80">用户ID</th>
<td>{$user_id}</td>
<input type="hidden" name="id" value="{$id}"/>
</tr>
<tr>
<th>姓名</th>
... ... @@ -54,16 +55,12 @@
<td>{$email}</td>
</tr>
<tr>
<th>团队成员或个人相关经验</th>
<th>相关专业经验</th>
<td>{$experience}</td>
</tr>
<tr>
<th>团队成员或个人描述</th>
<td>{$product}</td>
</tr>
<tr>
<th>双创项目创意概述</th>
<td>{$product_description}</td>
<th>个人创意特长与兴趣领域描述</th>
<td>{$skill}</td>
</tr>
<tr>
<th>提交时间</th>
... ... @@ -71,6 +68,25 @@
</tr>
</table>
</div>
<div class="span3">
<table class="table table-bordered">
<tr>
<th>状态</th>
</tr>
<tr>
<td>
<php>
$status_yes=$status==2?"checked":"";
$status_no=$status==1?"checked":"";
$status_un=$status==3?"checked":"";
</php>
<label class="radio"><input type="radio" name="status" value="2" {$status_yes}>通过</label>
<label class="radio"><input type="radio" name="status" value="1" {$status_no}>待审核</label>
<label class="radio"><input type="radio" name="status" value="3" {$status_un}>驳回</label>
</td>
</tr>
</table>
</div>
</div>
<div class="form-actions">
<a class="btn" href="{:U('WillProduceApply/index')}">返回</a>
... ...
<?php
/**
* Created by PhpStorm.
* User: 29925
* Date: 2018/4/27
* Time: 21:16
*/
namespace Admin\Controller;
use Common\Controller\AdminbaseController;
class TrainApplyController extends AdminbaseController {
protected $train_apply_model;
protected $train_model;
function _initialize() {
parent::_initialize(); // TODO: Change the autogenerated stub
$this->train_apply_model = D('Common/TrainApply');
$this->train_model = D('Common/Train');
}
// 体验培训报名列表
public function index() {
$this->assign('list', $this->train_apply_model->getList(I('get.p'), I('post.keyword'), strtotime(I('post.start_time')), strtotime(I('post.end_time'))));
$count = $this->train_apply_model->getCount(I('post.keyword'), strtotime(I('post.start_time')), strtotime(I('post.end_time')));
$page = $this->page($count, C('MAX_PAGE_NUM'));
$this->assign('page', $page->show('Admin'));
$this->assign('formget', I('post.'));
$this->assign('keyword', I('post.keyword'));
$this->display();
}
// 查看
public function view(){
$id = I("get.id",0,'intval');
$info = $this->train_apply_model->where(array('id'=>$id, 'is_del'=>0))->find();
$info['images'] = explode(',', $info['images']);
$this->assign($info);
$this->display();
}
// 发布
public function send(){
$id = I("get.id",0,'intval');
$info = $this->train_apply_model->where(array('id'=>$id, 'is_del'=>0))->find();
$info['images'] = explode(',', $info['images'])[0];
$this->assign($info);
$this->display();
}
// 删除
public function delete(){
if(I('get.id')){
$id = I("get.id",0,'intval');
if ($this->train_apply_model->where(array('id'=>$id))->save(array('is_del'=>1,'dtime'=>time())) !==false) {
$this->success("删除成功!");
} else {
$this->error("删除失败!");
}
}
if(I('post.ids')){
$ids = I('post.ids/a');
if (!$this->train_apply_model->where(array('id'=>array('in',$ids)))->save(array('is_del'=>1,'dtime'=>time()))) {
$this->error("删除失败!");
}
$this->success("删除成功!");
}
}
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: 29925
* Date: 2018/4/27
* Time: 20:41
*/
namespace Admin\Controller;
use Common\Controller\AdminbaseController;
class WillMissionApplyController extends AdminbaseController {
protected $will_mission_apply_model;
protected $will_mission_model;
function _initialize() {
parent::_initialize(); // TODO: Change the autogenerated stub
$this->will_mission_apply_model = D('Common/WillMissionApply');
$this->will_mission_model = D('Common/WillMission');
}
// 任务投稿提交列表
public function index() {
$mid = I('get.id',0,'intval');
$this->assign('list', $this->will_mission_apply_model->getList(1, I('get.p'), I('post.keyword'), strtotime(I('post.start_time')), strtotime(I('post.end_time'))));
$count = $this->will_mission_apply_model->getCount(1, I('post.keyword'), strtotime(I('post.start_time')), strtotime(I('post.end_time')));
$page = $this->page($count, C('MAX_PAGE_NUM'));
$this->assign('page', $page->show('Admin'));
$this->assign('formget', I('post.'));
$this->assign('keyword', I('post.keyword'));
$this->display();
}
// 查看
public function view(){
$id = I("get.id",0,'intval');
$info = $this->will_mission_apply_model->where(array('id'=>$id, 'is_del'=>0))->find();
$info['images'] = explode(',', $info['images']);
$this->assign($info);
$this->display();
}
// 发布
public function send(){
$id = I("get.id",0,'intval');
$info = $this->will_mission_apply_model->where(array('id'=>$id, 'is_del'=>0))->find();
$info['images'] = explode(',', $info['images'])[0];
$this->assign($info);
$this->display();
}
// 删除
public function delete(){
if(I('get.id')){
$id = I("get.id",0,'intval');
if ($this->will_mission_apply_model->where(array('id'=>$id))->save(array('is_del'=>1,'dtime'=>time())) !==false) {
$this->success("删除成功!");
} else {
$this->error("删除失败!");
}
}
if(I('post.ids')){
$ids = I('post.ids/a');
if (!$this->will_mission_apply_model->where(array('id'=>array('in',$ids)))->save(array('is_del'=>1,'dtime'=>time()))) {
$this->error("删除失败!");
}
$this->success("删除成功!");
}
}
}
\ No newline at end of file
... ...
... ... @@ -12,11 +12,13 @@ use Common\Controller\AdminbaseController;
class WillUserApplyController extends AdminbaseController {
protected $user_model;
protected $will_user_apply_model;
function _initialize() {
parent::_initialize(); // TODO: Change the autogenerated stub
$this->will_user_apply_model = D('Common/WillUserApply');
$this->user_model = D('Common/User');
}
// 鹿鸣社申请列表
... ... @@ -39,6 +41,25 @@ class WillUserApplyController extends AdminbaseController {
$this->display();
}
//用户认证编辑
public function edit_post(){
if(IS_POST) {
$post = I('post.');
$id = I('post.id');
$user_id = $this->will_user_apply_model->where(array('id'=>$id))->getField('user_id');
if($this->will_user_apply_model->save($post)) {
if(I('post.status') == 2) {
$this->user_model->where(array('id'=>$user_id))->save(array('status'=>2,'join_time'=>time()));
} else {
$this->user_model->where(array('id'=>$user_id))->save(array('status'=>1));
}
$this->success('保存成功');
} else {
$this->error('保存失败');
}
}
}
// 删除
public function delete(){
if(I('get.id')){
... ...
... ... @@ -20,9 +20,10 @@ class TrainApplyModel extends CommonModel {
array('name', 'require', '报名人不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('province', 'require', '所在省不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('city', 'require', '城市不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('age', 'number', '年龄格式错误', 1, 'regex', CommonModel::MODEL_BOTH),
array('sex', array(0,1,2), '性别格式错误', 1, 'regex', CommonModel::MODEL_BOTH),
array('birth', 'require', '出生年月不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('sex', array(0,1,2), '性别格式错误', 1, 'in', CommonModel::MODEL_BOTH),
array('mobile', 'require', '手机号码不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('mobile', 'mobile', '手机号码格式错误', 1, 'regex', CommonModel::MODEL_BOTH),
array('email', 'require', '邮箱不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('email', 'email', '邮箱格式错误', 1, 'regex', CommonModel::MODEL_BOTH),
array('lesson', 'require', '培训课程描述不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
... ... @@ -31,11 +32,15 @@ class TrainApplyModel extends CommonModel {
);
// 获取体验培训报名列表
public function getList($keyword = null) {
public function getList($page_num, $keyword = null, $start_time = null, $end_time = null) {
$perPage = 25;
$where['is_del'] = 0;
if($keyword) {
$where['name'] = array('like', '%'.$keyword.'%');
}
if($start_time && $end_time) {
$where['ctime'] = array('between', array($start_time,$end_time));
}
return $this->where($where)->select();
}
... ... @@ -45,4 +50,21 @@ class TrainApplyModel extends CommonModel {
$where['id'] = $id;
return $this->where($where)->find();
}
/**
* 获取数据总数
* @author Liuzhen
*/
public function getCount($keyword = null, $start_time = null, $end_time = null) {
$where['is_del'] = 0;
if($keyword) {
$where['name'] = array('like', '%'.$keyword.'%');
}
if($start_time && $end_time) {
$where['ctime'] = array('between', array($start_time,$end_time));
}
$count = $this->where($where)
->count();
return $count;
}
}
\ No newline at end of file
... ...
... ... @@ -17,27 +17,39 @@ class WillMissionApplyModel extends CommonModel {
//array(验证字段,验证规则,错误提示,验证条件,附加规则,验证时间)
array('user_id', 'number', '用户ID不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('mid', 'number', '任务ID不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('name', 'require', '姓名不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('name', 'require', '投稿人姓名不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('province', 'require', '所在省不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('city', 'require', '城市不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('age', 'number', '年龄格式错误', 1, 'regex', CommonModel::MODEL_BOTH),
array('sex', array(0,1,2), '性别格式错误', 1, 'regex', CommonModel::MODEL_BOTH),
array('school', 'require', '高校不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('birth', 'require', '出生年份不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('school', 'require', '所在公司或高校不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('sex', array(0,1,2), '性别格式错误', 1, 'in', CommonModel::MODEL_BOTH),
array('major', 'require', '专业不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('mobile', 'require', '手机号码不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('mobile', 'mobile', '手机号码格式错误', 1, 'regex', CommonModel::MODEL_BOTH),
array('classes', 'require', '年级不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('email', 'require', '邮箱不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('email', 'email', '邮箱格式错误', 1, 'regex', CommonModel::MODEL_BOTH),
array('classes', 'require', '年级不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('experience', 'require', '相关经验不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('product', 'require', '创作描述不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('product_description', 'require', '作品描述不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('att', 'require', '详细附件不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('images', 'require', '作品图片不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
);
// 获取任务投稿列表
public function getList($mid) {
public function getList($mid, $page_num, $keyword = null, $start_time = null, $end_time = null) {
$perPage = 25;
$where['is_del'] = 0;
$where['mid'] = $mid;
return $this->where($where)->select();
if($keyword) {
$where['name'] = array('like', '%'.$keyword.'%');
}
if($start_time && $end_time) {
$where['ctime'] = array('between', array($start_time,$end_time));
}
return $this->where($where)
->page($page_num, $perPage)
->select();
}
// 获取任务投稿详情
... ... @@ -46,4 +58,22 @@ class WillMissionApplyModel extends CommonModel {
$where['id'] = $id;
return $this->where($where)->find();
}
/**
* 获取数据总数
* @author Liuzhen
*/
public function getCount($mid, $keyword = null, $start_time = null, $end_time = null) {
$where['mid'] = $mid;
if($keyword) {
$where['name'] = array('like', '%'.$keyword.'%');
}
if($start_time && $end_time) {
$where['ctime'] = array('between', array($start_time,$end_time));
}
$where['is_del'] = 0;
$count = $this->where($where)
->count();
return $count;
}
}
\ No newline at end of file
... ...
... ... @@ -13,10 +13,12 @@ use Common\Controller\HomebaseController;
class TrainController extends HomebaseController {
protected $train_model;
protected $train_apply_model;
function _initialize() {
parent::_initialize();
$this->train_model = D("Common/Train");
$this->train_apply_model = D("Common/TrainApply");
}
// 工作坊列表
... ... @@ -79,4 +81,31 @@ class TrainController extends HomebaseController {
$this->assign("formget",array_merge($_GET,$_POST));
$this->assign("posts",$posts);
}
/**
* 体验培训提交
* @param post 提交的申请数据
* @param user_id 用户ID
*/
public function submit() {
if(IS_AJAX) {
$post =I('post.');
$user_id = $post['user_id'] = 1;
// $user_id = $post['user_id'] = sp_get_current_userid();
// if(!$user_id) {
// $this->ajaxReturn(array('status'=>false,'msg'=>'用户未登录'));
// }
$post['ctime'] = $post['utime'] = time();
if(!$this->train_apply_model->create($post)) {
$this->ajaxReturn(array('status'=>false,'msg'=>$this->train_apply_model->getError(),'data'=>$post));
}
$train_id = $this->train_apply_model->add($post);
if(!$train_id) {
$this->ajaxReturn(array('status'=>false,'msg'=>'提交失败'));
}
$this->ajaxReturn(array('status'=>true,'msg'=>'提交成功','data'=>$train_id));
} else {
$this->error('非法操作');
}
}
}
\ No newline at end of file
... ...
... ... @@ -14,6 +14,7 @@ class WillController extends HomebaseController {
protected $posts_model;
protected $will_mission_model;
protected $will_mission_apply_model;
protected $will_events_model;
protected $will_events_apply_model;
protected $will_produce_model;
... ... @@ -23,6 +24,7 @@ class WillController extends HomebaseController {
parent::_initialize();
$this->posts_model = D("Portal/Posts");
$this->will_mission_model = D("Common/WillMission");
$this->will_mission_apply_model = D("Common/WillMissionApply");
$this->will_events_model = D("Common/WillEvents");
$this->will_events_apply_model = D("Common/WillEventsApply");
$this->will_produce_model = D("Common/WillProduce");
... ... @@ -174,7 +176,7 @@ class WillController extends HomebaseController {
if(!$will_id) {
$this->ajaxReturn(array('status'=>false,'msg'=>'提交失败'));
}
$this->ajaxReturn(array('status'=>true,'msg'=>'提交成功','data'=>$will_id));
$this->ajaxReturn(array('status'=>true,'msg'=>'提交成功'));
} else {
$this->error('非法操作');
}
... ... @@ -206,7 +208,38 @@ class WillController extends HomebaseController {
if(!$will_id) {
$this->ajaxReturn(array('status'=>false,'msg'=>'提交失败'));
}
$this->ajaxReturn(array('status'=>true,'msg'=>'提交成功','data'=>$will_id));
$this->ajaxReturn(array('status'=>true,'msg'=>'提交成功'));
} else {
$this->error('非法操作');
}
}
/**
* 任务投稿提交
* @param post 提交的申请数据
* @param user_id 用户ID
*/
public function submit_mission() {
if(IS_AJAX) {
$post =I('post.');
$user_id = $post['user_id'] = 1;
// $user_id = $post['user_id'] = sp_get_current_userid();
// if(!$user_id) {
// $this->ajaxReturn(array('status'=>false,'msg'=>'用户未登录'));
// }
$post['images'] = implode(',',I('post.images'));
$post['ctime'] = $post['utime'] = time();
if(!$this->will_mission_apply_model->create($post)) {
$this->ajaxReturn(array('status'=>false,'msg'=>$this->will_mission_apply_model->getError(),'data'=>$post));
}
if(count(I('post.images'))<3 || count(I('post.images'))>5) {
$this->ajaxReturn(array('status'=>false,'msg'=>'图片数量不符'));
}
$will_id = $this->will_mission_apply_model->add($post);
if(!$will_id) {
$this->ajaxReturn(array('status'=>false,'msg'=>'提交失败'));
}
$this->ajaxReturn(array('status'=>true,'msg'=>'提交成功'));
} else {
$this->error('非法操作');
}
... ...
<div id="myModal" class="modal fade" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4>文化之旅报名表</h4>
</div>
<div class="modal-body">
<form action="" method="post" id="train">
<input type="hidden" name="tid" value=""/>
<div class="row">
<div class="row-title">
<h5>个人信息</h5>
</div>
<div class="row-con cf">
<div class="ipt-container lf">
<input type="text" name="name" placeholder="培训人姓名">
</div>
<div class="slt-list lf" id="city">
<div class="slt-container lf">
<select name="province" class="mm-select prov">
<option value="天津"></option>
</select>
</div>
<div class="slt-container lf">
<select name="city" class="mm-select city"><option value="天津"></option></select>
</div>
</div>
<div class="ipt-container lf">
<input id="d11" type="text" placeholder="出生年月" name="birth" onClick="WdatePicker({skin:'twoer'})"/>
</div>
<div class="ipt-container lf">
<input type="text" name="mobile" placeholder="手机号">
</div>
<div class="radio-container lf">
<label>性别:</label>
<input type="radio" name="sex" value="1" checked>
<input type="radio" name="sex" value="2">
</div>
<div class="ipt-container lf">
<input type="text" name="email" placeholder="邮箱">
</div>
</div>
</div>
<div class="row">
<div class="row-title">
<h5>个人兴趣</h5>
</div>
<div class="row-con">
<div class="textarea-container">
<textarea name="lesson" maxlength="500" placeholder="个人感兴趣的文化之旅目的地简要描述"></textarea>
</div>
<div class="textarea-container">
<textarea name="experience" maxlength="500" placeholder="个人感兴趣的文化项目简要描述"></textarea>
</div>
<div class="textarea-container">
<textarea name="travel" maxlength="500" placeholder="个人感兴趣的旅行方式简要描述"></textarea>
</div>
</div>
</div>
<div class="row">
<div class="sub-container">
<input type="button" name="submit" value="确认提交">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -3,10 +3,11 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>8体验培训</title>
<title>体验培训</title>
<link href="__TMPL__Public/assets/css/reset.css" rel="stylesheet" type="text/css" />
<link href="__TMPL__Public/assets/css/common.css" rel="stylesheet" type="text/css" />
<link href="__TMPL__Public/assets/css/style.css" rel="stylesheet" type="text/css" />
<link href="__TMPL__Public/assets/css/modal.css" rel="stylesheet" type="text/css" />
</head>
<body>
<tc_include file="Public:header"/>
... ... @@ -28,7 +29,7 @@
<div class="main">
<ul class="peixun-list">
<volist name="posts" id="vo">
<li>
<li data-id="{$vo.id}">
<div class="peixun-box">
<a href="###" class="peixun-pic scale"><img src="{:sp_get_asset_upload_path($vo['thumb'])}"/></a>
<div class="px-intro">
... ... @@ -37,7 +38,7 @@
<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>
<a href="#myModal" data-toggle="modal" class="btn-singup"><span>立即报名</span></a>
</div>
<div class="px-footer">
<a href="{:U('detail',array('id'=>$vo['id']))}"><san>查看详情 ></san></a>
... ... @@ -49,8 +50,61 @@
</div>
</div>
<tc_include file="Public:footer"/>
<tc_include file="Portal/Train:apply"/>
<!-- js -->
<script src="__TMPL__Public/assets/js/jquery.min.js"></script>
<script src="__TMPL__Public/assets/js/common.js"></script>
<script src="__TMPL__Public/assets/js/modal.js"></script>
<script type="text/javascript" src="__TMPL__Public/assets/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="__TMPL__Public/assets/js/jquery.cityselect1.js"></script>
<script>
// $('#myModal').modal({
// })
$('#myModal').on('shown.bs.modal', function (event) {
var button = $(event.relatedTarget);
var tid = button.parents('li').data('id');
$('input[name=tid]').val(tid);
document.documentElement.style.overflow='hidden';
})
$('#myModal').on('hidden.bs.modal', function () {
$('input[name=tid]').val('');
document.documentElement.style.overflow='auto';
})
</script>
<script>
$('input[name=submit]').click(function(){
var btn = $(this);
var text = btn.val();
var form = $('#train').serialize();
console.log(form);
$.ajax({
url:"{:U('Train/submit')}",
type:"POST",
data:form,
dateType:"json",
beforeSend: function () {
// Handle the beforeSend event
btn.val('提交中...').attr('disabled', true);
},
success:function (data) {
console.log(data);
if(data.status) {
alert(data.msg);
location.reload();
} else {
alert(data.msg);
}
},
error: function (data, status, e) { //提交失败自动执行的处理函数
alert(e);
},
complete: function () {
// Handle the complete event
btn.val(text).attr('disabled', false);
}
})
})
</script>
</body>
</html>
... ...
... ... @@ -3,11 +3,30 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>9鹿鸣社_3任务发布</title>
<title>鹿鸣社_任务发布</title>
<link href="__TMPL__Public/assets/css/reset.css" rel="stylesheet" type="text/css" />
<link href="__TMPL__Public/assets/css/common.css" rel="stylesheet" type="text/css" />
<link href="__TMPL__Public/assets/css/style.css" rel="stylesheet" type="text/css" />
<link href="__TMPL__Public/assets/css/modal.css" rel="stylesheet" type="text/css" />
<style>
.img_box{
width:100%;
position: absolute;
top: 0;
left: 0;
z-index:1;
background-color: #FFF;
overflow: hidden;
max-height: 100%;
}
.img_box img{
width: auto;
}
.upload{
z-index: 2;
}
</style>
</head>
<body>
<tc_include file="Public:header"/>
... ... @@ -31,7 +50,7 @@
<div class="main">
<ul class="task-list">
<volist name="list" id="vo">
<li class="pull-left">
<li class="pull-left" data-id="{$vo.id}">
<div class="task-listbox">
<div class="task-header">
<div class="task-title"><a href="{:U('Will/mission_detail', array('id'=>$vo['id']))}">{$vo.name}</a></div>
... ... @@ -42,58 +61,153 @@
<a href="{:U('Will/mission_detail', array('id'=>$vo['id']))}" class="scale"><img src="{:sp_get_asset_upload_path($vo['thumb'])}"/></a>
</div>
<div class="task-footer">
<a href="" class="btn-contribute"><span>投稿</span></a>
<a href="#myModal1" data-toggle="modal" class="btn-contribute"><span>投稿</span></a>
<a href="{:U('Will/mission_detail', array('id'=>$vo['id']))}" class="t-link t-abs-link">活动详情></a>
</div>
</div>
</li>
</volist>
<li class="pull-right">
<div class="task-listbox">
<div class="task-header">
<div class="task-title"><a href="">青年文创征集活动</a></div>
<div class="task-desc">投稿截止:2018-1-23</div>
<div class="task-status t-ed"><span>投稿中</span></div>
</div>
<div class="task-pic">
<a href="" class="scale"><img src="__TMPL__Public/assets/images/demo/task.jpg"/></a>
</div>
<div class="task-footer">
<a href="" class="t-link">活动详情></a>
</div>
</div>
</li>
<li class="pull-left">
<div class="task-listbox">
<div class="task-header">
<div class="task-title"><a href="">青年文创征集活动</a></div>
<div class="task-desc">投稿截止:2018-1-23</div>
<div class="task-status t-over"><span>获奖公示</span></div>
</div>
<div class="task-pic">
<a href="" class="scale"><img src="__TMPL__Public/assets/images/demo/task.jpg"/></a>
</div>
<div class="task-footer">
<a href="" class="t-link">活动详情></a>
</ul>
</div>
</div>
<div id="myModal1" class="modal fade" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4>任务发布投稿表</h4>
</div>
<div class="modal-body">
<form action="" method="post" id="mission">
<input type="hidden" name="mid" value=""/>
<div class="row">
<div class="row-title">
<h5>投稿人姓名</h5>
</div>
<div class="row-con cf">
<div class="ipt-container lf">
<input type="text" name="name" placeholder="投稿人姓名">
</div>
<div class="slt-list lf" id="city">
<div class="slt-container lf">
<select name="province" class="mm-select prov">
<option value="天津"></option>
</select>
</div>
<div class="slt-container lf">
<select name="city" class="mm-select city"><option value="天津"></option></select>
</div>
</div>
<div class="ipt-container lf">
<input id="d11" type="text" name="birth" placeholder="出生年月" onClick="WdatePicker({skin:'twoer'})"/>
</div>
<div class="ipt-container lf">
<input type="text" name="school" placeholder="所在公司或高校">
</div>
<div class="radio-container lf">
<label>性别:</label>
<input type="radio" name="sex" value="1" checked>
<input type="radio" name="sex" value="2">
</div>
<div class="ipt-container lf">
<input type="text" name="major" placeholder="专业">
</div>
<div class="ipt-container lf">
<input type="text" name="mobile" placeholder="手机号">
</div>
<div class="slt-container lf">
<select name="classes" id="slt_0">
<option selected>一年级</option>
<option>二年级</option>
<option>三年级</option>
</select>
</div>
<div class="ipt-container lf">
<input type="text" name="email" placeholder="邮箱">
</div>
</div>
</div>
</div>
</li>
<li class="pull-right">
<div class="task-listbox">
<div class="task-header">
<div class="task-title"><a href="">青年文创征集活动</a></div>
<div class="task-desc">投稿截止:2018-1-23</div>
<div class="task-status t-over"><span>获奖公示</span></div>
<div class="row">
<div class="row-title">
<h5>专业经验</h5>
</div>
<div class="row-con">
<div class="textarea-container">
<textarea name="experience" placeholder="相关专业经验(绘画、设计、广告、文创、营销等)简要描述"></textarea>
</div>
<div class="textarea-container">
<textarea name="product" placeholder="相关创作或获奖作品简要描述"></textarea>
</div>
</div>
</div>
<div class="task-pic">
<a href="" class="scale"><img src="__TMPL__Public/assets/images/demo/task.jpg"/></a>
<div class="row">
<div class="row-title">
<h5>作品描述</h5>
</div>
<div class="row-con">
<div class="file-container">
上传详细附件
<input type="file" name="att" id="att">
</div>
<div class="file-container" style="display:none;border:none;" id="att_file"></div>
<div class="textarea-container">
<textarea id="txt" name="product_description" placeholder="投稿作品创意概述"></textarea>
<p>
<span id="txt_num">0</span>/500字
</p>
</div>
<div class="pic-container">
<div class="pic-title">
<p>投稿作品图片,3~5张,jpg、png或jif格式。</p>
</div>
<div class="btn-list cf">
<div class="btn-item lf">
<div class="img_box">
</div>
<i class="icon"></i>
<p>上传投稿作品图片</p>
<input type="file" name="images[]" class="upload" id="id_photos">
</div>
<div class="btn-item lf">
<div class="img_box">
</div>
<i class="icon"></i>
<p>上传投稿作品图片</p>
<input type="file" name="images[]" class="upload" id="id_photos1">
</div>
<div class="btn-item lf">
<div class="img_box">
</div>
<i class="icon"></i>
<p>上传投稿作品图片</p>
<input type="file" name="images[]" class="upload" id="id_photos2">
</div>
<div class="btn-item lf">
<div class="img_box">
</div>
<i class="icon"></i>
<p>上传投稿作品图片</p>
<input type="file" name="images[]" class="upload" id="id_photos3">
</div>
<div class="btn-item lf">
<div class="img_box">
</div>
<i class="icon"></i>
<p>上传投稿作品图片</p>
<input type="file" name="images[]" class="upload" id="id_photos4">
</div>
</div>
</div>
</div>
</div>
<div class="task-footer">
<a href="" class="t-link">活动详情></a>
<div class="row">
<div class="sub-container">
<input type="button" name="submit" value="确认提交">
</div>
</div>
</div>
</li>
</ul>
</form>
</div>
</div>
</div>
</div>
<tc_include file="Portal/Will:apply"/>
... ... @@ -102,6 +216,9 @@
<script src="__TMPL__Public/assets/js/jquery.min.js"></script>
<script src="__TMPL__Public/assets/js/common.js"></script>
<script src="__TMPL__Public/assets/js/modal.js"></script>
<script type="text/javascript" src="__TMPL__Public/assets/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="js/jquery.cityselect1.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ajaxfileupload.js"></script>
<script>
// $('#myModal').modal({
... ... @@ -112,10 +229,104 @@
$('#myModal').on('hidden.bs.modal', function () {
document.documentElement.style.overflow='auto';
})
$('#myModal1').on('shown.bs.modal', function (event) {
var button = $(event.relatedTarget);
var mid = button.parents('.pull-left').data('id')
$('input[name=mid]').val(mid);
document.documentElement.style.overflow='hidden';
})
$('#myModal1').on('hidden.bs.modal', function () {
$('input[name=mid]').val('');
document.documentElement.style.overflow='auto';
})
</script>
<!--城市-->
<script type="text/javascript">
$("#city").citySelect({nodata:"none",required:false});
</script>
<script>
// 附件上传
$('#att').on('change',function(){
var fileId = $(this).attr('id');
$.ajaxFileUpload({
url: "{:U('personalUploadAtt')}", //处理图片的脚本路径
type: 'post', //提交的方式
secureuri: false, //是否启用安全提交
fileElementId: fileId, //file控件ID
dataType: 'json', //服务器返回的数据类型
success: function (data) { //提交成功后自动执行的处理函数
if(data.status) {
$('#att_file').show();
$('#att_file').append('<a target="_blank" href="'+data.file+'">我上传的附件</a><input type="hidden" name="att" value="'+data.data+'"/>');
} else {
alert(data.msg);
}
},
error: function (data, status, e) { //提交失败自动执行的处理函数
alert(e);
}
})
});
// 图片上传
$('.upload').on('change',function(){
var imgHidden = $(this).parent();
var imgWarp = $(this).parent().find('.img_box');
var fileId = $(this).attr('id');
$.ajaxFileUpload({
url: "{:U('personalUpload')}", //处理图片的脚本路径
type: 'post', //提交的方式
secureuri: false, //是否启用安全提交
fileElementId: fileId, //file控件ID
dataType: 'json', //服务器返回的数据类型
success: function (data) { //提交成功后自动执行的处理函数
if(data.status) {
imgWarp.append('<img src="'+ data.file +'" height="100%" />');
imgHidden.append('<input type="hidden" name="images[]" value="'+data.data+'"/>');
} else {
alert(data.msg);
}
},
error: function (data, status, e) { //提交失败自动执行的处理函数
alert(e);
}
})
});
</script>
<script>
$('input[name=submit]').click(function(){
var btn = $(this);
var text = btn.val();
var form = $('#mission').serialize();
$.ajax({
url:"{:U('Will/submit_mission')}",
type:"POST",
data:form,
dateType:"json",
beforeSend: function () {
// Handle the beforeSend event
btn.val('提交中...').attr('disabled', true);
},
success:function (data) {
if(data.status) {
alert(data.msg);
location.reload();
} else {
alert(data.msg);
}
},
error: function (data, status, e) { //提交失败自动执行的处理函数
alert(e);
},
complete: function () {
// Handle the complete event
btn.val(text).attr('disabled', false);
}
})
})
$('#txt').keyup(function() {
var len=$(this).val().length;
$('#txt_num').html(len);
});
</script>
</body>
</html>
... ...