├── src
├── assets
│ ├── index.scss
│ └── styles
│ │ └── color.scss
├── styles
│ ├── components
│ │ ├── icon.scss
│ │ ├── baseColor.scss
│ │ ├── picker-date
│ │ │ └── index.scss
│ │ ├── selectDrop.scss
│ │ ├── mxGraph.scss
│ │ ├── dropdown.scss
│ │ ├── collapse.scss
│ │ └── button.scss
│ └── index.scss
├── components
│ ├── table
│ │ ├── index.js
│ │ ├── slot.js
│ │ └── table.vue
│ ├── icon
│ │ ├── index.js
│ │ └── icon.vue
│ ├── button
│ │ ├── index.js
│ │ └── button.vue
│ ├── mGraph
│ │ ├── index.js
│ │ ├── images
│ │ │ └── grid.gif
│ │ ├── event.js
│ │ ├── toobar.vue
│ │ ├── mxGraph.vue
│ │ └── Graph.vue
│ ├── calendar
│ │ ├── index.js
│ │ ├── utils.js
│ │ ├── calendar.scss
│ │ └── calendar.vue
│ ├── date-picker
│ │ ├── index.js
│ │ ├── panel
│ │ │ ├── panel-mixin.js
│ │ │ └── Date
│ │ │ │ ├── date-panel-label.vue
│ │ │ │ └── date.vue
│ │ ├── picker
│ │ │ └── date-picker.js
│ │ └── picker.vue
│ ├── awesomeProgress
│ │ ├── index.js
│ │ └── awesomeProgress.vue
│ ├── editTab
│ │ ├── index.js
│ │ ├── utils.js
│ │ ├── Tab.vue
│ │ └── editTabs.vue
│ ├── list
│ │ ├── index.js
│ │ ├── listItem.vue
│ │ └── list.vue
│ ├── collapse
│ │ ├── index.js
│ │ ├── panel.vue
│ │ └── collapse.vue
│ ├── grid
│ │ └── row.vue
│ ├── base
│ │ └── notification
│ │ │ ├── transfer-queue.js
│ │ │ ├── index.js
│ │ │ ├── notice.vue
│ │ │ └── notification.vue
│ ├── dropdown
│ │ ├── dropdown-menu.vue
│ │ ├── index.js
│ │ ├── dropdown-item.vue
│ │ ├── dropdown.vue
│ │ └── drop.vue
│ ├── message
│ │ └── index.js
│ ├── HelloWorld.vue
│ └── invented
│ │ └── index.vue
├── views
│ ├── images
│ │ └── logo.png
│ ├── invented
│ │ └── index.vue
│ ├── About.vue
│ ├── undo
│ │ ├── index.vue
│ │ └── draggbleItem.vue
│ ├── Home.vue
│ └── mxGraph.vue
├── store.js
├── App.vue
├── directive
│ ├── index.js
│ ├── drag.js
│ └── v-click-outside-x.js
├── router.js
├── main.js
└── utils
│ └── utils.js
├── README.md
├── .browserslistrc
├── babel.config.js
├── postcss.config.js
├── public
├── favicon.ico
└── index.html
├── .editorconfig
├── .gitignore
├── .eslintrc.js
├── vue.config.js
└── package.json
/src/assets/index.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/assets/styles/color.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # workinteresting
2 |
--------------------------------------------------------------------------------
/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 |
--------------------------------------------------------------------------------
/src/styles/components/icon.scss:
--------------------------------------------------------------------------------
1 | .ka-icon {
2 | display: inline-block;
3 | }
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/app'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/src/components/table/index.js:
--------------------------------------------------------------------------------
1 | import Table from "./table";
2 | export default Table;
3 |
--------------------------------------------------------------------------------
/src/components/icon/index.js:
--------------------------------------------------------------------------------
1 | import Icon from './icon.vue'
2 |
3 | export default Icon
4 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | autoprefixer: {}
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/src/components/button/index.js:
--------------------------------------------------------------------------------
1 | import Button from './button.vue'
2 | export default Button
3 |
--------------------------------------------------------------------------------
/src/components/mGraph/index.js:
--------------------------------------------------------------------------------
1 | import mxGraph from "./mxGraph";
2 | export default mxGraph;
3 |
--------------------------------------------------------------------------------
/src/components/calendar/index.js:
--------------------------------------------------------------------------------
1 | import Calendar from "./calendar.vue";
2 | export default Calendar
3 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/whenTheMorningDark/workinteresting/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/src/components/date-picker/index.js:
--------------------------------------------------------------------------------
1 | import DatePicker from './picker/date-picker';
2 |
3 | export default DatePicker;
4 |
--------------------------------------------------------------------------------
/src/views/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/whenTheMorningDark/workinteresting/HEAD/src/views/images/logo.png
--------------------------------------------------------------------------------
/src/components/awesomeProgress/index.js:
--------------------------------------------------------------------------------
1 | import AwesomeProgress from './awesomeProgress.vue'
2 | export default AwesomeProgress;
3 |
--------------------------------------------------------------------------------
/src/components/mGraph/images/grid.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/whenTheMorningDark/workinteresting/HEAD/src/components/mGraph/images/grid.gif
--------------------------------------------------------------------------------
/src/components/editTab/index.js:
--------------------------------------------------------------------------------
1 | import editTabs from "./editTabs";
2 | import Tab from "./Tab";
3 | editTabs.Tab = Tab;
4 | export default editTabs
5 |
--------------------------------------------------------------------------------
/src/components/list/index.js:
--------------------------------------------------------------------------------
1 | import List from './list.vue'
2 | import ListItem from './listItem.vue'
3 | List.Item = ListItem
4 | export default List
5 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.{js,jsx,ts,tsx,vue}]
2 | indent_style = space
3 | indent_size = 2
4 | trim_trailing_whitespace = true
5 | insert_final_newline = true
6 |
--------------------------------------------------------------------------------
/src/components/collapse/index.js:
--------------------------------------------------------------------------------
1 | import Panel from './panel.vue'
2 | import Collapse from './collapse'
3 | Collapse.Panel = Panel
4 | export default Collapse
5 |
--------------------------------------------------------------------------------
/src/styles/components/baseColor.scss:
--------------------------------------------------------------------------------
1 | $fontColor:#fff;
2 | $borderColor:#dcdee2;
3 |
4 | // 基础颜色设置
5 | $primary:#2d8cf0;
6 | $success:#67c23a;
7 | $info:#909399;
8 | $warning:#e6a23c;
9 | $danger:#f56c6c;
--------------------------------------------------------------------------------
/src/components/grid/row.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/src/components/base/notification/transfer-queue.js:
--------------------------------------------------------------------------------
1 | let transferIndex = 0;
2 |
3 | function transferIncrease() {
4 | transferIndex++;
5 | }
6 |
7 | export {
8 | transferIndex,
9 | transferIncrease
10 | };
11 |
--------------------------------------------------------------------------------
/src/components/dropdown/dropdown-menu.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/src/store.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 |
4 | Vue.use(Vuex)
5 |
6 | export default new Vuex.Store({
7 | state: {
8 |
9 | },
10 | mutations: {
11 |
12 | },
13 | actions: {
14 |
15 | }
16 | })
17 |
--------------------------------------------------------------------------------
/src/components/dropdown/index.js:
--------------------------------------------------------------------------------
1 | import Dropdown from "./dropdown.vue"
2 | import DropdownMenu from "./dropdown-menu.vue"
3 | import DropItem from "./dropdown-item"
4 | Dropdown.DropdownMenu = DropdownMenu;
5 | Dropdown.DropItem = DropItem;
6 | export default Dropdown
7 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
17 |
--------------------------------------------------------------------------------
/src/styles/components/picker-date/index.scss:
--------------------------------------------------------------------------------
1 | .ivu-picker-panelbody {
2 | // float: left;
3 | overflow: hidden;
4 |
5 | .ivu-date-picker-header {
6 | height: 32px;
7 | line-height: 32px;
8 | // text-align: center;
9 | border-bottom: 1px solid #e8eaec;
10 | }
11 | }
--------------------------------------------------------------------------------
/src/styles/components/selectDrop.scss:
--------------------------------------------------------------------------------
1 | .ka-select-dropdown {
2 | // width: 100px;
3 | // height: 200px;
4 | margin: 5px 0;
5 | padding: 5px 0;
6 | background-color: #ffffff;
7 | box-sizing: border-box;
8 | border-radius: 4px;
9 | box-shadow: 0 1px 6px rgba(0, 0, 0, .2);
10 | }
--------------------------------------------------------------------------------
/src/directive/index.js:
--------------------------------------------------------------------------------
1 | import drag from "./drag";
2 | const install = function (Vue) {
3 | Vue.directive("calendar-drag", drag);
4 | }
5 |
6 | // if (window.Vue) {
7 | // window['calendar-drag'] = drag;
8 | // Vue.use(install)
9 | // }
10 | drag.install = install;
11 | export default drag;
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 |
14 | # Editor directories and files
15 | .idea
16 | .vscode
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.sw?
22 |
--------------------------------------------------------------------------------
/src/styles/index.scss:
--------------------------------------------------------------------------------
1 | @import "./components/baseColor.scss";
2 | @import "./components/collapse.scss";
3 | @import "./components/icon.scss";
4 | @import "./components/button.scss";
5 | @import "./components/dropdown.scss";
6 | @import "./components/selectDrop.scss";
7 | @import "./components/mxGraph.scss";
8 | @import "./components/picker-date/index.scss";
--------------------------------------------------------------------------------
/src/components/editTab/utils.js:
--------------------------------------------------------------------------------
1 | // 根据当前组件向下找子组件
2 | export const findComponentsDownward = (context, componentName) => {
3 | return context.$children.reduce((components, child) => {
4 | if (child.$options.name === componentName) components.push(child);
5 | const foundChilds = findComponentsDownward(child, componentName);
6 | return components.concat(foundChilds);
7 | }, []);
8 | }
9 |
--------------------------------------------------------------------------------
/src/components/list/listItem.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
--------------------------------------------------------------------------------
/src/views/invented/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
21 |
22 |
24 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | node: true
5 | },
6 | extends: ['plugin:vue/essential', 'eslint:recommended'],
7 | rules: {
8 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
9 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
10 | // //强制使用单引号
11 | // quotes: ['error', 'single'],
12 | // //强制不使用分号结尾
13 | // semi: ['error', 'never']
14 | },
15 | parserOptions: {
16 | parser: 'babel-eslint'
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/components/date-picker/panel/panel-mixin.js:
--------------------------------------------------------------------------------
1 | const prefixCls = 'ivu-picker-panel';
2 | const datePrefixCls = 'ivu-date-picker';
3 |
4 | export default {
5 | props: {
6 | confim: {
7 | type: Boolean,
8 | default: false
9 | }
10 | },
11 | methods: {
12 | iconBtnCls(direction, type = '') {
13 | return [
14 | `${prefixCls}-icon-btn`,
15 | `${datePrefixCls}-${direction}-btn`,
16 | `${datePrefixCls}-${direction}-btn-arrow${type}`,
17 | ];
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/styles/components/mxGraph.scss:
--------------------------------------------------------------------------------
1 | .mxGraph {
2 | width: 100%;
3 | height: 100%;
4 |
5 | .toolbar {
6 | display: flex;
7 | width: 100%;
8 | height: 35px;
9 | border: 1px solid #dddddd;
10 | align-items: center;
11 |
12 | .toolbar-item {
13 | width: 25px;
14 | height: 25px;
15 | display: flex;
16 | justify-content: center;
17 | align-items: center;
18 | cursor: pointer;
19 | }
20 | }
21 |
22 | .container {
23 | width: 100%;
24 | height: 100%;
25 | }
26 | }
--------------------------------------------------------------------------------
/src/views/About.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
6 |
8 |
9 | {{ book.name }}
10 |
11 |
12 |
13 |
14 |
15 |
27 |
--------------------------------------------------------------------------------
/src/components/calendar/utils.js:
--------------------------------------------------------------------------------
1 | const getNewDate = date => {
2 | let year = date.getFullYear();
3 | let month = date.getMonth();
4 | let day = date.getDate();
5 | let hour = date.getHours();
6 | let minute = date.getMinutes();
7 | let second = date.getSeconds();
8 | return {
9 | year,
10 | month,
11 | day,
12 | hour,
13 | minute,
14 | second
15 | };
16 | };
17 | // 获取指定年月日获取日期
18 | const getDate = (year, month, day) => {
19 | return new Date(year, month, day);
20 | };
21 | export { getNewDate, getDate };
22 |
--------------------------------------------------------------------------------
/src/components/table/slot.js:
--------------------------------------------------------------------------------
1 | export default {
2 | functional: true, // 无状态组件
3 | props: {
4 | row: Object,
5 | column: Object,
6 | index: Number
7 | },
8 | render: (h, ctx) => {
9 | console.log(ctx);
10 | // console.log(ctx.injections.tableRoot.$scopedSlots[ctx.props.column.slot]({
11 | // row: ctx.props.row,
12 | // column: ctx.props.column,
13 | // index: ctx.props.index
14 | // }))
15 | return h(
16 | "div", {
17 | style: {
18 | color: "red"
19 | }
20 | }, "asddsa");
21 | }
22 | };
23 |
--------------------------------------------------------------------------------
/src/components/date-picker/picker/date-picker.js:
--------------------------------------------------------------------------------
1 | import Picker from "../picker";
2 | import DatePickerPanel from "../panel/Date/date";
3 | export default {
4 | name: "CalenDarPicker",
5 | mixins: [Picker],
6 | props: {
7 | type: {
8 | default: "date"
9 | }
10 | },
11 | components: {
12 | DatePickerPanel
13 | },
14 | computed: {
15 | panel() {
16 | const isRange = this.type === 'daterange' || this.type === 'datetimerange';
17 | return isRange ? 'RangeDatePickerPanel' : 'DatePickerPanel';
18 | },
19 | ownPickerProps() {
20 | return this.options;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | workinteresting
10 |
11 |
12 |
13 |
14 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/components/base/notification/index.js:
--------------------------------------------------------------------------------
1 | import Notification from "./Notification";
2 | import Vue from "vue";
3 |
4 | Notification.newInstance = properties => {
5 | const _props = properties || {};
6 |
7 | const Instance = new Vue({
8 | render(h) {
9 | return h(Notification, {
10 | props: _props
11 | })
12 | }
13 | })
14 | const component = Instance.$mount();
15 | document.body.appendChild(component.$el);
16 | const notification = Instance.$children[0];
17 | console.log(notification);
18 | return {
19 | notice(noticeProps) {
20 | console.log("notice");
21 | notification.add(noticeProps) // 调用notification中的add方法
22 | },
23 | component: notification
24 | }
25 | }
26 | export default Notification;
27 |
--------------------------------------------------------------------------------
/src/components/editTab/Tab.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/components/mGraph/event.js:
--------------------------------------------------------------------------------
1 | // 主要存放于mxgraph事件
2 | import {
3 | mxUndoManager,
4 | mxEvent
5 | } from 'mxgraph/javascript/mxClient'
6 | export default {
7 | methods: {
8 | initUndoManager() {
9 | // this.undoManager
10 | this.undoManager = new mxUndoManager();
11 | const listener = (sender, evt) => {
12 | console.log(evt);
13 | console.log(sender)
14 | this.undoManager.undoableEditHappened(evt.getProperty('edit'));
15 | }
16 | // console.log(this.graph);
17 | this.graph.getModel().addListener(mxEvent.UNDO, listener)
18 | this.graph.getView().addListener(mxEvent.UNDO, listener)
19 | },
20 | undoFun() {
21 | if (this.graph.isEnabled()) {
22 |
23 | // console.log(this.undoManager.undo())
24 | this.undoManager.undo();
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/vue.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | publicPath: './',
3 | outputDir: 'dist',
4 | lintOnSave: true,
5 | chainWebpack: (config) => {
6 | config.module
7 | .rule('')
8 | .test(/mxClient\.js$/)
9 | .use('exports-loader')
10 | .loader('exports-loader?mxClient,mxToolbar,mxConnectionHandler,mxEllipse,mxConnectionConstraint,mxWindow,' +
11 | 'mxObjectCodec,mxGraphModel,mxActor,mxPopupMenu,mxShape,mxEventObject,mxGraph,mxPopupMenuHandler,mxPrintPreview,' +
12 | 'mxEventSource,mxRectangle,mxVertexHandler,mxMouseEvent,mxGraphView,mxCodecRegistry,mxImage,mxGeometry,' +
13 | 'mxRubberband,mxConstraintHandler,mxKeyHandler,mxDragSource,mxGraphModel,mxEvent,mxUtils,mxEvent,mxCodec,mxCell,' +
14 | 'mxConstants,mxPoint,mxGraphHandler,mxCylinder,mxCellRenderer,mxEvent,mxUndoManager')
15 | .end()
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/router.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable indent */
2 | import Vue from 'vue'
3 | import Router from 'vue-router'
4 | import Home from './views/Home.vue'
5 | Vue.use(Router)
6 |
7 | export default new Router({
8 | mode: 'history',
9 | base: process.env.BASE_URL,
10 | routes: [{
11 | path: '/',
12 | name: 'home',
13 | component: Home
14 | },
15 | {
16 | path: '/about',
17 | name: 'about',
18 | component: () => import('./views/About.vue')
19 | },
20 | {
21 | path: '/invented',
22 | name: 'invented',
23 | component: () => import('./views/invented')
24 | },
25 | {
26 | path: '/undo',
27 | name: 'undo',
28 | component: () => import('./views/undo')
29 | },
30 | {
31 | path: '/mxHome',
32 | name: 'mxHome',
33 | component: () => import('./views/mxGraph')
34 | },
35 | ]
36 | })
37 |
--------------------------------------------------------------------------------
/src/components/date-picker/panel/Date/date-panel-label.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ datePanelLabel.labels[0].label }}
7 | {{ datePanelLabel.separator }}
8 | {{ datePanelLabel.labels[1].label }}
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/views/undo/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
43 |
44 |
--------------------------------------------------------------------------------
/src/components/button/button.vue:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
44 |
--------------------------------------------------------------------------------
/src/components/icon/icon.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
45 |
46 |
--------------------------------------------------------------------------------
/src/styles/components/dropdown.scss:
--------------------------------------------------------------------------------
1 | .ka-dropdown {
2 | display: inline-block;
3 |
4 | .ka-dropdown-rel {
5 | position: relative;
6 | }
7 |
8 | .ka-select-dropdown {
9 | overflow: hidden;
10 | transform-origin: center top
11 | }
12 |
13 | .ka-dropdown-menu {
14 | min-width: 100px;
15 |
16 | .ka-dropdown-item {
17 | margin: 0;
18 | line-height: normal;
19 | padding: 7px 16px;
20 | clear: both;
21 | color: #515a6e;
22 | font-size: 14px !important;
23 | white-space: nowrap;
24 | list-style: none;
25 | cursor: pointer;
26 | transition: background .2s ease-in-out;
27 |
28 | &.ka-dropdown-item-disabled {
29 | color: #c5c8ce;
30 | cursor: not-allowed;
31 |
32 | &:hover {
33 | background: #ffffff !important;
34 | }
35 | }
36 |
37 | &.ka-dropdown-item-divied {
38 | border-bottom: 1px solid #dddddd;
39 | }
40 |
41 | &:hover {
42 | background: #dddddd;
43 | }
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/src/components/mGraph/toobar.vue:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
45 |
46 |
--------------------------------------------------------------------------------
/src/components/calendar/calendar.scss:
--------------------------------------------------------------------------------
1 | .panel {
2 | width: 32 * 7px;
3 | position: absolute;
4 | background: #ffffff;
5 | // box-shadow: 2px 2px 2px pink, -2px -2px -2px pink;
6 |
7 | .panel-nav {
8 | display: flex;
9 | justify-content: space-around;
10 | height: 30px;
11 |
12 | span {
13 | cursor: pointer;
14 | user-select: none;
15 | }
16 | }
17 |
18 | .panel-content {
19 | .cell {
20 | display: inline-flex;
21 | justify-content: center;
22 | align-items: center;
23 | width: 32px;
24 | height: 32px;
25 | font-weight: bold;
26 | box-sizing: border-box;
27 | cursor: pointer;
28 |
29 | &.cell-days:hover {
30 | border: 1px solid #dddddd;
31 | }
32 |
33 | &.select {
34 | border: 1px solid #dddddd;
35 | }
36 | }
37 | }
38 |
39 | .panel-footer {
40 | height: 30px;
41 | text-align: center;
42 | }
43 |
44 | .notCurrentMonth {
45 | color: gray;
46 | }
47 |
48 | .today {
49 | background: #dddddd;
50 | color: #ffffff;
51 | border-radius: 4px;
52 | }
53 | }
--------------------------------------------------------------------------------
/src/components/dropdown/dropdown-item.vue:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
54 |
55 |
--------------------------------------------------------------------------------
/src/styles/components/collapse.scss:
--------------------------------------------------------------------------------
1 | .ka-collapse {
2 | background: #f7f7f7;
3 | border-radius: 3px;
4 | border: 1px solid #dcdee2;
5 |
6 | .ka-collapse-item {
7 | border-top: 1px solid #dcdee2;
8 |
9 | .ka-collapse-header {
10 | height: 38px;
11 | line-height: 38px;
12 | padding-left: 16px;
13 | color: #666;
14 | cursor: pointer;
15 | position: relative;
16 | border-bottom: 1px solid transparent;
17 | transition: all .2s ease-in-out;
18 |
19 | >i {
20 | margin-right: 14px;
21 | transition: all .2s ease-in-out;
22 | }
23 | }
24 |
25 | .ka-collapse-content {
26 | color: #515a6e;
27 | padding: 0 16px;
28 | background-color: #fff;
29 |
30 | >.ka-collapse-content-box {
31 | padding-top: 16px;
32 | padding-bottom: 16px;
33 | }
34 | }
35 |
36 | &:first-child {
37 | border-top: 0;
38 | }
39 |
40 | &.ka-collapse-item-active {
41 | .ka-collapse-header {
42 | >i {
43 | transform: rotate(90deg);
44 | }
45 | }
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "workinteresting",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve",
7 | "build": "vue-cli-service build",
8 | "lint": "vue-cli-service lint"
9 | },
10 | "dependencies": {
11 | "babel-plugin-transform-runtime": "^6.23.0",
12 | "babel-preset-vue": "^2.0.2",
13 | "bezier-easing": "^2.1.0",
14 | "core-js": "^2.6.5",
15 | "eslint-plugin-flow-vars": "^0.5.0",
16 | "eslint-plugin-html": "^6.0.0",
17 | "mxgraph": "^3.9.12",
18 | "node-sass": "^4.12.0",
19 | "popper.js": "^1.16.0",
20 | "sass-loader": "^7.3.1",
21 | "vue": "^2.6.10",
22 | "vue-router": "^3.0.3",
23 | "vuex": "^3.0.1"
24 | },
25 | "devDependencies": {
26 | "@vue/cli-plugin-babel": "^3.11.0",
27 | "@vue/cli-plugin-eslint": "^3.11.0",
28 | "@vue/cli-service": "^3.11.0",
29 | "@vue/eslint-config-standard": "^4.0.0",
30 | "babel-eslint": "^10.0.3",
31 | "babel-preset-env": "^1.7.0",
32 | "babel-preset-stage-0": "^6.24.1",
33 | "eslint": "^5.16.0",
34 | "eslint-friendly-formatter": "^4.0.1",
35 | "eslint-loader": "^3.0.2",
36 | "eslint-plugin-vue": "^5.0.0",
37 | "node-sass": "^4.9.0",
38 | "sass-loader": "^7.1.0",
39 | "vue-template-compiler": "^2.6.10",
40 | "exports-loader": "^0.7.0",
41 | "script-loader": "^0.7.2"
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/views/Home.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 | 字典一的内容
8 |
9 |
12 | 字典二的内容
13 |
14 |
17 | 字典三的内容
18 |
19 |
22 | 字典4的内容
23 |
24 |
27 | 字典4a的内容
28 |
29 |
32 | 字典4b的内容
33 |
34 |
35 |
36 |
37 |
38 |
55 |
67 |
--------------------------------------------------------------------------------
/src/components/collapse/panel.vue:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 |
65 |
66 |
--------------------------------------------------------------------------------
/src/components/table/table.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | |
6 | {{col.title}}
7 | |
8 |
9 |
10 |
12 | |
14 |
15 |
18 |
19 |
20 | {{row[col.key]}}
21 |
22 | |
23 |
24 |
25 |
26 |
27 |
55 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import router from './router'
4 | import store from './store'
5 | import utils from './utils/utils'
6 | import Button from './components/button'
7 | import List from './components/list'
8 | import Icon from './components/icon'
9 | import Collapse from './components/collapse'
10 | import Dropdown from "./components/dropdown"
11 | import mxGraph from "./components/mGraph"
12 | import AwesomeProgress from "./components/awesomeProgress"
13 | import Table from "./components/table"
14 | import Message from "./components/message"
15 | import Calendar from "./components/calendar"
16 | import DatePicker from "./components/date-picker"
17 | import editTabs from "./components/editTab"
18 | import "./styles/index.scss"
19 | Vue.prototype.$utils = utils
20 | Vue.config.productionTip = false
21 | Vue.component('Button', Button)
22 | Vue.component('List', List)
23 | Vue.component('ListItem', List.Item)
24 | Vue.component('Icon', Icon)
25 | Vue.component('Collapse', Collapse)
26 | Vue.component('Panel', Collapse.Panel)
27 | Vue.component('Dropdown', Dropdown)
28 | Vue.component('DropdownMenu', Dropdown.DropdownMenu)
29 | Vue.component('DropdownItem', Dropdown.DropItem)
30 | Vue.component('mxGraph', mxGraph)
31 | Vue.component('AwesomeProgress', AwesomeProgress)
32 | Vue.component('Table', Table)
33 | Vue.component('Calendar', Calendar)
34 | Vue.component('DatePicker', DatePicker)
35 | Vue.component('editTabs', editTabs)
36 | Vue.component('Tab', editTabs.Tab)
37 | Vue.prototype.$Message = Message;
38 | new Vue({
39 | router,
40 | store,
41 | render: h => h(App)
42 | }).$mount('#app')
43 |
--------------------------------------------------------------------------------
/src/components/dropdown/dropdown.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
10 |
11 |
12 |
13 |
14 |
15 |
66 |
67 |
--------------------------------------------------------------------------------
/src/components/date-picker/panel/Date/date.vue:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
57 |
--------------------------------------------------------------------------------
/src/directive/drag.js:
--------------------------------------------------------------------------------
1 | // 日历拖拽指令
2 | export default {
3 | bind(el, binding, vnode) {
4 | let dragHeader = el.querySelector(".calendar-header");
5 | let dragDom = el;
6 | dragHeader.style.cssText += ';cursor:move';
7 | dragDom.style.cssText += ';top:0px'
8 | dragHeader.onmousedown = (e) => {
9 | e = e || window.event
10 | let startX = e.clientX;
11 | let startY = e.clientY;
12 | const disX = e.clientX - dragDom.offsetLeft;
13 | const disY = e.clientY - dragDom.offsetTop;
14 | const dragDomWidth = dragDom.offsetWidth;
15 | const screenWidth = window.innerWidth;
16 | const dragDomHeight = dragDom.offsetHeight;
17 | const screenHeight = window.innerHeight;
18 | document.onmousemove = function (e) {
19 | e = e || window.event
20 | let left = e.clientX - disX;
21 | let top = e.clientY - disY;
22 | if (left <= 0) {
23 | left = 0;
24 | } else if (left >= screenWidth - dragDomWidth) {
25 | left = screenWidth - dragDomWidth;
26 | }
27 | if (top <= 0) {
28 | top = 0;
29 | } else if (top > screenHeight - dragDomHeight) {
30 | top = screenHeight - dragDomHeight
31 | }
32 |
33 | dragDom.style.cssText += `;left:${left}px;top:${top}px`
34 | }
35 | document.onmouseup = function (e) {
36 | console.log(vnode);
37 | e = e || window.event
38 | let endX = e.clientX;
39 | let endY = e.clientY;
40 | if (startX === endX && startY === endY) {
41 | console.log("click");
42 | vnode.child.$emit("headerEvent", "click");
43 | } else {
44 | vnode.child.$emit("headerEvent", "onmouseup");
45 | }
46 | document.onmousemove = null
47 | document.onmouseup = null
48 | }
49 | }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/styles/components/button.scss:
--------------------------------------------------------------------------------
1 | @keyframes ka-loading-loop {
2 | from {
3 | transform: rotate(0deg);
4 | }
5 |
6 | to {
7 | transform: rotate(360deg);
8 | }
9 | }
10 |
11 | .ka-btn[disabled] {
12 | cursor: not-allowed;
13 | opacity: 0.5;
14 | }
15 |
16 | .ka-btn {
17 | outline: none;
18 | line-height: 1.5;
19 | display: inline-block;
20 | margin-bottom: 0;
21 | font-weight: 400;
22 | text-align: center;
23 | vertical-align: middle;
24 | touch-action: manipulation;
25 | cursor: pointer;
26 | background-image: none;
27 | border: 1px solid transparent;
28 | white-space: nowrap;
29 | user-select: none;
30 | height: 32px;
31 | padding: 0 15px;
32 | font-size: 14px;
33 | border-radius: 4px;
34 | transition: color .2s linear, background-color .2s linear, border .2s linear, box-shadow .2s linear;
35 | color: #515a6e;
36 | background-color: $fontColor;
37 | border-color: $borderColor;
38 |
39 | +.ka-btn {
40 | margin-left: 10px;
41 | }
42 |
43 | &.ka-btn-primary {
44 | color: $fontColor;
45 | background-color: $primary;
46 | border-color: $primary;
47 | }
48 |
49 | &.ka-btn-success {
50 | color: $fontColor;
51 | background-color: $success;
52 | border-color: $success;
53 | }
54 |
55 | &.ka-btn-info {
56 | color: $fontColor;
57 | background-color: $info;
58 | border-color: $info;
59 | }
60 |
61 | &.ka-btn-warning {
62 | color: $fontColor;
63 | background-color: $warning;
64 | border-color: $warning;
65 | }
66 |
67 | &.ka-btn-danger {
68 | color: $fontColor;
69 | background-color: $danger;
70 | border-color: $danger;
71 | }
72 |
73 | &.ka-btn-loading {
74 | // background: red;
75 | // filter: blur(1);
76 | cursor: not-allowed;
77 | opacity: 0.5;
78 | }
79 |
80 | .ka-loading {
81 | animation: ka-loading-loop 1s linear infinite;
82 | }
83 | }
--------------------------------------------------------------------------------
/src/components/base/notification/notice.vue:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
81 |
82 |
--------------------------------------------------------------------------------
/src/components/message/index.js:
--------------------------------------------------------------------------------
1 | import Notification from "../base/notification/index";
2 | const prefixCls = "ivu-message";
3 | const prefixKey = 'ivu_message_key_';
4 | // const iconPrefixCls = 'ivu-icon';
5 | const defaults = {
6 | top: 24,
7 | duration: 1.5
8 | }
9 | // const iconTypes = {
10 | // 'info': 'ios-information-circle',
11 | // 'success': 'ios-checkmark-circle',
12 | // 'warning': 'ios-alert',
13 | // 'error': 'ios-close-circle',
14 | // 'loading': 'ios-loading'
15 | // };
16 |
17 | let messageInstance;
18 | let name = 1;
19 |
20 | function getMessageInstance() {
21 | messageInstance = messageInstance || Notification.newInstance({
22 | prefixCls: prefixCls,
23 | style: {
24 | top: `${defaults.top}px`
25 | }
26 | })
27 | return messageInstance;
28 | }
29 |
30 | // 定义message中的notice方法
31 | function notice(content = "", duration = defaults.duration, type, onClose = function () {}, closable = false) {
32 | // const iconType = iconTypes[type];
33 |
34 | // const loadCls = type === 'loading'?'ivu-load-loop':'';
35 | let instance = getMessageInstance();
36 | instance.notice({
37 | name: `${prefixKey}${name}`,
38 | duration: duration,
39 | styles: {},
40 | content: `我是message${content}`,
41 | onClose: onClose,
42 | type: "message",
43 | msgType: type,
44 | closable
45 | })
46 | return (function () {
47 | let target = name++;
48 | return function () {
49 | instance.remove(`${prefixKey}${target}`)
50 | }
51 | })()
52 | }
53 | export default {
54 | name: 'Message',
55 |
56 | info(options) {
57 | console.log("info");
58 | return this.message('info', options);
59 | },
60 | message(type, options) {
61 | if (typeof options === 'string') {
62 | options = {
63 | content: options
64 | };
65 | }
66 | return notice(options.content, options.duration, type, options.onClose, options.closable, options.render, options.background);
67 | },
68 | destroy() {
69 | let instance = getMessageInstance();
70 | messageInstance = null;
71 | instance.destroy('ivu-message');
72 | }
73 | };
74 |
--------------------------------------------------------------------------------
/src/components/HelloWorld.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
5 | For a guide and recipes on how to configure / customize this project,
6 | check out the
7 | vue-cli documentation.
8 |
9 |
Installed CLI Plugins
10 |
14 |
Essential Links
15 |
22 |
Ecosystem
23 |
30 |
31 |
32 |
33 |
41 |
42 |
43 |
59 |
--------------------------------------------------------------------------------
/src/components/dropdown/drop.vue:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
92 |
93 |
--------------------------------------------------------------------------------
/src/components/base/notification/notification.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
8 |
9 |
10 |
11 |
102 |
103 |
--------------------------------------------------------------------------------
/src/views/mxGraph.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
11 |
12 |
13 |
76 |
87 |
--------------------------------------------------------------------------------
/src/components/list/list.vue:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
61 |
62 | >
127 |
--------------------------------------------------------------------------------
/src/components/collapse/collapse.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
111 |
112 |
--------------------------------------------------------------------------------
/src/components/invented/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
19 | {{ item.value }}
20 |
21 |
22 |
23 |
24 |
25 |
112 |
113 |
146 |
--------------------------------------------------------------------------------
/src/components/date-picker/picker.vue:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
10 |
11 |
12 |
16 |
17 |
20 |
21 |
22 |
23 |
24 |
129 |
--------------------------------------------------------------------------------
/src/views/undo/draggbleItem.vue:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
115 |
116 | >
139 |
140 |
--------------------------------------------------------------------------------
/src/directive/v-click-outside-x.js:
--------------------------------------------------------------------------------
1 | const CLICK = 'click';
2 | const captureInstances = Object.create(null);
3 | const nonCaptureInstances = Object.create(null);
4 | const instancesList = [captureInstances, nonCaptureInstances];
5 | const captureEventHandler = function (event) {
6 | /* eslint-disable-next-line babel/no-invalid-this */
7 | commonHandler(this, captureInstances, event);
8 | };
9 | const nonCaptureEventHandler = function (event) {
10 | /* eslint-disable-next-line babel/no-invalid-this */
11 | commonHandler(this, nonCaptureInstances, event);
12 | };
13 |
14 |
15 | // const getEventHandler = function _getEventHandler(useCapture) {
16 | // return useCapture ? captureEventHandler : nonCaptureEventHandler;
17 | // };
18 |
19 | const getEventHandler = function (useCapture) {
20 | return useCapture ? captureEventHandler : nonCaptureEventHandler;
21 | }
22 |
23 | const commonHandler = function (context, instances, event) {
24 | const {
25 | target
26 | } = event;
27 |
28 | const itemIteratee = function (item) {
29 | console.log(item)
30 | const {
31 | el
32 | } = item;
33 |
34 | if (el !== target && !el.contains(target)) {
35 | const {
36 | binding
37 | } = item;
38 |
39 | if (binding.modifiers.stop) {
40 | event.stopPropagation();
41 | }
42 |
43 | if (binding.modifiers.prevent) {
44 | event.preventDefault();
45 | }
46 |
47 | binding.value.call(context, event);
48 | }
49 | };
50 | const keysIteratee = function (eventName) {
51 | instances[eventName].forEach(itemIteratee);
52 | };
53 | Object.keys(instances).forEach(keysIteratee);
54 | };
55 |
56 | export const directive = Object.defineProperties({}, {
57 | bind: {
58 | value: function bind(el, binding) {
59 | if (typeof binding.value !== 'function') {
60 | throw new TypeError('Binding value must be a function.');
61 | }
62 | console.log(binding);
63 | let eventType;
64 | const modifiers = binding.modifiers;
65 | // console.log(modifiers);
66 | if (modifiers.click) eventType = 'click';
67 | else if (modifiers.mousedown) eventType = 'mousedown';
68 | else if (modifiers.touchstart) eventType = 'touchstart';
69 | else eventType = CLICK;
70 |
71 | const useCapture = binding.arg;
72 | const normalisedBinding = {
73 | ...binding,
74 | ...{
75 | modifiers: {
76 | ...{
77 | capture: false,
78 | prevent: false,
79 | stop: false,
80 | },
81 | ...binding.modifiers,
82 | },
83 | },
84 | };
85 | console.log(normalisedBinding)
86 | const instances = useCapture ? captureInstances : nonCaptureInstances;
87 | console.log(instances);
88 | if (!Array.isArray(instances[eventType])) {
89 | instances[eventType] = []
90 | }
91 | if (instances[eventType].push({
92 | el,
93 | binding: normalisedBinding
94 | }) === 1) {
95 | if (typeof document === 'object' && document) {
96 | console.log("asdasda")
97 | document.addEventListener(
98 | eventType,
99 | getEventHandler(useCapture),
100 | useCapture,
101 | );
102 | }
103 | }
104 | }
105 | },
106 | unbind: {
107 | value: function unbind(el) {
108 | console.log(el)
109 | const compareElements = function _compareElements(item) {
110 | return item.el !== el;
111 | };
112 |
113 | const instancesIteratee = function _instancesIteratee(instances) {
114 | const instanceKeys = Object.keys(instances);
115 |
116 | if (instanceKeys.length) {
117 | const useCapture = instances === captureInstances;
118 |
119 | const keysIteratee = function _keysIteratee(eventName) {
120 | const newInstance = instances[eventName].filter(compareElements);
121 |
122 | if (newInstance.length) {
123 | instances[eventName] = newInstance;
124 | } else {
125 | if (typeof document === 'object' && document) {
126 | document.removeEventListener(
127 | eventName,
128 | getEventHandler(useCapture),
129 | useCapture,
130 | );
131 | }
132 |
133 | delete instances[eventName];
134 | }
135 | };
136 |
137 | instanceKeys.forEach(keysIteratee);
138 | }
139 | };
140 |
141 | instancesList.forEach(instancesIteratee);
142 | },
143 | }
144 | })
145 |
146 | // export const directive = {
147 | // bind: function bind(el, bind) {
148 | // console.log(el);
149 | // console.log(bind)
150 | // }
151 | // }
152 | console.log(directive)
153 |
--------------------------------------------------------------------------------
/src/components/calendar/calendar.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
9 |
10 | <
11 | <<
12 | {{time.year}}年
13 | {{time.month+1}}月
14 | >>
15 | >
16 |
17 |
18 |
19 |
22 | {{weekDays[j-1]}}
23 |
24 |
25 |
27 |
36 | {{visibeDays[(i-1)*7+(j-1)].getDate()}}
37 |
38 |
39 |
40 |
41 |
42 |
45 |
46 |
47 |
48 |
49 |
151 |
152 |
--------------------------------------------------------------------------------
/src/components/mGraph/mxGraph.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
11 |
12 |
13 |
14 |
157 |
158 |
--------------------------------------------------------------------------------
/src/utils/utils.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable space-before-function-paren */
2 | const utils = {
3 | // 生成随机的uid
4 | uid: () => {
5 | return `${+new Date()}${Math.random()}`;
6 | },
7 | /*
8 | 函数节流
9 | */
10 | throttle: (fn, threshhold) => {
11 | let timeout;
12 | let start = new Date();
13 | threshhold = threshhold || 160;
14 | return function () {
15 | const curr = new Date() - 0;
16 | clearTimeout(timeout);
17 | if (curr - start >= threshhold) {
18 | fn.apply(this, arguments);
19 | start = curr;
20 | } else {
21 | timeout = setTimeout(() => {
22 | fn.apply(this, arguments);
23 | }, threshhold);
24 | }
25 | };
26 | },
27 | // 判断参数是否在其中一个
28 | oneOf(value, validList) {
29 | for (let i = 0; i < validList.length; i++) {
30 | if (value === validList[i]) {
31 | return true;
32 | }
33 | }
34 | return false;
35 | },
36 | // 把图片转换成为base64
37 | /**
38 | * element-uploader组件中使用
39 | * onchangeFun (file, fileList) { // 上传图片后,获取图片路径
40 | this.getBase64(file.raw).then(res => {
41 | //doSomeThings
42 | });
43 | }
44 | *
45 | */
46 | getBase64(file) {
47 | return new Promise(function (resolve, reject) {
48 | let reader = new FileReader();
49 | let imgResult = "";
50 | reader.readAsDataURL(file);
51 | reader.onload = function () {
52 | imgResult = reader.result;
53 | };
54 | reader.onerror = function (error) {
55 | reject(error);
56 | };
57 | reader.onloadend = function () {
58 | resolve(imgResult);
59 | };
60 | });
61 | },
62 | // 向上寻找父组件
63 | findComponentUpward(context, componentName, componentNames) {
64 | if (typeof componentName === "string") {
65 | componentNames = [componentName];
66 | } else {
67 | componentNames = componentName;
68 | }
69 | let parent = context.$parent; // 找到这个组件的父元素
70 | let name = parent.$options.name; //找到父元素的name值
71 | while (parent && (!name || componentNames.indexOf(name) < 0)) {
72 | parent = parent.$parent;
73 | if (parent) {
74 | name = parent.$options.name;
75 | }
76 | }
77 | return parent;
78 | },
79 | // 将对象数组去重,根据某个属性字段来去重
80 | /*
81 | @ params arr 去重的数组
82 | @ String string 去重的字段
83 | */
84 | uniqeObjectArr(arr, string) {
85 | let hash = {};
86 | arr = arr.reduce((item, next) => {
87 | hash[next[string]] ? "" : (hash[next[string]] = true && item.push(next));
88 | return item;
89 | }, []);
90 | return arr;
91 | },
92 | // 对象转换成字符串
93 | ObjToStr(val) {
94 | return Object.prototype.toString.call(val);
95 | },
96 | // 判断是不是数组
97 | isArr(val) {
98 | return Array.isArray(val) || this.ObjToStr(val) === "[object Array]";
99 | },
100 | // 判断是不是数字
101 | isNum(val) {
102 | return !isNaN(val) || this.ObjToStr(val) === "[object Number]";
103 | },
104 | // 扁平化数组
105 | /**
106 | * flatten(['a', ['b', ['c']], 'd', ['e']]); // -> ['a', 'b', 'c', 'd', 'e']
107 | *
108 | */
109 | flatten(arr) {
110 | return this.curflatten(arr, []);
111 | },
112 | curflatten(arr, res) {
113 | // arr 初始数组 res 结果数组
114 | let len = arr.length;
115 | let i = -1;
116 | let cur;
117 | while (len) {
118 | len--;
119 | cur = arr[++i];
120 | this.isArr(cur) ? this.curflatten(cur, res) : res.push(cur); // 递归解构数组
121 | }
122 | return res;
123 | },
124 | // 发布新闻时需要提醒发布的时间。
125 | // 写一个函数,传递一个参数为时间戳,完成时间的格式化。
126 | // 如果发布一分钟内,输出:刚刚;
127 | // n 分钟前发布,输出:n分钟前;
128 | // 超过一个小时,输出:n小时前;超过一天,输出:n天前;
129 | // 但超过一个星期,输出发布的准确时间
130 | // let str = "2018-04-07 14:38:16";
131 | // console.log(new Date(str).getTime()) // 都是获取当前时间的毫秒数
132 | // console.log(Date.now()) // 都是获取当前时间的毫秒数
133 | format(date) {
134 | const min = 60 * 1000;
135 | const hour = 60 * min;
136 | const day = hour * 24;
137 | const week = day * 7;
138 | const month = day * 30;
139 | const year = month * 12;
140 | const time = this.isNum(date) ? date : new Date(date).getTime();
141 | const difVal = new Date().getTime() - time;
142 | if (difVal < 0) {
143 | return date;
144 | }
145 | let monthC = difVal / month;
146 | let weekC = difVal / week;
147 | let dayC = difVal / day;
148 | let hourC = difVal / hour;
149 | let minC = difVal / min;
150 | let yearC = difVal / year;
151 | if (yearC >= 1) return parseInt(yearC) + "年前";
152 | if (monthC >= 1) return parseInt(monthC) + "个月前";
153 | if (weekC >= 1) return parseInt(weekC) + "周前";
154 | if (dayC >= 1) return parseInt(dayC) + "天前";
155 | if (hourC >= 1) return parseInt(hourC) + "个小时前";
156 | if (minC >= 1) return parseInt(minC) + "分钟前";
157 | if (minC < 1) return "刚刚";
158 | },
159 | // 数组去重
160 | unique(arr, compare) {
161 | if (!Array.isArray(arr)) {
162 | return []
163 | }
164 | compare = compare || this.isEqual;
165 | return arr.filter((item, index) => {
166 | const len = arr.length;
167 | while (++index < len) {
168 | if (compare(item, arr[index])) return false;
169 | }
170 | return true
171 | })
172 | },
173 | // 默认相等的函数
174 | isEqual(a, b) {
175 | return a === b;
176 | },
177 | // 判断是否是正则对象
178 | isRegExp(val) {
179 | return this.ObjToStr(val) === "[object RegExp]"
180 | },
181 | // 判断是否是空对象
182 | isEmpty(obj) {
183 | for (let key in obj) {
184 | return false;
185 | }
186 | return true;
187 | }
188 | };
189 | export default utils;
190 |
--------------------------------------------------------------------------------
/src/components/mGraph/Graph.vue:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
224 |
225 |
--------------------------------------------------------------------------------
/src/components/awesomeProgress/awesomeProgress.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
278 |
279 |
--------------------------------------------------------------------------------
/src/components/editTab/editTabs.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
8 | 左
9 |
10 |
13 | 右
14 |
15 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
245 |
--------------------------------------------------------------------------------