Commit e2c2021b authored by Facius's avatar Facius

新增一键清空图片功能

parent 7aa7b434
<template> <template>
<view class="backView"> <view class="backView">
<u-loading style="position: fixed;top: 50%;" :show="loading" size="36" mode="flower"></u-loading> <u-loading style="position: fixed;top: 50%;" :show="loading" size="36" mode="flower"></u-loading>
<view class="topView"> <view class="topView">
<view :class="['topItemView', {'active':activeTop===ikey}]" @click="handleTopItemChange(ikey,item)" <view :class="['topItemView', {'active':activeTop===ikey}]" @click="handleTopItemChange(ikey,item)"
v-for="(item,ikey) in dataList" :key="ikey"> v-for="(item,ikey) in dataList" :key="ikey">
<text :class="['ph-lst-top-index', {'active':activeTop===ikey}]">{{ ikey + 1 }}</text> <text :class="['ph-lst-top-index', {'active':activeTop===ikey}]">{{ ikey + 1 }}</text>
<text class="topItemTitle">{{item.type}}</text> <text class="topItemTitle">{{item.type}}</text>
</view> </view>
</view> </view>
<view class="rightView"> <view class="rightView">
<view class="right-view-title">拍照项有:</view> <view class="right-view-title">拍照项有:</view>
<template v-for="(item,ikey) in rightList"> <template v-for="(item,ikey) in rightList">
<view class="rightItemView" @click="rightItemClick(item,ikey)" :key="ikey"> <view class="rightItemView" @click="rightItemClick(item,ikey)" :key="ikey">
<view :class="['rightContentView', {'active':item.imageList[0]}]"> <view :class="['rightContentView', {'active':item.imageList[0]}]">
<text class="ph-lst-item-index">{{ ikey + 1 }}</text> <text class="ph-lst-item-index">{{ ikey + 1 }}</text>
<text class="">{{item.name}}</text> <text class="">{{item.name}}</text>
<image class="ph-list-item-arrow" src="/static/photo/arrow.png"></image> <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> --> <!-- <text class="rightContent u-m-t-14 u-m-l-30 u-p-b-30">{{item.describe}}</text> -->
</view> </view>
<view class="rightImageView" v-if="item.imageList.length > 0"> <view class="rightImageView" v-if="item.imageList.length > 0">
<image class="rightImage" v-for="(image, index) in item.imageList.slice(0 , 10)" :src="image" <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> :key="index" @click.stop="handleClickImage(item, index)" mode="aspectFill"></image>
</view> </view>
</view> </view>
</template> </template>
<u-button v-if="activeTop + 1 === dataList.length" class="ph-list-button" type="error" shape="circle"
</view> :disabled="buttonDisabled" :custom-style="buttonStyle" @click="isPopShow = true">一键清空展示图片</u-button>
</view> </view>
</template> <u-popup border-radius="10" v-model="isPopShow" safe-area-inset-bottom mode="center" width="690rpx"
height="600rpx">
<script> <view class="ph-list-pop-title">
export default { <text>是否一键清空系统展示的图片?</text>
data() { </view>
return { <view class="ph-list-pop-text">
topList: [], <text>点击确定则删除系统展示的所有图片</text>
activeTop: 0, </view>
leftList: [], <view class="ph-list-pop-btn-view">
rightList: [], <u-button :custom-style="customStyleCancel" hover-class="none" shape="circle" type="primary"
classifyId: '', @click="isPopShow = false">
systemId: '', 取消
brand: '', </u-button>
brandId: '', <u-button :custom-style="customStyleSave" shape="circle" type="primary" @click="handleClickSure()">
dataList: [], 确定
loading: true </u-button>
} </view>
}, </u-popup>
onLoad(e) { </view>
getApp().trackPage('照片规范列表页') </template>
if (e && e.brandId) {
this.brandId = e.brandId <script>
} export default {
data() {
if (e && e.brand) { return {
this.brand = e.brand topList: [],
uni.setNavigationBarTitle({ activeTop: 0,
title: this.brand leftList: [],
}); rightList: [],
} classifyId: '',
systemId: '',
if (e && e.systemId) { brand: '',
this.systemId = e.systemId brandId: '',
dataList: [],
} loading: true,
isPopShow: false
if (e && e.classifyId) { }
this.classifyId = e.classifyId },
} onLoad(e) {
getApp().trackPage('照片规范列表页')
this.getListData() if (e && e.brandId) {
this.brandId = e.brandId
}, }
methods: { if (e && e.brand) {
getListData: function() { this.brand = e.brand
this.loading = true uni.setNavigationBarTitle({
let that = this title: this.brand
this.$u.cloudApi.getGroupStandardV2({ });
}
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, 'token': getApp().globalData.token,
'classify_id': this.classifyId,
'system_id': this.systemId,
'brand_id': this.brandId
}).then(res => { }).then(res => {
this.loading = false this.isPopShow = false
if (res && res.result) { if (res && res.result) {
if(res.result.error_code){ console.log(res.result)
uni.showToast({title: res.result.error_msg}) this.getListData()
}else{
that.handleData(res.result)
}
} }
}) })
}
}, }
}
handleData: function(result) { </script>
const globalData = getApp().globalData
globalData.photo.productList = result <style>
this.dataList = result .backView {
if (result.length > 0) { background-color: #F4F5F7;
var item = result[0] position: absolute;
globalData.photo.waterSetting = item.userWatermark top: 0;
this.rightList = item.list left: 0;
} width: 100%;
}, display: flex;
flex-direction: column;
//顶部点击 align-items: center;
handleTopItemChange: function(ikey, item) { height: 100%;
this.activeTop = ikey }
this.rightList = item.list
const photo = getApp().globalData.photo .centerBackView {
photo.topIndex = ikey display: flex;
photo.waterSetting = item.userWatermark flex-direction: row;
uni.pageScrollTo({ margin-top: 80rpx;
scrollTop: 0, width: 100%;
duration: 0 }
});
}, .ph-lst-top-index {
font-size: 26rpx;
// 点击图片 font-weight: bold;
handleClickImage(item, index) { color: #FFFFFF;
uni.previewImage({ border-radius: 8rpx;
urls: item.imageList, background-color: #999999;
current: index width: 36rpx;
}) height: 36rpx;
}, line-height: 36rpx;
text-align: center;
//右侧点击 }
rightItemClick: function(item, ikey) {
const photo = getApp().globalData.photo .ph-lst-top-index.active {
photo.currentItem = item background-color: #2272FF;
photo.itemIndex = ikey }
const len = item.imageList.length
photo.currentItemLength = len>9 ? 10 : len
uni.navigateTo({ .rightView {
url: '/pages/photo/take' background-color: #F4F5F7;
}) width: 100%;
}, display: flex;
flex-direction: column;
padding-top: 100rpx;
} padding-bottom: 50rpx;
} }
</script>
.right-view-title {
<style> font-size: 36rpx;
.backView { font-weight: bold;
background-color: #F4F5F7; height: 104rpx;
position: absolute; line-height: 104rpx;
top: 0; margin-left: 30rpx;
left: 0; }
width: 100%;
display: flex; .rightItemView {
flex-direction: column; /* width: 100%; */
align-items: center; /* display: flex; */
height: 100%; /* flex-direction: row; */
} /* justify-content: space-between; */
/* border-bottom: 20rpx solid #F3F3F3; */
.centerBackView { margin: 0rpx 30rpx 20rpx 30rpx;
display: flex; padding: 36rpx 30rpx 30rpx 30rpx;
flex-direction: row; border-radius: 12rpx;
margin-top: 80rpx; background-color: #FFFFFF;
width: 100%; /* min-height: 108rpx; */
} }
.ph-lst-top-index { .ph-lst-item-index {
font-size: 26rpx; font-size: 24rpx;
font-weight: bold; font-weight: bold;
color: #FFFFFF; border-radius: 4rpx;
border-radius: 8rpx; width: 34rpx;
background-color: #999999; height: 34rpx;
width: 36rpx; line-height: 32rpx;
height: 36rpx; text-align: center;
line-height: 36rpx; border-width: 1px;
text-align: center; border-style: solid;
} margin-right: 10rpx;
margin-top: 4rpx;
.ph-lst-top-index.active { }
background-color: #2272FF;
} .rightContentView {
display: flex;
align-items: flex-start;
.rightView { width: 100%;
background-color: #F4F5F7; font-size: 30rpx;
width: 100%; color: #2272FF;
display: flex; /* flex-direction: column; */
flex-direction: column; /* border-left: 2rpx solid #F3F3F3; */
padding-top: 100rpx; }
padding-bottom: 50rpx;
} .rightContentView.active {
color: #666666;
.right-view-title { border-color: #666666;
font-size: 36rpx; }
font-weight: bold;
height: 104rpx; .ph-list-item-arrow {
line-height: 104rpx; position: absolute;
margin-left: 30rpx; width: 40rpx;
} height: 40rpx;
right: 38rpx;
.rightItemView { }
/* width: 100%; */
/* display: flex; */ .rightContent {
/* flex-direction: row; */ font-size: 30rpx;
/* justify-content: space-between; */ color: #333333;
/* border-bottom: 20rpx solid #F3F3F3; */ line-height: 40rpx;
margin: 0rpx 30rpx 20rpx 30rpx; }
padding: 36rpx 30rpx 30rpx 30rpx;
border-radius: 12rpx; .rightImageView {
background-color: #FFFFFF; /* width: 300rpx; */
/* min-height: 108rpx; */ /* height: 320rpx; */
} display: flex;
align-items: center;
.ph-lst-item-index { justify-content: flex-start;
font-size: 24rpx; flex-wrap: wrap;
font-weight: bold; margin-top: 26rpx;
border-radius: 4rpx; }
width: 34rpx;
height: 34rpx; .rightImage {
line-height: 32rpx; background-color: #F3F3F3;
text-align: center; width: 116rpx;
border-width: 1px; height: 116rpx;
border-style: solid; margin: 0rpx 12rpx 12rpx 0rpx;
margin-right: 10rpx;
margin-top: 4rpx; }
}
.rightImage:nth-child(5n) {
.rightContentView { margin-right: 0;
display: flex; }
align-items: flex-start;
width: 100%;
font-size: 30rpx; .topView {
color: #2272FF; background-color: #FAFAFA;
/* flex-direction: column; */ width: 100%;
/* border-left: 2rpx solid #F3F3F3; */ height: 100rpx;
} position: fixed;
display: flex;
.rightContentView.active { flex-direction: row;
color: #666666; z-index: 1;
border-color: #666666; }
}
.topItemView {
.ph-list-item-arrow { /* width: 210rpx; */
position: absolute; height: 100rpx;
width: 40rpx; display: flex;
height: 40rpx; align-items: center;
right: 38rpx; justify-content: center;
} -webkit-flex: 1;
flex: 1;
.rightContent { background-color: #FFFFFF;
font-size: 30rpx; color: #999999;
color: #333333; }
line-height: 40rpx;
} .topItemView.active {
color: #2272FF;
.rightImageView { }
/* width: 300rpx; */
/* height: 320rpx; */ .topItemTitle {
display: flex; font-size: 36rpx;
align-items: center; font-weight: bold;
justify-content: flex-start; padding-left: 30rpx;
flex-wrap: wrap; }
margin-top: 26rpx;
} .greenBackColor {
background-color: #4CD964;
.rightImage { }
background-color: #F3F3F3;
width: 116rpx; .ph-list-pop-text {
height: 116rpx; color: #666666;
margin: 0rpx 12rpx 12rpx 0rpx; text-align: center;
margin-top: 20rpx;
} font-size: 30rpx;
.rightImage:nth-child(5n){ }
margin-right:0;
} .ph-list-pop-title {
font-size: 40rpx;
padding-top: 150rpx;
.topView { text-align: center;
background-color: #FAFAFA; color: #333333;
width: 100%; }
height: 100rpx;
position: fixed; .ph-list-pop-btn-view {
display: flex; display: flex;
flex-direction: row; justify-content: center;
z-index: 1; margin-top: 150rpx;
} }
.topItemView {
/* width: 210rpx; */
height: 100rpx;
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: 36rpx;
font-weight: bold;
padding-left: 30rpx;
}
.greenBackColor {
background-color: #4CD964;
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment