eoss-ui 0.6.34 → 0.6.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/lib/button-group.js +36 -19
  2. package/lib/button.js +36 -19
  3. package/lib/checkbox-group.js +36 -19
  4. package/lib/data-table-form.js +36 -19
  5. package/lib/data-table.js +36 -19
  6. package/lib/date-picker.js +36 -19
  7. package/lib/dialog.js +36 -19
  8. package/lib/eoss-ui.common.js +71 -41
  9. package/lib/flow-group.js +36 -19
  10. package/lib/flow-list.js +36 -19
  11. package/lib/flow.js +36 -19
  12. package/lib/form.js +36 -19
  13. package/lib/handle-user.js +36 -19
  14. package/lib/handler.js +36 -19
  15. package/lib/icon.js +36 -19
  16. package/lib/icons.js +1 -1
  17. package/lib/index.js +1 -1
  18. package/lib/input-number.js +36 -19
  19. package/lib/input.js +36 -19
  20. package/lib/login.js +39 -22
  21. package/lib/main.js +61 -31
  22. package/lib/nav.js +36 -19
  23. package/lib/page.js +36 -19
  24. package/lib/pagination.js +36 -19
  25. package/lib/player.js +36 -19
  26. package/lib/qr-code.js +36 -19
  27. package/lib/radio-group.js +36 -19
  28. package/lib/retrial-auth.js +36 -19
  29. package/lib/select-ganged.js +36 -19
  30. package/lib/select.js +36 -19
  31. package/lib/selector-panel.js +36 -19
  32. package/lib/selector.js +36 -19
  33. package/lib/sizer.js +36 -19
  34. package/lib/steps.js +36 -19
  35. package/lib/switch.js +36 -19
  36. package/lib/table-form.js +36 -19
  37. package/lib/tabs.js +36 -19
  38. package/lib/theme-chalk/base.css +1 -1
  39. package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
  40. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  41. package/lib/theme-chalk/icon.css +1 -1
  42. package/lib/theme-chalk/index.css +1 -1
  43. package/lib/theme-chalk/main.css +1 -1
  44. package/lib/theme-chalk/menu.css +1 -1
  45. package/lib/theme-chalk/simplicity.css +1 -1
  46. package/lib/theme-chalk/sizer.css +1 -1
  47. package/lib/theme-chalk/upload.css +1 -1
  48. package/lib/tips.js +36 -19
  49. package/lib/tree-group.js +36 -19
  50. package/lib/tree.js +36 -19
  51. package/lib/upload.js +36 -19
  52. package/lib/utils/util.js +36 -19
  53. package/lib/wujie.js +36 -19
  54. package/lib/wxlogin.js +36 -19
  55. package/package.json +1 -1
  56. package/packages/.DS_Store +0 -0
  57. package/packages/data-table/.DS_Store +0 -0
  58. package/packages/icons/.DS_Store +0 -0
  59. package/packages/icons/src/icon.json +1 -1
  60. package/packages/login/src/main.vue +1 -1
  61. package/packages/main/.DS_Store +0 -0
  62. package/packages/main/src/simplicity/index.vue +19 -8
  63. package/packages/theme-chalk/lib/base.css +1 -1
  64. package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
  65. package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
  66. package/packages/theme-chalk/lib/icon.css +1 -1
  67. package/packages/theme-chalk/lib/index.css +1 -1
  68. package/packages/theme-chalk/lib/main.css +1 -1
  69. package/packages/theme-chalk/lib/menu.css +1 -1
  70. package/packages/theme-chalk/lib/simplicity.css +1 -1
  71. package/packages/theme-chalk/lib/sizer.css +1 -1
  72. package/packages/theme-chalk/lib/upload.css +1 -1
  73. package/packages/theme-chalk/src/.DS_Store +0 -0
  74. package/packages/theme-chalk/src/common/var.scss +2 -2
  75. package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
  76. package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
  77. package/packages/theme-chalk/src/handler.scss +1 -1
  78. package/packages/theme-chalk/src/icon.scss +7 -0
  79. package/packages/theme-chalk/src/login.scss +1 -1
  80. package/packages/theme-chalk/src/retrial-auth.scss +1 -1
  81. package/src/.DS_Store +0 -0
  82. package/src/index.js +1 -1
  83. package/src/utils/util.js +34 -22
