meixioacomponent 0.3.53 → 0.3.56

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meixioacomponent",
3
- "version": "0.3.53",
3
+ "version": "0.3.56",
4
4
  "private": false,
5
5
  "author": "YuRi",
6
6
  "main": "lib/meixioacomponent.umd.min.js",
@@ -18,6 +18,7 @@
18
18
  "gulp": "^4.0.0",
19
19
  "register-service-worker": "^1.7.1",
20
20
  "vue": "^2.7.0",
21
+ "vue-cropper": "^0.5.8",
21
22
  "vue-router": "^3.2.0",
22
23
  "vuedraggable": "^2.24.3",
23
24
  "vuex": "^3.4.0"
@@ -0,0 +1,131 @@
1
+ <template>
2
+ <base-dialog
3
+ ref="baseDialog"
4
+ :width="`800px`"
5
+ :title="`截图`"
6
+ :hasCloseIcon="true"
7
+ :destroy="closeCropper"
8
+ :contentHeight="`400px`"
9
+ >
10
+ <div class="base-dialog-wrap" slot="dialog-content">
11
+ <vueCropper
12
+ :img="imgUrl"
13
+ ref="cropper"
14
+ :autoCrop="true"
15
+ :class="[croppetShape]"
16
+ :fixed="fixedOutline"
17
+ :fixedBox="fixedOutline"
18
+ :autoCropWidth="cropperOutline[0]"
19
+ :autoCropHeight="cropperOutline[1]"
20
+ ></vueCropper>
21
+ </div>
22
+ <div slot="dialog-footer" class="dialog-footer">
23
+ <base-button-handle
24
+ size="mini"
25
+ :align="`end`"
26
+ :config="buttonConfig"
27
+ ></base-button-handle>
28
+ </div>
29
+ </base-dialog>
30
+ </template>
31
+
32
+ <script>
33
+ import BaseButtonHandle from '../baseButtonHandle/baseButtonHandle.vue'
34
+ export default {
35
+ data() {
36
+ return {
37
+ buttonConfig: [],
38
+ }
39
+ },
40
+ created() {
41
+ this.buttonConfig = [
42
+ {
43
+ text: '取消',
44
+ type: 'info',
45
+ click: () => {
46
+ this.cancel()
47
+ },
48
+ },
49
+ {
50
+ text: '截图',
51
+ type: 'primary',
52
+ click: async () => {
53
+ this.complated().then((res) => {
54
+ this.$emit('cropperComplated', res)
55
+ this.closeCropper()
56
+ })
57
+ },
58
+ },
59
+ ]
60
+ },
61
+ mounted() {
62
+ this.$nextTick(() => {
63
+ this.$refs.baseDialog.showDialog()
64
+
65
+ this.$nextTick(() => {
66
+ this.start()
67
+ })
68
+ })
69
+ },
70
+ computed: {
71
+ imgUrl() {
72
+ return window.URL.createObjectURL(this.img)
73
+ },
74
+ fixedOutline() {
75
+ const { croppetShape } = this.$props
76
+ if (croppetShape == 'circ') {
77
+ return true
78
+ }
79
+ return false
80
+ },
81
+ },
82
+ components: {
83
+ BaseButtonHandle,
84
+ },
85
+ props: {
86
+ img: {},
87
+ croppetShape: {
88
+ type: String,
89
+ default: 'rect',
90
+ },
91
+ cropperOutline: {
92
+ type: Array,
93
+ default: () => [100, 100],
94
+ },
95
+ },
96
+ methods: {
97
+ start() {
98
+ this.$refs.cropper.startCrop()
99
+ },
100
+ cancel() {
101
+ this.$refs.cropper.stopCrop()
102
+ this.$refs.cropper.clearCrop()
103
+ },
104
+ complated() {
105
+ return new Promise((resolve, reject) => {
106
+ this.$refs.cropper.getCropBlob((data) => {
107
+ resolve(data)
108
+ })
109
+ })
110
+ },
111
+
112
+ closeCropper() {
113
+ this.$destroy()
114
+ },
115
+ },
116
+ }
117
+ </script>
118
+
119
+ <style lang="less" scoped>
120
+ .base-dialog-wrap {
121
+ width: 100%;
122
+ height: 100%;
123
+
124
+ .circ {
125
+ /deep/ .cropper-crop-box {
126
+ border-radius: 50%;
127
+ overflow: hidden;
128
+ }
129
+ }
130
+ }
131
+ </style>
@@ -10,7 +10,7 @@
10
10
  type="file"
