automan-cmd 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +65 -0
- package/README.md +56 -0
- package/bin/automan +3 -0
- package/bin/automan-build +3 -0
- package/bin/automan-config +3 -0
- package/bin/automan-create +3 -0
- package/bin/automan-publish +3 -0
- package/lib/automan-build.js +41 -0
- package/lib/automan-config.js +82 -0
- package/lib/automan-create.js +137 -0
- package/lib/automan-publish.js +331 -0
- package/lib/index.js +13 -0
- package/lib/install.js.tpl +47 -0
- package/lib/util.js +174 -0
- package/package.json +37 -0
- package/tpl/.babelrc +16 -0
- package/tpl/.browserslistrc +3 -0
- package/tpl/.eslintignore +2 -0
- package/tpl/.eslintrc.js +228 -0
- package/tpl/.gitignore.ejs +12 -0
- package/tpl/.postcssrc.js +12 -0
- package/tpl/README.md +1 -0
- package/tpl/changelog.md +1 -0
- package/tpl/editor/index.vue +45 -0
- package/tpl/icon.png +0 -0
- package/tpl/jsconfig.json +7 -0
- package/tpl/package.json.ejs +66 -0
- package/tpl/preview/app.vue +326 -0
- package/tpl/preview/attr/Data.vue +69 -0
- package/tpl/preview/attr/Resource.vue +79 -0
- package/tpl/preview/attr/com.vue +21 -0
- package/tpl/preview/attr/index.js +16 -0
- package/tpl/preview/components/Attribute.vue +365 -0
- package/tpl/preview/components/FitImg.vue +152 -0
- package/tpl/preview/components/ImgViewer.vue +80 -0
- package/tpl/preview/components/Loading.vue +55 -0
- package/tpl/preview/components/Toast.vue +111 -0
- package/tpl/preview/index.js +22 -0
- package/tpl/preview/index.tpl +13 -0
- package/tpl/preview/lib/ESlog.js +46 -0
- package/tpl/preview/lib/Util.js +57 -0
- package/tpl/preview/lib/fetch.js +139 -0
- package/tpl/preview/lib/index.js +15 -0
- package/tpl/preview/lib/vue/filters.js +53 -0
- package/tpl/preview/lib/vue/index.js +9 -0
- package/tpl/preview/lib/vue/mixin.js +166 -0
- package/tpl/preview/mint-ui/message-box/index.js +1503 -0
- package/tpl/preview/mint-ui/message-box/style.css +159 -0
- package/tpl/preview/mint-ui/popup/index.js +1046 -0
- package/tpl/preview/mint-ui/popup/style.css +115 -0
- package/tpl/preview/mint-ui/spinner/index.js +657 -0
- package/tpl/preview/mint-ui/spinner/style.css +227 -0
- package/tpl/preview/mint-ui/swipe/index.js +907 -0
- package/tpl/preview/mint-ui/swipe/style.css +43 -0
- package/tpl/preview/mint-ui/swipe-item/index.js +171 -0
- package/tpl/preview/mint-ui/swipe-item/style.css +1 -0
- package/tpl/preview/style.css +126 -0
- package/tpl/server.config.js +6 -0
- package/tpl/src/assets/css/index.scss +29 -0
- package/tpl/src/example.vue +165 -0
- package/tpl/src/index.vue.ejs +32 -0
- package/tpl/webpack.config.js.ejs +267 -0
- package/tpl/yarn.lock +6037 -0
@@ -0,0 +1,365 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="widget attribute">
|
3
|
+
<div>
|
4
|
+
<el-collapse v-model="activeNames">
|
5
|
+
<el-collapse-item
|
6
|
+
title="属性设置"
|
7
|
+
name="attr"
|
8
|
+
>
|
9
|
+
<div
|
10
|
+
v-if="componentProps"
|
11
|
+
size="mini"
|
12
|
+
label-position="left"
|
13
|
+
label-width="80px"
|
14
|
+
:model="componentProps"
|
15
|
+
>
|
16
|
+
<template v-for="(item) in propsInfo">
|
17
|
+
<div
|
18
|
+
v-if="(!item.work || item.work()) && !item.meta.ignore"
|
19
|
+
:key="item.key"
|
20
|
+
class="form-item"
|
21
|
+
>
|
22
|
+
<div>
|
23
|
+
<span class="label">
|
24
|
+
<el-tooltip placement="top">
|
25
|
+
<div
|
26
|
+
slot="content"
|
27
|
+
style="max-width:300px"
|
28
|
+
>{{ item.desc || '无' }}</div>
|
29
|
+
<span>{{ item.label || item.key }}</span>
|
30
|
+
</el-tooltip>
|
31
|
+
</span>
|
32
|
+
<span
|
33
|
+
v-if="item"
|
34
|
+
class="value"
|
35
|
+
>
|
36
|
+
<!-- 文本相关 -->
|
37
|
+
<el-input
|
38
|
+
v-if="item.type == 'string'"
|
39
|
+
v-model="componentProps[item.key]"
|
40
|
+
size="mini"
|
41
|
+
/>
|
42
|
+
<el-input
|
43
|
+
v-else-if="item.type == 'number'"
|
44
|
+
v-model.number="componentProps[item.key]"
|
45
|
+
type="number"
|
46
|
+
size="mini"
|
47
|
+
/>
|
48
|
+
<el-input
|
49
|
+
v-else-if="item.type == 'input'"
|
50
|
+
v-model="componentProps[item.key]"
|
51
|
+
size="mini"
|
52
|
+
/>
|
53
|
+
<el-input
|
54
|
+
v-else-if="item.type == 'text'"
|
55
|
+
v-model="componentProps[item.key]"
|
56
|
+
:autosize="{ minRows: 2, maxRows: 5 }"
|
57
|
+
type="textarea"
|
58
|
+
size="mini"
|
59
|
+
/>
|
60
|
+
<rich-text
|
61
|
+
v-else-if="item.type == 'richtext'"
|
62
|
+
:id="id"
|
63
|
+
v-model="componentProps[item.key]"
|
64
|
+
/>
|
65
|
+
<y-color-picker
|
66
|
+
v-else-if="item.type == 'color'"
|
67
|
+
v-model="componentProps[item.key]"
|
68
|
+
show-alpha
|
69
|
+
/>
|
70
|
+
<!-- json -->
|
71
|
+
<attr-data
|
72
|
+
v-else-if="isCollapsed('attr') && item.type == 'object'"
|
73
|
+
type="object"
|
74
|
+
:content.sync="componentProps[item.key]"
|
75
|
+
/>
|
76
|
+
<attr-data
|
77
|
+
v-else-if="isCollapsed('attr') && item.type == 'array'"
|
78
|
+
type="array"
|
79
|
+
:content.sync="componentProps[item.key]"
|
80
|
+
/>
|
81
|
+
<attr-data
|
82
|
+
v-else-if="isCollapsed('attr') && item.type == 'data'"
|
83
|
+
:content.sync="componentProps[item.key]"
|
84
|
+
/>
|
85
|
+
<!-- 布尔值 -->
|
86
|
+
<el-switch
|
87
|
+
v-else-if="item.type == 'boolean'"
|
88
|
+
v-model="componentProps[item.key]"
|
89
|
+
size="mini"
|
90
|
+
/>
|
91
|
+
<!-- 图片 -->
|
92
|
+
<template v-else-if="item.type == 'image'">
|
93
|
+
<resource
|
94
|
+
type="image"
|
95
|
+
:url.sync="componentProps[item.key]"
|
96
|
+
/>
|
97
|
+
</template>
|
98
|
+
<resource
|
99
|
+
v-else-if="item.type == 'audio'"
|
100
|
+
type="audio"
|
101
|
+
:url.sync="componentProps[item.key]"
|
102
|
+
/>
|
103
|
+
<resource
|
104
|
+
v-else-if="item.type == 'video'"
|
105
|
+
type="video"
|
106
|
+
:url.sync="componentProps[item.key]"
|
107
|
+
/>
|
108
|
+
<resource
|
109
|
+
v-else-if="item.type == 'file'"
|
110
|
+
type="file"
|
111
|
+
:url.sync="componentProps[item.key]"
|
112
|
+
/>
|
113
|
+
<!-- 方法调用 -->
|
114
|
+
<attr-function
|
115
|
+
v-else-if="item.type == 'function'"
|
116
|
+
:content.sync="componentProps[item.key]"
|
117
|
+
/>
|
118
|
+
|
119
|
+
<!-- 时间选择器 -->
|
120
|
+
<el-date-picker
|
121
|
+
v-else-if="item.type == 'date'"
|
122
|
+
v-model="componentProps[item.key]"
|
123
|
+
value-format="yyyy/MM/dd HH:mm:ss"
|
124
|
+
type="datetime"
|
125
|
+
placeholder="选择日期时间"
|
126
|
+
/>
|
127
|
+
|
128
|
+
<!-- 枚举 -->
|
129
|
+
<el-select
|
130
|
+
v-else-if="item.type == 'enum'"
|
131
|
+
v-model="componentProps[item.key]"
|
132
|
+
:multiple="item.meta && item.meta.multiple"
|
133
|
+
size="mini"
|
134
|
+
placeholder="请选择"
|
135
|
+
>
|
136
|
+
<el-option
|
137
|
+
v-for="(itemChild,key) in enumFilter(item.meta.defaultList)"
|
138
|
+
:key="key"
|
139
|
+
:label="itemChild.label"
|
140
|
+
:value="itemChild.value"
|
141
|
+
/>
|
142
|
+
</el-select>
|
143
|
+
|
144
|
+
<template v-else-if="item.type == 'checkbox'">
|
145
|
+
<!-- checkbox-group -->
|
146
|
+
<el-checkbox-group
|
147
|
+
v-if="item.meta.defaultList"
|
148
|
+
v-model="componentProps[item.key]"
|
149
|
+
>
|
150
|
+
<el-checkbox
|
151
|
+
v-for="(itemChild, key) in enumFilter(item.meta.defaultList)"
|
152
|
+
:key="key"
|
153
|
+
:label="itemChild.value"
|
154
|
+
>{{ itemChild.label }}</el-checkbox>
|
155
|
+
</el-checkbox-group>
|
156
|
+
<!-- checkbox -->
|
157
|
+
<el-checkbox
|
158
|
+
v-else
|
159
|
+
v-model="componentProps[item.key]"
|
160
|
+
/>
|
161
|
+
</template>
|
162
|
+
|
163
|
+
<!-- radio -->
|
164
|
+
<el-radio-group
|
165
|
+
v-else-if="item.type == 'radio'"
|
166
|
+
v-model="componentProps[item.key]"
|
167
|
+
>
|
168
|
+
<el-radio
|
169
|
+
v-for="(itemChild, key) in enumFilter(item.meta.defaultList)"
|
170
|
+
:key="key"
|
171
|
+
:label="itemChild.value"
|
172
|
+
>{{ itemChild.label }}</el-radio>
|
173
|
+
</el-radio-group>
|
174
|
+
</span>
|
175
|
+
</div>
|
176
|
+
</div>
|
177
|
+
</template>
|
178
|
+
</div>
|
179
|
+
</el-collapse-item>
|
180
|
+
</el-collapse>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
</template>
|
184
|
+
<style lang="stylus" rel="stylesheet/stylus" type="text/stylus">
|
185
|
+
.widget.attribute {
|
186
|
+
position: relative;
|
187
|
+
padding: 5px !important;
|
188
|
+
|
189
|
+
.el-input-group__append {
|
190
|
+
padding: 0 10px;
|
191
|
+
cursor: pointer;
|
192
|
+
}
|
193
|
+
|
194
|
+
.update {
|
195
|
+
padding: 20px 10px;
|
196
|
+
text-align: center;
|
197
|
+
|
198
|
+
.desc {
|
199
|
+
text-align: left;
|
200
|
+
margin: 10px 5px;
|
201
|
+
}
|
202
|
+
}
|
203
|
+
|
204
|
+
.id-lock {
|
205
|
+
position: absolute;
|
206
|
+
right: 0;
|
207
|
+
top: 0;
|
208
|
+
}
|
209
|
+
|
210
|
+
.alerttip {
|
211
|
+
margin-bottom: 5px;
|
212
|
+
}
|
213
|
+
|
214
|
+
.noselect {
|
215
|
+
font-size: 20px;
|
216
|
+
color: #aaa;
|
217
|
+
font-weight: bolder;
|
218
|
+
text-align: center;
|
219
|
+
}
|
220
|
+
|
221
|
+
.form-item {
|
222
|
+
margin-bottom: 5px;
|
223
|
+
padding: 5px;
|
224
|
+
|
225
|
+
&:hover {
|
226
|
+
background-color: #6081bd33;
|
227
|
+
border-radius: 5px;
|
228
|
+
|
229
|
+
.label {
|
230
|
+
color: #ffffff;
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
.label {
|
235
|
+
font-weight: bold;
|
236
|
+
display: inline-block;
|
237
|
+
margin-bottom: 4px;
|
238
|
+
font-size: 12px;
|
239
|
+
min-width: 70px;
|
240
|
+
}
|
241
|
+
|
242
|
+
.value {
|
243
|
+
color: #909399;
|
244
|
+
}
|
245
|
+
}
|
246
|
+
}
|
247
|
+
</style>
|
248
|
+
|
249
|
+
<script type="text/ecmascript-6">
|
250
|
+
/**
|
251
|
+
* 组件属性编辑器,每个组件的各个设置都是通过这里分发处理
|
252
|
+
*/
|
253
|
+
|
254
|
+
export default {
|
255
|
+
name: 'Attribute',
|
256
|
+
components: {},
|
257
|
+
mixins: [],
|
258
|
+
props: {
|
259
|
+
componentProps: {
|
260
|
+
type: Object
|
261
|
+
},
|
262
|
+
active: {
|
263
|
+
type: [Number, Boolean],
|
264
|
+
default: 0
|
265
|
+
}
|
266
|
+
},
|
267
|
+
data: function() {
|
268
|
+
return {
|
269
|
+
currEditor: '',
|
270
|
+
currEditorData: {},
|
271
|
+
showUpdate: false,
|
272
|
+
id: '',
|
273
|
+
canEditId: false,
|
274
|
+
propsInfo: {},
|
275
|
+
activeNames: ['base', 'animate', 'attr'],
|
276
|
+
newNodeInfo: null,
|
277
|
+
oldStyle: null,
|
278
|
+
forbidEdit: false
|
279
|
+
}
|
280
|
+
},
|
281
|
+
watch: {
|
282
|
+
},
|
283
|
+
mounted: function() {
|
284
|
+
this.onSelectOne()
|
285
|
+
},
|
286
|
+
methods: {
|
287
|
+
onSelectOne: function() {
|
288
|
+
this.dealPropsType()
|
289
|
+
},
|
290
|
+
isCollapsed(attr) {
|
291
|
+
const activeNames = this.activeNames
|
292
|
+
return activeNames && (activeNames.length && activeNames.indexOf(attr) > -1 || activeNames == attr)
|
293
|
+
},
|
294
|
+
enumFilter(list) {
|
295
|
+
if (!list) { return [] }
|
296
|
+
if (list instanceof Array) {
|
297
|
+
return list.map(li => {
|
298
|
+
return {
|
299
|
+
label: li,
|
300
|
+
value: li
|
301
|
+
}
|
302
|
+
})
|
303
|
+
}
|
304
|
+
if (typeof list === 'object') {
|
305
|
+
return Object.entries(list).map(([key, value]) => {
|
306
|
+
return {
|
307
|
+
label: value,
|
308
|
+
value: key
|
309
|
+
}
|
310
|
+
})
|
311
|
+
}
|
312
|
+
return list
|
313
|
+
},
|
314
|
+
dealPropsType: function() {
|
315
|
+
const fnTypeRE = /^(?:function|class) (\w+)/
|
316
|
+
const instance = window.componentVm
|
317
|
+
this.propsInfo = []
|
318
|
+
function getPropType(prop) {
|
319
|
+
// 编辑器属性上存在类型信息。以编辑器为准
|
320
|
+
const propEditor = prop.editor || prop.editer
|
321
|
+
if (propEditor && propEditor.type) {
|
322
|
+
return propEditor.type.toLocaleLowerCase()
|
323
|
+
}
|
324
|
+
const type = prop.type
|
325
|
+
if (typeof type == 'string') {
|
326
|
+
return type
|
327
|
+
}
|
328
|
+
const match = type.toString().match(fnTypeRE)
|
329
|
+
const ttype = typeof type === 'function'
|
330
|
+
? match && match[1] || 'any'
|
331
|
+
: 'any'
|
332
|
+
return ttype.toLocaleLowerCase()
|
333
|
+
}
|
334
|
+
if (instance && instance.$options) {
|
335
|
+
const props = instance.$options.props
|
336
|
+
const propsData = []
|
337
|
+
for (const key in props) {
|
338
|
+
const prop = props[key]
|
339
|
+
const propEditor = prop.editor || prop.editer
|
340
|
+
const propData = {
|
341
|
+
key,
|
342
|
+
value: instance[key],
|
343
|
+
type: getPropType(prop),
|
344
|
+
work: (propEditor && propEditor.work || (() => true)).bind(instance), // 新增属性有效性(是否应出现)的检测 绑定this至当前组件实例
|
345
|
+
meta: propEditor || {},
|
346
|
+
order: prop.order || 10000,
|
347
|
+
required: !!prop.required
|
348
|
+
}
|
349
|
+
// 编辑属性存在则处理些特殊属性
|
350
|
+
if (propEditor) {
|
351
|
+
propData.label = propEditor.label
|
352
|
+
propData.desc = propEditor.desc
|
353
|
+
}
|
354
|
+
propsData.push(propData)
|
355
|
+
}
|
356
|
+
this.propsInfo = propsData || []
|
357
|
+
this.propsInfo = this.propsInfo.sort(function(a, b) {
|
358
|
+
return a.order - b.order
|
359
|
+
})
|
360
|
+
console.log('propsData', propsData)
|
361
|
+
}
|
362
|
+
}
|
363
|
+
}
|
364
|
+
}
|
365
|
+
</script>
|
@@ -0,0 +1,152 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="component fit-img" ref="box">
|
3
|
+
124545
|
4
|
+
<img @load="onload" :src="src">
|
5
|
+
<spinner color="#fff" type="fading-circle" v-show="pending" :size="40" class="spinner" />
|
6
|
+
</div>
|
7
|
+
</template>
|
8
|
+
<style lang="stylus" rel="stylesheet/stylus" scoped type="text/stylus">
|
9
|
+
.component.fit-img {
|
10
|
+
display: -webkit-box;
|
11
|
+
-webkit-box-align: center;
|
12
|
+
-webkit-box-orient: vertical;
|
13
|
+
-webkit-box-pack: center;
|
14
|
+
overflow: hidden;
|
15
|
+
position: relative;
|
16
|
+
|
17
|
+
& > img {
|
18
|
+
visibility: hidden;
|
19
|
+
}
|
20
|
+
|
21
|
+
.spinner {
|
22
|
+
position: absolute;
|
23
|
+
left: 50%;
|
24
|
+
top: 50%;
|
25
|
+
transform: translate(-50%, -50%);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
</style>
|
29
|
+
|
30
|
+
<script type="text/ecmascript-6">
|
31
|
+
import Spinner from 'mint-ui/spinner'
|
32
|
+
import 'mint-ui/spinner/style.css'
|
33
|
+
|
34
|
+
export default {
|
35
|
+
name: 'FitImg',
|
36
|
+
components: { Spinner },
|
37
|
+
mixins: [],
|
38
|
+
props: {
|
39
|
+
src: {
|
40
|
+
required: true
|
41
|
+
}
|
42
|
+
},
|
43
|
+
data() {
|
44
|
+
return {
|
45
|
+
pending: true,
|
46
|
+
boxHeight: 1,
|
47
|
+
boxWidth: 1
|
48
|
+
}
|
49
|
+
},
|
50
|
+
mounted() {
|
51
|
+
this.$nextTick(() => {
|
52
|
+
this.boxHeight = this.$refs.box.clientHeight
|
53
|
+
this.boxWidth = this.$refs.box.clientWidth
|
54
|
+
})
|
55
|
+
},
|
56
|
+
methods: {
|
57
|
+
onload(e) {
|
58
|
+
const $img = e.currentTarget
|
59
|
+
this.pending = false
|
60
|
+
|
61
|
+
if (!$img) { return }
|
62
|
+
const height = $img.clientHeight
|
63
|
+
const width = $img.clientWidth
|
64
|
+
|
65
|
+
if (height / width > this.boxHeight / this.boxWidth) {
|
66
|
+
$img.style.height = '100%'
|
67
|
+
$img.style.width = 'auto'
|
68
|
+
} else {
|
69
|
+
$img.style.height = 'auto'
|
70
|
+
$img.style.width = '100%'
|
71
|
+
}
|
72
|
+
$img.style.visibility = 'visible'
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
</script>
|
77
|
+
<template>
|
78
|
+
<div class="component fit-img" ref="box">
|
79
|
+
124545
|
80
|
+
<img @load="onload" :src="src">
|
81
|
+
<spinner color="#fff" type="fading-circle" v-show="pending" :size="40" class="spinner" />
|
82
|
+
</div>
|
83
|
+
</template>
|
84
|
+
<style lang="stylus" rel="stylesheet/stylus" scoped type="text/stylus">
|
85
|
+
.component.fit-img {
|
86
|
+
display: -webkit-box;
|
87
|
+
-webkit-box-align: center;
|
88
|
+
-webkit-box-orient: vertical;
|
89
|
+
-webkit-box-pack: center;
|
90
|
+
overflow: hidden;
|
91
|
+
position: relative;
|
92
|
+
|
93
|
+
& > img {
|
94
|
+
visibility: hidden;
|
95
|
+
}
|
96
|
+
|
97
|
+
.spinner {
|
98
|
+
position: absolute;
|
99
|
+
left: 50%;
|
100
|
+
top: 50%;
|
101
|
+
transform: translate(-50%, -50%);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
</style>
|
105
|
+
|
106
|
+
<script type="text/ecmascript-6">
|
107
|
+
import Spinner from 'mint-ui/spinner'
|
108
|
+
import 'mint-ui/spinner/style.css'
|
109
|
+
|
110
|
+
export default {
|
111
|
+
name: 'FitImg',
|
112
|
+
components: { Spinner },
|
113
|
+
mixins: [],
|
114
|
+
props: {
|
115
|
+
src: {
|
116
|
+
required: true
|
117
|
+
}
|
118
|
+
},
|
119
|
+
data() {
|
120
|
+
return {
|
121
|
+
pending: true,
|
122
|
+
boxHeight: 1,
|
123
|
+
boxWidth: 1
|
124
|
+
}
|
125
|
+
},
|
126
|
+
mounted() {
|
127
|
+
this.$nextTick(() => {
|
128
|
+
this.boxHeight = this.$refs.box.clientHeight
|
129
|
+
this.boxWidth = this.$refs.box.clientWidth
|
130
|
+
})
|
131
|
+
},
|
132
|
+
methods: {
|
133
|
+
onload(e) {
|
134
|
+
const $img = e.currentTarget
|
135
|
+
this.pending = false
|
136
|
+
|
137
|
+
if (!$img) { return }
|
138
|
+
const height = $img.clientHeight
|
139
|
+
const width = $img.clientWidth
|
140
|
+
|
141
|
+
if (height / width > this.boxHeight / this.boxWidth) {
|
142
|
+
$img.style.height = '100%'
|
143
|
+
$img.style.width = 'auto'
|
144
|
+
} else {
|
145
|
+
$img.style.height = 'auto'
|
146
|
+
$img.style.width = '100%'
|
147
|
+
}
|
148
|
+
$img.style.visibility = 'visible'
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
152
|
+
</script>
|
@@ -0,0 +1,80 @@
|
|
1
|
+
<template>
|
2
|
+
<popup v-model="visible" class="component img-viwer">
|
3
|
+
<div :style="style">
|
4
|
+
<swipe :continuous="false" :speed="200" :prevent="false" :auto="0" :default-index="defaultIndex" @change="handleChange" class="swpier">
|
5
|
+
<swipe-item v-for="(img, index) in imgs" :key="index">
|
6
|
+
<fit-img class="fit-img" :src="img" />
|
7
|
+
</swipe-item>
|
8
|
+
</swipe>
|
9
|
+
</div>
|
10
|
+
</popup>
|
11
|
+
</template>
|
12
|
+
<style lang="stylus" rel="stylesheet/stylus" type="text/stylus">
|
13
|
+
.component.img-viwer {
|
14
|
+
background-color: rgba(0, 0, 0, 0.9);
|
15
|
+
|
16
|
+
.swpier {
|
17
|
+
height: 100%;
|
18
|
+
width: 100%;
|
19
|
+
}
|
20
|
+
|
21
|
+
.fit-img {
|
22
|
+
height: 100%;
|
23
|
+
width: 100%;
|
24
|
+
}
|
25
|
+
|
26
|
+
.mint-swipe-indicator {
|
27
|
+
background-color: #333;
|
28
|
+
|
29
|
+
&.is-active {
|
30
|
+
background-color: #fff;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
</style>
|
35
|
+
|
36
|
+
<script type="text/ecmascript-6">
|
37
|
+
import FitImg from './FitImg'
|
38
|
+
import SwipeItem from 'mint-ui/swipe-item/'
|
39
|
+
import 'mint-ui/swipe-item/style.css'
|
40
|
+
import Swipe from 'mint-ui/swipe'
|
41
|
+
import 'mint-ui/swipe/style.css'
|
42
|
+
import Popup from 'mint-ui/popup'
|
43
|
+
import 'mint-ui/popup/style.css'
|
44
|
+
|
45
|
+
export default {
|
46
|
+
name: 'ImgViewer',
|
47
|
+
components: { Popup, Swipe, SwipeItem, FitImg },
|
48
|
+
mixins: [],
|
49
|
+
data() {
|
50
|
+
return {
|
51
|
+
visible: false,
|
52
|
+
imgs: [],
|
53
|
+
style: {},
|
54
|
+
defaultIndex: 0
|
55
|
+
}
|
56
|
+
},
|
57
|
+
beforeMount() {
|
58
|
+
this.style = {
|
59
|
+
height: document.documentElement.clientHeight + 'px',
|
60
|
+
width: document.documentElement.clientWidth + 'px'
|
61
|
+
}
|
62
|
+
},
|
63
|
+
methods: {
|
64
|
+
handleChange(index) {
|
65
|
+
this.$emit('change', index)
|
66
|
+
},
|
67
|
+
open(imgs, index = 0) {
|
68
|
+
if (this.visible) { return }
|
69
|
+
this.imgs = imgs || []
|
70
|
+
this.defaultIndex = index
|
71
|
+
this.visible = true
|
72
|
+
},
|
73
|
+
close() {
|
74
|
+
this.visible = false
|
75
|
+
this.imgs = []
|
76
|
+
this.defaultIndex = 0
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
</script>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="component loading">
|
3
|
+
<mt-popup v-model="show" popup-transition="popup-fade" class="loading-popup" ref="loadEntity">
|
4
|
+
<mt-spinner color="#fff" type="fading-circle" :size="40" />
|
5
|
+
</mt-popup>
|
6
|
+
</div>
|
7
|
+
</template>
|
8
|
+
<style lang="stylus" rel="stylesheet/stylus" type="text/stylus">
|
9
|
+
.component.loading {
|
10
|
+
.loading-popup {
|
11
|
+
position: absolute;
|
12
|
+
top: 45%;
|
13
|
+
left: 50%;
|
14
|
+
transform: translate3D(-50%, -50%, 0);
|
15
|
+
}
|
16
|
+
|
17
|
+
.mint-popup {
|
18
|
+
background: transparent;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
</style>
|
22
|
+
|
23
|
+
<script type="text/ecmascript-6">
|
24
|
+
import Spinner from 'mint-ui/spinner'
|
25
|
+
import 'mint-ui/spinner/style.css'
|
26
|
+
import Popup from 'mint-ui/popup'
|
27
|
+
import 'mint-ui/popup/style.css'
|
28
|
+
|
29
|
+
export default {
|
30
|
+
name: 'Loading',
|
31
|
+
components: { MtSpinner: Spinner, MtPopup: Popup },
|
32
|
+
mixins: [],
|
33
|
+
data: function() {
|
34
|
+
return {
|
35
|
+
show: false
|
36
|
+
}
|
37
|
+
},
|
38
|
+
created: function() {
|
39
|
+
},
|
40
|
+
methods: {
|
41
|
+
open() {
|
42
|
+
this.show = true
|
43
|
+
const $loadEntity = this.$refs.loadEntity.$el
|
44
|
+
if (!$loadEntity) { return }
|
45
|
+
$loadEntity.style.display = 'block'
|
46
|
+
},
|
47
|
+
hide() {
|
48
|
+
this.show = false
|
49
|
+
const $loadEntity = this.$refs.loadEntity.$el
|
50
|
+
if (!$loadEntity) { return }
|
51
|
+
$loadEntity.style.display = 'none'
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
</script>
|