Skip to content

Commit 2f77227

Browse files
author
Parker
authored
Merge pull request #19 from hiparker/development
Development
2 parents 5d19867 + 1474b54 commit 2f77227

File tree

3 files changed

+37
-23
lines changed

3 files changed

+37
-23
lines changed

vue-admin-better/src/styles/vab.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ a {
7171
cursor: pointer;
7272
}
7373

74-
* {
74+
button,span,img,font,i {
7575
transition: $base-transition;
7676
}
7777
svg {

vue-admin-better/src/utils/index.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -286,24 +286,22 @@ export function random(m, n) {
286286
}
287287

288288
// 按钮倒计时锁定
289-
export function vueButtonClickBan(el, second, isAddClass) {
290-
if (
291-
el !== null &&
292-
el !== undefined &&
293-
el.path !== null &&
294-
el.path !== undefined
295-
) {
296-
let btnEl = null;
297-
for (let i = 0; i < el.path.length; i++) {
298-
if ("BUTTON" === el.path[i].nodeName) {
299-
btnEl = el.path[i];
289+
export function vueButtonClickBan(point, second, isAddClass) {
290+
let el = document.elementFromPoint(point.clientX, point.clientY);
291+
if (el !== null && el !== undefined) {
292+
for (let i = 0; i < 5; i++) {
293+
if ("BUTTON" === el.nodeName) {
300294
break;
301295
}
296+
el = el.parentNode;
297+
}
298+
if ("BUTTON" !== el.nodeName) {
299+
el = null;
302300
}
303301

304302
// 如果按钮对象不为空 则 进行处理
305-
if (btnEl !== null && btnEl !== undefined) {
306-
buttonClickBan(btnEl, second, isAddClass);
303+
if (el) {
304+
buttonClickBan(el, second, isAddClass);
307305
}
308306
}
309307
}

vue-admin-better/src/views/personalCenter/components/AvatarEdit.vue

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,19 @@
3131
ref="cropper"
3232
:img="options.img"
3333
:info="true"
34+
:outputType="options.outputType"
35+
:outputSize="options.size"
3436
:autoCrop="options.autoCrop"
3537
:autoCropWidth="options.autoCropWidth"
3638
:autoCropHeight="options.autoCropHeight"
3739
:fixedBox="options.fixedBox"
3840
:maxImgSize="options.maxImgSize"
39-
@realTime="realTime"
41+
:canScale="options.canScale"
42+
:canMove="options.canMove"
43+
:canMoveBox="options.canMoveBox"
44+
:fixed="options.fixed"
45+
:fixedNumber="options.fixedNumber"
46+
@real-time="realTime"
4047
>
4148
</vue-cropper>
4249
</div>
@@ -85,7 +92,6 @@
8592
VueCropper
8693
},
8794
data() {
88-
8995
return {
9096
title: "上传头像",
9197
instance: null,
@@ -100,13 +106,15 @@
100106
size: 1,
101107
outputType: 'image/jpeg',
102108
suffixName: '.jpg',
103-
canScale: false,
109+
canScale: true,
110+
canMove: true,
111+
canMoveBox: true,
104112
autoCrop: true,
105113
// 只有自动截图开启 宽度高度才生效
106-
autoCropWidth: 150,
107-
autoCropHeight: 150,
114+
autoCropWidth: 200,
115+
autoCropHeight: 200,
108116
maxImgSize: 1048,
109-
fixedBox: true,
117+
fixedBox: false,
110118
// 开启宽度和高度比例
111119
fixed: true,
112120
fixedNumber: [1, 1]
@@ -205,15 +213,15 @@
205213
data = e.target.result;
206214
}
207215
this.options.img = data;
208-
this.$refs.uploadImg.value = ''
216+
this.$refs.uploadImg.value = '';
209217
};
210218
// 转化为base64
211219
//reader.readAsDataURL(file)
212220
// 转化为blob
213221
reader.readAsArrayBuffer(file);
214222
},
215223
realTime(data) {
216-
this.previews = data
224+
this.previews = data;
217225
},
218226
// 设置头像base64
219227
setAvatarBase64(src, callback) {
@@ -222,7 +230,7 @@
222230
// 处理缓存
223231
image.src = src + '?v=' + Math.random();
224232
// 支持跨域图片
225-
image.crossOrigin = "*";
233+
image.crossOrigin = "anonymous";
226234
image.onload = function () {
227235
let base64 = _this.transBase64FromImage(image);
228236
callback && callback(base64);
@@ -260,6 +268,12 @@
260268
}
261269
}
262270
271+
.avatar-button {
272+
.el-button--small.is-round {
273+
padding: 9px 12px;
274+
}
275+
}
276+
263277
/* 裁剪工具 */
264278
.avatar-cropper {
265279
width: 325px;
@@ -274,6 +288,8 @@
274288
overflow: hidden;
275289
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC);
276290
box-shadow: 0 0 4px #ccc;
291+
width: 150px !important;
292+
height: 150px !important;
277293
}
278294
.preview:first-child{
279295
margin-bottom: 22px;

0 commit comments

Comments
 (0)