package/lib/tips.js CHANGED
@@ -103,6 +103,10 @@ module.exports =
103
103
  /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(eoss_element__WEBPACK_IMPORTED_MODULE_5__);
104
104
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
105
105
 
106
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
107
+
108
+ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
109
+
106
110
  /**
107
111
  * 新封装公告方法规范:
108
112
  * 1.方法顺序按字母顺序排列
@@ -187,7 +191,8 @@ var ajax = function ajax(_ref) {
187
191
  publicKey = _ref.publicKey,
188
192
  secret = _ref.secret,
189
193
  encodes = _ref.encodes,
190
- oldmode = _ref.oldmode;
194
+ oldmode = _ref.oldmode,
195
+ configs = _objectWithoutProperties(_ref, ['headers', 'method', 'url', 'host', 'data', 'params', 'format', 'mix', 'defaults', 'loading', 'publicKey', 'secret', 'encodes', 'oldmode']);
191
196
 
192
197
  var header = headers || {};
193
198
  if (!method) {
@@ -491,13 +496,13 @@ var ajax = function ajax(_ref) {
491
496
  if (oldmode && !header['api-response-mode']) {
492
497
  header['api-response-mode'] = true;
493
498
  }
494
- return http({
499
+ return http(_extends({
495
500
  method: method,
496
501
  url: url,
497
502
  data: data,
498
503
  params: params,
499
504
  headers: header
500
- });
505
+ }, configs));
501
506
  };
502
507
 
503
508
  /**
@@ -1205,31 +1210,43 @@ var extend = function extend() {
1205
1210
  * @param {String} [fmt] - 格式
1206
1211
  **/
1207
1212
  var formatDate = function formatDate(date, fmt) {
1208
- var obj = void 0;
1209
- if (date) {
1210
- obj = new Date(date);
1211
- } else {
1212
- obj = new Date();
1213
- }
1213
+ // 1. 处理日期输入
1214
+ var obj = date ? new Date(date) : new Date();
1215
+ if (isNaN(obj.getTime())) throw new Error('Invalid date input');
1216
+
1217
+ // 2. 工具函数
1218
+ var pad = function pad(n) {
1219
+ return String(n).padStart(2, '0');
1220
+ };
1221
+ var monthNum = obj.getMonth(); // 数值月份 (0-11)
1222
+
1223
+ // 3. 定义格式化规则
1214
1224
  var quarter = ['一', '二', '三', '四'];
1225
+ var halfyear = ['上', '下'];
1215
1226
  var o = {
1216
- 'b+': Math.ceil((obj.getMonth() + 1) / 6), // 半年
1217
- 'M+': obj.getMonth() + 1, // 月份
1218
- 'd+': obj.getDate(), // 日
1219
- 'H+': obj.getHours(), // 小时
1220
- 'm+': obj.getMinutes(), //
1221
- 's+': obj.getSeconds(), // 秒
1222
- 'q+': quarter[Math.ceil((obj.getMonth() + 1) / 3) - 1], // 季度
1223
- S: obj.getMilliseconds() // 毫秒
1227
+ 'b+': halfyear[Math.floor(monthNum / 6)], // 1=上半年, 2=下半年
1228
+ 'M+': monthNum + 1, // 月份 (1-12)
1229
+ 'd+': obj.getDate(), // 日 (1-31)
1230
+ 'H+': obj.getHours(), // 小时 (0-23)
1231
+ 'm+': obj.getMinutes(), // 分钟 (0-59)
1232
+ 's+': obj.getSeconds(), // 秒 (0-59)
1233
+ 'q+': quarter[Math.floor(monthNum / 3)], // 季度 (一~四)
1234
+ 'S': obj.getMilliseconds() // 毫秒 (0-999)
1224
1235
  };
1236
+
1237
+ // 4. 处理年份
1225
1238
  if (/(y+)/.test(fmt)) {
1226
- fmt = fmt.replace(RegExp.$1, (obj.getFullYear() + '').substr(4 - RegExp.$1.length));
1239
+ fmt = fmt.replace(RegExp.$1, String(obj.getFullYear()).slice(-RegExp.$1.length));
1227
1240
  }
1241
+
1242
+ // 5. 处理其他字段
1228
1243
  for (var k in o) {
1229
1244
  if (new RegExp('(' + k + ')').test(fmt)) {
1230
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
1245
+ var val = k === 'q+' ? o[k] : pad(o[k]); // 季度不补零
1246
+ fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : val);
1231
1247
  }
1232
1248
  }
