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
dcbabe22
Commit
dcbabe22
authored
Apr 19, 2021
by
李俊赕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除操作
parent
8e34738c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
27 deletions
+22
-27
XhFiles.vue
src/components/createCom/XhFiles.vue
+17
-25
index.js
src/components/upload/index.js
+5
-2
No files found.
src/components/createCom/XhFiles.vue
View file @
dcbabe22
...
...
@@ -5,7 +5,8 @@
<u-icon
name=
"arrow-right"
color=
"#666"
size=
"28"
></u-icon>
</view>
<view
class=
"pics u-flex u-flex-wrap"
>
<u-image
class=
"pic"
v-for=
"item in 6"
width=
"170rpx"
height=
"170"
src=
"'https://cdn.uviewui.com/uview/example/fade.jpg"
></u-image>
<u-image
class=
"pic"
v-for=
"(item,index) in imgList"
width=
"170rpx"
height=
"170"
:src=
"item.path"
></u-image>
<!--
<u-image
class=
"pic"
v-for=
"item in 6"
width=
"170rpx"
height=
"170"
src=
"'https://cdn.uviewui.com/uview/example/fade.jpg"
></u-image>
-->
</view>
<u-popup
v-model=
"maskShow"
mode=
"center"
width=
"500"
>
<view
class=
"upload-box u-p-30"
>
...
...
@@ -51,37 +52,28 @@
// 弹窗展示
this
.
maskShow
=
true
},
chooseImage
(){
},
uploadFile
(
type
){
async
uploadFile
(
type
){
const
self
=
this
if
(
type
&&
type
===
'photo'
){
// 直接打开相册
this
.
chooseImage
()
let
config
=
{
options
:{
consourceType
:[
'album'
],
//['album', 'camera']
}
}
await
this
.
chooseImage
(
'qiniu'
,
config
)
self
.
setValue
()
return
}
// 使用拍照工具拍摄
},
checkStatus
(
item
){
if
(
!
item
){
return
false
}
const
dataValue
=
this
.
dataValue
let
flag
=
Array
.
isArray
(
dataValue
)
&&
dataValue
.
indexOf
(
item
)
>-
1
console
.
log
(
flag
,
'flag'
)
return
flag
},
setValue
(
txt
)
{
const
dataValue
=
this
.
dataValue
||
[]
let
idx
=
dataValue
.
indexOf
(
txt
)
if
(
idx
>
-
1
)
{
dataValue
.
splice
(
idx
,
1
)
}
else
{
dataValue
.
push
(
txt
)
}
this
.
dataValue
=
dataValue
this
.
valueChange
(
this
.
dataValue
)
setValue
()
{
const
dataValue
=
[]
this
.
imgList
.
map
(
item
=>
{
dataValue
.
push
(
item
.
key
)
})
this
.
valueChange
(
dataValue
)
}
}
}
...
...
src/components/upload/index.js
View file @
dcbabe22
...
...
@@ -31,7 +31,8 @@ export default {
/**
* 上传图片公用组件
* @param {Object} type 文件上传方式
* @param {Object} attr 文件属性:图片种类[category](身份证、证件、头像),其他
* @param {Object} attr 文件属性:图片种类[category](身份证、证件、头像);
* 图片上传其他配置[options】(如,选择图片或拍摄options.consourceType,['album', 'camera'];)其他
*/
async
chooseImage
(
type
,
attr
=
{}){
const
self
=
this
...
...
@@ -39,6 +40,7 @@ export default {
if
(
type
===
'qiniu'
){
// 图片种类
let
category
=
attr
&&
attr
.
category
||
self
.
categories
[
0
]
let
config
=
attr
&&
attr
.
options
||
{}
// 图片上传参数配置
// 七牛上传
let
options
=
{
onProgressUpdate
(
res
){
...
...
@@ -67,7 +69,8 @@ export default {
self
.
imgList
=
imgList
console
.
log
(
res
,
'res---onEachUpdate'
)
},
cardType
:
category
cardType
:
category
,
...
config
}
// 不需要进度条等可直接获取
...
...
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