Commit de2c5d8a authored by 李超鹏's avatar 李超鹏

type:update

socpe:self
body:修改拍照组件的水印功能
parent ee7f6c0c
<template> <template>
<view class="backView"> <view class="backView">
<u-navbar title="设置" :title-size="26" title-color="#000" :custom-back="backTake"></u-navbar> <u-navbar title="设置" :title-size="26" title-color="#000" :custom-back="backTake"></u-navbar>
<view class="shadowBackView" style="background-color: transparent;z-index: 1" v-if="loading"> <view class="shadowBackView" style="background-color: transparent;z-index: 1" v-if="loading">
<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>
...@@ -9,20 +9,20 @@ ...@@ -9,20 +9,20 @@
<text class="itemTitle">保存原图</text> <text class="itemTitle">保存原图</text>
<text class="itemNotice">拍照后另保存一张无水印的图片</text> <text class="itemNotice">拍照后另保存一张无水印的图片</text>
</view> </view>
<switch class="itemSwitch" :checked="result['has_origin']" @change="handleOrigineChange" color="#007AFF" /> <switch class="itemSwitch" :checked="result['hasOrigin']" @change="handleOrigineChange" color="#007AFF" />
</view> </view>
<view class="itemView" v-if="showTitleSwitch"> <view class="itemView" v-if="showTitleSwitch">
<view class="itemTitleView" @click="itemClick({},-1)"> <view class="itemTitleView" @click="itemClick({},-1)">
<text class="itemTitle">水印标题</text> <text class="itemTitle">水印标题</text>
<text class="itemNotice">{{result['lower_right']['title_text'] || '点击可编辑更改'}}</text> <text class="itemNotice">{{result['lowerLeft']['title'] || '点击可编辑更改'}}</text>
</view> </view>
<switch class="itemSwitch" disabled :checked="result['lower_right']['title_text'] != ''" <switch class="itemSwitch" disabled :checked="result['lowerLeft']['title'] != ''"
@click="handleClickTitleSwitch" color="#007AFF" /> @click="handleClickTitleSwitch" color="#007AFF" />
</view> </view>
<view class="itemView" v-for="(item,ikey) in itemList" :key="ikey"> <view class="itemView" v-for="(item,ikey) in itemList" :key="ikey">
<view class="itemTitleView" @click="itemClick(item,ikey)"> <view class="itemTitleView" @click="itemClick(item,ikey)">
<text class="itemTitle">{{item['watemark_text'] || '自定义' + (ikey + 1)}}</text> <text class="itemTitle">{{item['watemarkText'] || '自定义' + (ikey + 1)}}</text>
<text class="itemNotice">{{item['watemark_value'] || '点击可编辑更改'}}</text> <text class="itemNotice">{{item['watemarkValue'] || '点击可编辑更改'}}</text>
</view> </view>
<switch class="itemSwitch" :checked="item['enable']" @change="itemChange(item, ikey)" color="#007AFF" /> <switch class="itemSwitch" :checked="item['enable']" @change="itemChange(item, ikey)" color="#007AFF" />
</view> </view>
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
<view class="inputBackView"> <view class="inputBackView">
<view class="ph-pop-left-view"> <view class="ph-pop-left-view">
<view class="leftInputView"> <view class="leftInputView">
<input class="leftInput" type="text" v-model="currenItem['watemark_text']" <input class="leftInput" type="text" v-model="currenItem['watemarkText']"
@input="leftInput()" :disabled="currenItem.type === 'title_text'" placeholder="请输入" @input="leftInput()" :disabled="currenItem.type === '备注'" placeholder="请输入"
maxlength="10" /> maxlength="10" />
</view> </view>
<view class="ph-pop-tip-view" v-if="showTipLeft">*必填项</view> <view class="ph-pop-tip-view" v-if="showTipLeft">*必填项</view>
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<view class="ph-pop-mid-view">:</view> <view class="ph-pop-mid-view">:</view>
<view> <view>
<view class="rightInputView"> <view class="rightInputView">
<input class="rightInput" type="text" v-model="currenItem['watemark_value']" <input class="rightInput" type="text" v-model="currenItem['watemarkValue']"
@input="rightInput()" placeholder="请输入内容" maxlength="30" /> @input="rightInput()" placeholder="请输入内容" maxlength="30" />
</view> </view>
<view class="ph-pop-tip-view" v-if="showTipRight">*必填项</view> <view class="ph-pop-tip-view" v-if="showTipRight">*必填项</view>
...@@ -72,14 +72,14 @@ ...@@ -72,14 +72,14 @@
isPopShow: false, isPopShow: false,
icon_close_new: '', icon_close_new: '',
result: { result: {
has_origin: true, hasOrigin: true,
lower_right: { lowerLeft: {
body: [] body: []
} }
}, },
currenItem: { currenItem: {
'watemark_text': '', 'watemarkText': '',
'watemark_value': '' 'watemarkValue': ''
}, },
editingItem: {}, editingItem: {},
showTipLeft: false, showTipLeft: false,
...@@ -89,10 +89,11 @@ ...@@ -89,10 +89,11 @@
}, },
computed: { computed: {
itemList() { itemList() {
if (this.result['lower_right']) { console.log(this.result)
var arr = this.result['lower_right']['body'] if (this.result['lowerLeft']) {
var arr = this.result['lowerLeft']['body']
return arr.filter((item) => { return arr.filter((item) => {
return item.watemark_type === '备注' return item.watemarkType === '备注'
}) })
} else { } else {
return [] return []
...@@ -100,7 +101,7 @@ ...@@ -100,7 +101,7 @@
}, },
showTitleSwitch() { showTitleSwitch() {
return this.result['lower_right'].hasOwnProperty('title_text') return this.result['lowerLeft'].hasOwnProperty('title')
}, },
customStyleCancel() { customStyleCancel() {
return { return {
...@@ -122,54 +123,43 @@ ...@@ -122,54 +123,43 @@
getApp().trackPage('水印设置页') getApp().trackPage('水印设置页')
const globalData = getApp().globalData const globalData = getApp().globalData
this.icon_close_new = globalData.icon_close_new this.icon_close_new = globalData.icon_close_new
this.systemId = globalData.photo.currentItem.systemId this.systemId = globalData.photo.currentItem.partnerCompanyId
this.getItemList() this.getItemList()
}, },
methods: { methods: {
getItemList: function() { getItemList: function() {
// this.systemId = '79550af260555cc20afb34156c94b32c' // 测试数据 this.loading = true
this.loading = true this.$u.api.getWatermark({partnerCompanyId:this.systemId}).then(res => {
this.$u.api.getUserWatermark({ if (res.code == 200) {
'token': this.vuex_token, this.result = res.data
'system_id': this.systemId } else {
}).then(res => { uni.showToast({title: res.data.message})
if (res && res.result) {
if(res.result.error_code){
uni.showToast({title: res.result.error_msg})
}else{
this.result = res.result
}
}else{
uni.showToast({title: '网络异常'})
} }
this.loading = false this.loading = false
}) })
}, },
saveUserWatermark: function() { saveUserWatermark: function() {
this.loading = true this.loading = true
this.$u.api.saveUserWatermark({ this.$u.api.saveWatermark(this.result).then(res=>{
'token': this.vuex_token, if(res.code === 200){
'watermark': this.result uni.showToast({title:'保存成功'})
}).then(res => { getApp().globalData.photo.waterSetting = this.result
if (res.result.code == true) { this.$emit("changeWatermark", this.result);
const photo = getApp().globalData.photo
photo.waterSetting = this.result
}else{ }else{
uni.showToast({title: res.result.msg}) uni.showToast({title: res.message})
} }
this.loading = false this.loading = false
}) })
}, },
//保存原图 开关 //保存原图 开关
handleOrigineChange: function(e) { handleOrigineChange: function(e) {
this.result['has_origin'] = !this.result['has_origin'] this.result['hasOrigin'] = !this.result['hasOrigin']
this.saveUserWatermark() this.saveUserWatermark()
}, },
handleClickTitleSwitch: function(e) { handleClickTitleSwitch: function(e) {
var string = this.result['lower_right']['title_text'] ? '水印标题不可关闭' : '请先编辑该自定义项' var string = this.result['lowerLeft']['title'] ? '水印标题不可关闭' : '请先编辑该自定义项'
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: string title: string
...@@ -178,7 +168,7 @@ ...@@ -178,7 +168,7 @@
//自定义 开关 //自定义 开关
itemChange: function(item, ikey) { itemChange: function(item, ikey) {
if (item['watemark_value']) { if (item['watemarkValue']) {
// 修改 // 修改
item['enable'] = !item['enable'] item['enable'] = !item['enable']
this.saveUserWatermark() this.saveUserWatermark()
...@@ -194,9 +184,9 @@ ...@@ -194,9 +184,9 @@
itemClick: function(item, ikey) { itemClick: function(item, ikey) {
if (ikey === -1) { if (ikey === -1) {
this.currenItem = { this.currenItem = {
'watemark_text': '水印标题', 'watemarkText': '水印标题',
'watemark_value': this.result['lower_right']['title_text'], 'watemarkValue': this.result['lowerLeft']['title'],
'type': 'title_text' 'type': '备注'
} }
} else { } else {
this.editingItem = item this.editingItem = item
...@@ -210,7 +200,7 @@ ...@@ -210,7 +200,7 @@
//左侧输入框 //左侧输入框
leftInput: function(e) { leftInput: function(e) {
if (this.currenItem['watemark_text']) { if (this.currenItem['watemarkText']) {
this.showTipLeft = false this.showTipLeft = false
} }
...@@ -218,7 +208,7 @@ ...@@ -218,7 +208,7 @@
//右侧输入框 //右侧输入框
rightInput: function(e) { rightInput: function(e) {
if (this.currenItem['watemark_value']) { if (this.currenItem['watemarkValue']) {
this.showTipRight = false this.showTipRight = false
} }
}, },
...@@ -227,8 +217,8 @@ ...@@ -227,8 +217,8 @@
popCancelClick: function() { popCancelClick: function() {
this.isPopShow = false this.isPopShow = false
this.currenItem = { this.currenItem = {
'watemark_text': '', 'watemarkText': '',
'watemark_value': '' 'watemarkValue': ''
} }
}, },
...@@ -236,27 +226,27 @@ ...@@ -236,27 +226,27 @@
this.showTipLeft = false, this.showTipLeft = false,
this.showTipRight = false this.showTipRight = false
}, },
backTake() { backTake() {
this.$emit('changeType', 1) this.$emit('changeType', 1)
}, },
//自定义弹窗 保存 //自定义弹窗 保存
popSaveClick: function() { popSaveClick: function() {
if (this.currenItem['watemark_text'] && this.currenItem['watemark_value']) { if (this.currenItem['watemarkText'] && this.currenItem['watemarkValue']) {
this.isPopShow = false this.isPopShow = false
if (this.currenItem.type === 'title_text') { if (this.currenItem.type === '备注') {
this.result['lower_right']['title_text'] = this.currenItem['watemark_value'] this.result['lowerLeft']['title'] = this.currenItem['watemarkValue']
} else { } else {
this.editingItem['watemark_text'] = this.currenItem['watemark_text'] this.editingItem['watemarkText'] = this.currenItem['watemarkText']
this.editingItem['watemark_value'] = this.currenItem['watemark_value'] this.editingItem['watemarkValue'] = this.currenItem['watemarkValue']
this.editingItem['enable'] = true this.editingItem['enable'] = true
} }
this.saveUserWatermark() this.saveUserWatermark()
} else { } else {
// 提示 // 提示
if (!this.currenItem['watemark_text']) { if (!this.currenItem['watemarkText']) {
this.showTipLeft = true this.showTipLeft = true
} }
if (!this.currenItem['watemark_value']) { if (!this.currenItem['watemarkValue']) {
this.showTipRight = true this.showTipRight = true
} }
} }
......
<template> <template>
<view class="camera"> <view class="camera">
<view class="camera-container" v-if="showType === 1"> <view class="camera-container" v-if="showType === 1">
<cover-view class="header-box" :style="{'height':navHeight/2 + 'px'}"> <cover-view class="header-box" :style="{'height':navHeight/2 + 'px'}">
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
src="/static/photo/icon-switch.png"></cover-image> src="/static/photo/icon-switch.png"></cover-image>
<cover-image @click="setCameraInfo('flash')" class="icon" mode="aspectFit" <cover-image @click="setCameraInfo('flash')" class="icon" mode="aspectFit"
:src="'/static/photo/icon-light-' + cameraInfo.flash +'.png'"></cover-image> :src="'/static/photo/icon-light-' + cameraInfo.flash +'.png'"></cover-image>
<cover-image v-if="currentItem.system_id" @click="changeType(3)" class="icon" mode="aspectFit" <cover-image v-if="currentItem.partnerCompanyId" @click="changeType(3)" class="icon" mode="aspectFit"
src="/static/photo/icon-setting.png"></cover-image> src="/static/photo/icon-setting.png"></cover-image>
</cover-view> </cover-view>
</cover-view> </cover-view>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<cover-view class="bottom-box" v-if="!standardShow"> <cover-view class="bottom-box" v-if="!standardShow">
<cover-image class="icon" src='/static/photo/icon-back.png' mode="" @click="goBack"></cover-image> <cover-image class="icon" src='/static/photo/icon-back.png' mode="" @click="goBack"></cover-image>
<cover-image class='icon-take icon' src='/static/photo/icon-take.png' @click="$u.debounce(takePhoto, 500)"> </cover-image> <cover-image class='icon-take icon' src='/static/photo/icon-take.png' @click="$u.debounce(takePhoto, 500)"> </cover-image>
<cover-image class='icon' src='/static/photo/icon-standard.png' @click="standardShow = true" v-if="standardStatus"> </cover-image> <cover-image class='icon' src='/static/photo/icon-standard.png' @click="standardShow = true" v-if="standardStatus"> </cover-image>
<view class='icon' v-else></view> <view class='icon' v-else></view>
</cover-view> </cover-view>
<canvas canvas-id="canvas" id="photoCanvas" class="canvas" <canvas canvas-id="canvas" id="photoCanvas" class="canvas"
...@@ -37,11 +37,11 @@ ...@@ -37,11 +37,11 @@
<image @click="closeShadow" class="icon icon-close" mode="aspectFit" src="/static/photo/icon-close.png"></image> <image @click="closeShadow" class="icon icon-close" mode="aspectFit" src="/static/photo/icon-close.png"></image>
</view> </view>
</view> </view>
</view> </view>
<photo-preview v-if="showType === 2" @changeType="changeType" @finish="finish" /> <photo-preview v-if="showType === 2" @changeType="changeType" @finish="finish" />
<photo-setting v-if="showType === 3" @changeType="changeType" /> <photo-setting v-if="showType === 3" @changeType="changeType" @changeWatermark="changeWatermark"/>
</view> </view>
</template> </template>
<script> <script>
let r = require("@/libs/bmap-wx.min.js"); let r = require("@/libs/bmap-wx.min.js");
...@@ -49,31 +49,31 @@ ...@@ -49,31 +49,31 @@
// ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG", // ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG",
ak: "iXsGdyEcm1iQONoUPyEp0hrBTLCuOaW2" ak: "iXsGdyEcm1iQONoUPyEp0hrBTLCuOaW2"
}); });
import standard from '@/components/photo/standard.vue' import standard from '@/components/photo/standard.vue'
import preview from '@/components/photo/preview.vue' import preview from '@/components/photo/preview.vue'
import setting from '@/components/photo/setting.vue' import setting from '@/components/photo/setting.vue'
export default { export default {
props: { props: {
currentItem: { // 对应的规范item currentItem: { // 对应的规范item
default () { default () {
return { return {
_id: '', // 规格ID _id: '', // 规格ID
system_id: '', // 系统ID system_id: '', // 系统ID
brand_id: '', // 品牌ID brand_id: '', // 品牌ID
classify_id: '', // 分类ID classify_id: '', // 分类ID
images: [], // 拍照要求示意图 images: [], // 拍照要求示意图
main_point: [] // 要点 main_point: [] // 要点
} }
} }
} }
}, },
components: { components: {
'photo-standard': standard, 'photo-standard': standard,
'photo-preview': preview, 'photo-preview': preview,
'photo-setting': setting, 'photo-setting': setting,
}, },
data() { data() {
return { return {
showType: 1, showType: 1,
standardShow: false, standardShow: false,
cameraInfo: { cameraInfo: {
...@@ -102,14 +102,14 @@ ...@@ -102,14 +102,14 @@
ratio: 0, ratio: 0,
cameraChange: false, cameraChange: false,
waterSetting: null, waterSetting: null,
shadowInitShow: false, // 第一次进入页面需显示弹窗 shadowInitShow: false, // 第一次进入页面需显示弹窗
standardStatus: false // 是否显示拍照要求 standardStatus: false // 是否显示拍照要求
} }
}, },
created(e) { created(e) {
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
getApp().trackPage('拍照页') getApp().trackPage('拍照页')
photo.allImages = [] photo.allImages = []
photo.currentItemLength = 0 photo.currentItemLength = 0
// this.ctx = uni.createCameraContext(); // this.ctx = uni.createCameraContext();
this.updateTime() this.updateTime()
...@@ -117,21 +117,21 @@ ...@@ -117,21 +117,21 @@
this.getMarkPath() this.getMarkPath()
this.initData() this.initData()
photo.currentItem = this.currentItem photo.currentItem = this.currentItem
if (this.currentItem.images.length > 0) { if (this.currentItem.images.length > 0) {
this.shadowInitShow = true this.shadowInitShow = true
this.standardShow = true this.standardShow = true
this.standardStatus = true this.standardStatus = true
} }
}, },
computed: { computed: {
titleTxt() { titleTxt() {
const waterSetting = this.waterSetting const waterSetting = this.waterSetting
let txt = '' let txt = ''
if (!waterSetting || !waterSetting.lower_right) { if (!waterSetting || !waterSetting.lowerLeft) {
return '' return ''
} }
txt = waterSetting.lower_right && waterSetting.lower_right.title_text || '' txt = waterSetting.lowerLeft && waterSetting.lowerLeft.title || ''
return txt return txt
}, },
settingTxtArr() { settingTxtArr() {
...@@ -144,17 +144,17 @@ ...@@ -144,17 +144,17 @@
let settingTxtArr = [] let settingTxtArr = []
const typeArr = ['经度', '纬度', '地址', '时间'] const typeArr = ['经度', '纬度', '地址', '时间']
const waterSetting = this.waterSetting const waterSetting = this.waterSetting
if (!waterSetting || !waterSetting.lower_right || !waterSetting.lower_right.body) { if (!waterSetting || !waterSetting.lowerLeft || !waterSetting.lowerLeft.body) {
return arr return arr
} }
const settingArr = waterSetting.lower_right.body const settingArr = waterSetting.lowerLeft.body
settingArr.map(item => { settingArr.map(item => {
const idx = typeArr.indexOf(item.watemark_type) const idx = typeArr.indexOf(item.watemarkType)
if (item.enable && (idx > -1 || (item.watemark_value && item.watemark_text))) { if (item.enable && (idx > -1 || (item.watemarkValue && item.watemarkText))) {
if (idx > -1) { if (idx > -1) {
settingTxtArr.push(arr[idx]) settingTxtArr.push(arr[idx])
} else { } else {
settingTxtArr.push(item.watemark_text + ':' + item.watemark_value) settingTxtArr.push(item.watemarkText + ':' + item.watemarkValue)
} }
} }
}) })
...@@ -179,18 +179,21 @@ ...@@ -179,18 +179,21 @@
this.shadowInitShow = false this.shadowInitShow = false
this.standardShow = false this.standardShow = false
}, },
goBack() { goBack() {
uni.showTabBar() uni.showTabBar()
this.$emit('close') this.$emit('close')
}, },
finish() { finish() {
uni.showTabBar() uni.showTabBar()
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
this.$emit('close', photo.allImages) this.$emit('close', photo.allImages)
}, },
changeType(type) { changeType(type) {
this.showType = type this.showType = type
}, },
changeWatermark(watermark){
this.waterSetting = watermark
},
updateTime() { updateTime() {
this.waterInfo.date = this.getTime() this.waterInfo.date = this.getTime()
// let timer = setTimeout(() => { // let timer = setTimeout(() => {
...@@ -224,10 +227,10 @@ ...@@ -224,10 +227,10 @@
}, },
baiduLocation() { baiduLocation() {
// 百度sdk解析经纬度 // 百度sdk解析经纬度
let waterInfo = this.waterInfo let waterInfo = this.waterInfo
const t = function() { const t = function() {
let t = { let t = {
success: function(res) { success: function(res) {
let e = res.wxMarkerData[0]; let e = res.wxMarkerData[0];
let i = e.address; let i = e.address;
waterInfo.address = i waterInfo.address = i
...@@ -257,7 +260,7 @@ ...@@ -257,7 +260,7 @@
//获取位置 //获取位置
getLocation() { getLocation() {
let that = this let that = this
const waterInfo = this.waterInfo const waterInfo = this.waterInfo
uni.getLocation({ uni.getLocation({
type: 'gcj02', type: 'gcj02',
success: function(res) { success: function(res) {
...@@ -423,7 +426,7 @@ ...@@ -423,7 +426,7 @@
globalTempPath.origin = this.tempImgs.origin globalTempPath.origin = this.tempImgs.origin
globalTempPath.mixWater = res.tempFilePath globalTempPath.mixWater = res.tempFilePath
let timer = setTimeout(()=>{ let timer = setTimeout(()=>{
//this.goPage('/pages/photo/preview') //this.goPage('/pages/photo/preview')
this.changeType(2) this.changeType(2)
},0) },0)
// this.saveToLocal(res.tempFilePath) // this.saveToLocal(res.tempFilePath)
...@@ -477,21 +480,21 @@ ...@@ -477,21 +480,21 @@
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.camera { .camera {
position:fixed; position:fixed;
padding:0; padding:0;
margin:0; margin:0;
top:0; top:0;
left:0; left:0;
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 999999; z-index: 999999;
} }
.camera-container { .camera-container {
// padding-top:var(--status-bar-height); // padding-top:var(--status-bar-height);
min-height: 100vh; min-height: 100vh;
background-color: black; background-color: black;
} }
.header-box { .header-box {
......
<template> <template>
<view class="backView"> <view class="backView">
<u-navbar :title-size="32" title-color="#000" :border-bottom="false" :title="title"></u-navbar> <u-navbar :title-size="32" title-color="#000" :border-bottom="false" :title="title"></u-navbar>
<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>
<scroll-view scroll-y="true" class="scroll-y"> <scroll-view scroll-y="true" class="scroll-y">
<template v-for="(item,ikey) in rightList"> <template v-for="(item,ikey) in rightList">
<view class="rightItemView" @click="take(item,ikey)" :key="ikey"> <view class="rightItemView" @click="take(item,ikey)" :key="ikey">
<view :class="['rightContentView', {'active':item.orderImages[0]}]"> <view :class="['rightContentView', {'active':item.orderImages[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.orderImages && item.orderImages.length > 0"> <view class="rightImageView" v-if="item.orderImages && item.orderImages.length > 0">
<image class="rightImage" v-for="(image, index) in item.orderImages.slice(0 , 10)" :src="image" <image class="rightImage" v-for="(image, index) in item.orderImages.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>
</scroll-view> </scroll-view>
<take-photo type="test" v-if="takeStatus" :currentItem="currentItemDate" @close="closeTake"></take-photo> <take-photo type="test" v-if="takeStatus" :currentItem="currentItemDate" @close="closeTake"></take-photo>
<!-- <u-button v-if="activeTop + 1 === dataList.length" class="ph-list-button" type="error" shape="circle" <!-- <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> --> :disabled="buttonDisabled" :custom-style="buttonStyle" @click="isPopShow = true">一键清空展示图片</u-button> -->
</view> </view>
<!-- <u-popup border-radius="10" v-model="isPopShow" safe-area-inset-bottom mode="center" width="690rpx" <!-- <u-popup border-radius="10" v-model="isPopShow" safe-area-inset-bottom mode="center" width="690rpx"
height="600rpx"> height="600rpx">
<view class="ph-list-pop-title"> <view class="ph-list-pop-title">
<text>是否一键清空系统展示的图片?</text> <text>是否一键清空系统展示的图片?</text>
</view> </view>
<view class="ph-list-pop-text"> <view class="ph-list-pop-text">
<text>点击"确定"则删除系统展示的所有图片</text> <text>点击"确定"则删除系统展示的所有图片</text>
</view> </view>
<view class="ph-list-pop-btn-view"> <view class="ph-list-pop-btn-view">
<u-button :custom-style="customStyleCancel" hover-class="none" shape="circle" type="primary" <u-button :custom-style="customStyleCancel" hover-class="none" shape="circle" type="primary"
@click="isPopShow = false"> @click="isPopShow = false">
取消 取消
</u-button> </u-button>
<u-button :custom-style="customStyleSave" shape="circle" type="primary" @click="handleClickSure()"> <u-button :custom-style="customStyleSave" shape="circle" type="primary" @click="handleClickSure()">
确定 确定
</u-button> </u-button>
</view> </view>
</u-popup> --> </u-popup> -->
</view> </view>
</template> </template>
<script> <script>
import takePhoto from '@/components/take/index.vue' import takePhoto from '@/components/take/index.vue'
export default { export default {
components: { components: {
'take-photo': takePhoto 'take-photo': takePhoto
}, },
data() { data() {
return { return {
takeStatus: false, takeStatus: false,
currentItemDate:{}, currentItemDate:{},
topList: [], topList: [],
activeTop: 0, activeTop: 0,
leftList: [], leftList: [],
rightList: [], rightList: [],
classifyId: '', classifyId: '',
systemId: '', systemId: '',
brand: '', brand: '',
brandId: '', brandId: '',
orderId:'', orderId:'',
dataList: [], dataList: [],
loading: true, loading: true,
isPopShow: false, isPopShow: false,
userWatermark:{}, userWatermark:{},
title: '规范展示' title: '规范展示'
} }
}, },
onLoad(e) { onLoad(e) {
getApp().trackPage('照片规范列表页') getApp().trackPage('照片规范列表页')
if (e && e.brandId) { if (e && e.brandId) {
this.brandId = e.brandId this.brandId = e.brandId
} }
if (e && e.brand) { if (e && e.brand) {
this.brand = decodeURIComponent(e.brand) this.brand = decodeURIComponent(e.brand)
this.title = this.brand this.title = this.brand
} }
if (e && e.orderId) { if (e && e.orderId) {
this.orderId = e.orderId this.orderId = e.orderId
} }
if (e && e.systemId) { if (e && e.systemId) {
this.systemId = e.systemId this.systemId = e.systemId
} }
if (e && e.classifyId) { if (e && e.classifyId) {
this.classifyId = e.classifyId this.classifyId = e.classifyId
} }
// this.getListData() // this.getListData()
this.getListDataNew() this.getListDataNew()
this.getWatermark() this.getWatermark()
}, },
computed: { computed: {
buttonStyle() { buttonStyle() {
return { return {
'color': '#FFFFFF', 'color': '#FFFFFF',
'width': '600rpx', 'width': '600rpx',
'height': '104rpx', 'height': '104rpx',
'font-size': '36rpx' 'font-size': '36rpx'
} }
}, },
buttonDisabled() { buttonDisabled() {
for (var item of this.dataList) { for (var item of this.dataList) {
for (var i of item.list) { for (var i of item.list) {
if ((i.imageList || []).length > 0) { if ((i.imageList || []).length > 0) {
return false return false
} }
} }
} }
return true return true
}, },
customStyleCancel() { customStyleCancel() {
return { return {
'background-color': '#D1D4D4', 'background-color': '#D1D4D4',
'width': '280rpx', 'width': '280rpx',
'height': '96rpx' 'height': '96rpx'
} }
}, },
customStyleSave() { customStyleSave() {
return { return {
'background-color': '##2272FF', 'background-color': '##2272FF',
'width': '280rpx', 'width': '280rpx',
'height': '96rpx', 'height': '96rpx',
'margin-left': '50rpx' 'margin-left': '50rpx'
} }
} }
}, },
methods: { methods: {
getListData: function() { getListData: function() {
this.loading = true this.loading = true
let that = this let that = this
this.$u.cloudApi.getGroupStandardV2({ this.$u.cloudApi.getGroupStandardV2({
'token': this.vuex_token, 'token': this.vuex_token,
'classify_id': this.classifyId, 'classify_id': this.classifyId,
'system_id': this.systemId, 'system_id': this.systemId,
'brand_id': this.brandId 'brand_id': this.brandId
}).then(res => { }).then(res => {
this.loading = false this.loading = false
if (res && res.result) { if (res && res.result) {
if (res.result.error_code) { if (res.result.error_code) {
uni.showToast({ uni.showToast({
title: res.result.error_msg title: res.result.error_msg
}) })
} else { } else {
that.handleData(res.result) that.handleData(res.result)
} }
} }
}) })
}, },
getListDataNew() { getListDataNew() {
this.loading = true this.loading = true
let self = this let self = this
var data = { var data = {
partnerCompanyId:this.systemId , partnerCompanyId:this.systemId ,
orderId:this.orderId, orderId:this.orderId,
categoryId:this.classifyId, categoryId:this.classifyId,
brandId:this.brandId brandId:this.brandId
}; };
self.$u.api.orderStandard(data).then((res) => { self.$u.api.orderStandard(data).then((res) => {
this.loading = false this.loading = false
if (res.code == 200) { if (res.code == 200) {
console.log("===", res.data) if(res.data && res.data.length > 0){
if(res.data && res.data.length > 0){ let dataList = []
let dataList = [] var flag = false;
var flag = false; res.data.forEach(item=>{
res.data.forEach(item=>{ if(dataList.length===0 ){
if(dataList.length===0 ){ var dataItem = {type:'',list:[]}
var dataItem = {type:'',list:[]} dataItem.type = item.type
dataItem.type = item.type dataItem.list.push(item)
dataItem.list.push(item) dataList.push(dataItem)
dataList.push(dataItem) }else{
}else{ dataList.forEach(dataListItem=>{
dataList.forEach(dataListItem=>{ if(dataListItem.type===item.type){
if(dataListItem.type===item.type){ dataListItem.list.push(item)
dataListItem.list.push(item) flag = true
flag = true return false;
return false; }else{
}else{ flag = false
flag = false }
} })
}) if(!flag){
if(!flag){ var dataItem = {type:'',list:[]}
var dataItem = {type:'',list:[]} dataItem.type = item.type
dataItem.type = item.type dataItem.list.push(item)
dataItem.list.push(item) dataList.push(dataItem)
dataList.push(dataItem) }
} }
} })
}) console.log("===", dataList)
this.handleData(dataList) this.handleData(dataList)
} }
} else { } else {
console.log(res.code.message) console.log(res.code.message)
} }
}); });
}, },
handleData: function(result) { handleData: function(result) {
this.activeTop = 0 this.activeTop = 0
this.dataList = result this.dataList = result
if (result.length > 0) { if (result.length > 0) {
var item = result[0] var item = result[0]
getApp().globalData.photo.waterSetting = this.userWatermark this.rightList = item.list
this.rightList = item.list }
} },
},
//顶部点击
//顶部点击 handleTopItemChange: function(ikey, item) {
handleTopItemChange: function(ikey, item) { this.activeTop = ikey
this.activeTop = ikey this.rightList = item.list
this.rightList = item.list const photo = getApp().globalData.photo
const photo = getApp().globalData.photo photo.topIndex = ikey
photo.topIndex = ikey photo.waterSetting = item.userWatermark
photo.waterSetting = item.userWatermark uni.pageScrollTo({
uni.pageScrollTo({ scrollTop: 0,
scrollTop: 0, duration: 0
duration: 0 });
}); },
}, // 点击图片
// 点击图片 handleClickImage(item, index) {
handleClickImage(item, index) { uni.previewImage({
uni.previewImage({ urls: item.orderImages,
urls: item.orderImages, current: index
current: index })
}) },
}, //右侧点击
//右侧点击 rightItemClick: function(item, ikey) {
rightItemClick: function(item, ikey) { const photo = getApp().globalData.photo
const photo = getApp().globalData.photo photo.currentItem = item
photo.currentItem = item photo.itemIndex = ikey
photo.itemIndex = ikey const len = item.imageList.length
const len = item.imageList.length photo.currentItemLength = len > 9 ? 10 : len
photo.currentItemLength = len > 9 ? 10 : len uni.navigateTo({
uni.navigateTo({ url: '/pages/photo/take'
url: '/pages/photo/take' })
}) },
}, // 清除图片
// 清除图片
handleClickSure: function() { handleClickSure: function() {
this.$u.cloudApi.cleanImage({ this.$u.cloudApi.cleanImage({
'token': this.vuex_token, 'token': this.vuex_token,
...@@ -261,246 +260,247 @@ ...@@ -261,246 +260,247 @@
if (res && res.result) { if (res && res.result) {
this.getListData() this.getListData()
} }
}) })
}, },
take(item,ikey) { take(item,ikey) {
this.currentItemDate = item this.currentItemDate = item
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
photo.currentItem = item photo.currentItem = item
photo.itemIndex = ikey photo.itemIndex = ikey
const len = item.orderImages?item.orderImages.length:0 const len = item.orderImages?item.orderImages.length:0
photo.currentItemLength = len > 9 ? 10 : len photo.currentItemLength = len > 9 ? 10 : len
uni.hideTabBar() uni.hideTabBar()
this.takeStatus = true this.takeStatus = true
}, },
closeTake(img) { closeTake(img) {
if(img !==undefined ){ if(img !==undefined ){
if (!this.currentItemDate.orderImages) this.currentItemDate.orderImages = [] if (!this.currentItemDate.orderImages) this.currentItemDate.orderImages = []
// step1 添加图片 // step1 添加图片
img.forEach(v => { img.forEach(v => {
this.currentItemDate.orderImages.push(v.key) this.currentItemDate.orderImages.push(v.key)
}) })
// step2 保存图片 // step2 保存图片
var data={ var data={
type : this.currentItemDate.type, type : this.currentItemDate.type,
images : Array.from(this.currentItemDate.orderImages), images : Array.from(this.currentItemDate.orderImages),
fieldsName:this.currentItemDate.fieldName fieldsName:this.currentItemDate.fieldName
} }
this.$u.api.saveImage(data,this.orderId).then((res) => { this.$u.api.saveImage(data,this.orderId).then((res) => {
if (res.code == 200) { if (res.code == 200) {
console.log("===", res.data) console.log("===", res.data)
} else { } else {
console.log("保存图片异常",res.data.message) console.log("保存图片异常",res.data.message)
} }
}); });
} }
this.takeStatus = false this.takeStatus = false
}, },
getWatermark(){ getWatermark(){
var data={partnerCompanyId:this.systemId} var data={partnerCompanyId:this.systemId}
this.$u.api.getWatermark(data).then((res) => { this.$u.api.getWatermark(data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
console.log("===", res.data) console.log("===", res.data)
this.userWatermark = res.data this.userWatermark = res.data
} else { getApp().globalData.photo.waterSetting = this.userWatermark
console.log("获取水印备注异常",res.data.message) } else {
} console.log("获取水印备注异常",res.data.message)
}); }
} });
} }
} }
</script> }
</script>
<style>
.backView { <style>
background-color: #F4F5F7; .backView {
position: absolute; background-color: #F4F5F7;
top: 0; position: absolute;
left: 0; top: 0;
width: 100%; left: 0;
display: flex; width: 100%;
flex-direction: column; display: flex;
align-items: center; flex-direction: column;
height: 100%; align-items: center;
} height: 100%;
}
.centerBackView {
display: flex; .centerBackView {
flex-direction: row; display: flex;
margin-top: 80rpx; flex-direction: row;
width: 100%; margin-top: 80rpx;
} width: 100%;
}
.ph-lst-top-index {
font-size: 26rpx; .ph-lst-top-index {
font-weight: bold; font-size: 26rpx;
color: #FFFFFF; font-weight: bold;
border-radius: 8rpx; color: #FFFFFF;
background-color: #999999; border-radius: 8rpx;
width: 36rpx; background-color: #999999;
height: 36rpx; width: 36rpx;
line-height: 36rpx; height: 36rpx;
text-align: center; line-height: 36rpx;
} text-align: center;
}
.ph-lst-top-index.active {
background-color: #2272FF; .ph-lst-top-index.active {
} background-color: #2272FF;
}
.rightView {
background-color: #F4F5F7; .rightView {
width: 100%; background-color: #F4F5F7;
display: flex; width: 100%;
flex-direction: column; display: flex;
padding-bottom: 50rpx; flex-direction: column;
} padding-bottom: 50rpx;
}
.right-view-title {
font-size: 36rpx; .right-view-title {
font-weight: bold; font-size: 36rpx;
height: 104rpx; font-weight: bold;
line-height: 104rpx; height: 104rpx;
margin-left: 30rpx; line-height: 104rpx;
} margin-left: 30rpx;
}
.rightItemView {
/* width: 100%; */ .rightItemView {
/* display: flex; */ /* width: 100%; */
/* flex-direction: row; */ /* display: flex; */
/* justify-content: space-between; */ /* flex-direction: row; */
/* border-bottom: 20rpx solid #F3F3F3; */ /* justify-content: space-between; */
margin: 0rpx 30rpx 20rpx 30rpx; /* border-bottom: 20rpx solid #F3F3F3; */
padding: 36rpx 30rpx 30rpx 30rpx; margin: 0rpx 30rpx 20rpx 30rpx;
border-radius: 12rpx; padding: 36rpx 30rpx 30rpx 30rpx;
background-color: #FFFFFF; border-radius: 12rpx;
/* min-height: 108rpx; */ background-color: #FFFFFF;
} /* min-height: 108rpx; */
}
.ph-lst-item-index {
font-size: 24rpx; .ph-lst-item-index {
font-weight: bold; font-size: 24rpx;
border-radius: 4rpx; font-weight: bold;
width: 34rpx; border-radius: 4rpx;
height: 34rpx; width: 34rpx;
line-height: 32rpx; height: 34rpx;
text-align: center; line-height: 32rpx;
border-width: 1px; text-align: center;
border-style: solid; border-width: 1px;
margin-right: 10rpx; border-style: solid;
margin-top: 4rpx; margin-right: 10rpx;
} margin-top: 4rpx;
}
.rightContentView {
display: flex; .rightContentView {
align-items: flex-start; display: flex;
width: 100%; align-items: flex-start;
font-size: 30rpx; width: 100%;
color: #2272FF; font-size: 30rpx;
/* flex-direction: column; */ color: #2272FF;
/* border-left: 2rpx solid #F3F3F3; */ /* flex-direction: column; */
} /* border-left: 2rpx solid #F3F3F3; */
}
.rightContentView.active {
color: #666666; .rightContentView.active {
border-color: #666666; color: #666666;
} border-color: #666666;
}
.ph-list-item-arrow {
position: absolute; .ph-list-item-arrow {
width: 40rpx; position: absolute;
height: 40rpx; width: 40rpx;
right: 38rpx; height: 40rpx;
} right: 38rpx;
}
.rightContent {
font-size: 30rpx; .rightContent {
color: #333333; font-size: 30rpx;
line-height: 40rpx; color: #333333;
} line-height: 40rpx;
}
.rightImageView {
/* width: 300rpx; */ .rightImageView {
/* height: 320rpx; */ /* width: 300rpx; */
display: flex; /* height: 320rpx; */
align-items: center; display: flex;
justify-content: flex-start; align-items: center;
flex-wrap: wrap; justify-content: flex-start;
margin-top: 26rpx; flex-wrap: wrap;
} margin-top: 26rpx;
}
.rightImage {
background-color: #F3F3F3; .rightImage {
width: 116rpx; background-color: #F3F3F3;
height: 116rpx; width: 116rpx;
margin: 0rpx 12rpx 12rpx 0rpx; height: 116rpx;
margin: 0rpx 12rpx 12rpx 0rpx;
}
}
.rightImage:nth-child(5n) {
margin-right: 0; .rightImage:nth-child(5n) {
} margin-right: 0;
}
.topView {
background-color: #FAFAFA; .topView {
width: 100%; background-color: #FAFAFA;
height: 100rpx; width: 100%;
position: fixed; height: 100rpx;
display: flex; position: fixed;
flex-direction: row; display: flex;
z-index: 1; flex-direction: row;
} z-index: 1;
}
.topItemView {
/* width: 210rpx; */ .topItemView {
height: 100rpx; /* width: 210rpx; */
display: flex; height: 100rpx;
align-items: center; display: flex;
justify-content: center; align-items: center;
-webkit-flex: 1; justify-content: center;
flex: 1; -webkit-flex: 1;
background-color: #FFFFFF; flex: 1;
color: #999999; background-color: #FFFFFF;
} color: #999999;
}
.topItemView.active {
color: #2272FF; .topItemView.active {
} color: #2272FF;
}
.topItemTitle {
font-size: 36rpx; .topItemTitle {
font-weight: bold; font-size: 36rpx;
padding-left: 30rpx; font-weight: bold;
} padding-left: 30rpx;
}
.greenBackColor {
background-color: #4CD964; .greenBackColor {
} background-color: #4CD964;
}
.ph-list-pop-text {
color: #666666; .ph-list-pop-text {
text-align: center; color: #666666;
margin-top: 20rpx; text-align: center;
font-size: 30rpx; margin-top: 20rpx;
} font-size: 30rpx;
}
.ph-list-pop-title {
font-size: 40rpx; .ph-list-pop-title {
padding-top: 150rpx; font-size: 40rpx;
text-align: center; padding-top: 150rpx;
color: #333333; text-align: center;
} color: #333333;
}
.ph-list-pop-btn-view {
display: flex; .ph-list-pop-btn-view {
justify-content: center; display: flex;
margin-top: 150rpx; justify-content: center;
} margin-top: 150rpx;
}
.scroll-y {
height: 80vh; .scroll-y {
} height: 80vh;
}
</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