1249
+
1233
1250
  return fmt;
1234
1251
  };
1235
1252
 
package/lib/tree-group.js CHANGED
@@ -103,6 +103,10 @@ module.exports =
103
103
  /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(eoss_element__WEBPACK_IMPORTED_MODULE_5__);
104
104
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
105
105
 
106
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
107
+
108
+ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
109
+
106
110
  /**
107
111
  * 新封装公告方法规范:
108
112
  * 1.方法顺序按字母顺序排列
@@ -187,7 +191,8 @@ var ajax = function ajax(_ref) {
187
191
  publicKey = _ref.publicKey,
188
192
  secret = _ref.secret,
189
193
  encodes = _ref.encodes,
190
- oldmode = _ref.oldmode;
194
+ oldmode = _ref.oldmode,
195
+ configs = _objectWithoutProperties(_ref, ['headers', 'method', 'url', 'host', 'data', 'params', 'format', 'mix', 'defaults', 'loading', 'publicKey', 'secret', 'encodes', 'oldmode']);
191
196
 
192
197
  var header = headers || {};
193
198
  if (!method) {
@@ -491,13 +496,13 @@ var ajax = function ajax(_ref) {
491
496
  if (oldmode && !header['api-response-mode']) {
492
497
  header['api-response-mode'] = true;
493
498
  }
494
- return http({
499
+ return http(_extends({
495
500
  method: method,
496
501
  url: url,
497
502
  data: data,
498
503
  params: params,
499
504
  headers: header
500
- });
505
+ }, configs));
501
506
  };
502
507
 
503
508
  /**
@@ -1205,31 +1210,43 @@ var extend = function extend() {
1205
1210
  * @param {String} [fmt] - 格式
1206
1211
  **/
1207
1212
  var formatDate = function formatDate(date, fmt) {
1208
- var obj = void 0;
1209
- if (date) {
1210
- obj = new Date(date);
1211
- } else {
1212
- obj = new Date();
1213
- }
1213
+ // 1. 处理日期输入
1214
+ var obj = date ? new Date(date) : new Date();
1215
+ if (isNaN(obj.getTime())) throw new Error('Invalid date input');
1216
+
1217
+ // 2. 工具函数
1218
+ var pad = function pad(n) {
1219
+ return String(n).padStart(2, '0');
1220
+ };
1221
+ var monthNum = obj.getMonth(); // 数值月份 (0-11)
1222
+
1223
+ // 3. 定义格式化规则
1214
1224
  var quarter = ['一', '二', '三', '四'];
1225
+ var halfyear = ['上', '下'];
1215
1226
  var o = {
1216
- 'b+': Math.ceil((obj.getMonth() + 1) / 6), // 半年
1217
- 'M+': obj.getMonth() + 1, // 月份
1218
- 'd+': obj.getDate(), // 日
1219
- 'H+': obj.getHours(), // 小时
1220
- 'm+': obj.getMinutes(), //
1221
- 's+': obj.getSeconds(), // 秒
1222
- 'q+': quarter[Math.ceil((obj.getMonth() + 1) / 3) - 1], // 季度
1223
- S: obj.getMilliseconds() // 毫秒
1227
+ 'b+': halfyear[Math.floor(monthNum / 6)], // 1=上半年, 2=下半年
1228
+ 'M+': monthNum + 1, // 月份 (1-12)
1229
+ 'd+': obj.getDate(), // 日 (1-31)
1230
+ 'H+': obj.getHours(), // 小时 (0-23)
1231
+ 'm+': obj.getMinutes(), // 分钟 (0-59)
1232
+ 's+': obj.getSeconds(), // 秒 (0-59)
1233
+ 'q+': quarter[Math.floor(monthNum / 3)], // 季度 (一~四)
1234
+ 'S': obj.getMilliseconds() // 毫秒 (0-999)
1224
1235
  };
1236
+
1237
+ // 4. 处理年份
1225
1238
  if (/(y+)/.test(fmt)) {
1226
- fmt = fmt.replace(RegExp.$1, (obj.getFullYear() + '').substr(4 - RegExp.$1.length));
1239
+ fmt = fmt.replace(RegExp.$1, String(obj.getFullYear()).slice(-RegExp.$1.length));
1227
1240
  }
1241
+
1242
+ // 5. 处理其他字段
1228
1243
  for (var k in o) {
1229
1244
  if (new RegExp('(' + k + ')').test(fmt)) {
1230
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
1245
+ var val = k === 'q+' ? o[k] : pad(o[k]); // 季度不补零
1246
+ fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : val);
1231
1247
  }
1232
1248
  }
