Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
exhibition_page
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
龙菲
exhibition_page
Commits
d65f7bf6
提交
d65f7bf6
authored
10月 08, 2023
作者:
龙菲
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
以图搜图优化
上级
d2fc8e1e
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
74 行增加
和
40 行删除
+74
-40
index.vue
src/views/searchPic/index.vue
+74
-40
没有找到文件。
src/views/searchPic/index.vue
浏览文件 @
d65f7bf6
...
@@ -19,13 +19,25 @@
...
@@ -19,13 +19,25 @@
class=
"upload-area"
class=
"upload-area"
name=
"zipFile"
name=
"zipFile"
accept=
".jpg,.png"
accept=
".jpg,.png"
:action=
"importZipUrl"
action
:headers=
"headers"
:before-upload=
"handleBeforeUpload"
:show-file-list=
"false"
:on-success=
"handleSuccess"
:on-success=
"handleSuccess"
:on-
change=
"handleChange
"
:on-
progress=
"handleProgress
"
:
auto-upload=
"false
"
:
file-list=
"fileList
"
drag
drag
>
>
<div
v-if=
"showProgress"
>
<el-progress
id=
"progress"
type=
"circle"
:percentage=
"percent"
:stroke-width=
"8"
:width=
"100"
:show-text=
"true"
></el-progress>
</div>
<div
class=
"img-wrapper"
v-else
>
<div
class=
"icon"
>
<div
class=
"icon"
>
<svg-icon
icon-class=
"img"
></svg-icon>
<svg-icon
icon-class=
"img"
></svg-icon>
</div>
</div>
...
@@ -35,6 +47,7 @@
...
@@ -35,6 +47,7 @@
<div
class=
"camera"
>
<div
class=
"camera"
>
<svg-icon
icon-class=
"camera"
></svg-icon>
<svg-icon
icon-class=
"camera"
></svg-icon>
</div>
</div>
</div>
</el-upload>
</el-upload>
</div>
</div>
</div>
</div>
...
@@ -44,10 +57,60 @@
...
@@ -44,10 +57,60 @@
<
script
>
<
script
>
export
default
{
export
default
{
data
()
{
data
()
{
return
{};
return
{
// progressText: "", //进度文字
progressPercent
:
0
,
//进度百分比
showProgress
:
false
,
//是否展示进度条
fileList
:
[],
//双向绑定的文件,上传完之后会被清空
showFileList
:
[],
//展示的文件列表,上传之后不会被清空
};
},
},
mounted
()
{},
mounted
()
{},
methods
:
{},
methods
:
{
// 上传前钩子,处理文件类型
async
handleBeforeUpload
(
file
)
{
// debugger;
let
reg
=
/
(?
<=
\.)[
a-z
]
+$/g
;
let
fileType
=
file
.
name
.
match
(
reg
)
+
""
;
let
typeArr
=
[
"png"
,
"jpg"
,
"jpeg"
];
if
(
!
typeArr
.
includes
(
fileType
))
{
this
.
$message
.
warning
(
"上传文件格式错误!"
);
return
;
}
let
formData
=
new
FormData
();
formData
.
append
(
"file"
,
file
);
this
.
showProgress
=
true
;
// TODO:上传接口调用
// await realtimeUpload(formData, this).then((res) => {
// if (res.code == "0") {
// this.$message.success(res.data);
// } else {
// this.$message.warning(res.data);
// }
// });
setTimeout
(()
=>
{
this
.
showProgress
=
false
;
// this.rotateFn(0)
this
.
progressPercent
=
0
;
},
1000
);
},
// 文件上传进度钩子,展示文件进度
handleProgress
(
event
)
{
console
.
log
(
event
);
this
.
showProgress
=
true
;
this
.
progressPercent
=
parseInt
(
event
.
percent
);
},
// 上传成功之后的钩子
handleSuccess
(
res
)
{
console
.
log
(
res
);
if
(
res
.
code
==
200
)
{
this
.
progressPercent
=
100
;
}
else
{
console
.
log
(
"上传失败"
);
}
this
.
showProgress
=
false
;
},
},
};
};
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
...
@@ -108,7 +171,7 @@ export default {
...
@@ -108,7 +171,7 @@ export default {
}
}
}
}
.upload-wrapper
{
.upload-wrapper
{
height
:
4
00px
;
height
:
3
00px
;
width
:
100%
;
width
:
100%
;
display
:
flex
;
display
:
flex
;
justify-content
:
center
;
justify-content
:
center
;
...
@@ -164,38 +227,9 @@ export default {
...
@@ -164,38 +227,9 @@ export default {
}
}
}
}
}
}
.img-wrapper
{
.show-result
{
display
:
flex
;
.banner
{
justify-content
:
center
;
.subtitle
{
align-items
:
center
;
opacity
:
0
;
}
}
.upload-wrapper
{
height
:
90px
;
.upload-panel
{
height
:
80px
;
transform
:
translateY
(
-200px
);
}
}
::v-deep
.el-upload-dragger
{
align-items
:
flex-start
!
important
;
padding
:
0
10px
;
position
:
relative
;
.icon
{
opacity
:
0
;
}
.text
{
transform
:
translateY
(
-28px
);
}
.camera
{
color
:
$deepBlue
;
opacity
:
1
;
position
:
absolute
;
right
:
0
;
top
:
0
;
font-size
:
20px
;
}
}
}
}
</
style
>
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论