meixioacomponent 0.6.21 → 0.6.22

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.6.21",
3
+ "version": "0.6.22",
4
4
  "private": false,
5
5
  "author": "YuRi",
6
6
  "main": "lib/meixioacomponent.common.js",
@@ -1,12 +1,12 @@
1
1
  <template>
2
- <div class="section-wrap">
2
+ <div :class="{isFixed:fixedHeader}" class="section-wrap">
3
3
  <div
4
- class="section-header"
5
- ref="sectionHeader"
6
- @click.self="handleOpen"
7
- :style="{
4
+ ref="sectionHeader"
5
+ :style="{
8
6
  cursor: event && !disable ? 'pointer' : 'default',
9
7
  }"
8
+ class="section-header"
9
+ @click.self="handleOpen"
10
10
  >
11
11
  <div class="header-left">
12
12
  <slot name="header-prefix"></slot>
@@ -15,15 +15,15 @@
15
15
  <div class="header-right">
16
16
  <slot name="section-header-right"></slot>
17
17
  <base-icon
18
- :size="`l`"
19
18
  :event="true"
20
19
  :name="iconClass"
20
+ :size="`l`"
21
21
  @iconClick="iconClick"
22
22
  ></base-icon>
23
23
 
24
24
  </div>
25
25
  </div>
26
- <div class="section-content" v-show="module">
26
+ <div v-show="module" class="section-content">
27
27
  <slot name="sectionContent"></slot>
28
28
  </div>
29
29
  </div>
@@ -40,7 +40,8 @@ export default {
40
40
  this.init()
41
41
  })
42
42
  },