1249
+
1233
1250
  return fmt;
1234
1251
  };
1235
1252
 
package/lib/tree.js CHANGED
@@ -103,6 +103,10 @@ module.exports =
103
103
  /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(eoss_element__WEBPACK_IMPORTED_MODULE_5__);
104
104
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
105
105
 
106
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
107
+
108
+ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
109
+
106
110
  /**
107
111
  * 新封装公告方法规范:
108
112
  * 1.方法顺序按字母顺序排列
@@ -187,7 +191,8 @@ var ajax = function ajax(_ref) {
187
191
  publicKey = _ref.publicKey,
188
192
  secret = _ref.secret,
189
193
  encodes = _ref.encodes,
190
- oldmode = _ref.oldmode;
194
+ oldmode = _ref.oldmode,
195
+ configs = _objectWithoutProperties(_ref, ['headers', 'method', 'url', 'host', 'data', 'params', 'format', 'mix', 'defaults', 'loading', 'publicKey', 'secret', 'encodes', 'oldmode']);
191
196
 
192
197
  var header = headers || {};
193
198
  if (!method) {
@@ -491,13 +496,13 @@ var ajax = function ajax(_ref) {
491
496
  if (oldmode && !header['api-response-mode']) {
492
497
  header['api-response-mode'] = true;
493
498
  }
494
- return http({
499
+ return http(_extends({
495
500
  method: method,
496
501
  url: url,
497
502
  data: data,
498
503
  params: params,
499
504
  headers: header
500
- });
505
+ }, configs));
501
506
  };
502
507
 
503
508
  /**
@@ -1205,31 +1210,43 @@ var extend = function extend() {
1205
1210
  * @param {String} [fmt] - 格式
1206
1211
  **/
