This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

优化表单组件;修复readOnly

old
宇天 2020-07-22 19:56:46 +08:00
parent f573fa5a61
commit b5cf3b8bb6
33 changed files with 267 additions and 115 deletions

View File

@ -132,7 +132,7 @@ function mkWCFile({ style, html, js }) {
return `/** return `/**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date ${BUILD_DATE} * @date ${BUILD_DATE}
* @version v${VERSION} * @version v${VERSION}
* *

View File

@ -143,7 +143,7 @@ function mkWCFile({ style, html, js }) {
return `/** return `/**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date ${BUILD_DATE} * @date ${BUILD_DATE}
* @version v${VERSION} * @version v${VERSION}
* *

View File

@ -1,6 +1,6 @@
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2018-08-04 18:47:35 * @date 2018-08-04 18:47:35
*/ */
@ -133,15 +133,44 @@ function CodeMirror(place, givenOptions) {
updateInput = false updateInput = false
})() })()
var history = new History() var history = new History()
connect(scroller, 'mousedown', operation(onMouseDown)) connect(
connect(scroller, 'dblclick', operation(onDoubleClick)) scroller,
connect(lineSpace, 'selectstart', e_preventDefault) 'mousedown',
if (!gecko) connect(scroller, 'contextmenu', onContextMenu) operation(onMouseDown)
connect(scroller, 'scroll', onScrollMain) )
connect(scrollbar, 'scroll', onScrollBar) connect(
connect(scrollbar, 'mousedown', function() { scroller,
'dblclick',
operation(onDoubleClick)
)
connect(
lineSpace,
'selectstart',
e_preventDefault
)
if (!gecko)
connect(
scroller,
'contextmenu',
onContextMenu
)
connect(
scroller,
'scroll',
onScrollMain
)
connect(
scrollbar,
'scroll',
onScrollBar
)
connect(
scrollbar,
'mousedown',
function() {
if (focused) setTimeout(focusInput, 0) if (focused) setTimeout(focusInput, 0)
}) }
)
var resizeHandler = connect( var resizeHandler = connect(
window, window,
'resize', 'resize',
@ -151,31 +180,79 @@ function CodeMirror(place, givenOptions) {
}, },
true true
) )
connect(input, 'keyup', operation(onKeyUp)) connect(
connect(input, 'input', fastPoll) input,
connect(input, 'keydown', operation(onKeyDown)) 'keyup',
connect(input, 'keypress', operation(onKeyPress)) operation(onKeyUp)
connect(input, 'focus', onFocus) )
connect(input, 'blur', onBlur) connect(
input,
'input',
fastPoll
)
connect(
input,
'keydown',
operation(onKeyDown)
)
connect(
input,
'keypress',
operation(onKeyPress)
)
connect(
input,
'focus',
onFocus
)
connect(
input,
'blur',
onBlur
)
function drag_(e) { function drag_(e) {
if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return
e_stop(e) e_stop(e)
} }
if (options.dragDrop) { if (options.dragDrop) {
connect(scroller, 'dragstart', onDragStart) connect(
connect(scroller, 'dragenter', drag_) scroller,
connect(scroller, 'dragover', drag_) 'dragstart',
connect(scroller, 'drop', operation(onDrop)) onDragStart
)
connect(
scroller,
'dragenter',
drag_
)
connect(
scroller,
'dragover',
drag_
)
connect(
scroller,
'drop',
operation(onDrop)
)
} }
connect(scroller, 'paste', function() { connect(
scroller,
'paste',
function() {
focusInput() focusInput()
fastPoll() fastPoll()
}) }
connect(input, 'paste', function() { )
connect(
input,
'paste',
function() {
pasteIncoming = true pasteIncoming = true
fastPoll() fastPoll()
}) }
)
connect( connect(
input, input,
'cut', 'cut',
@ -184,10 +261,14 @@ function CodeMirror(place, givenOptions) {
}) })
) )
if (khtml) if (khtml)
connect(sizer, 'mouseup', function() { connect(
sizer,
'mouseup',
function() {
if (document.activeElement == input) input.blur() if (document.activeElement == input) input.blur()
focusInput() focusInput()
}) }
)
var hasFocus var hasFocus
try { try {
hasFocus = document.activeElement == input hasFocus = document.activeElement == input
@ -698,8 +779,18 @@ function CodeMirror(place, givenOptions) {
type == 'single' type == 'single'
) { ) {
if (webkit) scroller.draggable = true if (webkit) scroller.draggable = true
var up = connect(document, 'mouseup', operation(dragEnd), true) var up = connect(
var drop = connect(scroller, 'drop', operation(dragEnd), true) document,
'mouseup',
operation(dragEnd),
true
)
var drop = connect(
scroller,
'drop',
operation(dragEnd),
true
)
draggingText = true draggingText = true
if (scroller.dragDrop) scroller.dragDrop() if (scroller.dragDrop) scroller.dragDrop()
return return
@ -775,7 +866,12 @@ function CodeMirror(place, givenOptions) {
}), }),
true true
) )
var up = connect(document, 'mouseup', operation(done), true) var up = connect(
document,
'mouseup',
operation(done),
true
)
} }
function onDoubleClick(e) { function onDoubleClick(e) {
@ -3358,7 +3454,12 @@ CodeMirror.fromTextArea = function(textarea, options) {
textarea.value = instance.getValue() textarea.value = instance.getValue()
} }
if (textarea.form) { if (textarea.form) {
var rmSubmit = connect(textarea.form, 'submit', save, true) var rmSubmit = connect(
textarea.form,
'submit',
save,
true
)
var realSubmit = textarea.form.submit var realSubmit = textarea.form.submit
textarea.form.submit = function wrappedSubmit() { textarea.form.submit = function wrappedSubmit() {
save() save()
@ -3764,7 +3865,7 @@ Line.prototype = {
if (!m) break if (!m) break
pos += skipped + 1 pos += skipped + 1
if (m[0] == '\t') { if (m[0] == '\t') {
var tabWidth = tabSize - col % tabSize var tabWidth = tabSize - (col % tabSize)
content.appendChild(elt('span', spaceStr(tabWidth), 'cm-tab')) content.appendChild(elt('span', spaceStr(tabWidth), 'cm-tab'))
col += tabWidth col += tabWidth
} else { } else {
@ -4287,7 +4388,7 @@ function countColumn(string, end, tabSize) {
if (end == -1) end = string.length if (end == -1) end = string.length
} }
for (var i = 0, n = 0; i < end; ++i) { for (var i = 0, n = 0; i < end; ++i) {
if (string.charAt(i) == '\t') n += tabSize - n % tabSize if (string.charAt(i) == '\t') n += tabSize - (n % tabSize)
else ++n else ++n
} }
return n return n

View File

@ -1,6 +1,6 @@
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2018-08-04 18:47:35 * @date 2018-08-04 18:47:35
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2016-08-19 10:38:25 * @date 2016-08-19 10:38:25
* *
*/ */

View File

@ -1,7 +1,7 @@
@charset "UTF-8"; @charset "UTF-8";
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2017-04-17 16:43:22 * @date 2017-04-17 16:43:22
* *
*/ */

View File

@ -0,0 +1 @@
.do-meditor-attach{width:630px;height:300px;cursor:default;color:#526273}.do-meditor-attach ::-webkit-scrollbar{width:5px;height:5px;background:#f2f5fc}.do-meditor-attach ::-webkit-scrollbar:hover{background:#e8ebf4}.do-meditor-attach ::-webkit-scrollbar-button{display:none}.do-meditor-attach ::-webkit-scrollbar-thumb{background:#bdbdbd}.do-meditor-attach ::-webkit-scrollbar-thumb:hover{background:#9e9e9e}.do-meditor-attach .tab-box{float:left;width:130px;height:300px;padding:10px 5px;text-align:center;background:#f2f5fc;border-radius:5px}.do-meditor-attach .tab-box .item{display:block;width:100%;height:40px;line-height:40px;border-radius:3px;cursor:pointer}.do-meditor-attach .tab-box .item.active{background:#fff}.do-meditor-attach .cont-box{position:relative;float:right;width:480px;height:auto;min-height:200px}.do-meditor-attach .cont-box .remote,.do-meditor-attach .cont-box .local{position:relative;width:92%;height:auto;margin:0 auto}.do-meditor-attach .cont-box .remote{padding:30px 0}.do-meditor-attach .cont-box .hide{display:none}.do-meditor-attach .cont-box .section{display:block;width:100%;height:auto;margin:15px 0;line-height:35px}.do-meditor-attach .cont-box .section .submit{float:right;width:30%;height:45px;line-height:45px}.do-meditor-attach .cont-box .select-file{width:100%;height:35px;line-height:35px}.do-meditor-attach .cont-box .select-file .file{float:left;width:100px;height:35px;border-radius:3px;background:#e8ebf4;text-align:center;cursor:pointer}.do-meditor-attach .cont-box .select-file .file:hover{background:#f2f5fc}.do-meditor-attach .cont-box .select-file .file:active{background:#dae1e9}.do-meditor-attach .cont-box .select-file .tips{display:inline-block;padding:0 10px}.do-meditor-attach .cont-box .upload-box{width:100%;height:auto;min-height:255px;padding-top:10px}.do-meditor-attach .cont-box .upload-box .thead{width:100%;height:35px;line-height:35px;background:#f2f5fc}.do-meditor-attach .cont-box .upload-box .col{overflow:hidden;float:left;height:30px;padding:0 5px;text-align:center}.do-meditor-attach .cont-box .upload-box .col:nth-child(1){width:50%}.do-meditor-attach .cont-box .upload-box .col:nth-child(2){width:35%}.do-meditor-attach .cont-box .upload-box .col:nth-child(3){width:15%}.do-meditor-attach .cont-box .upload-box .tbody{overflow:hidden;overflow-y:auto;width:100%;height:220px}.do-meditor-attach .cont-box .upload-box .tbody p{display:block;width:100%;height:30px;line-height:30px}.do-meditor-attach .cont-box .upload-box .insert{display:inline-block;padding:3px 5px;line-height:13px;background:#f2f5fc;color:#526273;cursor:pointer}.do-meditor-attach .cont-box .upload-box .red{color:#f30}.do-meditor-attach .cont-box .manager{overflow:hidden;overflow-y:auto;width:100%;height:300px}.do-meditor-attach .cont-box .manager .list-box{width:100%;-webkit-column-count:4;column-count:4;-webkit-column-gap:5;column-gap:5}.do-meditor-attach .cont-box .manager .item{margin:0 0 10px;padding:5px;text-align:center;background:#f2f5fc;-webkit-column-break-inside:avoid;break-inside:avoid;transition:background .2s ease-in-out}.do-meditor-attach .cont-box .manager .item:hover{background:#dae1e9}.do-meditor-attach .cont-box .manager .item .thumb{display:block;width:100%}.do-meditor-attach .cont-box .manager .item .name{overflow:hidden;height:30px;line-height:30px;text-align:center}.do-meditor-attach .cont-box .manager .item img{width:100%;height:auto}.do-meditor-attach .cont-box .manager .item em{line-height:1;font-size:50px}

View File

@ -1,7 +1,7 @@
@charset "UTF-8"; @charset "UTF-8";
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2017-04-20 19:13:24 * @date 2017-04-20 19:13:24
* *
*/ */

View File

@ -1,7 +1,7 @@
@charset "UTF-8"; @charset "UTF-8";
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2014-10-10 00:45:09 * @date 2014-10-10 00:45:09
* *
* douiCSS * douiCSS

1
src/css/tree.css Normal file
View File

@ -0,0 +1 @@
.do-tree{overflow:hidden;overflow-y:auto;position:relative;display:block;width:100%;height:100%;line-height:30px;font-size:15px;color:#526273}.do-tree__item{overflow:hidden;min-height:30px}.do-tree__item .sub-tree{display:none;width:100%;padding-left:20px}.do-tree__item em,.do-tree__item span{display:block;cursor:pointer}.do-tree__item em{float:left;padding:0 5px;font-size:20px;color:#62778d}.do-tree__item span:hover{color:#62778d}.do-tree__item span.active{color:#425064;font-weight:bold}.do-tree__item span.checkbox{float:left;position:relative;width:18px;height:18px;margin:6px 5px 6px 0;line-height:16px;border:1px solid #526273;border-radius:3px;font-size:16px;text-align:center}.do-tree__item span.label{white-space:nowrap;text-overflow:ellipsis}.do-tree__item.open>.sub-tree{display:block}

View File

@ -1,7 +1,7 @@
@charset "UTF-8"; @charset "UTF-8";
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2017-04-14 21:18:53 * @date 2017-04-14 21:18:53
* *
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* 拖拽插件的核心部分 * 拖拽插件的核心部分
* @author yutent<yutent@doui.cc> * @author yutent<yutent.io@gmail.com>
* @date 2019/08/23 19:41:21 * @date 2019/08/23 19:41:21
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* 拖拽指令 :drag * 拖拽指令 :drag
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2017-03-29 18:39:35 * @date 2017-03-29 18:39:35
* *
*/ */

View File

@ -165,7 +165,6 @@ export default class Checkbox {
} }
set value(val) { set value(val) {
log(val, this, this.props.label)
if (Array.isArray(val)) { if (Array.isArray(val)) {
this.props.value = val this.props.value = val
this.checked = this.props.value.includes(this.props.label) this.checked = this.props.value.includes(this.props.label)
@ -261,7 +260,11 @@ export default class Checkbox {
case 'checked': case 'checked':
case 'readonly': case 'readonly':
case 'disabled': case 'disabled':
this[name] = true var k = name
if (k === 'readonly') {
k = 'readOnly'
}
this[k] = true
break break
} }
} }

View File

@ -25,6 +25,7 @@ li {
-moz-user-select: none; -moz-user-select: none;
color: nth($cd, 2); color: nth($cd, 2);
border-radius: 2px; border-radius: 2px;
cursor: text;
} }
.label { .label {
@ -40,7 +41,7 @@ li {
border-radius: inherit; border-radius: inherit;
background: #fff; background: #fff;
color: inherit; color: inherit;
cursor: text; cursor: inherit;
input, input,
textarea { textarea {
@ -52,8 +53,7 @@ li {
border: 0; border: 0;
border-radius: inherit; border-radius: inherit;
color: inherit; color: inherit;
font-size: inherit; font: inherit;
font-family: inherit;
background: none; background: none;
outline: none; outline: none;
box-shadow: none; box-shadow: none;
@ -154,10 +154,16 @@ li {
:host([auto-border]) .label { :host([auto-border]) .label {
border-color: transparent; border-color: transparent;
} }
:host([disabled]) .label { :host([disabled]) {
background: nth($cp, 1);
cursor: not-allowed; cursor: not-allowed;
.label {
background: nth($cp, 1);
opacity: 0.6; opacity: 0.6;
}
}
:host([readonly]) {
cursor: default;
} }
:host(:focus-within) { :host(:focus-within) {
@include focus1; @include focus1;
@ -549,7 +555,11 @@ export default class Input {
case 'readonly': case 'readonly':
case 'disabled': case 'disabled':
this[name] = true var k = name
if (k === 'readonly') {
k = 'readOnly'
}
this[k] = true
break break
} }
} }

View File

@ -373,7 +373,11 @@ export default class Number {
case 'readonly': case 'readonly':
case 'disabled': case 'disabled':
this[name] = true var k = name
if (k === 'readonly') {
k = 'readOnly'
}
this[k] = true
break break
} }
} }

View File

@ -26,16 +26,14 @@
color: nth($cgr, 3); color: nth($cgr, 3);
&.checked .dot::after { &.checked .dot::after {
display: block;
width: 12px;
height: 12px;
border-radius: 50%;
background: nth($cgr, 1);
content: ''; content: '';
} }
} }
.dot { .dot {
display: flex;
justify-content: center;
align-items: center;
width: 18px; width: 18px;
height: 18px; height: 18px;
padding: 2px; padding: 2px;
@ -43,6 +41,14 @@
border: 1px solid nth($cgr, 1); border: 1px solid nth($cgr, 1);
border-radius: 50%; border-radius: 50%;
background: #fff; background: #fff;
&::after {
display: block;
width: 12px;
height: 12px;
border-radius: 50%;
background: nth($cgr, 1);
}
} }
} }
@ -57,33 +63,46 @@
:host([size='large']) { :host([size='large']) {
label { label {
width: 58px; min-width: 58px;
height: 32px; height: 32px;
} }
.dot { .dot {
width: 26px; width: 26px;
height: 26px; height: 26px;
&::after {
width: 18px;
height: 18px;
}
} }
} }
:host([size='medium']) { :host([size='medium']) {
label { label {
width: 50px; min-width: 50px;
height: 28px; height: 28px;
} }
.dot { .dot {
width: 22px; width: 22px;
height: 22px; height: 22px;
&::after {
width: 14px;
height: 14px;
}
} }
} }
:host([size='mini']) { :host([size='mini']) {
label { label {
width: 22px;
height: 14px; height: 14px;
padding: 2px;
} }
.dot { .dot {
width: 10px; width: 14px;
height: 10px; height: 14px;
&::after {
width: 8px;
height: 8px;
}
} }
} }
@ -230,11 +249,13 @@ export default class Radio {
} }
mounted() { mounted() {
this._handleClick = $.bind(this, 'click', ev => { this._handleClick = $.catch(this, 'click', ev => {
if (!this.disabled && !this.readOnly && !this.checked) { if (this.disabled || this.readOnly || this.checked) {
return
}
this.checked = true this.checked = true
this.dispatchEvent(new CustomEvent('input')) this.dispatchEvent(new CustomEvent('input'))
}
}) })
} }
@ -251,7 +272,11 @@ export default class Radio {
case 'checked': case 'checked':
case 'readonly': case 'readonly':
case 'disabled': case 'disabled':
this[name] = true var k = name
if (k === 'readonly') {
k = 'readOnly'
}
this[k] = true
break break
} }
} }

View File

@ -521,7 +521,11 @@ export default class Select {
case 'readonly': case 'readonly':
case 'disabled': case 'disabled':
this[name] = true var k = name
if (k === 'readonly') {
k = 'readOnly'
}
this[k] = true
break break
} }
} }

