国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.5KB

  1. function SelectImage(sform, stype) {
  2. let s = sform.split(".");
  3. if (s.length === 2) {
  4. let frm = document.getElementsByName(s[0]);
  5. let ipt = document.getElementsByName(s[1]);
  6. let tmp = document.createElement("input");
  7. tmp.id = 'field'+s[1];
  8. tmp.type = "file";
  9. tmp.style.display = 'none';
  10. if ($(`#${tmp.id}`).length === 0) {
  11. $(frm).append(tmp);
  12. }
  13. $(`#${tmp.id}`).click();
  14. $(`#${tmp.id}`).off('change').change(function (val) {
  15. const f = val.target.files[0];
  16. var formData = new FormData();
  17. var fileData = f;
  18. formData.append('file', fileData);
  19. $.ajax({
  20. url: '../user/api.php?action=upload&type=litpic',
  21. type: 'POST',
  22. data: formData,
  23. processData: false,
  24. contentType: false,
  25. success: function (result) {
  26. if (result.code === 0) {
  27. $(ipt).val(result.data);
  28. } else {
  29. ShowMsg("文件上传失败,错误原因:"+result.error.message);
  30. }
  31. },
  32. error: function (xhr, status, error) {
  33. ShowMsg("文件上传失败");//处理上传失败后的回调
  34. }
  35. });
  36. })
  37. }
  38. }
  39. $(document).ready(function() {
  40. $('.datepicker').daterangepicker({
  41. "singleDatePicker": true,
  42. "autoApply": true,
  43. "showDropdowns": true,
  44. "linkedCalendars": false,
  45. "timePicker": true,
  46. "timePicker24Hour": true,
  47. //"timePickerSeconds": true,
  48. "showCustomRangeLabel": false,
  49. ranges: {
  50. '今日': [moment(), moment()],
  51. '昨日': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
  52. '本月': [moment().startOf('month'), moment().startOf('month')],
  53. '上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').startOf('month')]
  54. },
  55. "locale": {
  56. format: 'YYYY-MM-DD HH:mm',
  57. applyLabel: '确定',
  58. cancelLabel: '取消',
  59. daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
  60. monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  61. firstDay: 1
  62. }
  63. }, function (start) {
  64. $(this).val(start.format("YYYY-MM-DD HH:mm"));
  65. });
  66. });