leisure-core 0.4.77 → 0.4.81
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/index.js +3 -0
- package/le-image/src/main.vue +8 -148
- package/le-image-container/index.js +7 -0
- package/le-image-container/src/main.vue +155 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import LeRichText from "./le-rich-text/index.js";
|
|
|
22
22
|
import LeButtonUpload from "./le-button-upload/index.js";
|
|
23
23
|
import LeButtonSelectMedia from "./le-button-select-media/index.js";
|
|
24
24
|
import LeImage from "./le-image/index.js";
|
|
25
|
+
import LeImageContainer from "./le-image-container/index.js";
|
|
25
26
|
import LeBackUp from "./le-backup/index.js";
|
|
26
27
|
import LeUpload from "./le-upload/index.js";
|
|
27
28
|
import LeMpurl from "./le-mpurl/index.js";
|
|
@@ -54,6 +55,7 @@ const components = [
|
|
|
54
55
|
LeRichText,
|
|
55
56
|
LeButtonUpload,
|
|
56
57
|
LeButtonSelectMedia,
|
|
58
|
+
LeImageContainer,
|
|
57
59
|
LeImage,
|
|
58
60
|
LeBackUp,
|
|
59
61
|
LeUpload,
|
|
@@ -156,6 +158,7 @@ export default {
|
|
|
156
158
|
LeRichText,
|
|
157
159
|
LeButtonUpload,
|
|
158
160
|
LeButtonSelectMedia,
|
|
161
|
+
LeImageContainer,
|
|
159
162
|
LeImage,
|
|
160
163
|
LeBackUp,
|
|
161
164
|
LeUpload,
|
package/le-image/src/main.vue
CHANGED
|
@@ -1,155 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
:key="index"
|
|
9
|
-
>
|
|
10
|
-
<el-image :src="item" class="img">
|
|
11
|
-
<div slot="placeholder" class="image-slot">
|
|
12
|
-
加载中<span class="dot">...</span>
|
|
13
|
-
</div>
|
|
14
|
-
</el-image>
|
|
15
|
-
<span
|
|
16
|
-
class="delete"
|
|
17
|
-
@click="delImgList(item)"
|
|
18
|
-
:id="index"
|
|
19
|
-
:style="imgDeleCss"
|
|
20
|
-
>
|
|
21
|
-
<i class="el-icon-delete"></i>
|
|
22
|
-
</span>
|
|
23
|
-
</div>
|
|
24
|
-
<div style="display: flex">
|
|
25
|
-
<div class="img">
|
|
26
|
-
<le-button-upload
|
|
27
|
-
title="上传素材"
|
|
28
|
-
@callMdiaUrl="selectContent"
|
|
29
|
-
></le-button-upload>
|
|
30
|
-
<le-button-select-media
|
|
31
|
-
title="选择素材"
|
|
32
|
-
:multiple="false"
|
|
33
|
-
@selectContent="selectContent"
|
|
34
|
-
></le-button-select-media>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
2
|
+
<el-image
|
|
3
|
+
v-bind="$attrs"
|
|
4
|
+
v-on="$listeners"
|
|
5
|
+
:class="['customClass', $attrs.class]"
|
|
6
|
+
:style="$attrs.style"
|
|
7
|
+
></el-image>
|
|
38
8
|
</template>
|
|
39
9
|
<script>
|
|
40
10
|
export default {
|
|
41
11
|
name: "le-image",
|
|
42
|
-
props: {
|
|
43
|
-
|
|
44
|
-
type: Array,
|
|
45
|
-
default: () => [],
|
|
46
|
-
},
|
|
47
|
-
limit: {
|
|
48
|
-
type: Number,
|
|
49
|
-
default: 99999,
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
data() {
|
|
53
|
-
return {
|
|
54
|
-
imgDeleCss: "display:none",
|
|
55
|
-
imageList: [],
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
|
-
watch: {
|
|
59
|
-
images: {
|
|
60
|
-
handler(val) {
|
|
61
|
-
this.imageList = val;
|
|
62
|
-
},
|
|
63
|
-
immediate: true,
|
|
64
|
-
deep: true,
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
mounted() {},
|
|
68
|
-
methods: {
|
|
69
|
-
mouseOverImg() {
|
|
70
|
-
this.imgDeleCss = "display:block;cursor:pointer";
|
|
71
|
-
},
|
|
72
|
-
mouseLeaveImg() {
|
|
73
|
-
this.imgDeleCss = "display:none";
|
|
74
|
-
},
|
|
75
|
-
delImgList(item) {
|
|
76
|
-
let lenp = this.imageList.indexOf(item);
|
|
77
|
-
this.imageList.splice(lenp, 1);
|
|
78
|
-
this.$emit("getImages", this.imageList);
|
|
79
|
-
},
|
|
80
|
-
selectContent(val) {
|
|
81
|
-
let images = this.imageList;
|
|
82
|
-
let num = images && images.length > 0 ? images.length : 0;
|
|
83
|
-
if (num < this.limit) {
|
|
84
|
-
if (!Array.isArray(val)) {
|
|
85
|
-
if (!val) return;
|
|
86
|
-
this.imageList.push(val);
|
|
87
|
-
this.$emit("getImages", this.imageList);
|
|
88
|
-
} else {
|
|
89
|
-
this.imageList.push(...val);
|
|
90
|
-
this.$emit("getImages", this.imageList);
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
this.$message.warning(`图片数量最多${this.limit}张!`);
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
},
|
|
12
|
+
props: {},
|
|
13
|
+
methods: {},
|
|
97
14
|
};
|
|
98
15
|
</script>
|
|
99
|
-
<style lang="scss" scoped>
|
|
100
|
-
.le-image {
|
|
101
|
-
display: flex;
|
|
102
|
-
display: -webkit-flex;
|
|
103
|
-
flex-wrap: wrap;
|
|
104
|
-
.list {
|
|
105
|
-
position: relative;
|
|
106
|
-
width: 100px;
|
|
107
|
-
height: 100px;
|
|
108
|
-
left: 0;
|
|
109
|
-
top: 0;
|
|
110
|
-
cursor: default;
|
|
111
|
-
text-align: center;
|
|
112
|
-
color: #fff;
|
|
113
|
-
opacity: 100;
|
|
114
|
-
font-size: 20px;
|
|
115
|
-
/* background-color: rgba(0, 0, 0, 0.5); */
|
|
116
|
-
/* transition: opacity 0.3s; */
|
|
117
|
-
display: inline;
|
|
118
|
-
|
|
119
|
-
.img {
|
|
120
|
-
width: 100px;
|
|
121
|
-
height: 100px;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.delete {
|
|
125
|
-
position: absolute;
|
|
126
|
-
right: 0px;
|
|
127
|
-
bottom: 0;
|
|
128
|
-
font-size: 20px;
|
|
129
|
-
color: #fff;
|
|
130
|
-
display: block;
|
|
131
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
132
|
-
transition: opacity 0.3s;
|
|
133
|
-
width: 100%;
|
|
134
|
-
height: 100%;
|
|
135
|
-
text-align: center;
|
|
136
|
-
padding-top: 30%;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
.img {
|
|
140
|
-
background-color: #fbfdff;
|
|
141
|
-
border: 1px dashed #c0ccda;
|
|
142
|
-
border-radius: 6px;
|
|
143
|
-
width: 100px;
|
|
144
|
-
height: 100px;
|
|
145
|
-
cursor: pointer;
|
|
146
|
-
font-size: 16px;
|
|
147
|
-
color: #8c939d;
|
|
148
|
-
display: flex;
|
|
149
|
-
display: -webkit-flex;
|
|
150
|
-
flex-direction: column;
|
|
151
|
-
justify-content: center;
|
|
152
|
-
align-items: center;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
</style>
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="le-image-container">
|
|
3
|
+
<div
|
|
4
|
+
class="list"
|
|
5
|
+
@mouseover="mouseOverImg"
|
|
6
|
+
@mouseleave="mouseLeaveImg"
|
|
7
|
+
v-for="(item, index) in imageList"
|
|
8
|
+
:key="index"
|
|
9
|
+
>
|
|
10
|
+
<el-image :src="item" class="img">
|
|
11
|
+
<div slot="placeholder" class="image-slot">
|
|
12
|
+
加载中<span class="dot">...</span>
|
|
13
|
+
</div>
|
|
14
|
+
</el-image>
|
|
15
|
+
<span
|
|
16
|
+
class="delete"
|
|
17
|
+
@click="delImgList(item)"
|
|
18
|
+
:id="index"
|
|
19
|
+
:style="imgDeleCss"
|
|
20
|
+
>
|
|
21
|
+
<i class="el-icon-delete"></i>
|
|
22
|
+
</span>
|
|
23
|
+
</div>
|
|
24
|
+
<div style="display: flex">
|
|
25
|
+
<div class="img">
|
|
26
|
+
<le-button-upload
|
|
27
|
+
title="上传素材"
|
|
28
|
+
@callMdiaUrl="selectContent"
|
|
29
|
+
></le-button-upload>
|
|
30
|
+
<le-button-select-media
|
|
31
|
+
title="选择素材"
|
|
32
|
+
:multiple="false"
|
|
33
|
+
@selectContent="selectContent"
|
|
34
|
+
></le-button-select-media>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
<script>
|
|
40
|
+
export default {
|
|
41
|
+
name: "le-image-container",
|
|
42
|
+
props: {
|
|
43
|
+
images: {
|
|
44
|
+
type: Array,
|
|
45
|
+
default: () => [],
|
|
46
|
+
},
|
|
47
|
+
limit: {
|
|
48
|
+
type: Number,
|
|
49
|
+
default: 99999,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
data() {
|
|
53
|
+
return {
|
|
54
|
+
imgDeleCss: "display:none",
|
|
55
|
+
imageList: [],
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
watch: {
|
|
59
|
+
images: {
|
|
60
|
+
handler(val) {
|
|
61
|
+
this.imageList = val;
|
|
62
|
+
},
|
|
63
|
+
immediate: true,
|
|
64
|
+
deep: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
mounted() {},
|
|
68
|
+
methods: {
|
|
69
|
+
mouseOverImg() {
|
|
70
|
+
this.imgDeleCss = "display:block;cursor:pointer";
|
|
71
|
+
},
|
|
72
|
+
mouseLeaveImg() {
|
|
73
|
+
this.imgDeleCss = "display:none";
|
|
74
|
+
},
|
|
75
|
+
delImgList(item) {
|
|
76
|
+
let lenp = this.imageList.indexOf(item);
|
|
77
|
+
this.imageList.splice(lenp, 1);
|
|
78
|
+
this.$emit("getImages", this.imageList);
|
|
79
|
+
},
|
|
80
|
+
selectContent(val) {
|
|
81
|
+
let images = this.imageList;
|
|
82
|
+
let num = images && images.length > 0 ? images.length : 0;
|
|
83
|
+
if (num < this.limit) {
|
|
84
|
+
if (!Array.isArray(val)) {
|
|
85
|
+
if (!val) return;
|
|
86
|
+
this.imageList.push(val);
|
|
87
|
+
this.$emit("getImages", this.imageList);
|
|
88
|
+
} else {
|
|
89
|
+
this.imageList.push(...val);
|
|
90
|
+
this.$emit("getImages", this.imageList);
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
this.$message.warning(`图片数量最多${this.limit}张!`);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
</script>
|
|
99
|
+
<style lang="scss" scoped>
|
|
100
|
+
.le-image-container {
|
|
101
|
+
display: flex;
|
|
102
|
+
display: -webkit-flex;
|
|
103
|
+
flex-wrap: wrap;
|
|
104
|
+
.list {
|
|
105
|
+
position: relative;
|
|
106
|
+
width: 100px;
|
|
107
|
+
height: 100px;
|
|
108
|
+
left: 0;
|
|
109
|
+
top: 0;
|
|
110
|
+
cursor: default;
|
|
111
|
+
text-align: center;
|
|
112
|
+
color: #fff;
|
|
113
|
+
opacity: 100;
|
|
114
|
+
font-size: 20px;
|
|
115
|
+
/* background-color: rgba(0, 0, 0, 0.5); */
|
|
116
|
+
/* transition: opacity 0.3s; */
|
|
117
|
+
display: inline;
|
|
118
|
+
|
|
119
|
+
.img {
|
|
120
|
+
width: 100px;
|
|
121
|
+
height: 100px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.delete {
|
|
125
|
+
position: absolute;
|
|
126
|
+
right: 0px;
|
|
127
|
+
bottom: 0;
|
|
128
|
+
font-size: 20px;
|
|
129
|
+
color: #fff;
|
|
130
|
+
display: block;
|
|
131
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
132
|
+
transition: opacity 0.3s;
|
|
133
|
+
width: 100%;
|
|
134
|
+
height: 100%;
|
|
135
|
+
text-align: center;
|
|
136
|
+
padding-top: 30%;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
.img {
|
|
140
|
+
background-color: #fbfdff;
|
|
141
|
+
border: 1px dashed #c0ccda;
|
|
142
|
+
border-radius: 6px;
|
|
143
|
+
width: 100px;
|
|
144
|
+
height: 100px;
|
|
145
|
+
cursor: pointer;
|
|
146
|
+
font-size: 16px;
|
|
147
|
+
color: #8c939d;
|
|
148
|
+
display: flex;
|
|
149
|
+
display: -webkit-flex;
|
|
150
|
+
flex-direction: column;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
align-items: center;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
</style>
|