Commit da5ff8fc authored by Facius's avatar Facius

自定义水印优化

parent 69f776e3
......@@ -12,16 +12,16 @@
<text class="itemTitle">水印标题</text>
<text class="itemNotice">{{result['lower_right']['title_text'] || '点击可编辑更改'}}</text>
</view>
<switch class="itemSwitch" disabled :checked="result['lower_right']['title_text']"
@change="itemChange({},-1)" color="#007AFF" />
<switch class="itemSwitch" disabled :checked="result['lower_right']['title_text'] != ''"
@click="handleClickTitleSwitch" color="#007AFF" />
</view>
<view class="itemView" v-for="(item,ikey) in itemList" :key="ikey">
<view class="itemTitleView" @click="itemClick(item,ikey)">
<text class="itemTitle">{{item['watemark_text'] || '自定义' + (ikey + 1)}}</text>
<text class="itemNotice">{{item['watemark_value'] || '点击可编辑更改'}}</text>
</view>
<switch class="itemSwitch" :disabled="!item['enable']" :checked="item['enable']"
@change="itemChange(item, ikey)" color="#007AFF" />
<switch class="itemSwitch" :checked="item['enable']" @change="itemChange(item, ikey)"
color="#007AFF" />
</view>
<view class="shadowBackView" v-if="isPopShow">
<view class="popCenterView">
......@@ -29,16 +29,17 @@
<view class="inputBackView">
<view class="ph-pop-left-view">
<view class="leftInputView">
<input class="leftInput" type="text" v-model="currenItem['watemark_text']" @input="leftInput()"
:disabled="currenItem.type === 'title_text'" placeholder="请输入" maxlength="10" />
<input class="leftInput" type="text" v-model="currenItem['watemark_text']"
@input="leftInput()" :disabled="currenItem.type === 'title_text'" placeholder="请输入"
maxlength="10" />
</view>
<view class="ph-pop-tip-view" v-if="showTipLeft">*必填项</view>
</view>
<view class="ph-pop-mid-view">:</view>
<view>
<view class="rightInputView">
<input class="rightInput" type="text" v-model="currenItem['watemark_value']" @input="rightInput()"
placeholder="请输入内容" maxlength="30" />
<input class="rightInput" type="text" v-model="currenItem['watemark_value']"
@input="rightInput()" placeholder="请输入内容" maxlength="30" />
</view>
<view class="ph-pop-tip-view" v-if="showTipRight">*必填项</view>
</view>
......@@ -76,8 +77,8 @@
'watemark_text': '',
'watemark_value': ''
},
editingItem: {},
showTipLeft: false,
editingItem: {},
showTipLeft: false,
showTipRight: false
}
},
......@@ -109,14 +110,15 @@
getItemList: function() {
// this.systemId = '79550af260555cc20afb34156c94b32c' // 测试数据
uni.showLoading();
this.$u.cloudApi.getUserWatermark({
this.$u.cloudApi.getUserWatermark({
'token': getApp().globalData.token,
'system_id': this.systemId
}).then(res => {
console.log(res)
if (res && res.result) {
this.result = res.result
this.result = res.result
this.result['lower_right']['title_text'] = ''
}
this.$nextTick(function() {
uni.hideLoading();
......@@ -125,16 +127,16 @@
})
},
saveUserWatermark: function() {
uni.showLoading();
uni.showLoading();
this.$u.cloudApi.saveUserWatermark({
'token': getApp().globalData.token,
'watermark': this.result
}).then(res => {
console.log(res)
if (res.result == true) {
const photo = getApp().globalData.photo
photo.waterSetting = this.result
}
console.log(res)
if (res.result == true) {
const photo = getApp().globalData.photo
photo.waterSetting = this.result
}
this.$nextTick(function() {
uni.hideLoading();
......@@ -145,29 +147,29 @@
//保存原图 开关
handleOrigineChange: function(e) {
this.result['has_origin'] = !this.result['has_origin']
this.result['has_origin'] = !this.result['has_origin']
this.saveUserWatermark()
},
handleClickTitleSwitch: function(e) {
var string = this.result['lower_right']['title_text'] ? '水印标题不可关闭' : '请先编辑该自定义项'
uni.showToast({
icon: 'none',
title: string
})
},
//自定义 开关
itemChange: function(item, ikey) {
if (ikey === -1) { // 水印标题
// if (this.result['lower_right']['title_text']) {
if (item['watemark_value']) {
// 修改
item['enable'] = !item['enable']
this.saveUserWatermark()
// } else {
// // 弹出修改框
// this.itemClick(item, ikey)
// }
} else { // 其他自定义
// if (item['watemark_value']) {
// 修改
this.saveUserWatermark()
// } else {
// // 弹出修改框
// this.itemClick(item, ikey)
// }
} else {
uni.showToast({
icon: 'none',
title: '请先编辑该自定义项'
})
}
},
......@@ -191,16 +193,16 @@
//左侧输入框
leftInput: function(e) {
if (this.currenItem['watemark_text']) {
this.showTipLeft = false
}
if (this.currenItem['watemark_text']) {
this.showTipLeft = false
}
},
//右侧输入框
rightInput: function(e) {
if (this.currenItem['watemark_value']) {
this.showTipRight = false
if (this.currenItem['watemark_value']) {
this.showTipRight = false
}
},
......@@ -226,12 +228,12 @@
}
this.saveUserWatermark()
} else {
// 提示
if (!this.currenItem['watemark_text']) {
this.showTipLeft = true
}
if (!this.currenItem['watemark_value']) {
this.showTipRight = true
// 提示
if (!this.currenItem['watemark_text']) {
this.showTipLeft = true
}
if (!this.currenItem['watemark_value']) {
this.showTipRight = true
}
}
......@@ -341,13 +343,13 @@
.inputBackView {
margin-top: 52rpx;
width: 100%;
width: 100%;
height: 90rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
display: flex;
justify-content: space-between;
display: flex;
align-items: flex-start;
}
......@@ -355,7 +357,7 @@
width: 220rpx;
height: 72rpx;
border: 2rpx solid #666666;
display: flex;
align-items: center;
justify-content: center;
......@@ -364,17 +366,18 @@
.leftInput {
width: 180rpx;
height: 32rpx;
}
.ph-pop-left-view {
margin-left: 30rpx;
}
.ph-pop-tip-view {
color:#F56C6C;
}
.ph-pop-mid-view {
margin-top: 20rpx;
}
.ph-pop-left-view {
margin-left: 30rpx;
}
.ph-pop-tip-view {
color: #F56C6C;
}
.ph-pop-mid-view {
margin-top: 20rpx;
}
.rightInputView {
......
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