作者 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('StoryApply/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('StoryApply/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('StoryApply/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 width="50">用户id</th>
<th width="50">投稿人姓名</th>
<th>所在省市</th>
<th>标题</th>
<th>邮箱</th>
<th width="100">提交时间</th>
<th>状态</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.title}</td>
<td>{$vo.email}</td>
<td>{:date('Y-m-d H:i',$vo['ctime'])}</td>
<td><eq name="vo.is_issue" value="0">未发布</eq><eq name="vo.is_issue" value="1">已发布</eq></td>
<td>
<a href="{:U('StoryApply/view',array('id'=>$vo['id']))}">查看</a> |
<eq name="vo.is_issue" value="0"><a href="{:U('StoryApply/send',array('id'=>$vo['id']))}">发布</a> |</eq>
<a href="{:U('StoryApply/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 width="50">提交时间</th>
<th>状态</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('StoryApply/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" />
<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('StoryApply/index')}">故事投稿列表</a></li>
<li class="active"><a target="_self">发布故事</a></li>
</ul>
<form action="{:U('StoryApply/add_post')}" 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="post[name]" id="name" value="{$name}" required placeholder="请输入标题"/>
<span class="form-required">*</span>
<input type="hidden" name="id" value="{$id}"/>
<input type="hidden" name="post[user_id]" value="{$user_id}"/>
</td>
</tr>
<tr>
<th>故事简介</th>
<td>
<textarea name="post[description]" placeholder="请输入故事简介">{$description}</textarea>
</td>
</tr>
<tr>
<th>详情</th>
<td>
<script type="text/plain" id="content" name="post[content]">{$description}</script>
</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="post[thumb]" id="thumb" value="{$images|default=''}">
<a href="javascript:upload_one_image('图片上传','#thumb');">
<if condition="empty($images)">
<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($images)}" 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('StoryApply/index')}">返回</a>
</div>
</form>
</div>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript">
//编辑器路径定义
var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.all.min.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 : {
'post[name]' : {
required : 1
}
},
//验证未通过提示消息
messages : {
'post[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() {
location = "{:U('StoryApply/index')}";
return true;
},
focus : 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><a href="{:U('StoryApply/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="100">用户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>{$title}</td>
</tr>
<tr>
<th>邮箱</th>
<td>{$email}</td>
</tr>
<tr>
<th>恋物故事描述</th>
<td>{$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('StoryApply/index')}">返回</a>
</div>
</form>
</div>
<script src="__PUBLIC__/js/common.js"></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('AdminProject/index')}">非遗项目列表</a></li>
<li class="active"><a target="_self">添加非遗项目</a></li>
</ul>
<form action="{:U('AdminProject/add_post')}" 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="post[name]" id="name" required placeholder="请输入标题"/>
<span class="form-required">*</span>
</td>
</tr>
<tr>
<th width="150">区域</th>
<td>
<textarea type="text" style="width:400px;" name="post[city]" id="city" required placeholder="请选择区域"></textarea>
<span class="form-required">*</span>
</td>
</tr>
<tr>
<th width="150">描述内容</th>
<td>
<textarea type="text" style="width:400px;" name="post[description]" id="description" required placeholder="请输入描述内容"></textarea>
<span class="form-required">*</span>
</td>
</tr>
<tr>
<th width="150">传承人名称</th>
<td>
<input type="text" style="width:400px;" name="post[sname]" id="sname" required placeholder="请输入传承人名称"/>
<span class="form-required">*</span>
</td>
</tr>
<tr>
<th width="150">传承人描述</th>
<td>
<textarea type="text" style="width:400px;" name="post[sdescription]" id="sdescription" required placeholder="请输入传承人描述"></textarea>
<span class="form-required">*</span>
</td>
</tr>
<tr>
<th width="150">关联资讯文章</th>
<td>
<volist name="consult" id="vo">
&nbsp;<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}">
&nbsp;{$vo.post_title}
</volist>
</td>
</tr>
<tr>
<th>详情</th>
<td>
<script type="text/plain" id="content" name="post[content]">{$post.content}</script>
</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="post[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>
<tr>
<th><b>传承人头像</b></th>
</tr>
<tr>
<td>
<div style="text-align: center;">
<input type="hidden" name="post[avatar]" id="avatar" value="{$post.avatar|default=''}">
<a href="javascript:upload_one_image('图片上传','#avatar');">
<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="avatar-preview" width="135" style="cursor: hand" />
</a>
<input type="button" class="btn btn-small" onclick="$('#avatar-preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');$('#avatar').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('AdminProject/index')}">返回</a>
</div>
</form>
</div>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript">
//编辑器路径定义
var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
$(function() {
$('.yes').on('click', function () {
$('.price').show();
})
$('.no').on('click', function () {
$('.price').hide();
})
$(".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 : {
'post[name]' : {
required : 1
}
},
//验证未通过提示消息
messages : {
'post[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('AdminProject/index')}";
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('AdminProject/index')}">非遗项目列表</a></li>
<li class="active"><a target="_self">编辑非遗项目</a></li>
</ul>
<form action="{:U('AdminProject/edit_post')}" 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="post[name]" id="name" value="{$post.name}" required placeholder="请输入名称"/>
<span class="form-required">*</span>
<input type="hidden" name="id" value="{$post.id}"/>
</td>
</tr>
<tr>
<th width="150">区域</th>
<td>
<textarea type="text" style="width:400px;" name="post[city]" id="city" required placeholder="请选择区域">{$post.city}</textarea>
<span class="form-required">*</span>
</td>
</tr>
<tr>
<th width="150">描述内容</th>
<td>
<textarea type="text" style="width:400px;" name="post[description]" id="description" required placeholder="请输入描述内容">{$post.description}</textarea>
<span class="form-required">*</span>
</td>
</tr>
<tr>
<th width="150">传承人名称</th>
<td>
<input type="text" style="width:400px;" name="post[sname]" id="sname" value="{$post.sname}" required placeholder="请输入传承人名称"/>
<span class="form-required">*</span>
</td>
</tr>
<tr>
<th width="150">传承人描述</th>
<td>
<textarea type="text" style="width:400px;" name="post[sdescription]" id="sdescription" required placeholder="请输入传承人描述">{$post.sdescription}</textarea>
<span class="form-required">*</span>
</td>
</tr>
<tr>
<th width="150">关联资讯文章</th>
<td>
<volist name="consult" id="vo">
<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}">
&nbsp;{$vo.post_title}
</volist>
<span class="form-required">*</span>
</td>
</tr>
<tr>
<th>详情</th>
<td>
<script type="text/plain" id="content" name="post[content]">{$post.content}</script>
</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="post[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>
<tr>
<th><b>传承人头像</b></th>
</tr>
<tr>
<td>
<div style="text-align: center;">
<input type="hidden" name="post[avatar]" id="avatar" value="{$post.avatar|default=''}">
<a href="javascript:upload_one_image('图片上传','#avatar');">
<if condition="empty($post['avatar'])">
<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="avatar-preview" width="135" style="cursor: hand" />
<else />
<img src="{:sp_get_image_preview_url($post['avatar'])}" id="avatar-preview" width="135" style="cursor: hand"/>
</if>
</a>
<input type="button" class="btn btn-small" onclick="$('#avatar-preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');$('#avatar').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('AdminProject/index')}">返回</a>
</div>
</form>
</div>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript">
//编辑器路径定义
var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
$(function() {
$('.yes').on('click', function () {
$('.price').show();
})
$('.no').on('click', function () {
$('.price').hide();
})
$(".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 : {
'post[name]' : {
required : 1
}
},
//验证未通过提示消息
messages : {
'post[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('AdminProject/index')}";
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('AdminProject/add')}" target="_self">添加非遗项目</a></li>
</ul>
<form class="well form-search" method="post" action="{:U('AdminProject/add')}">
时间:
<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('AdminProject/add')}">清空</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('AdminProject/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>名称</th>
<th>区域</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.city}</td>
<td>{$vo.description}</td>
<td>{$vo.sname}</td>
<td>
<notempty name="vo.thumb">
<a href="javascript:parent.image_preview_dialog('{:sp_get_image_preview_url($vo['thumb'])}');">
<img src="{:sp_get_image_preview_url($vo['thumb'])}" width="80"/>
</a>
</notempty>
</td>
<td>{:date('Y-m-d H:i',$vo['ctime'])}</td>
<td>
<a href="{:U('AdminProject/edit',array('id'=>$vo['id']))}">{:L('EDIT')}</a> |
<a href="{:U('AdminProject/delete',array('id'=>$vo['id']))}" 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>传承人名称</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('AdminProject/delete')}" 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('AdminProject/index',$formget)}";
}
}
setInterval(function() {
refersh_window();
}, 2000);
$(function() {
setCookie("refersh_time", 0);
});
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -23,6 +23,13 @@
</td>
</tr>
<tr>
<th width="150">描述内容</th>
<td>
<textarea type="text" style="width:400px;" name="post[description]" id="description" required placeholder="请输入描述内容"></textarea>
<span class="form-required">*</span>
</td>
</tr>
<tr>
<th>详情</th>
<td>
<script type="text/plain" id="content" name="post[content]">{$post.content}</script>
... ...
... ... @@ -24,6 +24,13 @@
</td>
</tr>
<tr>
<th width="150">描述内容</th>
<td>
<textarea type="text" style="width:400px;" name="post[description]" id="description" required placeholder="请输入描述内容">{$post.description}</textarea>
<span class="form-required">*</span>
</td>
</tr>
<tr>
<th>详情</th>
<td>
<script type="text/plain" id="content" name="post[content]">{$post.content}</script>
... ...
... ... @@ -25,6 +25,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>标题</th>
<th>描述</th>
<th>缩略图</th>
<th width="150">添加时间</th>
<!--<th width="50">{:L('STATUS')}</th>-->
... ... @@ -36,6 +37,7 @@
<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.description}</td>
<td>
<notempty name="vo.thumb">
<a href="javascript:parent.image_preview_dialog('{:sp_get_image_preview_url($vo['thumb'])}');">
... ... @@ -55,6 +57,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>标题</th>
<th>描述</th>
<th>缩略图</th>
<th width="150">添加时间</th>
<!--<th width="50">{:L('STATUS')}</th>-->
... ...
<?php
/**
* Created by PhpStorm.
* User: 29925
* Date: 2018/4/28
* Time: 11:26
*/
namespace Admin\Controller;
use Common\Controller\AdminbaseController;
class StoryApplyController extends AdminbaseController {
protected $story_apply_model;
protected $story_model;
function _initialize() {
parent::_initialize(); // TODO: Change the autogenerated stub
$this->story_apply_model = D('Common/StoryApply');
$this->story_model = D('Common/Story');
}
// 故事投稿提交列表
public function index() {
$this->assign('list', $this->story_apply_model->getList(I('get.p'), I('post.keyword'), strtotime(I('post.start_time')), strtotime(I('post.end_time'))));
$count = $this->story_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->story_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->story_apply_model->where(array('id'=>$id, 'is_del'=>0))->find();
$info['images'] = explode(',', $info['images'])[0];
$this->assign($info);
$this->display();
}
// 发布提交
public function add_post(){
if (IS_POST) {
$id = I('post.id',0,'intval');
$info = I('post.post');
$info['content'] = htmlspecialchars_decode($info['content']);
$info['ctime'] = time();
if(!$id) {
$this->error("参数错误");
}
if(!$this->story_model->create($info)) {
$this->error($this->story_model->getError());
}
$result = $this->story_model->add($info);
if ($result) {
$this->story_apply_model->where(array('id'=>$id))->save(array('is_issue'=>1));
$this->success("添加成功!");
} else {
$this->error("添加失败!");
}
}
}
// 删除
public function delete(){
if(I('get.id')){
$id = I("get.id",0,'intval');
if ($this->story_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->story_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/28
* Time: 11:54
*/
namespace Common\Model;
use Common\Model\CommonModel;
class ProjectModel extends CommonModel {
// 自动验证
protected $_validate = array(
//array(验证字段,验证规则,错误提示,验证条件,附加规则,验证时间)
array('name', 'require', '名称不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('description', 'require', '描述不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('city', 'require', '城市不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('thumb', 'require', '缩略图不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('sname', 'require', '传承人名称不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('avatar', 'require', '传承人头像不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('sdescription', 'require', '传承人描述不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('href_ids', 'require', '报道跳转资讯id不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('content', 'require', '详情不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
);
// 获取列表
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)
->page($page_num, $perPage)
->select();
}
// 获取任务投稿详情
public function getInfo($id) {
$where['is_del'] = 0;
$where['id'] = $id;
return $this->where($where)->find();
}
/**
* 获取数据总数
* @author Liuzhen
*/
public function getCount($keyword = null, $start_time = null, $end_time = null) {
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
... ...
... ... @@ -19,19 +19,27 @@ class StoryApplyModel extends CommonModel {
array('name', 'require', '昵称不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('email', 'require', '邮箱不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('email', 'email', '邮箱格式不正确', 1, 'regex', CommonModel::MODEL_BOTH),
array('province', 'require', '所在省不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('city', 'require', '所在城市不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('title', 'require', '标题不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('description', 'require', '描述不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('pictures', 'require', '图片不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('file', 'require', '附件不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('images', 'require', '图片不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('att', 'require', '附件不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
);
// 获取恋物故事投稿列表
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.'%');
}
return $this->where($where)->select();
if($start_time && $end_time) {
$where['ctime'] = array('between', array($start_time,$end_time));
}
return $this->where($where)
->page($page_num, $perPage)
->select();
}
// 获取恋物故事投稿详情
... ... @@ -40,4 +48,21 @@ class StoryApplyModel extends CommonModel {
$where['id'] = $id;
return $this->where($where)->find();
}
/**
* 获取数据总数
* @author Liuzhen
*/
public function getCount($keyword = null, $start_time = null, $end_time = null) {
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
... ...
... ... @@ -15,8 +15,9 @@ class StoryModel extends CommonModel {
// 自动验证
protected $_validate = array(
//array(验证字段,验证规则,错误提示,验证条件,附加规则,验证时间)
array('user_id', 'number', '用户ID不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
// array('user_id', 'number', '用户ID不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('name', 'require', '名称不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('description', 'require', '描述内容不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('thumb', 'require', '缩略图不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
array('content', 'require', '详细内容不能为空', 1, 'regex', CommonModel::MODEL_BOTH),
);
... ...
<?php
/**
* Created by PhpStorm.
* User: 29925
* Date: 2018/4/28
* Time: 12:00
*/
namespace Portal\Controller;
use Common\Controller\AdminbaseController;
class AdminProjectController extends AdminbaseController {
protected $project_model;
protected $posts_model;
function _initialize() {
parent::_initialize();
$this->consult();
$this->project_model = D("Common/Project");
$this->posts_model = D("Portal/Posts");
}
// 资讯所有文章列表
public function consult() {
$where['b.term_id'] = 2;
$consult = M('Posts')->field('a.*,b.listorder,b.tid')
->alias("a")
->join("__TERM_RELATIONSHIPS__ b ON a.id = b.object_id")
->where($where)
->select();
$this->assign('consult', $consult);
}
// 非遗项目列表
public function index(){
$this->_lists(array('is_del'=>0));
$this->display();
}
// 非遗项目添加
public function add(){
$this->display();
}
// 非遗项目添加提交
public function add_post(){
if (IS_POST) {
$info = I('post.post');
$info['href_ids'] = implode(',',$info['ids']);
$info['content'] = htmlspecialchars_decode($info['content']);
$info['ctime'] = time();
if(!$this->project_model->create($info)) {
$this->error($this->project_model->getError());
}
$result = $this->project_model->add($info);
if ($result) {
$this->success("添加成功!");
} else {
$this->error("添加失败!");
}
}
}
// 编辑
public function edit(){
$id = I("get.id",0,'intval');
$post = $this->project_model->where(array("id" => $id))->find();
$this->assign("post",$post);
$this->display();
}
// 编辑提交
public function edit_post(){
if (IS_POST) {
$id = I('post.id');
$info = I('post.post');
$info['content'] = htmlspecialchars_decode($info['content']);
$info['utime'] = time();
if ($this->project_model->create($info)!==false) {
if ($this->project_model->where(array('id'=>$id))->save($info)!==false) {
$this->success("修改成功!");
} else {
$this->error("修改失败!");
}
} else {
$this->error($this->story_model->getError());
}
}
}
/**
* 非遗项目列表处理方法,根据不同条件显示不同的列表
* @param array $where 查询条件
*/
private function _lists($where=array()){
$where['is_del'] = 0;
$this->project_model
->where($where);
$count = $this->project_model->count();
$page = $this->page($count, 20);
$posts = $this->project_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 delete(){
if(isset($_POST['ids'])){
$ids = array_map("intval", $_POST['ids']);
$data=array("dtime"=>time(),"is_del"=>1);
if ($this->project_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->project_model->where(array('id'=>$id))->save($data)) {
$this->success("删除成功!");
} else {
$this->error("删除失败!");
}
}
}
}
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: 29925
* Date: 2018/4/28
* Time: 9:55
*/
namespace Portal\Controller;
use Common\Controller\HomebaseController;
class StoryController extends HomebaseController {
protected $story_model;
protected $story_apply_model;
function _initialize() {
parent::_initialize();
$this->story_model = D("Common/Story");
$this->story_apply_model = D("Common/StoryApply");
}
// 物恋列表
public function index(){
$this->_lists(array('is_del'=>0));
$this->display();
}
// 物恋详情
public function detail(){
$id = I('get.id',0,'intval');
if(!$id) {
$this->error('参数错误');
}
$info = $this->story_model->getInfo($id);
$this->assign($info);
$this->display();
}
/**
* 物恋列表处理方法,根据不同条件显示不同的列表
* @param array $where 查询条件
*/
private function _lists($where=array()){
$where['is_del'] = 0;
$this->story_model
->where($where);
$count = $this->story_model->count();
$page = $this->page($count, 20);
$posts = $this->story_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);
}
/**
* 物恋投稿提交
* @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['images'] = implode(',',I('post.images'));
$post['ctime'] = $post['utime'] = time();
if(!$this->story_apply_model->create($post)) {
$this->ajaxReturn(array('status'=>false,'msg'=>$this->story_apply_model->getError(),'data'=>$post));
}
if(count(I('post.images'))<3 || count(I('post.images'))>9) {
$this->ajaxReturn(array('status'=>false,'msg'=>'图片数量不符'));
}
$story_id = $this->story_apply_model->add($post);
if(!$story_id) {
$this->ajaxReturn(array('status'=>false,'msg'=>'提交失败'));
}
$this->ajaxReturn(array('status'=>true,'msg'=>'提交成功'));
} else {
$this->error('非法操作');
}
}
//上传图片
public function personalUpload() {
if(IS_POST){
list($status, $info, $link, $attachmentId) = $this->uploadCommon('image', C('UPLOAD_MATERIAL_IMAGE_MAX_SIZE'), 'personal', false);
if ($status) {
echo json_encode(array('status' => true, 'data' => $info, 'file'=>sp_get_image_preview_url($info)));exit;
} else {
echo json_encode(array('status' => false, 'msg'=>$info));exit;
}
} else {
$this->error('非法操作');
}
}
//上传附件
public function personalUploadAtt() {
if(IS_POST){
list($status, $info, $link, $attachmentId) = $this->uploadCommon('file', C('UPLOAD_MAX_SIZE'), 'file', false);
if ($status) {
echo json_encode(array('status' => true, 'data' => $info, 'file'=>sp_get_image_preview_url($info)));exit;
} else {
echo json_encode(array('status' => false, 'msg'=>$info));exit;
}
} else {
$this->error('非法操作');
}
}
}
\ No newline at end of file
... ...
... ... @@ -44,25 +44,7 @@ class TrainController extends HomebaseController {
* @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%");
}
$where['is_del'] = 0;
$this->train_model
->where($where);
... ... @@ -76,7 +58,21 @@ class TrainController extends HomebaseController {
->limit($page->firstRow , $page->listRows)
->order("ctime DESC")
->select();
// 计算剩余报名人数及当前用户是否报名
$user_id = 1;
// $user_id = sp_get_current_userid();
// if(!$user_id) {
// $this->ajaxReturn(array('status'=>false,'msg'=>'用户未登录'));
// }
foreach($posts as $k=>$v) {
$posts[$k]['is_apply'] = 0;
$count = $this->train_apply_model->where(array('tid'=>$v['id']))->count();
$posts[$k]['surplus'] = $v['num'] - $count;
if($this->train_apply_model->where(array('user_id'=>$user_id))->count()) {
$posts[$k]['is_apply'] = 1;
}
}
$this->assign("page", $page->show('Admin'));
$this->assign("formget",array_merge($_GET,$_POST));
$this->assign("posts",$posts);
... ...
... ... @@ -4,6 +4,7 @@ return array (
'ADMIN_AD_ADD_POST' => '提交添加',
'ADMIN_AD_EDIT_POST' => '提交编辑',
'ADMIN_AD_TOGGLE' => '广告显示切换',
'ADMIN_ADMINPORJECT_INDEX' => '非遗项目',
'ADMIN_BACKUP_DEFAULT' => '备份管理',
'ADMIN_BACKUP_INDEX' => '数据备份',
'ADMIN_BACKUP_INDEX_POST' => '提交数据备份',
... ... @@ -79,7 +80,6 @@ return array (
'ADMIN_PORJECT_DEFAULT' => '非遗项目管理',
'ADMIN_PORJECT_DELETEPROJECT' => '删除',
'ADMIN_PORJECT_EDITPROJECT' => '编辑',
'ADMIN_PORJECT_PROJECT' => '非遗项目',
'ADMIN_RBAC_AUTHORIZE_POST' => '提交设置',
'ADMIN_RBAC_INDEX' => '角色管理',
'ADMIN_RBAC_ROLEADD_POST' => '提交添加',
... ...
... ... @@ -65,6 +65,10 @@ return array (
'PORTAL_ADMINPOST_TOP' => '文章置顶',
'PORTAL_ADMINPRODUCT_EDIT' => '编辑',
'PORTAL_ADMINPRODUCT_INDEX' => '商品分类',
'PORTAL_ADMINPROJECT_ADD' => '添加',
'PORTAL_ADMINPROJECT_DELETE' => '删除',
'PORTAL_ADMINPROJECT_EDIT' => '编辑',
'PORTAL_ADMINPROJECT_INDEX' => '非遗项目',
'PORTAL_ADMINRECRUIT_ADD' => '添加',
'PORTAL_ADMINRECRUIT_DELETE' => '删除',
'PORTAL_ADMINRECRUIT_EDIT' => '编辑',
... ...
<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="story">
<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="ipt-container lf">
<input type="text" name="email" 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>
</div>
<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="ipt-box lf">
<input type="text" name="title" placeholder="故事标题">
</div>
<div class="textarea-container lf">
<textarea id="txt" name="description" maxlength="3000" placeholder="恋物故事正文,300~3000字"></textarea>
<p>
<span id="txt_num">0</span>/3000字
</p>
</div>
<div class="pic-container">
<div class="pic-title">
<p>上传相关配图,3~9张,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 class="btn-item lf">
<div class="img_box"></div>
<i class="icon"></i>
<p>上传投稿作品图片</p>
<input type="file" name="images[]" class="upload" id="id_photos5">
</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_photos6">
</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_photos7">
</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_photos8">
</div>
</div>
</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
... ...
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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"/>
<tc_include file="Public:nav"/>
<div class="inbanner" style="background-image: url(__TMPL__Public/assets/images/banner/inbanner.jpg);">
<!--分类-->
<div class="catebox">
<div class="in-catebox">
<div class="in-cate-tit">白鹿物恋</div>
<ul class="in-cate-nav">
<li class="active"><a href="{:U('Story/index')}">恋物故事</a></li>
<li><a href="">白鹿优品</a></li>
</ul>
</div>
</div>
</div>
<div class="page-container">
<div class="single-container">
<div class="breadnav">
<div class="breadcrumb">您所在的位置:<a href="">首页</a> > <a href="">白鹿物恋</a> > 恋物故事</div>
</div>
<div class="gxwc-thumb">
<div class="g-thumb-pic">
<img src="{:sp_get_asset_upload_path($thumb)}"/>
</div>
<div class="g-thumb-grid">
<h1 class="art-title">{$name}</h1>
<div class="g-meta">
<div class="g-item g-canlder">
发布时间:<span>{:date('Y-m-d',$ctime)}</span>
</div>
</div>
</div>
</div>
<div class="content">
{$content}
</div>
</div>
</div>
<tc_include file="Public:footer"/>
<tc_include file="Portal/Story: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>
// $('#myModal').modal({
// })
$('#myModal').on('shown.bs.modal', function () {
document.documentElement.style.overflow='hidden';
})
$('#myModal').on('hidden.bs.modal', function () {
document.documentElement.style.overflow='auto';
})
</script>
<!--城市-->
<script type="text/javascript">
$("#city").citySelect({nodata:"none",required:false});
</script>
</body>
</html>
... ...
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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"/>
<tc_include file="Public:nav"/>
<div class="inbanner" style="background-image: url(__TMPL__Public/assets/images/banner/inbanner.jpg);">
<!--分类-->
<div class="catebox">
<div class="in-catebox">
<div class="in-cate-tit">白鹿物恋</div>
<ul class="in-cate-nav">
<li class="active"><a href="{:U('Story/index')}">恋物故事</a></li>
<li><a href="">白鹿优品</a></li>
</ul>
</div>
</div>
</div>
<div class="page-container">
<div class="main">
<div class="page-top-button">
<a href="#myModal" class="btn" data-toggle="modal">投稿</a>
</div>
<ul class="lw-history">
<volist name="posts" id="vo">
<li data-id="{$vo.id}">
<div class="lw-box-lt">
<div class="lw-header">
<div class="lw-avatar">
<img src="__TMPL__Public/assets/images/demo/avatar.jpg" alt="" /> <span>陈云心发表了文章·6天前</span>
</div>
<div class="lw-action">
<a href="{:U('detail',array('id'=>$vo['id']))}" class="lw-link">[ 阅读全文 ]</a>
<a href="javascript:;" class="btn-thumb"><span>25</span></a>
</div>
</div>
<div class="lw-title"><a href="{:U('detail',array('id'=>$vo['id']))}">{$vo.name}</a></div>
<div class="lw-desc">{$vo.description}</div>
</div>
<div class="lw-box-rt">
<a href="" class="scale">
<img src="{:sp_get_image_preview_url($vo['thumb'])}"/>
</a>
</div>
</li>
</volist>
</ul>
</div>
</div>
<tc_include file="Public:footer"/>
<tc_include file="Portal/Story: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 src="__TMPL__Public/assets/js/pop.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 type="text/javascript" src="__PUBLIC__/js/ajaxfileupload.js"></script>
<script>
// $('#myModal').modal({
// })
$('#myModal').on('shown.bs.modal', function () {
document.documentElement.style.overflow='hidden';
})
$('#myModal').on('hidden.bs.modal', function () {
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 = $('#story').serialize();
$.ajax({
url:"{:U('Story/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);
}
})
})
$('#txt').keyup(function() {
var len=$(this).val().length;
$('#txt_num').html(len);
});
</script>
</body>
</html>
... ...
... ... @@ -35,10 +35,15 @@
<div class="px-intro">
<div class="px-tit"><a href="{:U('detail',array('id'=>$vo['id']))}">{$vo.name}</a></div>
<div class="px-meta">
<span>还剩 <i class="px-num">3</i> 个名额</span>
<span>还剩 <i class="px-num">{$vo.surplus}</i> 个名额</span>
<span>活动收费:<i class="px-price">{$vo.price}</i></span>
</div>
<a href="#myModal" data-toggle="modal" 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>
... ...
... ... @@ -162,36 +162,31 @@
</div>
<div class="btn-list cf">
<div class="btn-item lf">
<div class="img_box">
</div>
<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>
<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>
<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>
<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>
<div class="img_box"></div>
<i class="icon"></i>
<p>上传投稿作品图片</p>
<input type="file" name="images[]" class="upload" id="id_photos4">
... ... @@ -217,7 +212,7 @@
<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="__TMPL__Public/assets/js/jquery.cityselect1.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ajaxfileupload.js"></script>
<script>
// $('#myModal').modal({
... ...