1207
1212
  var formatDate = function formatDate(date, fmt) {
1208
- var obj = void 0;
1209
- if (date) {
1210
- obj = new Date(date);
1211
- } else {
1212
- obj = new Date();
1213
- }
1213
+ // 1. 处理日期输入
1214
+ var obj = date ? new Date(date) : new Date();
1215
+ if (isNaN(obj.getTime())) throw new Error('Invalid date input');
1216
+
1217
+ // 2. 工具函数
1218
+ var pad = function pad(n) {
1219
+ return String(n).padStart(2, '0');
1220
+ };
1221
+ var monthNum = obj.getMonth(); // 数值月份 (0-11)
1222
+
1223
+ // 3. 定义格式化规则
1214
1224
  var quarter = ['一', '二', '三', '四'];
1225
+ var halfyear = ['上', '下'];
1215
1226
  var o = {
1216
- 'b+': Math.ceil((obj.getMonth() + 1) / 6), // 半年
1217
- 'M+': obj.getMonth() + 1, // 月份
1218
- 'd+': obj.getDate(), // 日
1219
- 'H+': obj.getHours(), // 小时
1220
- 'm+': obj.getMinutes(), //
1221
- 's+': obj.getSeconds(), // 秒
1222
- 'q+': quarter[Math.ceil((obj.getMonth() + 1) / 3) - 1], // 季度
1223
- S: obj.getMilliseconds() // 毫秒
1227
+ 'b+': halfyear[Math.floor(monthNum / 6)], // 1=上半年, 2=下半年
1228
+ 'M+': monthNum + 1, // 月份 (1-12)
1229
+ 'd+': obj.getDate(), // 日 (1-31)
1230
+ 'H+': obj.getHours(), // 小时 (0-23)
1231
+ 'm+': obj.getMinutes(), // 分钟 (0-59)
1232
+ 's+': obj.getSeconds(), // 秒 (0-59)
1233
+ 'q+': quarter[Math.floor(monthNum / 3)], // 季度 (一~四)
1234
+ 'S': obj.getMilliseconds() // 毫秒 (0-999)
1224
1235
  };
1236
+
1237
+ // 4. 处理年份
1225
1238
  if (/(y+)/.test(fmt)) {
1226
- fmt = fmt.replace(RegExp.$1, (obj.getFullYear() + '').substr(4 - RegExp.$1.length));
1239
+ fmt = fmt.replace(RegExp.$1, String(obj.getFullYear()).slice(-RegExp.$1.length));
1227
1240
  }
1241
+
1242
+ // 5. 处理其他字段
1228
1243
  for (var k in o) {
1229
1244
  if (new RegExp('(' + k + ')').test(fmt)) {
1230
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
1245
+ var val = k === 'q+' ? o[k] : pad(o[k]); // 季度不补零
1246
+ fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : val);
1231
1247
  }
1232
1248
  }
1249
+
1233
1250
  return fmt;
1234
1251
  };
1235
1252
 
package/lib/upload.js CHANGED
@@ -102,6 +102,10 @@ module.exports =
102
102
  /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(eoss_element__WEBPACK_IMPORTED_MODULE_5__);
103
103
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
104
104
 
105
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
106
+
107
+ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
108
+
105
109
  /**
106
110
  * 新封装公告方法规范:
107
111
  * 1.方法顺序按字母顺序排列
@@ -186,7 +190,8 @@ var ajax = function ajax(_ref) {
186
190
  publicKey = _ref.publicKey,
187
191
  secret = _ref.secret,
188
192
  encodes = _ref.encodes,
189
- oldmode = _ref.oldmode;
193
+ oldmode = _ref.oldmode,
194
+ configs = _objectWithoutProperties(_ref, ['headers', 'method', 'url', 'host', 'data', 'params', 'format', 'mix', 'defaults', 'loading', 'publicKey', 'secret', 'encodes', 'oldmode']);
190
195
 
191
196
  var header = headers || {};
192
197
  if (!method) {
@@ -490,13 +495,13 @@ var ajax = function ajax(_ref) {
490
495
  if (oldmode && !header['api-response-mode']) {
491
496
  header['api-response-mode'] = true;
492
497
  }
493
- return http({
498
+ return http(_extends({
494
499
  method: method,
495
500
  url: url,
496
501
  data: data,
497
502
  params: params,
498
503
  headers: header
499
- });
504
+ }, configs));
500
505
  };
501
506
 
502
507
  /**
@@ -1204,31 +1209,43 @@ var extend = function extend() {
1204
1209
  * @param {String} [fmt] - 格式
1205
1210
  **/