11
11
  ref="inputFile"
12
12
  :accept="accept"
13
- @change="valueChange"
13
+ @change="inputFileChange"
14
14
  style="display: none;"
15
15
  v-if="type == 'upload'"
16
16
  :multiple="uploadType == 'single' ? false : true"
@@ -124,6 +124,20 @@ export default {
124
124
  fileSize: {
125
125
  default: 99,
126
126
  },
127
+ cropper: {
128
+ type: Boolean,
129
+ default: false,
130
+ },
131
+
132
+ cropperConfig: {
133
+ type: Object,
134
+ default: () => {
135
+ return {
136
+ croppetShape: 'rect',
137
+ cropperOutline: [100, 100],
138
+ }
139
+ },
140
+ },
127
141
  },
128
142
  computed: {
129
143
  module: {
@@ -226,14 +240,36 @@ export default {
226
240
  return list
227
241
  },
228
242
 
229
- async valueChange(e) {
243
+ inputFileChange(e) {
244
+ const { cropper, isGroup, fileType, uploadType } = this.$props
230
245
  let files = e.target.files
246
+ if (cropper && !isGroup && fileType == 'img' && uploadType == 'single') {
247
+ this.userCropper(files[0])
248
+ return
249
+ } else {
250
+ this.fileComplated(files)
251
+ }
252
+
253
+ // this.$refs.inputFile.value = ''
254
+ },
255
+
256
+ async fileComplated(files) {
231
257
  let list = await this.returnFiles(files)
232
258
  if (list.length > 0) {
233
259
  this.emitEvent(list)
234
260
  }
261
+ },
235
262
 
236
- this.$refs.inputFile.value = ''
263
+ userCropper(file) {
264
+ const { cropperConfig } = this.$props
265
+ const module = require('../../../config/use/useCropper').default
266
+ module.startCropper({
267
+ img: file,
268
+ config: cropperConfig,
269
+ complatedCb: (res) => {
270
+ this.fileComplated(res)
271
+ },
272
+ })
237
273
  },
238
274
 
239
275
  emitEvent(list) {
@@ -1,32 +1,28 @@
1
- import componentConfig from "../../../config/componentConfig";
2
- import useUpload from "../../../config/use/UseUpload";
1
+ import componentConfig from '../../../config/componentConfig'
2
+ import useUpload from '../../../config/use/UseUpload'
3
3
  export const baseUploadMixins = {
4
4
  data() {
5
5
  return {
6
6
  dynamicmount: null,
7
- };
7
+ }
8
8
  },
9
- created() {
10
- },
11
- mounted() {
12
-
13
- },
14
- beforeDestroy() { },
9
+ created() {},
10
+ mounted() {},
11
+ beforeDestroy() {},
15
12
 
16
13
  props: {
17
14
  uploadPath: {
18
15
  default: () => {
19
- return [0, 1];
16
+ return [0, 1]
20
17
  },
21
18
  },
22
-
23
19
  },
24
20
  computed: {
25
21
  isMax() {
26
22
  if (this.module.length >= this.$props.max) {
27
- return true;
23
+ return true
28
24
  }
29
- return false;
25
+ return false
30
26
  },
31
27
  },
32
28
 
@@ -35,33 +31,30 @@ export const baseUploadMixins = {
35
31
  if (this.module) {
36
32
  for (let i = 0; i < list.length; i++) {
37
33
  if (this.isMax) {
38
- this.$message.error("超出文件上传限制");
39
- break;
34
+ this.$message.error('超出文件上传限制')
35
+ break
40
36
  }
41
- list[i].cb = this.uploadEd;
42
- this.module.push(list[i]);
37
+ list[i].cb = this.uploadEd
38
+ this.module.push(list[i])
43
39
  }
44
40
  }
45
- const { uploadPath } = this.$props;
41
+ const { uploadPath } = this.$props
46
42
 
47
- componentConfig.setUploadUrl(uploadPath[0], uploadPath[1]);
43
+ componentConfig.setUploadUrl(uploadPath[0], uploadPath[1])
48
44
 
49
45
  if (!this.uploadLoading) {
50
- useUpload.toUpload(
51
- this.module ? this.module : list,
52
- this.isGroup ? this.uploadEd : null
53
- );
46
+ useUpload.toUpload(this.module ? this.module : list, this.uploadEd)
54
47
  }
55
48
 
56
- this.uploadLoading = true;
49
+ this.uploadLoading = true
57
50
  },
58
51
 
59
52
  uploadEd(list) {
60
53
  if (!this.isGroup) {
61
- this.module = list;
54
+ this.module = list
62
55
  }
63
- this.uploadLoading = false;
64
- this.$emit("uploadEd", list);
56
+ this.uploadLoading = false
57
+ this.$emit('uploadEd', list)
65
58
  },
66
59
  },
67
- };
60
+ }
@@ -1,50 +1,51 @@
1
- import baseAnchor from "./base/baseAnchor";
2
- import baseAppendix from "./base/baseAppendix";
3
- import baseArea from "./base/baseArea";
4
- import baseAvatar from "./base/baseAvatar";
5
- import baseButtonHandle from "./base/baseButtonHandle";
6
- import baseDefaultSvg from "./base/baseDefaultSvg";
7
- import baseDialog from "./base/baseDialog";
8
- import baseDialogTable from "./base/baseDialogTable";
9
- import baseDrawer from "./base/baseDrawer";
10
- import baseEdito from "./base/baseEdito";
11
- import baseFixedHeader from "./base/baseFixedHeader";
12
- import baseIcon from "./base/baseIcon";
13
- import baseImageViewer from "./base/baseImageViewer";
14
- import baseImg from "./base/baseImg";
15
- import baseInforWrap from "./base/baseInforWrap";
16
- import baseLineInfoGroup from "./base/baseLineInfoGroup";
17
- import baseLineInfoItem from "./base/baseLineInfoItem";
18
- import basePageHeader from "./base/basePageHeader";
19
- import basePagination from "./base/basePagination";
20
- import basePlainTable from "./base/basePlainTable";
21
- import baseSection from "./base/baseSection";
22
- import baseSkeleton from "./base/baseSkeleton";
23
- import baseSvg from "./base/baseSvg";
24
- import baseTimeTypeSelect from "./base/baseTimeTypeSelect";
25
- import baseToggle from "./base/baseToggle";
26
- import baseUploadItem from "./base/baseUpload/baseUploadItem";
27
- import baseUpload from "./base/baseUpload/baseUpload";
28
- import upload from "./base/upload";
29
- import baseDialogForm from "./proForm/dialogForm/dialogFormIndex";
30
- import baseForm from "./proForm/proForm/index";
31
- import baseFormWrap from "./proForm/proFormWrap/index";
32
- import baseProTable from "./proPageTable/index";
33
- import baseMoverVerifiBar from "./base/baseMoverVerifiBar";
34
- import baseTimeLine from "./base/baseTimeLine";
35
- import basePopoverButton from "./base/basePopoverButton";
36
- import baseTreeSelect from "./base/baseTreeSelect";
1
+ import baseAnchor from './base/baseAnchor'
2
+ import baseAppendix from './base/baseAppendix'
3
+ import baseArea from './base/baseArea'
4
+ import baseAvatar from './base/baseAvatar'
5
+ import baseButtonHandle from './base/baseButtonHandle'
6
+ import baseDefaultSvg from './base/baseDefaultSvg'
7
+ import baseDialog from './base/baseDialog'
8
+ import baseDialogTable from './base/baseDialogTable'
9
+ import baseDrawer from './base/baseDrawer'
10
+ import baseEdito from './base/baseEdito'
11
+ import baseFixedHeader from './base/baseFixedHeader'
12
+ import baseIcon from './base/baseIcon'
13
+ import baseImageViewer from './base/baseImageViewer'
14
+ import baseImg from './base/baseImg'
15
+ import baseInforWrap from './base/baseInforWrap'
16
+ import baseLineInfoGroup from './base/baseLineInfoGroup'
17
+ import baseLineInfoItem from './base/baseLineInfoItem'
18
+ import basePageHeader from './base/basePageHeader'
19
+ import basePagination from './base/basePagination'
20
+ import basePlainTable from './base/basePlainTable'
21
+ import baseSection from './base/baseSection'
22
+ import baseSkeleton from './base/baseSkeleton'
23
+ import baseSvg from './base/baseSvg'
24
+ import baseTimeTypeSelect from './base/baseTimeTypeSelect'
25
+ import baseToggle from './base/baseToggle'
26
+ import baseUploadItem from './base/baseUpload/baseUploadItem'
27
+ import baseUpload from './base/baseUpload/baseUpload'
28
+ import upload from './base/upload'
29
+ import baseDialogForm from './proForm/dialogForm/dialogFormIndex'
30
+ import baseForm from './proForm/proForm/index'
31
+ import baseFormWrap from './proForm/proFormWrap/index'
32
+ import baseProTable from './proPageTable/index'
33
+ import baseMoverVerifiBar from './base/baseMoverVerifiBar'
34
+ import baseTimeLine from './base/baseTimeLine'
35
+ import basePopoverButton from './base/basePopoverButton'
36
+ import baseTreeSelect from './base/baseTreeSelect'
37
+ import VueCropper from 'vue-cropper'
37
38
  // js 文件相关
38
- import Theme from "../config/theme/theme";
39
- import DynamicMount from "./dynamicmount/index.js";
40
- import componentConfig from "../config/componentConfig";
41
- import DynamicMountClass from "./dynamicmount/DynamicMount";
42
- import SelectStore from "../config/selectStore/SelectStore";
39
+ import Theme from '../config/theme/theme'
40
+ import DynamicMount from './dynamicmount/index.js'
41
+ import componentConfig from '../config/componentConfig'
42
+ import DynamicMountClass from './dynamicmount/DynamicMount'
43
+ import SelectStore from '../config/selectStore/SelectStore'
43
44
  //
44
- import useImg from "../config/use/UseImg";
45
- import UseDrag from "../config/use/useDrag";
46
- import useUpload from "../config/use/UseUpload";
47
- import useFixedHeader from "../config/use/useFixedHeader";
45
+ import useImg from '../config/use/UseImg'
46
+ import UseDrag from '../config/use/useDrag'
47
+ import useUpload from '../config/use/UseUpload'
48
+ import useFixedHeader from '../config/use/useFixedHeader'
48
49
 
49
50
  const meixicomponents = [
50
51
  baseAnchor,
@@ -82,18 +83,19 @@ const meixicomponents = [
82
83
  baseMoverVerifiBar,
83
84
  baseTimeLine,
84
85
  basePopoverButton,
85
- baseTreeSelect
86
- ];
86
+ baseTreeSelect,
87
+ ]
87
88
 
88
89
  const install = (Vue) => {
89
90
  meixicomponents.forEach((component) => {
90
- Vue.component(component.name, component);
91
- });
92
- Vue.use(DynamicMount);
93
- };
91
+ Vue.component(component.name, component)
92
+ })
93
+ Vue.use(DynamicMount)
94
+ Vue.use(VueCropper);
95
+ }
94
96
 