43
- beforeDestroy() {},
43
+ beforeDestroy() {
44
+ },
44
45
  props: {
45
46
  disable: {
46
47
  type: Boolean,
@@ -59,6 +60,10 @@ export default {
59
60
  type: Boolean,
60
61
  default: true,
61
62
  },
63
+ fixedHeader: {
64
+ type: Boolean,
65
+ default: false,
66
+ }
62
67
  },
63
68
 
64
69
  computed: {
@@ -79,7 +84,19 @@ export default {
79
84
  },
80
85
  methods: {
81
86
  init() {
82
- if (!this.$props.event) return
87
+
88
+
89
+ // if (!this.$props.event) return
90
+
91
+ // let observer = new IntersectionObserver((entries) => {
92
+ // console.log(entries)
93
+ // }, {
94
+ // threshold: [1]
95
+ // })
96
+ //
97
+ // observer.observe(this.$refs.sectionHeader);
98
+
99
+
83
100
  },
84
101
  handleOpen() {
85
102
  if (this.$props.disable) return
@@ -87,7 +104,7 @@ export default {
87
104
  this.$emit('visibleContent', this.module)
88
105
  },
89
106
 
90
- iconClick(){
107
+ iconClick() {
91
108
  this.handleOpen();
92
109
  }
93
110
  },
@@ -110,6 +127,7 @@ export default {
110
127
  background: var(--hover-gray);
111
128
  justify-content: space-between;
112
129
  border-radius: calc(var(--radius) * 2);
130
+
113
131
  .header-left {
114
132
  max-width: 60%;
115
133
  display: flex;
@@ -117,6 +135,7 @@ export default {
117
135
  flex-flow: row nowrap;
118
136
  justify-content: space-between;
119
137
  }
138
+
120
139
  .header-right {
121
140
  max-width: 40%;
122
141
  display: flex;
@@ -125,6 +144,7 @@ export default {
125
144
  justify-content: flex-end;
126
145
  }
127
146
  }
147
+
128
148
  .header-text {
129
149
  position: relative;
130
150
  display: inline-block;
@@ -132,6 +152,7 @@ export default {
132
152
  font-size: var(--font-size-base);
133
153
  font-weight: var(--font-weight-kg);
134
154
  margin-left: var(--margin-4);
155
+
135
156
  &::before {
136
157
  top: 0px;
137
158
  left: -10px;
@@ -143,8 +164,20 @@ export default {
143
164
  background: var(--color-primary);
144
165
  }
145
166
  }
167
+
146
168
  .section-content {
147
169
  padding: calc(var(--padding-4) * 2) 0px;
148
170
  }
149
171
  }
172
+
173
+ .isFixed {
174
+ .section-header {
175
+ position: fixed;
176
+ }
177
+
178
+ .section-content {
179
+
180
+ padding-top: calc(calc(var(--padding-4) * 2) + 40px) !important;
181
+ }
182
+ }
150
183
  </style>
@@ -63,6 +63,7 @@ import useFixedHeader from '../config/use/useFixedHeader'
63
63
  import useCropper from '../config/use/useCropper'
64
64
  import useViewVideo from '../config/use/UseViewVideo'
65
65
  import useGuide from '../config/use/UseGuide'
66
+ import LinkViewClass from "../config/LinkViewClass";
66
67
 
67
68
  import VueDND from 'awe-dnd'
68
69
  import {useElementComponent} from "../config/useElement";
@@ -199,5 +200,6 @@ export default {
199
200
  useViewVideo,
200
201
  useGuide,
201
202
  DynamicMountClass,
202
- useWait
203
+ useWait,
204
+ LinkViewClass
203
205
  }
@@ -0,0 +1,142 @@
1
+ import {judgeButtonPermission} from '../utils/utils'
2
+ import componentConfig from "./componentConfig";
3
+
4
+ class LinkViewClass {
5
+ constructor(params) {
6
+ this.delFn = null
7
+ this.exportFn = null
8
+ this.tableData = []
9
+ this.pageProps = {}
10
+ this.pageConfig = {}
11
+ this.activeIndex = 0
12
+ this.tablePermission = {
13
+ key: '',
14
+ value: true,
15
+ }
16
+ this.editPermission = {
17
+ key: '',
18
+ value: true,
19
+ }
20
+ this.delPermission = {
21
+ key: '',
22
+ value: true,
23
+ }
24
+ this.addPermission = {
25
+ key: '',
26
+ value: true,
27
+ }
28
+ this.refreshTableData = null
29
+ this.init()
30
+ this.setPermissions(params)
31
+ }
32
+
33
+ setPermissions(param) {
34
+ const {permissions} = param
35
+ if (permissions) {
36
+ this.tablePermission.key = permissions[0]
37
+ this.addPermission.key = permissions[1]
38
+ this.editPermission.key = permissions[2]
39
+ this.delPermission.key = permissions[3]
40
+ }
41
+
42
+ this.jugePermission()
43
+ }
44
+
45
+ jugePermission() {
46
+ const {
47
+ tablePermission,
48
+ addPermission,
49
+ editPermission,
50
+ delPermission,
51
+ } = this
52
+ const permissionList = componentConfig.store.getters['permissions']
53
+ tablePermission.value = judgeButtonPermission(
54
+ permissionList,
55
+ tablePermission.key,
56
+ )
57
+ editPermission.value = judgeButtonPermission(
58
+ permissionList,
59
+ editPermission.key,
60
+ )
61
+ delPermission.value = judgeButtonPermission(
62
+ permissionList,
63
+ delPermission.key,
64
+ )
65
+ addPermission.value = judgeButtonPermission(
66
+ permissionList,
67
+ addPermission.key,
68
+ )
69
+ }
70
+
71
+ init() {
72
+ this.tableData = []
73
+ this.activeIndex = 0
74
+ this.refreshTableData = null
75
+ this.pageProps = {
76
+ size: 15,
77
+ total: 100,
78
+ current: 1,
79
+ }
80
+ this.pageConfig = {
81
+ size: 'size',
82
+ page: 'current',
83
+ total: 'total',
84
+ }
85
+ }
86
+
87
+ onHandNextData() {
88
+ if (this.hasNextTableData()) {
89
+ this.activeIndex += 1
90
+ return
91
+ }
92
+ this.activeIndex = this.tableData.length - 1
93
+ }
94
+
95
+ onHandPreData() {
96
+ if (this.hasPreTableData()) {
97
+ this.activeIndex -= 1
98
+ } else {
99
+ this.activeIndex = 0
100
+ }
101
+ }
102
+
103
+ hasNextTableData() {
104
+ return this.tableData.length > 0
105
+ ? this.activeIndex !== this.tableData.length - 1
106
+ : false
107
+ }
108
+
109
+ hasPreTableData() {
110
+ return this.activeIndex > 0
111
+ }
112
+
113
+ getTableDataForActiveIndex() {
114
+ return this.tableData[this.activeIndex]
115
+ }
116
+
117
+ getPageProps() {
118
+ return this.pageProps
119
+ }
120
+
121
+ getTableData() {
122
+ // this.activeIndex = 0
123
+ return {
124
+ _class: this,
125
+ tableData: this.tableData,
126
+ }
127
+ }
128
+
129
+ getPageConfig() {
130
+ return this.pageConfig
131
+ }
132
+
133
+ getPermission(key) {
134
+ return this[`${key}`].value
135
+ }
136
+
137
+ setActiveIndex(index) {
138
+ this.activeIndex = index
139
+ }
140
+ }
141
+
142
+ export default LinkViewClass
@@ -31,7 +31,6 @@ const componentConfig = {
31
31
  },
32
32
 
33
33
  initConfig: (_store, _router) => {
34
- console.log(_store)
35
34
  // 注册element 组件
36
35
  useElementComponent()
37
36
  // 动态注册vuex modules
@@ -183,11 +183,11 @@ export const jugeFileTypeKey = (suffix) => {
183
183
  }
184
184
 
185
185
  export const vhToNumber = (type, value) => {
186
- if (type == 'height') {
186
+ if (type === 'height') {
187
187
  let heightValue = window.innerHeight
188
188
  console.log(heightValue)
189
189
  return heightValue * (value / 100)
190
- } else if (type == 'width') {
190
+ } else if (type === 'width') {
191
191
  let widthValue = window.innerWidth
192
192
  return widthValue * (value / 100)
193
193
  } else {
@@ -195,6 +195,46 @@ export const vhToNumber = (type, value) => {
195
195
  }
196
196
  }
197
197
 
198
+
199
+ export const judgeButtonPermission = (permissionList, params) => {
200
+ let el = null;
201
+ let flag = true;
202
+ let value = null;
203
+ const isObject = params instanceof Object;
204
+ if (isObject) {
205
+ el = params.el;
206
+ value = params.bind.value;
207
+ } else {
208
+ value = params;
209
+ }
210
+ if (permissionList) {
211
+ if (value instanceof Array) {
212
+ for (let i = 0; i < value.length; i++) {
213
+ flag = permissionList.includes(value[i]);
214
+ if (flag) {
215
+ break;
216
+ }
217
+ }
218
+ } else {
219
+ flag = permissionList.includes(value);
220
+ }
221
+ }
222
+
223
+ if (isObject) {
224
+ if (el && !flag) {
225
+ el.remove();
226
+ }
227
+ }
228
+
229
+ return flag;
230
+ };
231
+
232
+
233
+
234
+
235
+
236
+
237
+
198
238
  export const isDOM = (typeof HTMLElement === 'object') ?
199
239
  function (obj) {
200
240
  return obj instanceof HTMLElement;