1206
1211
  var formatDate = function formatDate(date, fmt) {
1207
- var obj = void 0;
1208
- if (date) {
1209
- obj = new Date(date);
1210
- } else {
1211
- obj = new Date();
1212
- }
1212
+ // 1. 处理日期输入
1213
+ var obj = date ? new Date(date) : new Date();
1214
+ if (isNaN(obj.getTime())) throw new Error('Invalid date input');
1215
+
1216
+ // 2. 工具函数
1217
+ var pad = function pad(n) {
1218
+ return String(n).padStart(2, '0');
1219
+ };
1220
+ var monthNum = obj.getMonth(); // 数值月份 (0-11)
1221
+
1222
+ // 3. 定义格式化规则
1213
1223
  var quarter = ['一', '二', '三', '四'];
1224
+ var halfyear = ['上', '下'];
1214
1225
  var o = {
1215
- 'b+': Math.ceil((obj.getMonth() + 1) / 6), // 半年
1216
- 'M+': obj.getMonth() + 1, // 月份
1217
- 'd+': obj.getDate(), // 日
1218
- 'H+': obj.getHours(), // 小时
1219
- 'm+': obj.getMinutes(), //
1220
- 's+': obj.getSeconds(), // 秒
1221
- 'q+': quarter[Math.ceil((obj.getMonth() + 1) / 3) - 1], // 季度
1222
- S: obj.getMilliseconds() // 毫秒
1226
+ 'b+': halfyear[Math.floor(monthNum / 6)], // 1=上半年, 2=下半年
1227
+ 'M+': monthNum + 1, // 月份 (1-12)
1228
+ 'd+': obj.getDate(), // 日 (1-31)
1229
+ 'H+': obj.getHours(), // 小时 (0-23)
1230
+ 'm+': obj.getMinutes(), // 分钟 (0-59)
1231
+ 's+': obj.getSeconds(), // 秒 (0-59)
1232
+ 'q+': quarter[Math.floor(monthNum / 3)], // 季度 (一~四)
1233
+ 'S': obj.getMilliseconds() // 毫秒 (0-999)
1223
1234
  };
1235
+
1236
+ // 4. 处理年份
1224
1237
  if (/(y+)/.test(fmt)) {
1225
- fmt = fmt.replace(RegExp.$1, (obj.getFullYear() + '').substr(4 - RegExp.$1.length));
1238
+ fmt = fmt.replace(RegExp.$1, String(obj.getFullYear()).slice(-RegExp.$1.length));
1226
1239
  }
1240
+
1241
+ // 5. 处理其他字段
1227
1242
  for (var k in o) {
1228
1243
  if (new RegExp('(' + k + ')').test(fmt)) {
1229
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
1244
+ var val = k === 'q+' ? o[k] : pad(o[k]); // 季度不补零
1245
+ fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : val);
1230
1246
  }
1231
1247
  }
1248
+
1232
1249
  return fmt;
1233
1250
  };
1234
1251
 
package/lib/utils/util.js CHANGED
@@ -2,6 +2,8 @@ exports.__esModule = true;
2
2
 
3
3
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
4
 
5
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
6
+
5
7
  var _api = require('../config/api');
6
8
 
7
9
  var _axios = require('axios');
@@ -24,6 +26,8 @@ var _eossElement = require('eoss-element');
24
26
 
25
27
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
28
 
29
+ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
30
+
27
31
  /**
28
32
  * 新封装公告方法规范:
29
33
  * 1.方法顺序按字母顺序排列
@@ -104,7 +108,8 @@ var ajax = function ajax(_ref) {
104
108
  publicKey = _ref.publicKey,
105
109
  secret = _ref.secret,
106
110
  encodes = _ref.encodes,
107
- oldmode = _ref.oldmode;
111
+ oldmode = _ref.oldmode,
112
+ configs = _objectWithoutProperties(_ref, ['headers', 'method', 'url', 'host', 'data', 'params', 'format', 'mix', 'defaults', 'loading', 'publicKey', 'secret', 'encodes', 'oldmode']);
108
113
 
109
114
  var header = headers || {};
110
115
  if (!method) {
@@ -408,13 +413,13 @@ var ajax = function ajax(_ref) {
408
413
  if (oldmode && !header['api-response-mode']) {
409
414
  header['api-response-mode'] = true;
410
415
  }
411
- return http({
416
+ return http(_extends({
412
417
  method: method,
413
418
  url: url,
414
419
  data: data,
415
420
  params: params,
416
421
  headers: header
417
- });
422
+ }, configs));
418
423
  };
419
424
 
420
425
  /**
@@ -1122,31 +1127,43 @@ var extend = function extend() {
1122
1127
  * @param {String} [fmt] - 格式
1123
1128
  **/
