Commit 1ed284c2 authored by Facius's avatar Facius

水印设置页面交互和接口调试

parent 2b1099d2
...@@ -128,9 +128,11 @@ ...@@ -128,9 +128,11 @@
"path": "pages/photo/setting", "path": "pages/photo/setting",
"style": { "style": {
"navigationBarTitleText": "水印设置", "navigationBarTitleText": "水印设置",
"navigationBarBackgroundColor": "#333333", "navigationBarBackgroundColor":"#FFFFFF",
"navigationBarTextStyle": "#FFFFFF", "backgroundColor":"#F4F5F7"
"disableScroll": true // "navigationBarBackgroundColor": "#333333",
// "navigationBarTextStyle": "#FFFFFF",
// "disableScroll": true
} }
}, },
{ {
......
<template> <template>
<view class="backView"> <view class="backView">
<view class="firstItemView"> <view class="itemView firstItem">
<view class="itemTitleView "> <view class="itemTitleView">
<text class="itemTitle">保存原图</text> <text class="itemTitle">保存原图</text>
<text class="itemNotice">拍照后另保存一张无水印的图片</text> <text class="itemNotice">拍照后另保存一张无水印的图片</text>
</view> </view>
<switch class="itemSwitch" :checked="isSaveOrigine" @change="saveOrigineChange" color="#007AFF" style="transform:scale(0.8)"/> <switch class="itemSwitch" :checked="result['has_origin']" @change="handleOrigineChange" color="#007AFF"
style="transform:scale(0.8)" />
</view> </view>
<view class="itemView" v-for="(item,ikey) in itemList":key="ikey"> <view class="itemView" v-if="showTitleSwitch">
<view class="itemTitleView" @click="itemClick({},-1)">
<text class="itemTitle">水印标题</text>
<text class="itemNotice">{{result['lower_right']['title_text'] || '点击可编辑更改'}}</text>
</view>
<switch class="itemSwitch" :checked="result['lower_right']['title_text']" @change="itemChange({},-1)"
color="#007AFF" style="transform:scale(0.8)" />
</view>
<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.title}}</text> <text class="itemTitle">{{item['watemark_text'] || '自定义' + (ikey + 1)}}</text>
<text class="itemNotice">{{item.notice}}</text> <text class="itemNotice">{{item['watemark_value'] || '点击可编辑更改'}}</text>
</view> </view>
<switch class="itemSwitch" :checked="item.isSelect" @change="itemChange" color="#007AFF" style="transform:scale(0.8)"/> <switch class="itemSwitch" :checked="item['watemark_value']" @change="itemChange(item, ikey)"
color="#007AFF" style="transform:scale(0.8)" />
</view> </view>
<view class="shadowBackView" v-if="isPopShow"> <view class="shadowBackView" v-if="isPopShow">
<view class="popCenterView"> <view class="popCenterView">
<text class="popTitle">设置自定义项</text> <text class="popTitle">设置自定义项</text>
<view class="inputBackView"> <view class="inputBackView">
<view class="leftInputView"> <view class="leftInputView">
<input class="leftInput" type="text" value="" placeholder="请输入" @input="leftInput"/> <input class="leftInput" type="text" v-model="currenItem['watemark_text']"
:disabled="currenItem.type === 'title_text'" placeholder="请输入" maxlength="10" />
</view> </view>
: :
<view class="rightInputView"> <view class="rightInputView">
<input class="rightInput" type="text" value="" placeholder="请输入内容" @input="rightInput"/> <input class="rightInput" type="text" v-model="currenItem['watemark_value']" placeholder="请输入内容"
maxlength="30" />
</view> </view>
</view> </view>
<text class="popNoticeText u-m-t-40">示例:</text> <text class="popNoticeText u-m-t-40">示例:</text>
...@@ -45,87 +57,157 @@ ...@@ -45,87 +57,157 @@
export default { export default {
data() { data() {
return { return {
isSaveOrigine:true, systemId: '',
itemList:[], isSaveOrigine: true,
isPopShow:false, isPopShow: false,
icon_close_new:'' icon_close_new: '',
result: {
has_origin: true,
lower_right: {
body: []
}
},
currenItem: {
'watemark_text': '',
'watemark_value': ''
},
editingItem: {}
}
},
computed: {
itemList() {
if (this.result['lower_right']) {
var arr = this.result['lower_right']['body']
return arr.filter((item) => {
return item.watemark_type === '备注'
})
} else {
return []
}
},
showTitleSwitch() {
return this.result['lower_right'].hasOwnProperty('title_text')
} }
}, },
onLoad(e) { onLoad(e) {
getApp().trackPage('水印设置页') getApp().trackPage('水印设置页')
this.icon_close_new = getApp().globalData.icon_close_new this.icon_close_new = getApp().globalData.icon_close_new
if(e && e.product_code){ if (e && e.systemId) {
this.product_code = e.product_code this.systemId = e.systemId
} }
this.getItemList() this.getItemList()
}, },
methods: { methods: {
getItemList: function () { getItemList: function() {
this.itemList = [ this.systemId = '79550af260555cc20afb34156c94b32c' // 测试数据
{ uni.showLoading();
title:'自定义1', this.$u.cloudApi.getUserWatermark({
notice:'点击可编辑更改', 'system_id': this.systemId
isSelect:false }).then(res => {
}, console.log(res)
{
title:'自定义2', if (res && res.result) {
notice:'点击可编辑更改', this.result = res.result
isSelect:true
},
{
title:'自定义3',
notice:'点击可编辑更改',
isSelect:false
},
{
title:'自定义4',
notice:'点击可编辑更改',
isSelect:false
},
{
title:'自定义5',
notice:'点击可编辑更改',
isSelect:false
} }
] this.$nextTick(function() {
uni.hideLoading();
})
})
},
saveUserWatermark: function() {
uni.showLoading();
this.$u.cloudApi.saveUserWatermark({
'token': getApp().globalData.token,
'watermark': this.result
}).then(res => {
console.log(res)
this.$nextTick(function() {
uni.hideLoading();
})
})
}, },
//保存原图 开关 //保存原图 开关
saveOrigineChange: function(e) { handleOrigineChange: function(e) {
console.log('保存原图 开关 发生 change 事件,携带值为', e.target.value) this.result['has_origin'] = !this.result['has_origin']
console.log('保存原图 开关 发生 change 事件,携带值为', this.result['has_origin'])
}, },
//自定义 开关 //自定义 开关
itemChange: function(e) { itemChange: function(item, ikey) {
console.log('自定义 开关 发生 change 事件,携带值为', e.target.value) if (ikey === -1) { // 水印标题
if (this.result['lower_right']['title_text']) {
// 修改
this.saveUserWatermark()
} else {
// 弹出修改框
this.itemClick(item, ikey)
}
} else { // 其他自定义
if (item['watemark_value']) {
// 修改
this.saveUserWatermark()
} else {
// 弹出修改框
this.itemClick(item, ikey)
}
}
}, },
//自定义 点击 //自定义 点击
itemClick: function (item,ikey) { itemClick: function(item, ikey) {
console.log('自定义 开关 发生 click 事件,携带值为', item,ikey) if (ikey === -1) {
this.currenItem = {
'watemark_text': '水印标题',
'watemark_value': this.result['lower_right']['title_text'],
'type': 'title_text'
}
} else {
this.editingItem = item
this.currenItem = {
...item
}
}
this.isPopShow = true this.isPopShow = true
}, },
//左侧输入框 //左侧输入框
leftInput: function (e){ leftInput: function(e) {
console.log('左侧输入框 发生 input 事件,携带值为', e.detail.value) console.log('左侧输入框 发生 input 事件,携带值为', e.detail.value)
}, },
//右侧输入框 //右侧输入框
rightInput: function (e){ rightInput: function(e) {
console.log('右侧输入框 发生 input 事件,携带值为', e.detail.value) console.log('右侧输入框 发生 input 事件,携带值为', e.detail.value)
}, },
//自定义弹窗 关闭 //自定义弹窗 关闭
popCancelClick: function () { popCancelClick: function() {
this.currenItem = {
'watemark_text': '',
'watemark_value': ''
}
this.isPopShow = false this.isPopShow = false
}, },
//自定义弹窗 保存 //自定义弹窗 保存
popSaveClick: function () { popSaveClick: function() {
this.isPopShow = false this.isPopShow = false
debugger
if (this.currenItem.type === 'title_text') {
this.result['lower_right']['title_text'] = this.currenItem['watemark_value']
} else {
this.editingItem['watemark_text'] = this.currenItem['watemark_text']
this.editingItem['watemark_value'] = this.currenItem['watemark_value']
}
this.saveUserWatermark()
} }
...@@ -134,7 +216,7 @@ ...@@ -134,7 +216,7 @@
</script> </script>
<style> <style>
.backView{ .backView {
background-color: #FAFAFA; background-color: #FAFAFA;
position: absolute; position: absolute;
top: 0; top: 0;
...@@ -145,6 +227,7 @@ ...@@ -145,6 +227,7 @@
align-items: center; align-items: center;
} }
/*
.firstItemView{ .firstItemView{
background-color: #FFFFFF; background-color: #FFFFFF;
width: 100%; width: 100%;
...@@ -155,9 +238,9 @@ ...@@ -155,9 +238,9 @@
padding-top: 80rpx; padding-top: 80rpx;
padding-bottom: 80rpx; padding-bottom: 80rpx;
border-bottom: 2rpx solid #F4F5F7; border-bottom: 2rpx solid #F4F5F7;
} } */
.itemView{ .itemView {
background-color: #FFFFFF; background-color: #FFFFFF;
width: 100%; width: 100%;
display: flex; display: flex;
...@@ -169,8 +252,11 @@ ...@@ -169,8 +252,11 @@
} }
.itemView.firstItem {
border-bottom: 2rpx solid #F4F5F7;
}
.itemTitleView{ .itemTitleView {
background-color: #FFFFFF; background-color: #FFFFFF;
width: 80%; width: 80%;
display: flex; display: flex;
...@@ -178,25 +264,25 @@ ...@@ -178,25 +264,25 @@
padding-left: 30rpx; padding-left: 30rpx;
} }
.itemTitle{ .itemTitle {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
} }
.itemNotice{ .itemNotice {
font-size: 26rpx; font-size: 26rpx;
font-weight: bold; font-weight: bold;
color: #666666; color: #666666;
margin-top: 4rpx; margin-top: 4rpx;
} }
.itemSwitch{ .itemSwitch {
margin-right: 30rpx; margin-right: 30rpx;
} }
.shadowBackView{ .shadowBackView {
background-color: rgba(0,0,0,0.5); background-color: rgba(0, 0, 0, 0.5);
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
...@@ -208,7 +294,7 @@ ...@@ -208,7 +294,7 @@
} }
.popCenterView{ .popCenterView {
background-color: #FFFFFF; background-color: #FFFFFF;
width: 690rpx; width: 690rpx;
height: 600rpx; height: 600rpx;
...@@ -219,14 +305,14 @@ ...@@ -219,14 +305,14 @@
} }
.popTitle{ .popTitle {
font-size: 36rpx; font-size: 36rpx;
font-weight: bold; font-weight: bold;
margin-top: 50rpx; margin-top: 50rpx;
padding-left: 30rpx; padding-left: 30rpx;
} }
.inputBackView{ .inputBackView {
margin-top: 52rpx; margin-top: 52rpx;
width: 100%; width: 100%;
display: flex; display: flex;
...@@ -235,7 +321,7 @@ ...@@ -235,7 +321,7 @@
justify-content: space-between; justify-content: space-between;
} }
.leftInputView{ .leftInputView {
width: 220rpx; width: 220rpx;
height: 72rpx; height: 72rpx;
border: 2rpx solid #666666; border: 2rpx solid #666666;
...@@ -245,12 +331,12 @@ ...@@ -245,12 +331,12 @@
justify-content: center; justify-content: center;
} }
.leftInput{ .leftInput {
width: 180rpx; width: 180rpx;
height: 32rpx; height: 32rpx;
} }
.rightInputView{ .rightInputView {
width: 360rpx; width: 360rpx;
height: 72rpx; height: 72rpx;
border: 2rpx solid #666666; border: 2rpx solid #666666;
...@@ -260,18 +346,18 @@ ...@@ -260,18 +346,18 @@
justify-content: center; justify-content: center;
} }
.rightInput{ .rightInput {
width: 320rpx; width: 320rpx;
height: 32rpx; height: 32rpx;
} }
.popNoticeText{ .popNoticeText {
font-size: 26rpx; font-size: 26rpx;
color: #666666; color: #666666;
padding-left: 30rpx; padding-left: 30rpx;
} }
.popBtnView{ .popBtnView {
margin-top: 110rpx; margin-top: 110rpx;
width: 100%; width: 100%;
display: flex; display: flex;
...@@ -279,7 +365,7 @@ ...@@ -279,7 +365,7 @@
justify-content: space-between; justify-content: space-between;
} }
.popCancelBtn{ .popCancelBtn {
background-color: #D1D4D4; background-color: #D1D4D4;
width: 280rpx; width: 280rpx;
height: 96rpx; height: 96rpx;
...@@ -290,7 +376,7 @@ ...@@ -290,7 +376,7 @@
justify-content: center; justify-content: center;
} }
.popSaveBtn{ .popSaveBtn {
background-color: #2272FF; background-color: #2272FF;
width: 280rpx; width: 280rpx;
height: 96rpx; height: 96rpx;
...@@ -301,10 +387,9 @@ ...@@ -301,10 +387,9 @@
justify-content: center; justify-content: center;
} }
.popBtnText{ .popBtnText {
font-size: 32rpx; font-size: 32rpx;
color: #FFFFFF; color: #FFFFFF;
font-weight: 600; font-weight: 600;
} }
</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