Browse Source

自定义表单时间选择框优化

tags/6.2.7
tianya 1 year ago
parent
commit
7a73340625
5 changed files with 35 additions and 4 deletions
  1. +1
    -1
      src/apps/diy.php
  2. +29
    -1
      src/static/web/js/diy.js
  3. +1
    -1
      src/system/common.inc.php
  4. +1
    -1
      src/system/customfields.func.php
  5. +3
    -0
      src/theme/apps/post_diyform.htm

+ 1
- 1
src/apps/diy.php View File

@@ -74,7 +74,7 @@ if ($action == 'post') {
$goto = !empty($cfg_cmspath) ? $cfg_cmspath : '/';
$bkmsg = '发布成功,请等待管理员处理';
//提交后返回提交页面
echo"<script>alert('提交成功');history.go(-1)</script>";
ShowMsg('提交成功', '-1');
exit;
}
ShowMsg($bkmsg, $goto);


+ 29
- 1
src/static/web/js/diy.js View File

@@ -35,4 +35,32 @@ function SelectImage(sform, stype) {
});
})
}
}
}
$(document).ready(function () {
$('.datepicker').daterangepicker({
"singleDatePicker": true,
"autoApply": true,
"showDropdowns": true,
"linkedCalendars": false,
"timePicker": true,
"timePicker24Hour": true,
//"timePickerSeconds": true,
"showCustomRangeLabel": false,
ranges: {
'今日': [moment(), moment()],
'昨日': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'本月': [moment().startOf('month'), moment().startOf('month')],
'上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').startOf('month')]
},
"locale": {
format: 'YYYY-MM-DD HH:mm',
applyLabel: '确定',
cancelLabel: '取消',
daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
firstDay: 1
}
}, function (start) {
$(this).val(start.format("YYYY-MM-DD HH:mm"));
});
})

+ 1
- 1
src/system/common.inc.php View File

@@ -7,7 +7,7 @@
* @link https://www.dedebiz.com
*/
//系统默认运行模式为安全模式,模板管理、标签管理、数据库管理、模块管理等功能已暂停,如果您需要这些功能,DEDEBIZ_SAFE_MODE后面值`TRUE`改为`FALSE`恢复使用
define('DEDEBIZ_SAFE_MODE', FALSE);
define('DEDEBIZ_SAFE_MODE', TRUE);
//生产环境使用`production`,如果采用`dev`模式,会有一些php的报错信息提示,用于开发调试
if (!defined('DEDE_ENVIRONMENT')) {
define('DEDE_ENVIRONMENT', 'production');


+ 1
- 1
src/system/customfields.func.php View File

@@ -102,7 +102,7 @@ function GetFormItem($ctag, $admintype = 'admin')
$innertext = "<textarea name='$fieldname' id='$fieldname' class='form-control admin-textarea-sm'></textarea>";
} else if ($fieldType == "datetime") {
$nowtime = GetDateTimeMk(time());
$innertext = "<input type='text' name='$fieldname' value='$nowtime' id='$fieldname' class='form-control admin-input-lg'>";
$innertext = "<input type='text' name='$fieldname' value='$nowtime' id='$fieldname' class='form-control admin-input-lg datepicker'>";
} else if ($fieldType == 'img') {
$fname = defined('DEDEADMIN')? 'form1' : 'addcontent';
$innertext = "<input type='text' name='$fieldname' id='$fieldname' class='form-control admin-input-lg' placeholder='请选择图片上传或填写图片地址'> <input type='button' name='".$fieldname."_bt' class='btn btn-success btn-sm' value='选择' onClick=\"SelectImage('$fname.$fieldname','big')\">";


+ 3
- 0
src/theme/apps/post_diyform.htm View File

@@ -6,8 +6,11 @@
<title><?php echo $diy->name;?>-<?php echo $cfg_webname;?></title>
<link rel="stylesheet" href="<?php echo $cfg_cmsurl;?>/static/web/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo $cfg_cmsurl;?>/static/web/font/css/font-awesome.min.css">
<link rel="stylesheet" href="<?php echo $cfg_cmsurl;?>/static/web/css/daterangepicker.css">
<link rel="stylesheet" href="<?php echo $cfg_cmsurl;?>/static/web/css/style.css">
<script src="<?php echo $cfg_cmsurl;?>/static/web/js/jquery.min.js"></script>
<script src="<?php echo $cfg_cmsurl;?>/static/web/js/moment.min.js"></script>
<script src="<?php echo $cfg_cmsurl;?>/static/web/js/daterangepicker.js"></script>
<script src="<?php echo $cfg_cmsurl;?>/static/web/js/diy.js"></script>
</head>
<body>


Loading…
Cancel
Save