Merge branch 'master' of https://gitee.com/sentcms/sentcms
# Conflicts: # public/static/admin/js/module/form.js # public/static/common/js/require-xlsx.js
This commit is contained in:
@@ -6,6 +6,13 @@
|
|||||||
生产环境建议Linux+Nginx+php+mysql
|
生产环境建议Linux+Nginx+php+mysql
|
||||||
建议PHP7+
|
建议PHP7+
|
||||||
|
|
||||||
|
## 在线预览
|
||||||
|
|
||||||
|
demo: http://www.sentcms.com/
|
||||||
|
|
||||||
|
账号:admin
|
||||||
|
密码:admin888
|
||||||
|
|
||||||
## 安装
|
## 安装
|
||||||
|
|
||||||
为了保证系统的安全性,系统根目录移至public目录下,把程序和逻辑代码放到根目录以外。在配置网站时,把网站根目录指向web目录下,然后通过composer把所需的扩展类库更新,包括thinkphp框架同样通过composer进行更新。
|
为了保证系统的安全性,系统根目录移至public目录下,把程序和逻辑代码放到根目录以外。在配置网站时,把网站根目录指向web目录下,然后通过composer把所需的扩展类库更新,包括thinkphp框架同样通过composer进行更新。
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ class Form extends Base {
|
|||||||
* @author K先森 <77413254@qq.com>
|
* @author K先森 <77413254@qq.com>
|
||||||
*/
|
*/
|
||||||
public function status() {
|
public function status() {
|
||||||
$id = $this->getArrayParam('id');
|
$id = $this->request->param('form_id', 0);
|
||||||
$status = input('status', '0', 'trim,intval');
|
$status = input('status', '0', 'trim,intval');
|
||||||
|
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
@@ -284,7 +284,7 @@ class Form extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$map['id'] = array('IN', $id);
|
$map['id'] = array('IN', $id);
|
||||||
$result = db('form')->where($map)->setField('status', $status);
|
$result = FormM::where($map)->update(['status'=>$status]);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
return $this->success("设置成功!");
|
return $this->success("设置成功!");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Model extends \think\Model {
|
|||||||
'title' => ['name' => 'title', 'title' => '标题', 'type' => 'text', 'length' => 200, 'extra' => '', 'remark' => '标题', 'is_show' => 1, 'is_must' => 1, 'value' => ''],
|
'title' => ['name' => 'title', 'title' => '标题', 'type' => 'text', 'length' => 200, 'extra' => '', 'remark' => '标题', 'is_show' => 1, 'is_must' => 1, 'value' => ''],
|
||||||
'category_id' => ['name' => 'category_id', 'title' => '栏目', 'type' => 'bind', 'length' => 10, 'extra' => 'category:tree', 'remark' => '栏目', 'is_show' => 1, 'is_must' => 1, 'value' => '0'],
|
'category_id' => ['name' => 'category_id', 'title' => '栏目', 'type' => 'bind', 'length' => 10, 'extra' => 'category:tree', 'remark' => '栏目', 'is_show' => 1, 'is_must' => 1, 'value' => '0'],
|
||||||
'uid' => ['name' => 'uid', 'title' => '用户UID', 'type' => 'num', 'length' => 11, 'extra' => '', 'remark' => '用户UID', 'is_show' => 0, 'is_must' => 1, 'value' => '0'],
|
'uid' => ['name' => 'uid', 'title' => '用户UID', 'type' => 'num', 'length' => 11, 'extra' => '', 'remark' => '用户UID', 'is_show' => 0, 'is_must' => 1, 'value' => '0'],
|
||||||
'cover_id' => ['name' => 'cover_id', 'title' => '内容封面', 'type' => 'image', 'length' => 10, 'extra' => '', 'remark' => '内容封面', 'is_show' => 1, 'is_must' => 0, 'value' => ''],
|
'cover_id' => ['name' => 'cover_id', 'title' => '内容封面', 'type' => 'image', 'length' => 10, 'extra' => '', 'remark' => '内容封面', 'is_show' => 1, 'is_must' => 0, 'value' => '0'],
|
||||||
'description' => ['name' => 'description', 'title' => '内容描述', 'type' => 'textarea', 'length' => '', 'extra' => '', 'remark' => '内容描述', 'is_show' => 1, 'is_must' => 0, 'value' => ''],
|
'description' => ['name' => 'description', 'title' => '内容描述', 'type' => 'textarea', 'length' => '', 'extra' => '', 'remark' => '内容描述', 'is_show' => 1, 'is_must' => 0, 'value' => ''],
|
||||||
'content' => ['name' => 'content', 'title' => '内容', 'type' => 'editor', 'length' => '', 'extra' => '', 'remark' => '内容', 'is_show' => 1, 'is_must' => 0, 'value' => ''],
|
'content' => ['name' => 'content', 'title' => '内容', 'type' => 'editor', 'length' => '', 'extra' => '', 'remark' => '内容', 'is_show' => 1, 'is_must' => 0, 'value' => ''],
|
||||||
'status' => ['name' => 'status', 'title' => '数据状态', 'type' => 'select', 'length' => 2, 'extra' => "-1:删除\r\n0:禁用\r\n1:正常\r\n2:待审核\r\n3:草稿", 'remark' => '数据状态', 'is_show' => 1, 'is_must' => 1, 'value' => '1'],
|
'status' => ['name' => 'status', 'title' => '数据状态', 'type' => 'select', 'length' => 2, 'extra' => "-1:删除\r\n0:禁用\r\n1:正常\r\n2:待审核\r\n3:草稿", 'remark' => '数据状态', 'is_show' => 1, 'is_must' => 1, 'value' => '1'],
|
||||||
|
|||||||
@@ -676,11 +676,11 @@ function show_msg($msg, $class = 'primary'){
|
|||||||
ob_flush();
|
ob_flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
function session($name, $value = false){
|
function session($name, $value = ''){
|
||||||
if ($name == '') {
|
if ($name == '') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (false !== $value) {
|
if ('' !== $value) {
|
||||||
$_SESSION[$name] = $value;
|
$_SESSION[$name] = $value;
|
||||||
}else{
|
}else{
|
||||||
return isset($_SESSION[$name]) ? $_SESSION[$name] : false;
|
return isset($_SESSION[$name]) ? $_SESSION[$name] : false;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ require.config({
|
|||||||
paths: {
|
paths: {
|
||||||
'sent': ['common/js/sent'],
|
'sent': ['common/js/sent'],
|
||||||
'form': ['common/js/require-form'],
|
'form': ['common/js/require-form'],
|
||||||
'xlsx': ['common/js/require-xlsx'],
|
'xlsxs': ['common/js/require-xlsx'],
|
||||||
'upload': 'common/js/require-upload',
|
'upload': 'common/js/require-upload',
|
||||||
'validator': 'common/js/require-validator',
|
'validator': 'common/js/require-validator',
|
||||||
'message': ['plugins/messager/messager'],
|
'message': ['plugins/messager/messager'],
|
||||||
@@ -70,7 +70,7 @@ require.config({
|
|||||||
|
|
||||||
// nanoscroller
|
// nanoscroller
|
||||||
'slimscroll': 'plugins/jquery-slimscroll/jquery.slimscroll',
|
'slimscroll': 'plugins/jquery-slimscroll/jquery.slimscroll',
|
||||||
'sheetjs': ['plugins/sheetjs/xlsx.full.min']
|
'xlsx': ['plugins/sheetjs/xlsx.full.min']
|
||||||
},
|
},
|
||||||
shim: {
|
shim: {
|
||||||
'message': {deps: ['jquery', 'css!'+'plugins/messager/css/style.css']},
|
'message': {deps: ['jquery', 'css!'+'plugins/messager/css/style.css']},
|
||||||
|
|||||||
@@ -1,15 +1,43 @@
|
|||||||
define(['jquery', 'sent', 'form', 'xlsx', 'sheetjs'], function($, sent, form, xlsx, xlsx2){
|
define(['jquery', 'sent', 'form', 'xlsxs'], function($, sent, form, xlsxs){
|
||||||
|
|
||||||
|
var outList = [];
|
||||||
|
|
||||||
var formModule = {
|
var formModule = {
|
||||||
lists: function(){
|
lists: function(){
|
||||||
console.log('xlsx2')
|
|
||||||
if($('.btn-out').size() > 0){
|
if($('.btn-out').size() > 0){
|
||||||
$('.btn-out').click(function(e){
|
$('.btn-out').click(function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var url = $(this).attr('href');
|
var url = $(this).attr('href');
|
||||||
console.log(xlsx)
|
formModule.outXlsx(url)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
outXlsx: function (url, page = 1){
|
||||||
|
var data = $('form').serialize();
|
||||||
|
var pagesize = $('select.pagesize').val() || 30;
|
||||||
|
data = data + '&out=1&pagesize='+pagesize+'&page='+page
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
data: data,
|
||||||
|
type: 'get',
|
||||||
|
beforeSend: function(){
|
||||||
|
sent.msg('正在导出第'+page+'页,请耐心等待,不要关闭浏览器');
|
||||||
|
},
|
||||||
|
error: function(){
|
||||||
|
sent.msg('导出失败!');
|
||||||
|
},
|
||||||
|
success:function(res){
|
||||||
|
outList = outList.concat(res.data);
|
||||||
|
if (res.last_page > page) {
|
||||||
|
formModule.outXlsx(url, page+1)
|
||||||
|
}else{
|
||||||
|
xlsxs.downloadExl(outList,res.file_name);
|
||||||
|
sent.msg('导出完成!');
|
||||||
|
setTimeout(function(){}, 3000);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dataType: 'json'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
define(['jquery', 'sheetjs'], function($, XLSX) {
|
define(['jquery', 'xlsx'], function($, xlsx) {
|
||||||
|
|
||||||
// var wopts = { bookType: 'csv', bookSST: false, type: 'binary' };//ods格式
|
// var wopts = { bookType: 'csv', bookSST: false, type: 'binary' };//ods格式
|
||||||
var wopts = { bookType: 'xlsx', bookSST: false, type: 'binary' };//这里的数据是用来定义导出的格式类型
|
var wopts = { bookType: 'xlsx', bookSST: false, type: 'binary' };//这里的数据是用来定义导出的格式类型
|
||||||
// var wopts = { bookType: 'ods', bookSST: false, type: 'binary' };//ods格式
|
// var wopts = { bookType: 'ods', bookSST: false, type: 'binary' };//ods格式
|
||||||
@@ -10,8 +9,8 @@ define(['jquery', 'sheetjs'], function($, XLSX) {
|
|||||||
var xls = {
|
var xls = {
|
||||||
downloadExl: function (data, fileName) {
|
downloadExl: function (data, fileName) {
|
||||||
var wb = { SheetNames: ['Sheet1'], Sheets: {}, Props: {} };
|
var wb = { SheetNames: ['Sheet1'], Sheets: {}, Props: {} };
|
||||||
wb.Sheets['Sheet1'] = sheetjs.utils.json_to_sheet(data);//通过json_to_sheet转成单页(Sheet)数据
|
wb.Sheets['Sheet1'] = xlsx.utils.json_to_sheet(data);//通过json_to_sheet转成单页(Sheet)数据
|
||||||
this.saveAs(new Blob([this.s2ab(sheetjs.write(wb, wopts))], { type: "application/octet-stream" }), fileName + '.' + (wopts.bookType=="biff2"?"xls":wopts.bookType));
|
this.saveAs(new Blob([this.s2ab(xlsx.write(wb, wopts))], { type: "application/octet-stream" }), fileName + '.' + (wopts.bookType=="biff2"?"xls":wopts.bookType));
|
||||||
},
|
},
|
||||||
|
|
||||||
//如果使用 FileSaver.js 就不要同时使用以下函数
|
//如果使用 FileSaver.js 就不要同时使用以下函数
|
||||||
@@ -40,7 +39,7 @@ define(['jquery', 'sheetjs'], function($, XLSX) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
console.log(XLSX);
|
|
||||||
window.xls = xls;
|
window.xls = xls;
|
||||||
return xls;
|
return xls;
|
||||||
});
|
});
|
||||||
0
runtime/sql/install.sql
Normal file → Executable file
0
runtime/sql/install.sql
Normal file → Executable file
@@ -51,7 +51,11 @@
|
|||||||
<a href="{:url('/admin/model/status', ['id'=>$item['id'], 'status'=>abs(1-$item['status'])])}" class="ajax-get">{$item['status'] ? '禁用' : '启用'}</a>
|
<a href="{:url('/admin/model/status', ['id'=>$item['id'], 'status'=>abs(1-$item['status'])])}" class="ajax-get">{$item['status'] ? '禁用' : '启用'}</a>
|
||||||
<a href="{:url('/admin/model/edit', ['id'=>$item['id']])}">编辑</a>
|
<a href="{:url('/admin/model/edit', ['id'=>$item['id']])}">编辑</a>
|
||||||
<a href="{:url('/admin/model/del', ['id'=>$item['id']])}" class="confirm ajax-get">删除</a>
|
<a href="{:url('/admin/model/del', ['id'=>$item['id']])}" class="confirm ajax-get">删除</a>
|
||||||
<a href="{:url('/admin/content/index?model_id='.$item['id'])}">数据</a>
|
{if $item['status']}
|
||||||
|
<a href="{:url('/admin/'.$item['name'].'/index')}">数据</a>
|
||||||
|
{else}
|
||||||
|
<a href="javascript:alert('请先启用该模型');">数据</a>
|
||||||
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/volist}
|
{/volist}
|
||||||
|
|||||||
@@ -68,9 +68,9 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{:url('/admin/user/edit', ['id'=>$item['uid']])}" class="table-link" title="">编辑</a>
|
<a href="{:url('/admin/user/edit', ['uid'=>$item['uid']])}" class="table-link" title="">编辑</a>
|
||||||
<a href="{:url('/admin/user/auth', ['id'=>$item['uid']])}" class="table-link">授权</a>
|
<a href="{:url('/admin/user/auth', ['uid'=>$item['uid']])}" class="table-link">授权</a>
|
||||||
<a href="{:url('/admin/user/del', ['id'=>$item['uid']])}" class="table-link confirm ajax-get">删除</a>
|
<a href="{:url('/admin/user/del', ['uid'=>$item['uid']])}" class="table-link confirm ajax-get">删除</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/volist}
|
{/volist}
|
||||||
|
|||||||
Reference in New Issue
Block a user