View File

@ -15,15 +15,17 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
// vertical-align: middle;
line-height: 0;
white-space: nowrap; white-space: nowrap;
} }
label { label {
display: flex; display: flex;
width: 38px; align-items: center;
height: 22px; width: 32px;
height: 18px;
padding: 3px; padding: 3px;
margin: 5px; margin: 5px;
line-height: 0;
border-radius: 21px; border-radius: 21px;
background: nth($cp, 3); background: nth($cp, 3);
cursor: inherit; cursor: inherit;
@ -34,8 +36,8 @@
} }
} }
.dot { .dot {
width: 16px; width: 12px;
height: 16px; height: 12px;
border-radius: 50%; border-radius: 50%;
background: #fff; background: #fff;
} }
@ -48,22 +50,24 @@
:host([size='large']) { :host([size='large']) {
label { label {
width: 58px; width: 46px;
height: 32px; height: 26px;
padding: 3px 5px;
} }
.dot { .dot {
width: 26px; width: 18px;
height: 26px; height: 18px;
} }
} }
:host([size='medium']) { :host([size='medium']) {
label { label {
width: 50px; width: 38px;
height: 28px; height: 22px;
padding: 3px 4px;
} }
.dot { .dot {
width: 22px; width: 16px;
height: 22px; height: 16px;
} }
} }
:host([size='mini']) { :host([size='mini']) {

View File

@ -1,6 +1,6 @@
/** /**
* {icon svg} * {icon svg}
* @author yutent<yutent@doui.cc> * @author yutent<yutent.io@gmail.com>
* @date 2019/07/17 15:12:14 * @date 2019/07/17 15:12:14
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* markdown解析器 * markdown解析器
* @author yutent<yutent@doui.cc> * @author yutent<yutent.io@gmail.com>
* @date 2020/02/07 17:14:19 * @date 2020/02/07 17:14:19
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2017-04-19 21:17:26 * @date 2017-04-19 21:17:26
* *
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2017-04-19 21:17:26 * @date 2017-04-19 21:17:26
* *
*/ */
@ -108,7 +108,7 @@ class Uploader {
'progress', 'progress',
evt => { evt => {
if (evt.lengthComputable && this.progress) { if (evt.lengthComputable && this.progress) {
let res = Math.round(evt.loaded * 100 / evt.total) let res = Math.round((evt.loaded * 100) / evt.total)
this.progress(res) this.progress(res)
} }
}, },

View File

@ -1,6 +1,6 @@
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2017-04-17 21:41:48 * @date 2017-04-17 21:41:48
* *
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2017-04-17 16:37:12 * @date 2017-04-17 16:37:12
* *
*/ */
@ -471,7 +471,7 @@ Anot.component('meditor', {
let sh = ev.target.scrollHeight let sh = ev.target.scrollHeight
let ch = ev.target.clientHeight let ch = ev.target.clientHeight
let psh = preview.scrollHeight let psh = preview.scrollHeight
let syncTop = st / (sh - ch) * (psh - ch) let syncTop = (st / (sh - ch)) * (psh - ch)
preview.scrollTop = syncTop preview.scrollTop = syncTop
}) })
//编辑器成功加载的回调 //编辑器成功加载的回调

View File

@ -1,6 +1,6 @@
/** /**
* icon字典 * icon字典
* @author yutent<yutent@doui.cc> * @author yutent<yutent.io@gmail.com>
* @date 2019/07/08 17:39:11 * @date 2019/07/08 17:39:11
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2018-03-25 23:59:13 * @date 2018-03-25 23:59:13
* @version $Id$ * @version $Id$
*/ */
@ -441,7 +441,6 @@ if (!window.request) {
this.__INIT__ = param this.__INIT__ = param
} }
} }
Anot.ui.request = request.version
} }
export default request export default request

View File

@ -1,6 +1,6 @@
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2016-11-26 16:35:45 * @date 2016-11-26 16:35:45
* *
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2017-04-14 21:04:50 * @date 2017-04-14 21:04:50
* *
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2018-06-25 21:39:42 * @date 2018-06-25 21:39:42
* @version $Id$ * @version $Id$
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* *
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2017-04-14 21:04:50 * @date 2017-04-14 21:04:50
* *
*/ */

View File

@ -1,7 +1,7 @@
/** /**
* Uploader 无刷新上传文件(next版) * Uploader 无刷新上传文件(next版)
* 只支持chrome/firefox/IE10+/opera12+ * 只支持chrome/firefox/IE10+/opera12+
* @authors yutent (yutent@doui.cc) * @authors yutent (yutent.io@gmail.com)
* @date 2016-09-05 19:33:23 * @date 2016-09-05 19:33:23
* *
*/ */
@ -74,7 +74,7 @@ define(function() {
function(evt) { function(evt) {
if (evt.lengthComputable && _this.progress) { if (evt.lengthComputable && _this.progress) {
var now = Date.now() var now = Date.now()
var upSize = evt.loaded * 1000 / 1024 var upSize = (evt.loaded * 1000) / 1024
var res = { loaded: evt.loaded, time: now - startTime } var res = { loaded: evt.loaded, time: now - startTime }
res.speed = upSize / res.time res.speed = upSize / res.time
@ -84,7 +84,7 @@ define(function() {
res.speed = res.speed.toFixed(2) + ' KB/s' res.speed = res.speed.toFixed(2) + ' KB/s'
} }
res.progress = Math.round(evt.loaded * 100 / evt.total) res.progress = Math.round((evt.loaded * 100) / evt.total)
_this.progress(res) _this.progress(res)
} }
}, },

View File

@ -1,6 +1,6 @@
/** /**
* 公共方法库 * 公共方法库
* @author yutent<yutent@doui.cc> * @author yutent<yutent.io@gmail.com>
* @date 2019/08/08 10:47:55 * @date 2019/08/08 10:47:55
*/ */