Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
self-support
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李俊赕
self-support
Commits
4af0ed5f
Commit
4af0ed5f
authored
Sep 08, 2021
by
Facius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve: 上传进度三秒不点击变半透明
parent
85c30197
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
13 deletions
+34
-13
upload-progress.vue
src/components/upload-progress/upload-progress.vue
+34
-13
No files found.
src/components/upload-progress/upload-progress.vue
View file @
4af0ed5f
<
template
>
<
template
>
<view
class=
"upload-progress"
>
<view
class=
"upload-progress"
>
<view
:class=
"['u-flex', 'suspension',
{'error': uploadStatus === 3}]" @click="openpRrogress">
<view
:class=
"['u-flex', 'suspension',
{'error': uploadStatus === 3
, 'no-active': clicked
<
=
0
}]"
@
click=
"openpRrogress"
>
<view
class=
"progress"
v-if=
"taskCount > 0"
>
{{
uploadPercentage
}}
%
</view>
<view
class=
"progress"
v-if=
"taskCount > 0"
>
{{
uploadPercentage
}}
%
</view>
<view
class=
"upload-img"
v-
if=
"taskCount === 0"
>
<view
class=
"upload-img"
v-
else
>
<image
class=
"icon"
:src=
"icon"
></image>
<image
class=
"icon"
:src=
"icon"
></image>
</view>
</view>
</view>
</view>
...
@@ -66,17 +66,19 @@
...
@@ -66,17 +66,19 @@
data
()
{
data
()
{
return
{
return
{
open
:
false
,
open
:
false
,
progressStatus
:
false
progressStatus
:
false
,
clicked
:
1
}
}
},
},
computed
:
{
computed
:
{
icon
()
{
icon
()
{
console
.
log
(
process
.
uniEnv
.
qn_base_url
+
'upload-photo.png'
)
return
process
.
uniEnv
.
qn_base_url
+
'upload-photo.png'
return
process
.
uniEnv
.
qn_base_url
+
'upload-photo.png'
},
},
defaultImg
()
{
defaultImg
()
{
return
process
.
uniEnv
.
qn_base_url
+
'upload-default.png'
return
process
.
uniEnv
.
qn_base_url
+
'upload-default.png'
},
},
taskCount
()
{
taskCount
()
{
return
this
.
uploadTotal
return
this
.
uploadTotal
},
},
uploadStatusName
()
{
uploadStatusName
()
{
...
@@ -101,7 +103,7 @@
...
@@ -101,7 +103,7 @@
const
num
=
this
.
uploadSuccess
const
num
=
this
.
uploadSuccess
const
total
=
this
.
uploadTotal
const
total
=
this
.
uploadTotal
return
total
>
0
?
Math
.
floor
(
Math
.
round
(
num
/
total
*
10000
)
/
100.00
)
:
0
return
total
>
0
?
Math
.
floor
(
Math
.
round
(
num
/
total
*
10000
)
/
100.00
)
:
0
}
}
,
},
},
watch
:
{
watch
:
{
uploadStatus
(
newValue
)
{
uploadStatus
(
newValue
)
{
...
@@ -109,13 +111,22 @@
...
@@ -109,13 +111,22 @@
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
progressStatus
=
true
this
.
progressStatus
=
true
})
})
}
},
},
open
(
val
)
{
if
(
val
==
false
)
{
this
.
changeActive
()
}
},
},
created
()
{
this
.
changeActive
()
},
methods
:
{
methods
:
{
closePopup
()
{
closePopup
()
{
this
.
progressStatus
=
false
this
.
progressStatus
=
false
},
},
openpRrogress
()
{
openpRrogress
()
{
this
.
clicked
+=
1
this
.
open
=
true
this
.
open
=
true
this
.
progressStatus
=
false
this
.
progressStatus
=
false
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -124,7 +135,13 @@
...
@@ -124,7 +135,13 @@
},
},
retry
()
{
retry
()
{
if
(
this
.
uploadStatus
!==
2
)
upload
.
uploadImageTask
(
this
)
if
(
this
.
uploadStatus
!==
2
)
upload
.
uploadImageTask
(
this
)
}
},
changeActive
()
{
setTimeout
(()
=>
{
// 三秒不点击,算失去活跃
this
.
clicked
=
Math
.
max
(
0
,
this
.
clicked
-
1
)
},
3000
)
}
}
}
}
}
</
script
>
</
script
>
...
@@ -135,16 +152,20 @@
...
@@ -135,16 +152,20 @@
height
:
100%
;
height
:
100%
;
.suspension
{
.suspension
{
position
:
fixed
;
position
:
fixed
;
right
:
5%
;
right
:
20rpx
;
bottom
:
20%
;
bottom
:
20%
;
width
:
80rpx
;
width
:
80rpx
;
height
:
80rpx
;
height
:
80rpx
;
border-radius
:
50%
;
border-radius
:
50%
;
background
:
#2272FF
;
background
:
#2272FF
;
z-index
:
999
;
z-index
:
999
;
opacity
:
1
;
&
.error
{
&
.error
{
background
:
#FA5A49
;
background
:
#FA5A49
;
}
}
&
.no-active
{
opacity
:
0
.6
;
}
.progress
{
.progress
{
font-size
:
24rpx
;
font-size
:
24rpx
;
color
:
#fff
;
color
:
#fff
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment