eoss-mobiles 0.1.13
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.
- package/CHANGELOG.md +55 -0
- package/README.md +28 -0
- package/lib/action-sheet.js +313 -0
- package/lib/button-group.js +421 -0
- package/lib/button.js +278 -0
- package/lib/calendar.js +301 -0
- package/lib/cascader.js +336 -0
- package/lib/cell.js +366 -0
- package/lib/checkbox.js +2170 -0
- package/lib/circle.js +299 -0
- package/lib/config/api.js +31 -0
- package/lib/count-down.js +299 -0
- package/lib/date.js +956 -0
- package/lib/empty.js +274 -0
- package/lib/eoss-mobile.common.js +15072 -0
- package/lib/field.js +440 -0
- package/lib/flow.js +5664 -0
- package/lib/form.js +714 -0
- package/lib/grid-item.js +274 -0
- package/lib/grid.js +317 -0
- package/lib/image-preview.js +325 -0
- package/lib/index.js +1 -0
- package/lib/list.js +315 -0
- package/lib/loading.js +279 -0
- package/lib/nav-bar.js +283 -0
- package/lib/pagination.js +323 -0
- package/lib/picker.js +2714 -0
- package/lib/popover.js +306 -0
- package/lib/popup.js +297 -0
- package/lib/radio.js +2137 -0
- package/lib/rate.js +300 -0
- package/lib/search.js +316 -0
- package/lib/selector.js +3496 -0
- package/lib/skeleton.js +277 -0
- package/lib/stepper.js +300 -0
- package/lib/switch.js +304 -0
- package/lib/tab.js +274 -0
- package/lib/table-column.js +2991 -0
- package/lib/table.js +2652 -0
- package/lib/tabs.js +315 -0
- package/lib/tag.js +281 -0
- package/lib/theme-chalk/action-sheet.css +0 -0
- package/lib/theme-chalk/base.css +1 -0
- package/lib/theme-chalk/button-group.css +1 -0
- package/lib/theme-chalk/button.css +1 -0
- package/lib/theme-chalk/calendar.css +1 -0
- package/lib/theme-chalk/cascader.css +1 -0
- package/lib/theme-chalk/cell.css +1 -0
- package/lib/theme-chalk/checkbox.css +1 -0
- package/lib/theme-chalk/circle.css +1 -0
- package/lib/theme-chalk/count-down.css +0 -0
- package/lib/theme-chalk/date.css +0 -0
- package/lib/theme-chalk/empty.css +0 -0
- package/lib/theme-chalk/field.css +1 -0
- package/lib/theme-chalk/flow.css +1 -0
- package/lib/theme-chalk/fonts/iconfont.scss +530 -0
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/form.css +0 -0
- package/lib/theme-chalk/grid-item.css +1 -0
- package/lib/theme-chalk/grid.css +0 -0
- package/lib/theme-chalk/icon.css +1 -0
- package/lib/theme-chalk/image-preview.css +0 -0
- package/lib/theme-chalk/index.css +1 -0
- package/lib/theme-chalk/list.css +0 -0
- package/lib/theme-chalk/loading.css +0 -0
- package/lib/theme-chalk/nav-bar.css +0 -0
- package/lib/theme-chalk/navbar.css +1 -0
- package/lib/theme-chalk/pagination.css +1 -0
- package/lib/theme-chalk/picker.css +1 -0
- package/lib/theme-chalk/popover.css +0 -0
- package/lib/theme-chalk/popup.css +0 -0
- package/lib/theme-chalk/radio.css +1 -0
- package/lib/theme-chalk/rate.css +0 -0
- package/lib/theme-chalk/search.css +0 -0
- package/lib/theme-chalk/selector.css +1 -0
- package/lib/theme-chalk/skeleton.css +0 -0
- package/lib/theme-chalk/stepper.css +1 -0
- package/lib/theme-chalk/switch.css +1 -0
- package/lib/theme-chalk/tab.css +0 -0
- package/lib/theme-chalk/table-column.css +0 -0
- package/lib/theme-chalk/table.css +1 -0
- package/lib/theme-chalk/tabs.css +1 -0
- package/lib/theme-chalk/tag.css +1 -0
- package/lib/theme-chalk/theme.css +0 -0
- package/lib/theme-chalk/tree.css +1 -0
- package/lib/theme-chalk/uploader.css +0 -0
- package/lib/uploader.js +307 -0
- package/lib/utils/axios.js +199 -0
- package/lib/utils/date-util.js +320 -0
- package/lib/utils/http.js +74 -0
- package/lib/utils/rules.js +21 -0
- package/lib/utils/store.js +24 -0
- package/lib/utils/util.js +1315 -0
- package/package.json +153 -0
- package/packages/action-sheet/index.js +5 -0
- package/packages/action-sheet/src/main.vue +32 -0
- package/packages/button/index.js +5 -0
- package/packages/button/src/main.vue +15 -0
- package/packages/button-group/index.js +5 -0
- package/packages/button-group/src/main.vue +80 -0
- package/packages/calendar/index.js +5 -0
- package/packages/calendar/src/main.vue +34 -0
- package/packages/cascader/index.js +5 -0
- package/packages/cascader/src/main.vue +40 -0
- package/packages/cell/index.js +5 -0
- package/packages/cell/src/main.vue +72 -0
- package/packages/checkbox/index.js +5 -0
- package/packages/checkbox/src/main.vue +149 -0
- package/packages/circle/index.js +5 -0
- package/packages/circle/src/main.vue +27 -0
- package/packages/count-down/index.js +5 -0
- package/packages/count-down/src/main.vue +27 -0
- package/packages/date/index.js +5 -0
- package/packages/date/src/date-time.vue +290 -0
- package/packages/date/src/main.vue +319 -0
- package/packages/empty/index.js +5 -0
- package/packages/empty/src/main.vue +16 -0
- package/packages/field/index.js +5 -0
- package/packages/field/src/main.vue +130 -0
- package/packages/flow/index.js +5 -0
- package/packages/flow/src/components/Handle.vue +1031 -0
- package/packages/flow/src/components/Message.vue +96 -0
- package/packages/flow/src/components/Opinion.vue +112 -0
- package/packages/flow/src/components/Reject.vue +202 -0
- package/packages/flow/src/components/StartFlow.vue +440 -0
- package/packages/flow/src/components/TaskRead.vue +237 -0
- package/packages/flow/src/main.vue +43 -0
- package/packages/form/index.js +5 -0
- package/packages/form/src/main.vue +158 -0
- package/packages/grid/index.js +5 -0
- package/packages/grid/src/main.vue +28 -0
- package/packages/grid-item/index.js +5 -0
- package/packages/grid-item/src/main.vue +16 -0
- package/packages/image-preview/index.js +5 -0
- package/packages/image-preview/src/main.vue +34 -0
- package/packages/list/index.js +5 -0
- package/packages/list/src/main.vue +32 -0
- package/packages/loading/index.js +5 -0
- package/packages/loading/src/main.vue +20 -0
- package/packages/nav-bar/index.js +5 -0
- package/packages/nav-bar/src/main.vue +16 -0
- package/packages/pagination/index.js +5 -0
- package/packages/pagination/src/main.vue +29 -0
- package/packages/picker/index.js +5 -0
- package/packages/picker/src/main.vue +500 -0
- package/packages/popover/index.js +5 -0
- package/packages/popover/src/main.vue +32 -0
- package/packages/popup/index.js +5 -0
- package/packages/popup/src/main.vue +27 -0
- package/packages/radio/index.js +5 -0
- package/packages/radio/src/main.vue +147 -0
- package/packages/rate/index.js +5 -0
- package/packages/rate/src/main.vue +27 -0
- package/packages/search/index.js +5 -0
- package/packages/search/src/main.vue +39 -0
- package/packages/selector/index.js +5 -0
- package/packages/selector/src/main.vue +77 -0
- package/packages/selector/src/selector-field.vue +225 -0
- package/packages/selector/src/selector-tree.vue +472 -0
- package/packages/selector/src/tree.vue +179 -0
- package/packages/skeleton/index.js +5 -0
- package/packages/skeleton/src/main.vue +17 -0
- package/packages/stepper/index.js +5 -0
- package/packages/stepper/src/main.vue +25 -0
- package/packages/switch/index.js +5 -0
- package/packages/switch/src/main.vue +29 -0
- package/packages/tab/index.js +5 -0
- package/packages/tab/src/main.vue +16 -0
- package/packages/table/index.js +5 -0
- package/packages/table/src/main.vue +830 -0
- package/packages/table-column/index.js +5 -0
- package/packages/table-column/src/main.vue +742 -0
- package/packages/table-column/src/mixins/table.js +12 -0
- package/packages/tabs/index.js +5 -0
- package/packages/tabs/src/main.vue +34 -0
- package/packages/tag/index.js +5 -0
- package/packages/tag/src/main.vue +16 -0
- package/packages/theme-chalk/README.md +33 -0
- package/packages/theme-chalk/lib/action-sheet.css +0 -0
- package/packages/theme-chalk/lib/base.css +1 -0
- package/packages/theme-chalk/lib/button-group.css +1 -0
- package/packages/theme-chalk/lib/button.css +1 -0
- package/packages/theme-chalk/lib/calendar.css +1 -0
- package/packages/theme-chalk/lib/cascader.css +1 -0
- package/packages/theme-chalk/lib/cell.css +1 -0
- package/packages/theme-chalk/lib/checkbox.css +1 -0
- package/packages/theme-chalk/lib/circle.css +1 -0
- package/packages/theme-chalk/lib/count-down.css +0 -0
- package/packages/theme-chalk/lib/date.css +0 -0
- package/packages/theme-chalk/lib/empty.css +0 -0
- package/packages/theme-chalk/lib/field.css +1 -0
- package/packages/theme-chalk/lib/flow.css +1 -0
- package/packages/theme-chalk/lib/fonts/iconfont.scss +530 -0
- package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/lib/form.css +0 -0
- package/packages/theme-chalk/lib/grid-item.css +1 -0
- package/packages/theme-chalk/lib/grid.css +0 -0
- package/packages/theme-chalk/lib/icon.css +1 -0
- package/packages/theme-chalk/lib/image-preview.css +0 -0
- package/packages/theme-chalk/lib/index.css +1 -0
- package/packages/theme-chalk/lib/list.css +0 -0
- package/packages/theme-chalk/lib/loading.css +0 -0
- package/packages/theme-chalk/lib/nav-bar.css +0 -0
- package/packages/theme-chalk/lib/navbar.css +1 -0
- package/packages/theme-chalk/lib/pagination.css +1 -0
- package/packages/theme-chalk/lib/picker.css +1 -0
- package/packages/theme-chalk/lib/popover.css +0 -0
- package/packages/theme-chalk/lib/popup.css +0 -0
- package/packages/theme-chalk/lib/radio.css +1 -0
- package/packages/theme-chalk/lib/rate.css +0 -0
- package/packages/theme-chalk/lib/search.css +0 -0
- package/packages/theme-chalk/lib/selector.css +1 -0
- package/packages/theme-chalk/lib/skeleton.css +0 -0
- package/packages/theme-chalk/lib/stepper.css +1 -0
- package/packages/theme-chalk/lib/switch.css +1 -0
- package/packages/theme-chalk/lib/tab.css +0 -0
- package/packages/theme-chalk/lib/table-column.css +0 -0
- package/packages/theme-chalk/lib/table.css +1 -0
- package/packages/theme-chalk/lib/tabs.css +1 -0
- package/packages/theme-chalk/lib/tag.css +1 -0
- package/packages/theme-chalk/lib/theme.css +0 -0
- package/packages/theme-chalk/lib/tree.css +1 -0
- package/packages/theme-chalk/lib/uploader.css +0 -0
- package/packages/theme-chalk/package.json +35 -0
- package/packages/theme-chalk/src/action-sheet.scss +0 -0
- package/packages/theme-chalk/src/base.scss +182 -0
- package/packages/theme-chalk/src/button-group.scss +26 -0
- package/packages/theme-chalk/src/button.scss +3 -0
- package/packages/theme-chalk/src/calendar.scss +12 -0
- package/packages/theme-chalk/src/cascader.scss +12 -0
- package/packages/theme-chalk/src/cell.scss +14 -0
- package/packages/theme-chalk/src/checkbox.scss +10 -0
- package/packages/theme-chalk/src/circle.scss +7 -0
- package/packages/theme-chalk/src/common/var.scss +1525 -0
- package/packages/theme-chalk/src/count-down.scss +0 -0
- package/packages/theme-chalk/src/date.scss +0 -0
- package/packages/theme-chalk/src/empty.scss +0 -0
- package/packages/theme-chalk/src/field.scss +28 -0
- package/packages/theme-chalk/src/flow.scss +542 -0
- package/packages/theme-chalk/src/fonts/iconfont.scss +530 -0
- package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/src/form.scss +15 -0
- package/packages/theme-chalk/src/grid-item.scss +8 -0
- package/packages/theme-chalk/src/grid.scss +0 -0
- package/packages/theme-chalk/src/icon.scss +1661 -0
- package/packages/theme-chalk/src/image-preview.scss +0 -0
- package/packages/theme-chalk/src/index.scss +38 -0
- package/packages/theme-chalk/src/list.scss +0 -0
- package/packages/theme-chalk/src/loading.scss +0 -0
- package/packages/theme-chalk/src/mixins/color.scss +117 -0
- package/packages/theme-chalk/src/mixins/mixins.scss +25 -0
- package/packages/theme-chalk/src/nav-bar.scss +0 -0
- package/packages/theme-chalk/src/navbar.scss +6 -0
- package/packages/theme-chalk/src/pagination.scss +10 -0
- package/packages/theme-chalk/src/picker.scss +27 -0
- package/packages/theme-chalk/src/popover.scss +0 -0
- package/packages/theme-chalk/src/popup.scss +0 -0
- package/packages/theme-chalk/src/radio.scss +7 -0
- package/packages/theme-chalk/src/rate.scss +0 -0
- package/packages/theme-chalk/src/search.scss +0 -0
- package/packages/theme-chalk/src/selector.scss +218 -0
- package/packages/theme-chalk/src/skeleton.scss +0 -0
- package/packages/theme-chalk/src/stepper.scss +10 -0
- package/packages/theme-chalk/src/switch.scss +6 -0
- package/packages/theme-chalk/src/tab.scss +0 -0
- package/packages/theme-chalk/src/table-column.scss +0 -0
- package/packages/theme-chalk/src/table.scss +42 -0
- package/packages/theme-chalk/src/tabs.scss +21 -0
- package/packages/theme-chalk/src/tag.scss +13 -0
- package/packages/theme-chalk/src/theme.scss +2 -0
- package/packages/theme-chalk/src/tree.scss +115 -0
- package/packages/theme-chalk/src/uploader.scss +0 -0
- package/packages/uploader/index.js +5 -0
- package/packages/uploader/src/main.vue +31 -0
- package/src/config/api.js +29 -0
- package/src/index.js +130 -0
- package/src/utils/axios.js +198 -0
- package/src/utils/date-util.js +312 -0
- package/src/utils/http.js +66 -0
- package/src/utils/rules.js +18 -0
- package/src/utils/store.js +21 -0
- package/src/utils/util.js +1346 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<van-uploader v-model="newValue" v-bind="$attrs" v-on="$listeners">
|
|
3
|
+
<template v-for="(index, name) in $slots" :slot="name">
|
|
4
|
+
<slot :name="name" />
|
|
5
|
+
</template>
|
|
6
|
+
</van-uploader>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
export default {
|
|
11
|
+
name: 'EmUploader',
|
|
12
|
+
props: {
|
|
13
|
+
value: {
|
|
14
|
+
type: Array,
|
|
15
|
+
default: () => []
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
computed: {
|
|
19
|
+
newValue: {
|
|
20
|
+
get() {
|
|
21
|
+
return this.value;
|
|
22
|
+
},
|
|
23
|
+
set(val) {
|
|
24
|
+
return val;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<style></style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// 获取机构/用户/角色/群组等选择器
|
|
2
|
+
export const selectObject = '/api/v1/mecpSys/selectObject.json';
|
|
3
|
+
// 获取代码表数据
|
|
4
|
+
export const findSysCode = '/api/v1/mecpSys/findSysCode.json';
|
|
5
|
+
// 获取常用意见
|
|
6
|
+
export const commonOpion = '/api/v1/mecpIpending/commonOpion.json';
|
|
7
|
+
// 获取审核页面信息
|
|
8
|
+
export const getHandleInfoHtml = '/api/mecp/v1/mecpItask/getHandleInfoHtml.json';
|
|
9
|
+
// 获取节点信息(获取节点属性及办理人,审核)
|
|
10
|
+
export const getNodeInfoHtml = '/api/mecp/v1/mecpItask/getNodeInfoHtml.json';
|
|
11
|
+
// 提交办理(为H5提供接口)
|
|
12
|
+
export const taskHandleHtml = '/api/mecp/v1/mecpItask/taskHandleHtml.json';
|
|
13
|
+
// 发起流程
|
|
14
|
+
export const registerNew = '/api/v1/mecpItask/registerNew.json';
|
|
15
|
+
// 获取节点信息(获取节点属性及办理人,发起)
|
|
16
|
+
export const getNodeInfo = '/api/mecp/v1/mecpItask/getNodeInfo.json';
|
|
17
|
+
// 获取发起流程信息
|
|
18
|
+
export const toStartFlow = '/api/mecp/v1/mecpItask/toStartFlow.json';
|
|
19
|
+
// 驳回(为H5提供接口)
|
|
20
|
+
export const taskRejectHtml = '/api/mecp/v1/mecpItask/taskRejectHtml.json';
|
|
21
|
+
// 获取驳回页面信息
|
|
22
|
+
export const toTaskRejectHtml = '/api/mecp/v1/mecpItask/toTaskRejectHtml.json';
|
|
23
|
+
// 分阅阅结(为H5提供接口)
|
|
24
|
+
export const handleTaskRead = '/api/mecp/v1/mecpItask/handleTaskRead.json';
|
|
25
|
+
// 分阅(为H5提供接口)
|
|
26
|
+
export const taskReadHtml = '/api/mecp/v1/mecpItask/taskReadHtml.json';
|
|
27
|
+
// 获取分阅页面信息
|
|
28
|
+
export const toStartTaskReadHtml =
|
|
29
|
+
'/api/mecp/v1/mecpItask/toStartTaskReadHtml.json';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/* Automatically generated by './build/bin/build-entry.js' */
|
|
2
|
+
|
|
3
|
+
import Loading from '../packages/loading/index.js';
|
|
4
|
+
import Button from '../packages/button/index.js';
|
|
5
|
+
import ButtonGroup from '../packages/button-group/index.js';
|
|
6
|
+
import Selector from '../packages/selector/index.js';
|
|
7
|
+
import Field from '../packages/field/index.js';
|
|
8
|
+
import Radio from '../packages/radio/index.js';
|
|
9
|
+
import Picker from '../packages/picker/index.js';
|
|
10
|
+
import Cell from '../packages/cell/index.js';
|
|
11
|
+
import Circle from '../packages/circle/index.js';
|
|
12
|
+
import Switch from '../packages/switch/index.js';
|
|
13
|
+
import Uploader from '../packages/uploader/index.js';
|
|
14
|
+
import Grid from '../packages/grid/index.js';
|
|
15
|
+
import GridItem from '../packages/grid-item/index.js';
|
|
16
|
+
import Empty from '../packages/empty/index.js';
|
|
17
|
+
import Date from '../packages/date/index.js';
|
|
18
|
+
import Search from '../packages/search/index.js';
|
|
19
|
+
import Tabs from '../packages/tabs/index.js';
|
|
20
|
+
import Tab from '../packages/tab/index.js';
|
|
21
|
+
import Table from '../packages/table/index.js';
|
|
22
|
+
import TableColumn from '../packages/table-column/index.js';
|
|
23
|
+
import Tag from '../packages/tag/index.js';
|
|
24
|
+
import NavBar from '../packages/nav-bar/index.js';
|
|
25
|
+
import List from '../packages/list/index.js';
|
|
26
|
+
import Flow from '../packages/flow/index.js';
|
|
27
|
+
import Popover from '../packages/popover/index.js';
|
|
28
|
+
import Checkbox from '../packages/checkbox/index.js';
|
|
29
|
+
import Calendar from '../packages/calendar/index.js';
|
|
30
|
+
import CountDown from '../packages/count-down/index.js';
|
|
31
|
+
import Form from '../packages/form/index.js';
|
|
32
|
+
import Skeleton from '../packages/skeleton/index.js';
|
|
33
|
+
import Cascader from '../packages/cascader/index.js';
|
|
34
|
+
import ImagePreview from '../packages/image-preview/index.js';
|
|
35
|
+
import Rate from '../packages/rate/index.js';
|
|
36
|
+
import ActionSheet from '../packages/action-sheet/index.js';
|
|
37
|
+
import Popup from '../packages/popup/index.js';
|
|
38
|
+
import Stepper from '../packages/stepper/index.js';
|
|
39
|
+
import Pagination from '../packages/pagination/index.js';
|
|
40
|
+
|
|
41
|
+
const components = [
|
|
42
|
+
Loading,
|
|
43
|
+
Button,
|
|
44
|
+
ButtonGroup,
|
|
45
|
+
Selector,
|
|
46
|
+
Field,
|
|
47
|
+
Radio,
|
|
48
|
+
Picker,
|
|
49
|
+
Cell,
|
|
50
|
+
Circle,
|
|
51
|
+
Switch,
|
|
52
|
+
Uploader,
|
|
53
|
+
Grid,
|
|
54
|
+
GridItem,
|
|
55
|
+
Empty,
|
|
56
|
+
Date,
|
|
57
|
+
Search,
|
|
58
|
+
Tabs,
|
|
59
|
+
Tab,
|
|
60
|
+
Table,
|
|
61
|
+
TableColumn,
|
|
62
|
+
Tag,
|
|
63
|
+
NavBar,
|
|
64
|
+
List,
|
|
65
|
+
Flow,
|
|
66
|
+
Popover,
|
|
67
|
+
Checkbox,
|
|
68
|
+
Calendar,
|
|
69
|
+
CountDown,
|
|
70
|
+
Form,
|
|
71
|
+
Skeleton,
|
|
72
|
+
Cascader,
|
|
73
|
+
ImagePreview,
|
|
74
|
+
Rate,
|
|
75
|
+
ActionSheet,
|
|
76
|
+
Popup,
|
|
77
|
+
Stepper,
|
|
78
|
+
Pagination
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
const install = function(Vue, opts = {}) {
|
|
82
|
+
components.forEach(component => {
|
|
83
|
+
Vue.component(component.name, component);
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
/* istanbul ignore if */
|
|
87
|
+
if (typeof window !== 'undefined' && window.Vue) {
|
|
88
|
+
install(window.Vue);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export default {
|
|
92
|
+
version: '0.1.13',
|
|
93
|
+
install,
|
|
94
|
+
Button,
|
|
95
|
+
ButtonGroup,
|
|
96
|
+
Selector,
|
|
97
|
+
Field,
|
|
98
|
+
Radio,
|
|
99
|
+
Picker,
|
|
100
|
+
Cell,
|
|
101
|
+
Circle,
|
|
102
|
+
Switch,
|
|
103
|
+
Uploader,
|
|
104
|
+
Grid,
|
|
105
|
+
GridItem,
|
|
106
|
+
Empty,
|
|
107
|
+
Date,
|
|
108
|
+
Search,
|
|
109
|
+
Tabs,
|
|
110
|
+
Tab,
|
|
111
|
+
Table,
|
|
112
|
+
TableColumn,
|
|
113
|
+
Tag,
|
|
114
|
+
NavBar,
|
|
115
|
+
List,
|
|
116
|
+
Flow,
|
|
117
|
+
Popover,
|
|
118
|
+
Checkbox,
|
|
119
|
+
Calendar,
|
|
120
|
+
CountDown,
|
|
121
|
+
Form,
|
|
122
|
+
Skeleton,
|
|
123
|
+
Cascader,
|
|
124
|
+
ImagePreview,
|
|
125
|
+
Rate,
|
|
126
|
+
ActionSheet,
|
|
127
|
+
Popup,
|
|
128
|
+
Stepper,
|
|
129
|
+
Pagination
|
|
130
|
+
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import Axios from 'axios';
|
|
2
|
+
// import Vue from 'vue';
|
|
3
|
+
import { Toast } from 'eoss-mobile-vant';
|
|
4
|
+
import $ from './util';
|
|
5
|
+
import qs from 'qs';
|
|
6
|
+
let apiUrl = $.getStorage('host');
|
|
7
|
+
let http = Axios.create({
|
|
8
|
+
headers: {
|
|
9
|
+
clientKey: $.getStorage('clientKey') || 'csjk'
|
|
10
|
+
},
|
|
11
|
+
baseURL: apiUrl,
|
|
12
|
+
timeout: 60000,
|
|
13
|
+
withCredentials: false
|
|
14
|
+
});
|
|
15
|
+
http.interceptors.request.use(
|
|
16
|
+
config => {
|
|
17
|
+
let data = {};
|
|
18
|
+
if (config.method === 'post') {
|
|
19
|
+
// 特殊处理在线考试接口1
|
|
20
|
+
if (config.url.search('HGtest') !== -1) {
|
|
21
|
+
config.headers['Content-Type'] = 'application/json;';
|
|
22
|
+
// config.data = qs.stringify(data);
|
|
23
|
+
Object.assign(data, config.data);
|
|
24
|
+
} else if (config.url.search('/outsidedirector/business/update') !== -1) {
|
|
25
|
+
|
|
26
|
+
delete config.data.userId;
|
|
27
|
+
} else if (config.url.indexOf('decisionSuperviseMeet') !== -1) {
|
|
28
|
+
config.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
29
|
+
Object.assign(data, config.data);
|
|
30
|
+
config.data = qs.stringify(data);
|
|
31
|
+
} else {
|
|
32
|
+
config.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
33
|
+
Object.assign(data, config.data);
|
|
34
|
+
config.data = qs.stringify(data);
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
Object.assign(config.params, data);
|
|
38
|
+
config.headers['Content-Type'] = 'application/json;';
|
|
39
|
+
}
|
|
40
|
+
if ($.getStorage('token')) {
|
|
41
|
+
config.headers.Authorization = $.getStorage('token');
|
|
42
|
+
}
|
|
43
|
+
if ($.getStorage('deviceId')) {
|
|
44
|
+
config.headers.deviceId = $.getStorage('deviceId');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let a = '/config/';
|
|
48
|
+
|
|
49
|
+
if (config.url.search(a) !== -1 && config.url.search('appInfo') === -1) {
|
|
50
|
+
config.headers.clientKey = $.getStorage('clientKey') || 'csjk2';
|
|
51
|
+
}
|
|
52
|
+
if (config.url.search('api/financePhone/') !== -1) {
|
|
53
|
+
config.baseURL = 'https://release.cdgzjg.cn/';
|
|
54
|
+
}
|
|
55
|
+
if (config.url.search('/getmyAccount.json') !== -1) {
|
|
56
|
+
delete config.params.userId;
|
|
57
|
+
}
|
|
58
|
+
if (config.url.search('/sso2/authCenter') !== -1) {
|
|
59
|
+
delete config.headers.clientKey;
|
|
60
|
+
delete config.headers.deviceId;
|
|
61
|
+
}
|
|
62
|
+
if (config.url.search('/appInfo') !== -1) {
|
|
63
|
+
config.headers.deviceId = $.getStorage('deviceId');
|
|
64
|
+
delete config.headers.clientKey;
|
|
65
|
+
}
|
|
66
|
+
if (
|
|
67
|
+
config.url.search('getPresetCustomInfo') !== -1 ||
|
|
68
|
+
config.url.search('registerNew') !== -1
|
|
69
|
+
) {
|
|
70
|
+
// config.baseURL = "/api";
|
|
71
|
+
config.headers.token = $.getStorage('token');
|
|
72
|
+
}
|
|
73
|
+
if (
|
|
74
|
+
config.url.search('mecp/overtime') !== -1 ||
|
|
75
|
+
config.url.search('mecp/leave') !== -1 ||
|
|
76
|
+
config.url.search('contractext') !== -1 ||
|
|
77
|
+
config.url.search('getSysParam') !== -1
|
|
78
|
+
) {
|
|
79
|
+
delete config.headers.deviceId;
|
|
80
|
+
}
|
|
81
|
+
// if(config.url.search('getVehicleMaintenanceInfoForAPP') !== -1 ) {
|
|
82
|
+
// delete config.headers.deviceId
|
|
83
|
+
// delete config.headers.Authorization
|
|
84
|
+
// delete config.headers.clientKey
|
|
85
|
+
// }
|
|
86
|
+
return config;
|
|
87
|
+
},
|
|
88
|
+
error => {
|
|
89
|
+
return Promise.error(error);
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
// 响应拦截器
|
|
93
|
+
http.interceptors.response.use(
|
|
94
|
+
response => {
|
|
95
|
+
if (response.status === 200) {
|
|
96
|
+
if (response.data.rCode === 64 || response.data.rCode === 27) {
|
|
97
|
+
$.H5TokenInvalid();
|
|
98
|
+
} else {
|
|
99
|
+
return Promise.resolve(response.data);
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
return Promise.reject(response);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
error => {
|
|
106
|
+
if (error && error.response) {
|
|
107
|
+
if (error.response.status) {
|
|
108
|
+
switch (error.response.status) {
|
|
109
|
+
case 400:
|
|
110
|
+
error.message = '错误请求';
|
|
111
|
+
break;
|
|
112
|
+
case 401:
|
|
113
|
+
error.message = '未授权,请重新登录';
|
|
114
|
+
break;
|
|
115
|
+
case 403:
|
|
116
|
+
error.message = '登录过期,请重新登录';
|
|
117
|
+
$.removeStorage('userId');
|
|
118
|
+
break;
|
|
119
|
+
case 404:
|
|
120
|
+
error.message = '网络请求不存在';
|
|
121
|
+
break;
|
|
122
|
+
case 405:
|
|
123
|
+
error.message = '请求方法错误';
|
|
124
|
+
break;
|
|
125
|
+
case 408:
|
|
126
|
+
error.message = '请求超时';
|
|
127
|
+
break;
|
|
128
|
+
case 500:
|
|
129
|
+
error.message = '服务器端出错';
|
|
130
|
+
break;
|
|
131
|
+
case 501:
|
|
132
|
+
error.message = '网络未实现';
|
|
133
|
+
break;
|
|
134
|
+
case 502:
|
|
135
|
+
error.message = '网络错误';
|
|
136
|
+
break;
|
|
137
|
+
case 503:
|
|
138
|
+
error.message = '服务不可用';
|
|
139
|
+
break;
|
|
140
|
+
case 504:
|
|
141
|
+
error.message = '网络超时';
|
|
142
|
+
break;
|
|
143
|
+
case 505:
|
|
144
|
+
error.message = 'http版本不支持该请求';
|
|
145
|
+
break;
|
|
146
|
+
default:
|
|
147
|
+
error.message = `连接错误${error.response.status}`;
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
error.message = '接口出现问题,无法请求';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
Toast({
|
|
154
|
+
message: error.message,
|
|
155
|
+
duration: 1500,
|
|
156
|
+
forbidClick: true
|
|
157
|
+
});
|
|
158
|
+
return Promise.reject(error);
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
const base = {
|
|
163
|
+
get: (url, params = {}) => {
|
|
164
|
+
if (params.params && url.search('registerNew') === -1) {
|
|
165
|
+
params.params.userId = params.params.userId
|
|
166
|
+
? params.params.userId
|
|
167
|
+
: $.getStorage('userId');
|
|
168
|
+
} else if (url.search('registerNew') === -1) {
|
|
169
|
+
params.userId = params.userId
|
|
170
|
+
? params.userId
|
|
171
|
+
: $.getStorage('userId');
|
|
172
|
+
}
|
|
173
|
+
if (url.search('mecpSys/login') !== -1) {
|
|
174
|
+
delete params.userId;
|
|
175
|
+
}
|
|
176
|
+
if (url.search('mecp.invest') !== -1) {
|
|
177
|
+
if (params.params) {
|
|
178
|
+
params.params.userId = 'u1b9f3ce4731649e0b665af015d74c19b';
|
|
179
|
+
} else {
|
|
180
|
+
params.userId = 'u1b9f3ce4731649e0b665af015d74c19b';
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return http.get(
|
|
184
|
+
url,
|
|
185
|
+
{
|
|
186
|
+
params
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
post: (url, params = {}) => {
|
|
190
|
+
if (params.params) {
|
|
191
|
+
params.params.userId = $.getStorage('userId');
|
|
192
|
+
} else {
|
|
193
|
+
params.userId = $.getStorage('userId');
|
|
194
|
+
}
|
|
195
|
+
return http.post(url, params);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
export default base;
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import fecha from 'element-ui/src/utils/date';
|
|
2
|
+
import { t } from 'element-ui/src/locale';
|
|
3
|
+
|
|
4
|
+
const weeks = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
|
|
5
|
+
const months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
|
|
6
|
+
|
|
7
|
+
const newArray = function(start, end) {
|
|
8
|
+
let result = [];
|
|
9
|
+
for (let i = start; i <= end; i++) {
|
|
10
|
+
result.push(i);
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const getI18nSettings = () => {
|
|
16
|
+
return {
|
|
17
|
+
dayNamesShort: weeks.map(week => t(`el.datepicker.weeks.${week}`)),
|
|
18
|
+
dayNames: weeks.map(week => t(`el.datepicker.weeks.${week}`)),
|
|
19
|
+
monthNamesShort: months.map(month => t(`el.datepicker.months.${month}`)),
|
|
20
|
+
monthNames: months.map((month, index) => t(`el.datepicker.month${index + 1}`)),
|
|
21
|
+
amPm: ['am', 'pm']
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const toDate = function(date) {
|
|
26
|
+
return isDate(date) ? new Date(date) : null;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const isDate = function(date) {
|
|
30
|
+
if (date === null || date === undefined) return false;
|
|
31
|
+
if (isNaN(new Date(date).getTime())) return false;
|
|
32
|
+
if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
|
|
33
|
+
return true;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const isDateObject = function(val) {
|
|
37
|
+
return val instanceof Date;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const formatDate = function(date, format) {
|
|
41
|
+
date = toDate(date);
|
|
42
|
+
if (!date) return '';
|
|
43
|
+
return fecha.format(date, format || 'yyyy-MM-dd', getI18nSettings());
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const parseDate = function(string, format) {
|
|
47
|
+
return fecha.parse(string, format || 'yyyy-MM-dd', getI18nSettings());
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const getDayCountOfMonth = function(year, month) {
|
|
51
|
+
if (month === 3 || month === 5 || month === 8 || month === 10) {
|
|
52
|
+
return 30;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (month === 1) {
|
|
56
|
+
if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
|
|
57
|
+
return 29;
|
|
58
|
+
} else {
|
|
59
|
+
return 28;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return 31;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const getDayCountOfYear = function(year) {
|
|
67
|
+
const isLeapYear = year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0);
|
|
68
|
+
return isLeapYear ? 366 : 365;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const getFirstDayOfMonth = function(date) {
|
|
72
|
+
const temp = new Date(date.getTime());
|
|
73
|
+
temp.setDate(1);
|
|
74
|
+
return temp.getDay();
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
|
|
78
|
+
// {prev, next} Date should work for Daylight Saving Time
|
|
79
|
+
// Adding 24 * 60 * 60 * 1000 does not work in the above scenario
|
|
80
|
+
export const prevDate = function(date, amount = 1) {
|
|
81
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const nextDate = function(date, amount = 1) {
|
|
85
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const getStartDateOfMonth = function(year, month) {
|
|
89
|
+
const result = new Date(year, month, 1);
|
|
90
|
+
const day = result.getDay();
|
|
91
|
+
|
|
92
|
+
if (day === 0) {
|
|
93
|
+
return prevDate(result, 7);
|
|
94
|
+
} else {
|
|
95
|
+
return prevDate(result, day);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const getWeekNumber = function(src) {
|
|
100
|
+
if (!isDate(src)) return null;
|
|
101
|
+
const date = new Date(src.getTime());
|
|
102
|
+
date.setHours(0, 0, 0, 0);
|
|
103
|
+
// Thursday in current week decides the year.
|
|
104
|
+
date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7));
|
|
105
|
+
// January 4 is always in week 1.
|
|
106
|
+
const week1 = new Date(date.getFullYear(), 0, 4);
|
|
107
|
+
// Adjust to Thursday in week 1 and count number of weeks from date to week 1.
|
|
108
|
+
// Rounding should be fine for Daylight Saving Time. Its shift should never be more than 12 hours.
|
|
109
|
+
return (
|
|
110
|
+
1 +
|
|
111
|
+
Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + ((week1.getDay() + 6) % 7)) / 7)
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const getRangeHours = function(ranges) {
|
|
116
|
+
const hours = [];
|
|
117
|
+
let disabledHours = [];
|
|
118
|
+
|
|
119
|
+
(ranges || []).forEach(range => {
|
|
120
|
+
const value = range.map(date => date.getHours());
|
|
121
|
+
|
|
122
|
+
disabledHours = disabledHours.concat(newArray(value[0], value[1]));
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
if (disabledHours.length) {
|
|
126
|
+
for (let i = 0; i < 24; i++) {
|
|
127
|
+
hours[i] = disabledHours.indexOf(i) === -1;
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
for (let i = 0; i < 24; i++) {
|
|
131
|
+
hours[i] = false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return hours;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const getPrevMonthLastDays = (date, amount) => {
|
|
139
|
+
if (amount <= 0) return [];
|
|
140
|
+
const temp = new Date(date.getTime());
|
|
141
|
+
temp.setDate(0);
|
|
142
|
+
const lastDay = temp.getDate();
|
|
143
|
+
return range(amount).map((_, index) => lastDay - (amount - index - 1));
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const getMonthDays = date => {
|
|
147
|
+
const temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
148
|
+
const days = temp.getDate();
|
|
149
|
+
return range(days).map((_, index) => index + 1);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
function setRangeData(arr, start, end, value) {
|
|
153
|
+
for (let i = start; i < end; i++) {
|
|
154
|
+
arr[i] = value;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export const getRangeMinutes = function(ranges, hour) {
|
|
159
|
+
const minutes = new Array(60);
|
|
160
|
+
|
|
161
|
+
if (ranges.length > 0) {
|
|
162
|
+
ranges.forEach(range => {
|
|
163
|
+
const start = range[0];
|
|
164
|
+
const end = range[1];
|
|
165
|
+
const startHour = start.getHours();
|
|
166
|
+
const startMinute = start.getMinutes();
|
|
167
|
+
const endHour = end.getHours();
|
|
168
|
+
const endMinute = end.getMinutes();
|
|
169
|
+
if (startHour === hour && endHour !== hour) {
|
|
170
|
+
setRangeData(minutes, startMinute, 60, true);
|
|
171
|
+
} else if (startHour === hour && endHour === hour) {
|
|
172
|
+
setRangeData(minutes, startMinute, endMinute + 1, true);
|
|
173
|
+
} else if (startHour !== hour && endHour === hour) {
|
|
174
|
+
setRangeData(minutes, 0, endMinute + 1, true);
|
|
175
|
+
} else if (startHour < hour && endHour > hour) {
|
|
176
|
+
setRangeData(minutes, 0, 60, true);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
} else {
|
|
180
|
+
setRangeData(minutes, 0, 60, true);
|
|
181
|
+
}
|
|
182
|
+
return minutes;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export const range = function(n) {
|
|
186
|
+
// see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
|
|
187
|
+
return Array.apply(null, { length: n }).map((_, n) => n);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export const modifyDate = function(date, y, m, d) {
|
|
191
|
+
return new Date(
|
|
192
|
+
y,
|
|
193
|
+
m,
|
|
194
|
+
d,
|
|
195
|
+
date.getHours(),
|
|
196
|
+
date.getMinutes(),
|
|
197
|
+
date.getSeconds(),
|
|
198
|
+
date.getMilliseconds()
|
|
199
|
+
);
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export const modifyTime = function(date, h, m, s) {
|
|
203
|
+
return new Date(
|
|
204
|
+
date.getFullYear(),
|
|
205
|
+
date.getMonth(),
|
|
206
|
+
date.getDate(),
|
|
207
|
+
h,
|
|
208
|
+
m,
|
|
209
|
+
s,
|
|
210
|
+
date.getMilliseconds()
|
|
211
|
+
);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export const modifyWithTimeString = (date, time) => {
|
|
215
|
+
if (date == null || !time) {
|
|
216
|
+
return date;
|
|
217
|
+
}
|
|
218
|
+
time = parseDate(time, 'HH:mm:ss');
|
|
219
|
+
return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export const clearTime = function(date) {
|
|
223
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export const clearMilliseconds = function(date) {
|
|
227
|
+
return new Date(
|
|
228
|
+
date.getFullYear(),
|
|
229
|
+
date.getMonth(),
|
|
230
|
+
date.getDate(),
|
|
231
|
+
date.getHours(),
|
|
232
|
+
date.getMinutes(),
|
|
233
|
+
date.getSeconds(),
|
|
234
|
+
0
|
|
235
|
+
);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
export const limitTimeRange = function(date, ranges, format = 'HH:mm:ss') {
|
|
239
|
+
// TODO: refactory a more elegant solution
|
|
240
|
+
if (ranges.length === 0) return date;
|
|
241
|
+
const normalizeDate = date => fecha.parse(fecha.format(date, format), format);
|
|
242
|
+
const ndate = normalizeDate(date);
|
|
243
|
+
const nranges = ranges.map(range => range.map(normalizeDate));
|
|
244
|
+
if (nranges.some(nrange => ndate >= nrange[0] && ndate <= nrange[1])) return date;
|
|
245
|
+
|
|
246
|
+
let minDate = nranges[0][0];
|
|
247
|
+
let maxDate = nranges[0][0];
|
|
248
|
+
|
|
249
|
+
nranges.forEach(nrange => {
|
|
250
|
+
minDate = new Date(Math.min(nrange[0], minDate));
|
|
251
|
+
maxDate = new Date(Math.max(nrange[1], minDate));
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
const ret = ndate < minDate ? minDate : maxDate;
|
|
255
|
+
// preserve Year/Month/Date
|
|
256
|
+
return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export const timeWithinRange = function(date, selectableRange, format) {
|
|
260
|
+
const limitedDate = limitTimeRange(date, selectableRange, format);
|
|
261
|
+
return limitedDate.getTime() === date.getTime();
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export const changeYearMonthAndClampDate = function(date, year, month) {
|
|
265
|
+
// clamp date to the number of days in `year`, `month`
|
|
266
|
+
// eg: (2010-1-31, 2010, 2) => 2010-2-28
|
|
267
|
+
const monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
|
|
268
|
+
return modifyDate(date, year, month, monthDate);
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
export const prevMonth = function(date) {
|
|
272
|
+
const year = date.getFullYear();
|
|
273
|
+
const month = date.getMonth();
|
|
274
|
+
return month === 0
|
|
275
|
+
? changeYearMonthAndClampDate(date, year - 1, 11)
|
|
276
|
+
: changeYearMonthAndClampDate(date, year, month - 1);
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
export const nextMonth = function(date) {
|
|
280
|
+
const year = date.getFullYear();
|
|
281
|
+
const month = date.getMonth();
|
|
282
|
+
return month === 11
|
|
283
|
+
? changeYearMonthAndClampDate(date, year + 1, 0)
|
|
284
|
+
: changeYearMonthAndClampDate(date, year, month + 1);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
export const prevYear = function(date, amount = 1) {
|
|
288
|
+
const year = date.getFullYear();
|
|
289
|
+
const month = date.getMonth();
|
|
290
|
+
return changeYearMonthAndClampDate(date, year - amount, month);
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
export const nextYear = function(date, amount = 1) {
|
|
294
|
+
const year = date.getFullYear();
|
|
295
|
+
const month = date.getMonth();
|
|
296
|
+
return changeYearMonthAndClampDate(date, year + amount, month);
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
export const extractDateFormat = function(format) {
|
|
300
|
+
return format
|
|
301
|
+
.replace(/\W?m{1,2}|\W?ZZ/g, '')
|
|
302
|
+
.replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '')
|
|
303
|
+
.trim();
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
export const extractTimeFormat = function(format) {
|
|
307
|
+
return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
export const validateRangeInOneMonth = function(start, end) {
|
|
311
|
+
return start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear();
|
|
312
|
+
};
|