95
- if (typeof window !== "undefined" && window.Vue) {
96
- install(window.Vue);
97
+ if (typeof window !== 'undefined' && window.Vue) {
98
+ install(window.Vue)
97
99
  }
98
100
 
99
101
  export default {
@@ -143,4 +145,4 @@ export default {
143
145
  useUpload,
144
146
  useFixedHeader,
145
147
  DynamicMountClass,
146
- };
148
+ }
@@ -38,7 +38,7 @@
38
38
  @formItemConfirm="formItemConfirm"
39
39
  @disableWatcherResult="disableWatcherResult"
40
40
  :disableWatcher="setWatcher(item.key)"
41
- v-if="formType == 'default'"
41
+ v-if="formType == 'default' && item.type"
42
42
  >
43
43
  <template slot="template" v-if="item.type == 'template'">
44
44
  <slot :name="`form-${item.key}`" :scope="module"></slot>
@@ -222,6 +222,7 @@ import baseButtonHandle from '../base/baseButtonHandle/baseButtonHandle.vue' //
222
222
 
223
223
  //
224
224
  import componentConfig from '../../config/componentConfig'
225
+ import { isatty } from 'tty'
225
226
  let canPush = true
226
227
  export default {
227
228
  name: 'baseProTable',
@@ -689,6 +690,8 @@ export default {
689
690
 
690
691
  // 表格如果有滚动条将滚动条拉到顶部
691
692
  scrollToTop() {
693
+ const { isAuth } = this.$props
694
+ if (!isAuth) return
692
695
  let elTable = this.$refs.elTable.$el
693
696
  let target = elTable.querySelector('.el-table__body-wrapper')
694
697
  if (target) {
@@ -979,6 +982,7 @@ export default {
979
982
  /deep/ .el-table__fixed {
980
983
  &::before {
981
984
  border-color: var(--color-table-border) !important;
985
+ background: var(--color-table-border) !important;
982
986
  }
983
987
  }
984
988
 
@@ -0,0 +1,51 @@
1
+ import baseCropper from '../../components/base/baseCropper/index.vue'
2
+ import DynamicMount from '../../components/dynamicmount/DynamicMount'
3
+ class UseCropper {
4
+ constructor() {
5
+ this.complatedCb = null
6
+ this.component = null
7
+ }
8
+ startCropper(params) {
9
+ this.complatedCb = params.complatedCb || null
10
+ const config = {
11
+ img: params.img,
12
+ croppetShape: params.config.croppetShape,
13
+ cropperOutline: params.config.cropperOutline,
14
+ }
15
+ this.next(config)
16
+ }
17
+ next(config) {
18
+ this.component = new DynamicMount({
19
+ componentProps: config,
20
+ vueComponent: baseCropper,
21
+ })
22
+
23
+ this.component.on('mounted', (component) => {
24
+ component.$on('cropperComplated', (res) => {
25
+ this.cropperComplated(res)
26
+ })
27
+ })
28
+
29
+ this.component.on('destroy', () => {
30
+ this.component = null
31
+ this.complatedCb = null
32
+ })
33
+
34
+ this.component.init()
35
+ }
36
+ cropperComplated = (res) => {
37
+ if (this.complatedCb) {
38
+ const time = Date.now()
39
+ this.complatedCb([
40
+ new File([res], `cropper-${time}`, {
41
+ type: res.type,
42
+ lastModified: time,
43
+ }),
44
+ ])
45
+ }
46
+ }
47
+ }
48
+
49
+ const useCropper = new UseCropper()
50
+
51
+ export default useCropper
package/src/App.vue CHANGED
@@ -1,13 +1,15 @@
1
1
  <template>
2
2
  <div id="app">
3
3
  <div style="height: 100vh;">
4
- <test></test>
5
- <!-- <base-upload v-model="test"></base-upload>
4
+ <!-- <test></test> -->
6
5
 
7
- <base-popover-button
8
- :buttonIcon="`meixicomponenticon-diqu`"
9
- v-model="flag"
10
- ></base-popover-button> -->
6
+ <!-- <base-upload-item
7
+ :fileType="`img`"
8
+ :cropper="true"
9
+ @uploadEd="uploadEd"
10
+ ref="baseUploadItem"
11
+ ></base-upload-item> -->
12
+ <base-upload v-model="test"></base-upload>
11
13
  </div>
12
14
  </div>
13
15
  </template>
@@ -18,8 +20,9 @@ import test from './component/test.vue'
18
20
  import BaseArea from '../packages/components/base/baseArea/baseArea.vue'
19
21
  import BaseTimeLine from '../packages/components/base/baseTimeLine/baseTimeLine.vue'
20
22
  import BaseUpload from '../packages/components/base/baseUpload/baseUpload.vue'
23
+ import BaseUploadItem from '../packages/components/base/baseUpload/baseUploadItem.vue'
21
24
  export default {
22
- components: { test, BaseArea, BaseTimeLine, BaseUpload },
25
+ components: { test, BaseArea, BaseTimeLine, BaseUpload, BaseUploadItem },
23
26
  data() {
24
27
  return {
25
28
  test: [],
@@ -54,8 +57,16 @@ export default {
54
57
  ],
55
58
  }
56
59
  },
57
- mounted() {},
58
- methods: {},
60
+ mounted() {
61
+ this.$nextTick(() => {
62
+ this.$refs.baseUploadItem.clickFile()
63
+ })
64
+ },
65
+ methods: {
66
+ uploadEd(res) {
67
+ console.log(res)
68
+ },
69
+ },
59
70
  }
60
71
  </script>
61
72