Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d3f76d79
authored
Jul 06, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加图片翻页功能
1 parent
b56fa703
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
22 deletions
src/views/work/ImageList.vue
src/views/work/image.vue
src/views/work/ImageList.vue
View file @
d3f76d7
...
...
@@ -7,6 +7,7 @@
:value=
"item"
:status=
"status"
:limit=
"1"
:list=
"workOrderDocs"
@
change=
"onChange('imgList')"
></image-upload>
<div
class=
"image_name"
:title=
"item.originName"
>
...
...
@@ -17,7 +18,7 @@
</template>
<ImageOtherUpload
v-model=
"otherList"
:list=
"
otherList
"
:list=
"
workOrderDocs
"
:limit=
"20-imgList.length"
:status=
"status"
:nameIndex=
"otherList.length"
...
...
@@ -77,6 +78,7 @@ export default {
// console.log(this.limit);
this
.
imgList
=
m
;
this
.
otherList
=
_other
;
this
.
workOrderDocs
=
n
},
immediate
:
true
,
},
...
...
@@ -86,6 +88,7 @@ export default {
imgList
:
[],
// 固定位置
otherList
:
[],
// 其他
limit
:
1
,
workOrderDocs
:[],
// 所有图片
};
},
methods
:
{
...
...
src/views/work/image.vue
View file @
d3f76d7
...
...
@@ -3,18 +3,34 @@
<!-- 图片列表 开始 -->
<div
class=
"img_cell"
v-if=
"imgInfo.path"
>
<div
class=
"el_img_box"
>
<i
class=
"el-icon-error el_icon"
@
click=
"removeImage(imgInfo)"
v-if=
"readStatus != 1"
></i>
<el-image
class=
"el_img"
:src=
"imgInfo.path"
:preview-src-list=
"[imgInfo.path]"
></el-image>
<i
class=
"el-icon-error el_icon"
@
click=
"removeImage(imgInfo)"
v-if=
"readStatus != 1"
></i>
<el-image
class=
"el_img"
:src=
"imgInfo.path"
:preview-src-list=
"getPreViewList(imgInfo.path)"
></el-image>
</div>
</div>
<!-- 图片列表 end -->
<!-- 上传 开始 -->
<el-upload
class=
"el_upload"
v-if=
"showUpload()"
:action=
"uploadUrl"
list-type=
"picture-card"
:accept=
"acceptFile"
:show-file-list=
"false"
:on-change=
"onChange"
:http-request=
"uploadRequest"
>
<el-upload
class=
"el_upload"
v-if=
"showUpload()"
:action=
"uploadUrl"
list-type=
"picture-card"
:accept=
"acceptFile"
:show-file-list=
"false"
:on-change=
"onChange"
:http-request=
"uploadRequest"
>
<i
class=
"el-icon-upload2"
></i>
</el-upload>
<!-- 上传 end -->
</div>
</
template
>
<
script
>
...
...
@@ -40,6 +56,12 @@ export default {
type
:
[
String
,
Number
],
default
:
1
,
},
list
:
{
type
:
Array
,
default
:
function
()
{
return
[];
},
},
},
data
()
{
return
{
...
...
@@ -59,7 +81,7 @@ export default {
},
status
:
{
handler
:
function
(
n
,
o
)
{
console
.
log
(
n
)
console
.
log
(
n
)
;
this
.
readStatus
=
n
;
},
immediate
:
true
,
...
...
@@ -107,7 +129,8 @@ export default {
// 上传图片到服务器
uploadImage
(
params
=
{},
noSignAttr
=
[
"file"
])
{
let
_this
=
this
;
const
fileUploadURL
=
"https://didicb.glsx.com.cn"
||
localStorage
.
getItem
(
"FILE_UPLOAD_URL"
);
const
fileUploadURL
=
"https://didicb.glsx.com.cn"
||
localStorage
.
getItem
(
"FILE_UPLOAD_URL"
);
//const fileUploadURL = 'http://qcdidicb.dev.glsx.com.cn:7060' // 给java后台测试用的地址
params
.
source
=
"glsx-oss-carowner"
;
params
.
app_key
=
"48e5e13229b82c1b4e6e8c96151f0637"
;
...
...
@@ -127,11 +150,11 @@ export default {
if
(
response
.
returnCode
==
0
)
{
// _this.imgList.push({ path: response.data });
// _this.previewList.push(res.data);
_this
.
$set
(
_this
.
imgInfo
,
'path'
,
response
.
data
)
_this
.
$set
(
_this
.
imgInfo
,
"path"
,
response
.
data
);
//
//this.$emit("change", response.data);
_this
.
$emit
(
"input"
,
_this
.
imgInfo
);
_this
.
$emit
(
'change'
)
_this
.
$emit
(
"change"
);
}
});
},
...
...
@@ -140,10 +163,10 @@ export default {
removeImage
(
row
)
{
//数组中删除对应img
//this.imgList = this.imgList.filter((k) => k.path != row.path);
row
.
path
=
''
;
row
.
path
=
""
;
row
.
changed
=
true
;
this
.
$emit
(
"input"
,
row
);
this
.
$emit
(
'change'
)
this
.
$emit
(
"change"
);
// 删除存量图片
// if (row.id) {
...
...
@@ -153,11 +176,11 @@ export default {
// 是否可以上传
showUpload
()
{
let
o
=
this
.
imgInfo
||
{}
let
o
=
this
.
imgInfo
||
{};
if
(
this
.
readStatus
==
1
)
{
return
false
;
}
if
(
o
.
source
==
'bhg'
&&
o
.
path
)
{
if
(
o
.
source
==
"bhg"
&&
o
.
path
)
{
return
false
;
}
...
...
@@ -170,15 +193,15 @@ export default {
// 获取图片预览列表
getPreViewList
(
url
)
{
let
_this
=
this
;
//let list = this.imgL
ist || [];
let
list
=
this
.
l
ist
||
[];
let
arr
=
[];
//
list.map((k) => {
//
if (k.pah == url) {
//
arr.unshift(k.path);
//
} else {
//
arr.push(k.path);
//
}
//
});
list
.
map
((
k
)
=>
{
if
(
k
.
pah
==
url
)
{
arr
.
unshift
(
k
.
path
);
}
else
{
arr
.
push
(
k
.
path
);
}
});
return
arr
;
},
},
...
...
@@ -198,7 +221,7 @@ export default {
display
:
flex
;
flex-wrap
:
wrap
;
}
.el_upload
{
.el_upload
{
margin
:
0
10px
0px
0
;
}
.img_cell
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment