Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
take_order
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
和慭琛
take_order
Commits
e2c2021b
Commit
e2c2021b
authored
Apr 07, 2021
by
Facius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增一键清空图片功能
parent
7aa7b434
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
398 additions
and
306 deletions
+398
-306
list.vue
take-order/pages/photo/list.vue
+398
-306
No files found.
take-order/pages/photo/list.vue
View file @
e2c2021b
<
template
>
<view
class=
"backView"
>
<u-loading
style=
"position: fixed;top: 50%;"
:show=
"loading"
size=
"36"
mode=
"flower"
></u-loading>
<view
class=
"topView"
>
<view
:class=
"['topItemView',
{'active':activeTop===ikey}]" @click="handleTopItemChange(ikey,item)"
v-for="(item,ikey) in dataList" :key="ikey">
<text
:class=
"['ph-lst-top-index',
{'active':activeTop===ikey}]">
{{
ikey
+
1
}}
</text>
<text
class=
"topItemTitle"
>
{{
item
.
type
}}
</text>
</view>
</view>
<view
class=
"rightView"
>
<view
class=
"right-view-title"
>
拍照项有:
</view>
<template
v-for=
"(item,ikey) in rightList"
>
<view
class=
"rightItemView"
@
click=
"rightItemClick(item,ikey)"
:key=
"ikey"
>
<view
:class=
"['rightContentView',
{'active':item.imageList[0]}]">
<text
class=
"ph-lst-item-index"
>
{{
ikey
+
1
}}
</text>
<text
class=
""
>
{{
item
.
name
}}
</text>
<image
class=
"ph-list-item-arrow"
src=
"/static/photo/arrow.png"
></image>
<!--
<text
class=
"rightContent u-m-t-14 u-m-l-30 u-p-b-30"
>
{{
item
.
describe
}}
</text>
-->
</view>
<view
class=
"rightImageView"
v-if=
"item.imageList.length > 0"
>
<image
class=
"rightImage"
v-for=
"(image, index) in item.imageList.slice(0 , 10)"
:src=
"image"
:key=
"index"
@
click
.
stop=
"handleClickImage(item, index)"
mode=
"aspectFill"
></image>
</view>
</view>
</
template
>
</view>
</view>
</template>
<
script
>
export
default
{
data
()
{
return
{
topList
:
[],
activeTop
:
0
,
leftList
:
[],
rightList
:
[],
classifyId
:
''
,
systemId
:
''
,
brand
:
''
,
brandId
:
''
,
dataList
:
[],
loading
:
true
}
},
onLoad
(
e
)
{
getApp
().
trackPage
(
'照片规范列表页'
)
if
(
e
&&
e
.
brandId
)
{
this
.
brandId
=
e
.
brandId
}
if
(
e
&&
e
.
brand
)
{
this
.
brand
=
e
.
brand
uni
.
setNavigationBarTitle
({
title
:
this
.
brand
});
}
if
(
e
&&
e
.
systemId
)
{
this
.
systemId
=
e
.
systemId
}
if
(
e
&&
e
.
classifyId
)
{
this
.
classifyId
=
e
.
classifyId
}
this
.
getListData
()
},
methods
:
{
getListData
:
function
()
{
this
.
loading
=
true
let
that
=
this
this
.
$u
.
cloudApi
.
getGroupStandardV2
({
<
template
>
<view
class=
"backView"
>
<u-loading
style=
"position: fixed;top: 50%;"
:show=
"loading"
size=
"36"
mode=
"flower"
></u-loading>
<view
class=
"topView"
>
<view
:class=
"['topItemView',
{'active':activeTop===ikey}]" @click="handleTopItemChange(ikey,item)"
v-for="(item,ikey) in dataList" :key="ikey">
<text
:class=
"['ph-lst-top-index',
{'active':activeTop===ikey}]">
{{
ikey
+
1
}}
</text>
<text
class=
"topItemTitle"
>
{{
item
.
type
}}
</text>
</view>
</view>
<view
class=
"rightView"
>
<view
class=
"right-view-title"
>
拍照项有:
</view>
<template
v-for=
"(item,ikey) in rightList"
>
<view
class=
"rightItemView"
@
click=
"rightItemClick(item,ikey)"
:key=
"ikey"
>
<view
:class=
"['rightContentView',
{'active':item.imageList[0]}]">
<text
class=
"ph-lst-item-index"
>
{{
ikey
+
1
}}
</text>
<text
class=
""
>
{{
item
.
name
}}
</text>
<image
class=
"ph-list-item-arrow"
src=
"/static/photo/arrow.png"
></image>
<!--
<text
class=
"rightContent u-m-t-14 u-m-l-30 u-p-b-30"
>
{{
item
.
describe
}}
</text>
-->
</view>
<view
class=
"rightImageView"
v-if=
"item.imageList.length > 0"
>
<image
class=
"rightImage"
v-for=
"(image, index) in item.imageList.slice(0 , 10)"
:src=
"image"
:key=
"index"
@
click
.
stop=
"handleClickImage(item, index)"
mode=
"aspectFill"
></image>
</view>
</view>
</
template
>
<u-button
v-if=
"activeTop + 1 === dataList.length"
class=
"ph-list-button"
type=
"error"
shape=
"circle"
:disabled=
"buttonDisabled"
:custom-style=
"buttonStyle"
@
click=
"isPopShow = true"
>
一键清空展示图片
</u-button>
</view>
<u-popup
border-radius=
"10"
v-model=
"isPopShow"
safe-area-inset-bottom
mode=
"center"
width=
"690rpx"
height=
"600rpx"
>
<view
class=
"ph-list-pop-title"
>
<text>
是否一键清空系统展示的图片?
</text>
</view>
<view
class=
"ph-list-pop-text"
>
<text>
点击确定则删除系统展示的所有图片
</text>
</view>
<view
class=
"ph-list-pop-btn-view"
>
<u-button
:custom-style=
"customStyleCancel"
hover-class=
"none"
shape=
"circle"
type=
"primary"
@
click=
"isPopShow = false"
>
取消
</u-button>
<u-button
:custom-style=
"customStyleSave"
shape=
"circle"
type=
"primary"
@
click=
"handleClickSure()"
>
确定
</u-button>
</view>
</u-popup>
</view>
</template>
<
script
>
export
default
{
data
()
{
return
{
topList
:
[],
activeTop
:
0
,
leftList
:
[],
rightList
:
[],
classifyId
:
''
,
systemId
:
''
,
brand
:
''
,
brandId
:
''
,
dataList
:
[],
loading
:
true
,
isPopShow
:
false
}
},
onLoad
(
e
)
{
getApp
().
trackPage
(
'照片规范列表页'
)
if
(
e
&&
e
.
brandId
)
{
this
.
brandId
=
e
.
brandId
}
if
(
e
&&
e
.
brand
)
{
this
.
brand
=
e
.
brand
uni
.
setNavigationBarTitle
({
title
:
this
.
brand
});
}
if
(
e
&&
e
.
systemId
)
{
this
.
systemId
=
e
.
systemId
}
if
(
e
&&
e
.
classifyId
)
{
this
.
classifyId
=
e
.
classifyId
}
this
.
getListData
()
},
computed
:
{
buttonStyle
()
{
return
{
'color'
:
'#FFFFFF'
,
'width'
:
'600rpx'
,
'height'
:
'104rpx'
,
'font-size'
:
'36rpx'
}
},
buttonDisabled
()
{
for
(
var
item
of
this
.
dataList
)
{
for
(
var
i
of
item
.
list
)
{
if
((
i
.
imageList
||
[]).
length
>
0
)
{
return
false
}
}
}
return
true
},
customStyleCancel
()
{
return
{
'background-color'
:
'#D1D4D4'
,
'width'
:
'280rpx'
,
'height'
:
'96rpx'
}
},
customStyleSave
()
{
return
{
'background-color'
:
'##2272FF'
,
'width'
:
'280rpx'
,
'height'
:
'96rpx'
,
'margin-left'
:
'50rpx'
}
}
},
methods
:
{
getListData
:
function
()
{
this
.
loading
=
true
let
that
=
this
this
.
$u
.
cloudApi
.
getGroupStandardV2
({
'token'
:
getApp
().
globalData
.
token
,
'classify_id'
:
this
.
classifyId
,
'system_id'
:
this
.
systemId
,
'brand_id'
:
this
.
brandId
}).
then
(
res
=>
{
this
.
loading
=
false
if
(
res
&&
res
.
result
)
{
if
(
res
.
result
.
error_code
)
{
uni
.
showToast
({
title
:
res
.
result
.
error_msg
})
}
else
{
that
.
handleData
(
res
.
result
)
}
}
})
},
handleData
:
function
(
result
)
{
this
.
activeTop
=
0
const
globalData
=
getApp
().
globalData
globalData
.
photo
.
productList
=
result
this
.
dataList
=
result
if
(
result
.
length
>
0
)
{
var
item
=
result
[
0
]
globalData
.
photo
.
waterSetting
=
item
.
userWatermark
this
.
rightList
=
item
.
list
}
},
//顶部点击
handleTopItemChange
:
function
(
ikey
,
item
)
{
this
.
activeTop
=
ikey
this
.
rightList
=
item
.
list
const
photo
=
getApp
().
globalData
.
photo
photo
.
topIndex
=
ikey
photo
.
waterSetting
=
item
.
userWatermark
uni
.
pageScrollTo
({
scrollTop
:
0
,
duration
:
0
});
},
// 点击图片
handleClickImage
(
item
,
index
)
{
uni
.
previewImage
({
urls
:
item
.
imageList
,
current
:
index
})
},
//右侧点击
rightItemClick
:
function
(
item
,
ikey
)
{
const
photo
=
getApp
().
globalData
.
photo
photo
.
currentItem
=
item
photo
.
itemIndex
=
ikey
const
len
=
item
.
imageList
.
length
photo
.
currentItemLength
=
len
>
9
?
10
:
len
uni
.
navigateTo
({
url
:
'/pages/photo/take'
})
},
handleClickSure
:
function
()
{
console
.
log
(
'-------'
)
this
.
$u
.
cloudApi
.
cleanImage
({
'token'
:
getApp
().
globalData
.
token
,
'classify_id'
:
this
.
classifyId
,
'system_id'
:
this
.
systemId
,
'brand_id'
:
this
.
brandId
}).
then
(
res
=>
{
this
.
loading
=
false
this
.
isPopShow
=
false
if
(
res
&&
res
.
result
)
{
if
(
res
.
result
.
error_code
){
uni
.
showToast
({
title
:
res
.
result
.
error_msg
})
}
else
{
that
.
handleData
(
res
.
result
)
}
console
.
log
(
res
.
result
)
this
.
getListData
()
}
})
},
handleData
:
function
(
result
)
{
const
globalData
=
getApp
().
globalData
globalData
.
photo
.
productList
=
result
this
.
dataList
=
result
if
(
result
.
length
>
0
)
{
var
item
=
result
[
0
]
globalData
.
photo
.
waterSetting
=
item
.
userWatermark
this
.
rightList
=
item
.
list
}
},
//顶部点击
handleTopItemChange
:
function
(
ikey
,
item
)
{
this
.
activeTop
=
ikey
this
.
rightList
=
item
.
list
const
photo
=
getApp
().
globalData
.
photo
photo
.
topIndex
=
ikey
photo
.
waterSetting
=
item
.
userWatermark
uni
.
pageScrollTo
({
scrollTop
:
0
,
duration
:
0
});
},
// 点击图片
handleClickImage
(
item
,
index
)
{
uni
.
previewImage
({
urls
:
item
.
imageList
,
current
:
index
})
},
//右侧点击
rightItemClick
:
function
(
item
,
ikey
)
{
const
photo
=
getApp
().
globalData
.
photo
photo
.
currentItem
=
item
photo
.
itemIndex
=
ikey
const
len
=
item
.
imageList
.
length
photo
.
currentItemLength
=
len
>
9
?
10
:
len
uni
.
navigateTo
({
url
:
'/pages/photo/take'
})
},
}
}
</
script
>
<
style
>
.backView
{
background-color
:
#F4F5F7
;
position
:
absolute
;
top
:
0
;
left
:
0
;
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
height
:
100%
;
}
.centerBackView
{
display
:
flex
;
flex-direction
:
row
;
margin-top
:
80
rpx
;
width
:
100%
;
}
.ph-lst-top-index
{
font-size
:
26
rpx
;
font-weight
:
bold
;
color
:
#FFFFFF
;
border-radius
:
8
rpx
;
background-color
:
#999999
;
width
:
36
rpx
;
height
:
36
rpx
;
line-height
:
36
rpx
;
text-align
:
center
;
}
.ph-lst-top-index.active
{
background-color
:
#2272FF
;
}
.rightView
{
background-color
:
#F4F5F7
;
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
padding-top
:
100
rpx
;
padding-bottom
:
50
rpx
;
}
.right-view-title
{
font-size
:
36
rpx
;
font-weight
:
bold
;
height
:
104
rpx
;
line-height
:
104
rpx
;
margin-left
:
30
rpx
;
}
.rightItemView
{
/* width: 100%; */
/* display: flex; */
/* flex-direction: row; */
/* justify-content: space-between; */
/* border-bottom: 20rpx solid #F3F3F3; */
margin
:
0
rpx
30
rpx
20
rpx
30
rpx
;
padding
:
36
rpx
30
rpx
30
rpx
30
rpx
;
border-radius
:
12
rpx
;
background-color
:
#FFFFFF
;
/* min-height: 108rpx; */
}
.ph-lst-item-index
{
font-size
:
24
rpx
;
font-weight
:
bold
;
border-radius
:
4
rpx
;
width
:
34
rpx
;
height
:
34
rpx
;
line-height
:
32
rpx
;
text-align
:
center
;
border-width
:
1px
;
border-style
:
solid
;
margin-right
:
10
rpx
;
margin-top
:
4
rpx
;
}
.rightContentView
{
display
:
flex
;
align-items
:
flex-start
;
width
:
100%
;
font-size
:
30
rpx
;
color
:
#2272FF
;
/* flex-direction: column; */
/* border-left: 2rpx solid #F3F3F3; */
}
.rightContentView.active
{
color
:
#666666
;
border-color
:
#666666
;
}
.ph-list-item-arrow
{
position
:
absolute
;
width
:
40
rpx
;
height
:
40
rpx
;
right
:
38
rpx
;
}
.rightContent
{
font-size
:
30
rpx
;
color
:
#333333
;
line-height
:
40
rpx
;
}
.rightImageView
{
/* width: 300rpx; */
/* height: 320rpx; */
display
:
flex
;
align-items
:
center
;
justify-content
:
flex-start
;
flex-wrap
:
wrap
;
margin-top
:
26
rpx
;
}
.rightImage
{
background-color
:
#F3F3F3
;
width
:
116
rpx
;
height
:
116
rpx
;
margin
:
0
rpx
12
rpx
12
rpx
0
rpx
;
}
.rightImage
:nth-child
(
5n
)
{
margin-right
:
0
;
}
.topView
{
background-color
:
#FAFAFA
;
width
:
100%
;
height
:
100
rpx
;
position
:
fixed
;
display
:
flex
;
flex-direction
:
row
;
z-index
:
1
;
}
.topItemView
{
/* width: 210rpx; */
height
:
100
rpx
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
-webkit-flex
:
1
;
flex
:
1
;
background-color
:
#FFFFFF
;
color
:
#999999
;
}
.topItemView.active
{
color
:
#2272FF
;
}
.topItemTitle
{
font-size
:
36
rpx
;
font-weight
:
bold
;
padding-left
:
30
rpx
;
}
.greenBackColor
{
background-color
:
#4CD964
;
}
})
}
}
}
</
script
>
<
style
>
.backView
{
background-color
:
#F4F5F7
;
position
:
absolute
;
top
:
0
;
left
:
0
;
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
height
:
100%
;
}
.centerBackView
{
display
:
flex
;
flex-direction
:
row
;
margin-top
:
80
rpx
;
width
:
100%
;
}
.ph-lst-top-index
{
font-size
:
26
rpx
;
font-weight
:
bold
;
color
:
#FFFFFF
;
border-radius
:
8
rpx
;
background-color
:
#999999
;
width
:
36
rpx
;
height
:
36
rpx
;
line-height
:
36
rpx
;
text-align
:
center
;
}
.ph-lst-top-index.active
{
background-color
:
#2272FF
;
}
.rightView
{
background-color
:
#F4F5F7
;
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
padding-top
:
100
rpx
;
padding-bottom
:
50
rpx
;
}
.right-view-title
{
font-size
:
36
rpx
;
font-weight
:
bold
;
height
:
104
rpx
;
line-height
:
104
rpx
;
margin-left
:
30
rpx
;
}
.rightItemView
{
/* width: 100%; */
/* display: flex; */
/* flex-direction: row; */
/* justify-content: space-between; */
/* border-bottom: 20rpx solid #F3F3F3; */
margin
:
0
rpx
30
rpx
20
rpx
30
rpx
;
padding
:
36
rpx
30
rpx
30
rpx
30
rpx
;
border-radius
:
12
rpx
;
background-color
:
#FFFFFF
;
/* min-height: 108rpx; */
}
.ph-lst-item-index
{
font-size
:
24
rpx
;
font-weight
:
bold
;
border-radius
:
4
rpx
;
width
:
34
rpx
;
height
:
34
rpx
;
line-height
:
32
rpx
;
text-align
:
center
;
border-width
:
1px
;
border-style
:
solid
;
margin-right
:
10
rpx
;
margin-top
:
4
rpx
;
}
.rightContentView
{
display
:
flex
;
align-items
:
flex-start
;
width
:
100%
;
font-size
:
30
rpx
;
color
:
#2272FF
;
/* flex-direction: column; */
/* border-left: 2rpx solid #F3F3F3; */
}
.rightContentView.active
{
color
:
#666666
;
border-color
:
#666666
;
}
.ph-list-item-arrow
{
position
:
absolute
;
width
:
40
rpx
;
height
:
40
rpx
;
right
:
38
rpx
;
}
.rightContent
{
font-size
:
30
rpx
;
color
:
#333333
;
line-height
:
40
rpx
;
}
.rightImageView
{
/* width: 300rpx; */
/* height: 320rpx; */
display
:
flex
;
align-items
:
center
;
justify-content
:
flex-start
;
flex-wrap
:
wrap
;
margin-top
:
26
rpx
;
}
.rightImage
{
background-color
:
#F3F3F3
;
width
:
116
rpx
;
height
:
116
rpx
;
margin
:
0
rpx
12
rpx
12
rpx
0
rpx
;
}
.rightImage
:nth-child
(
5n
)
{
margin-right
:
0
;
}
.topView
{
background-color
:
#FAFAFA
;
width
:
100%
;
height
:
100
rpx
;
position
:
fixed
;
display
:
flex
;
flex-direction
:
row
;
z-index
:
1
;
}
.topItemView
{
/* width: 210rpx; */
height
:
100
rpx
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
-webkit-flex
:
1
;
flex
:
1
;
background-color
:
#FFFFFF
;
color
:
#999999
;
}
.topItemView.active
{
color
:
#2272FF
;
}
.topItemTitle
{
font-size
:
36
rpx
;
font-weight
:
bold
;
padding-left
:
30
rpx
;
}
.greenBackColor
{
background-color
:
#4CD964
;
}
.ph-list-pop-text
{
color
:
#666666
;
text-align
:
center
;
margin-top
:
20
rpx
;
font-size
:
30
rpx
;
}
.ph-list-pop-title
{
font-size
:
40
rpx
;
padding-top
:
150
rpx
;
text-align
:
center
;
color
:
#333333
;
}
.ph-list-pop-btn-view
{
display
:
flex
;
justify-content
:
center
;
margin-top
:
150
rpx
;
}
</
style
>
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