1124
1129
  var formatDate = function formatDate(date, fmt) {
1125
- var obj = void 0;
1126
- if (date) {
1127
- obj = new Date(date);
1128
- } else {
1129
- obj = new Date();
1130
- }
1130
+ // 1. 处理日期输入
1131
+ var obj = date ? new Date(date) : new Date();
1132
+ if (isNaN(obj.getTime())) throw new Error('Invalid date input');
1133
+
1134
+ // 2. 工具函数
1135
+ var pad = function pad(n) {
1136
+ return String(n).padStart(2, '0');
1137
+ };
1138
+ var monthNum = obj.getMonth(); // 数值月份 (0-11)
1139
+
1140
+ // 3. 定义格式化规则
1131
1141
  var quarter = ['一', '二', '三', '四'];
1142
+ var halfyear = ['上', '下'];
1132
1143
  var o = {
1133
- 'b+': Math.ceil((obj.getMonth() + 1) / 6), // 半年
1134
- 'M+': obj.getMonth() + 1, // 月份
1135
- 'd+': obj.getDate(), // 日
1136
- 'H+': obj.getHours(), // 小时
1137
- 'm+': obj.getMinutes(), //
1138
- 's+': obj.getSeconds(), // 秒
1139
- 'q+': quarter[Math.ceil((obj.getMonth() + 1) / 3) - 1], // 季度
1140
- S: obj.getMilliseconds() // 毫秒
1144
+ 'b+': halfyear[Math.floor(monthNum / 6)], // 1=上半年, 2=下半年
1145
+ 'M+': monthNum + 1, // 月份 (1-12)
1146
+ 'd+': obj.getDate(), // 日 (1-31)
1147
+ 'H+': obj.getHours(), // 小时 (0-23)
1148
+ 'm+': obj.getMinutes(), // 分钟 (0-59)
1149
+ 's+': obj.getSeconds(), // 秒 (0-59)
1150
+ 'q+': quarter[Math.floor(monthNum / 3)], // 季度 (一~四)
1151
+ 'S': obj.getMilliseconds() // 毫秒 (0-999)
1141
1152
  };
1153
+
1154
+ // 4. 处理年份
1142
1155
  if (/(y+)/.test(fmt)) {
1143
- fmt = fmt.replace(RegExp.$1, (obj.getFullYear() + '').substr(4 - RegExp.$1.length));
1156
+ fmt = fmt.replace(RegExp.$1, String(obj.getFullYear()).slice(-RegExp.$1.length));
1144
1157
  }
1158
+
1159
+ // 5. 处理其他字段
1145
1160
  for (var k in o) {
1146
1161
  if (new RegExp('(' + k + ')').test(fmt)) {
1147
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
1162
+ var val = k === 'q+' ? o[k] : pad(o[k]); // 季度不补零
1163
+ fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : val);
1148
1164
  }
1149
1165
  }
1166
+
1150
1167
  return fmt;
1151
1168
  };
1152
1169
 
package/lib/wujie.js CHANGED
@@ -103,6 +103,10 @@ module.exports =
103
103
  /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(eoss_element__WEBPACK_IMPORTED_MODULE_5__);
104
104
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
105
105
 
106
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
107
+
108
+ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
109
+
106
110
  /**
107
111
  * 新封装公告方法规范:
108
112
  * 1.方法顺序按字母顺序排列
@@ -187,7 +191,8 @@ var ajax = function ajax(_ref) {
187
191
  publicKey = _ref.publicKey,
188
192
  secret = _ref.secret,
189
193
  encodes = _ref.encodes,
190
- oldmode = _ref.oldmode;
194
+ oldmode = _ref.oldmode,
195
+ configs = _objectWithoutProperties(_ref, ['headers', 'method', 'url', 'host', 'data', 'params', 'format', 'mix', 'defaults', 'loading', 'publicKey', 'secret', 'encodes', 'oldmode']);
191
196
 
192
197
  var header = headers || {};
193
198
  if (!method) {
@@ -491,13 +496,13 @@ var ajax = function ajax(_ref) {
491
496
  if (oldmode && !header['api-response-mode']) {
492
497
  header['api-response-mode'] = true;
493
498
  }
494
- return http({
499
+ return http(_extends({
495
500
  method: method,
496
501
  url: url,
497
502
  data: data,
498
503
  params: params,
499
504
  headers: header
500
- });
505
+ }, configs));
501
506
  };
502
507
 
503
508
  /**
@@ -1205,31 +1210,43 @@ var extend = function extend() {
1205
1210
  * @param {String} [fmt] - 格式
1206
1211
  **/
1207
1212
  var formatDate = function formatDate(date, fmt) {
1208
- var obj = void 0;
1209
- if (date) {
1210
- obj = new Date(date);
1211
- } else {
1212
- obj = new Date();
1213
- }
1213
+ // 1. 处理日期输入
1214
+ var obj = date ? new Date(date) : new Date();
1215
+ if (isNaN(obj.getTime())) throw new Error('Invalid date input');
1216
+
1217
+ // 2. 工具函数
1218
+ var pad = function pad(n) {
1219
+ return String(n).padStart(2, '0');
1220
+ };
1221
+ var monthNum = obj.getMonth(); // 数值月份 (0-11)
1222
+
1223
+ // 3. 定义格式化规则
1214
1224
  var quarter = ['一', '二', '三', '四'];
1225
+ var halfyear = ['上', '下'];
1215
1226
  var o = {
1216
- 'b+': Math.ceil((obj.getMonth() + 1) / 6), // 半年
1217
- 'M+': obj.getMonth() + 1, // 月份
1218
- 'd+': obj.getDate(), // 日
1219
- 'H+': obj.getHours(), // 小时
1220
- 'm+': obj.getMinutes(), //
1221
- 's+': obj.getSeconds(), // 秒
1222
- 'q+': quarter[Math.ceil((obj.getMonth() + 1) / 3) - 1], // 季度
1223
- S: obj.getMilliseconds() // 毫秒
1227
+ 'b+': halfyear[Math.floor(monthNum / 6)], // 1=上半年, 2=下半年
1228
+ 'M+': monthNum + 1, // 月份 (1-12)
1229
+ 'd+': obj.getDate(), // 日 (1-31)
1230
+ 'H+': obj.getHours(), // 小时 (0-23)
1231
+ 'm+': obj.getMinutes(), // 分钟 (0-59)
1232
+ 's+': obj.getSeconds(), // 秒 (0-59)
1233
+ 'q+': quarter[Math.floor(monthNum / 3)], // 季度 (一~四)
1234
+ 'S': obj.getMilliseconds() // 毫秒 (0-999)
1224
1235
  };
1236
+
1237
+ // 4. 处理年份
1225
1238
  if (/(y+)/.test(fmt)) {
1226
- fmt = fmt.replace(RegExp.$1, (obj.getFullYear() + '').substr(4 - RegExp.$1.length));
1239
+ fmt = fmt.replace(RegExp.$1, String(obj.getFullYear()).slice(-RegExp.$1.length));
1227
1240
  }
1241
+
1242
+ // 5. 处理其他字段
1228
1243
  for (var k in o) {
1229
1244
  if (new RegExp('(' + k + ')').test(fmt)) {
1230
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
1245
+ var val = k === 'q+' ? o[k] : pad(o[k]); // 季度不补零
1246
+ fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : val);
1231
1247
  }
1232
1248
  }
1249
+
1233
1250
  return fmt;
1234
1251
  };
1235
1252