Commit 27008cb6 authored by 李俊赕's avatar 李俊赕

Merge branch 'dev-photo-v2' of https://git.banshouhui.com/heyinchen/take_order into dev-photo-v2

parents e7785d60 5f986d5b
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
const globalData = getApp().globalData const globalData = getApp().globalData
globalData.photo.productList = result globalData.photo.productList = result
this.dataList = result this.dataList = result
var item = result[0] var item = result[0]
globalData.photo.waterSetting = item.userWatermark globalData.photo.waterSetting = item.userWatermark
this.rightList = item.list this.rightList = item.list
}, },
...@@ -108,8 +108,8 @@ ...@@ -108,8 +108,8 @@
//顶部点击 //顶部点击
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.waterSetting = item.userWatermark photo.waterSetting = item.userWatermark
uni.pageScrollTo({ uni.pageScrollTo({
scrollTop: 0, scrollTop: 0,
......
...@@ -5,40 +5,45 @@ ...@@ -5,40 +5,45 @@
<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['has_origin']" @change="handleOrigineChange" color="#007AFF" />
style="transform:scale(0.8)" />
</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['lower_right']['title_text'] || '点击可编辑更改'}}</text>
</view> </view>
<switch class="itemSwitch" :checked="result['lower_right']['title_text']" @change="itemChange({},-1)" <switch class="itemSwitch" disabled :checked="result['lower_right']['title_text']"
color="#007AFF" style="transform:scale(0.8)" /> @change="itemChange({},-1)" 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['watemark_text'] || '自定义' + (ikey + 1)}}</text>
<text class="itemNotice">{{item['watemark_value'] || '点击可编辑更改'}}</text> <text class="itemNotice">{{item['watemark_value'] || '点击可编辑更改'}}</text>
</view> </view>
<switch class="itemSwitch" :checked="item['watemark_value']" @change="itemChange(item, ikey)" <switch class="itemSwitch" :disabled="!item['enable']" :checked="item['enable']"
color="#007AFF" style="transform:scale(0.8)" /> @change="itemChange(item, ikey)" color="#007AFF" />
</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="ph-pop-left-view">
<input class="leftInput" type="text" v-model="currenItem['watemark_text']" <view class="leftInputView">
: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>
: <view class="ph-pop-mid-view">:</view>
<view class="rightInputView"> <view>
<input class="rightInput" type="text" v-model="currenItem['watemark_value']" placeholder="请输入内容" <view class="rightInputView">
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> </view>
</view> </view>
<text class="popNoticeText u-m-t-40">示例:</text> <text class="popNoticeText u-m-t-20">示例:</text>
<text class="popNoticeText">工程队名称:蓝天工程队</text> <text class="popNoticeText">工程队名称:蓝天工程队</text>
<view class="popBtnView"> <view class="popBtnView">
<view class="popCancelBtn" @click="popCancelClick()"> <view class="popCancelBtn" @click="popCancelClick()">
...@@ -71,7 +76,9 @@ ...@@ -71,7 +76,9 @@
'watemark_text': '', 'watemark_text': '',
'watemark_value': '' 'watemark_value': ''
}, },
editingItem: {} editingItem: {},
showTipLeft: false,
showTipRight: false
} }
}, },
computed: { computed: {
...@@ -92,19 +99,18 @@ ...@@ -92,19 +99,18 @@
}, },
onLoad(e) { onLoad(e) {
getApp().trackPage('水印设置页') getApp().trackPage('水印设置页')
this.icon_close_new = getApp().globalData.icon_close_new const globalData = getApp().globalData
if (e && e.systemId) { this.icon_close_new = globalData.icon_close_new
this.systemId = e.systemId this.systemId = globalData.photo.product.systemId
}
this.getItemList() this.getItemList()
}, },
methods: { methods: {
getItemList: function() { getItemList: function() {
this.systemId = '79550af260555cc20afb34156c94b32c' // 测试数据 // this.systemId = '79550af260555cc20afb34156c94b32c' // 测试数据
uni.showLoading(); uni.showLoading();
this.$u.cloudApi.getUserWatermark({ this.$u.cloudApi.getUserWatermark({
'token': getApp().globalData.token,
'system_id': this.systemId 'system_id': this.systemId
}).then(res => { }).then(res => {
console.log(res) console.log(res)
...@@ -119,12 +125,17 @@ ...@@ -119,12 +125,17 @@
}) })
}, },
saveUserWatermark: function() { saveUserWatermark: function() {
uni.showLoading(); uni.showLoading();
this.$u.cloudApi.saveUserWatermark({ this.$u.cloudApi.saveUserWatermark({
'token': getApp().globalData.token, 'token': getApp().globalData.token,
'watermark': this.result 'watermark': this.result
}).then(res => { }).then(res => {
console.log(res) console.log(res)
if (res.result == true) {
const photo = getApp().globalData.photo
photo.waterSetting = this.result
}
this.$nextTick(function() { this.$nextTick(function() {
uni.hideLoading(); uni.hideLoading();
}) })
...@@ -134,28 +145,28 @@ ...@@ -134,28 +145,28 @@
//保存原图 开关 //保存原图 开关
handleOrigineChange: function(e) { handleOrigineChange: function(e) {
this.result['has_origin'] = !this.result['has_origin'] this.result['has_origin'] = !this.result['has_origin']
console.log('保存原图 开关 发生 change 事件,携带值为', this.result['has_origin']) this.saveUserWatermark()
}, },
//自定义 开关 //自定义 开关
itemChange: function(item, ikey) { itemChange: function(item, ikey) {
if (ikey === -1) { // 水印标题 if (ikey === -1) { // 水印标题
if (this.result['lower_right']['title_text']) { // if (this.result['lower_right']['title_text']) {
// 修改 // 修改
this.saveUserWatermark() this.saveUserWatermark()
} else { // } else {
// 弹出修改框 // // 弹出修改框
this.itemClick(item, ikey) // this.itemClick(item, ikey)
} // }
} else { // 其他自定义 } else { // 其他自定义
if (item['watemark_value']) { // if (item['watemark_value']) {
// 修改 // 修改
this.saveUserWatermark() this.saveUserWatermark()
} else { // } else {
// 弹出修改框 // // 弹出修改框
this.itemClick(item, ikey) // this.itemClick(item, ikey)
} // }
} }
}, },
...@@ -180,12 +191,17 @@ ...@@ -180,12 +191,17 @@
//左侧输入框 //左侧输入框
leftInput: function(e) { leftInput: function(e) {
console.log('左侧输入框 发生 input 事件,携带值为', e.detail.value) if (this.currenItem['watemark_text']) {
this.showTipLeft = false
}
}, },
//右侧输入框 //右侧输入框
rightInput: function(e) { rightInput: function(e) {
console.log('右侧输入框 发生 input 事件,携带值为', e.detail.value) if (this.currenItem['watemark_value']) {
this.showTipRight = false
}
}, },
//自定义弹窗 关闭 //自定义弹窗 关闭
...@@ -199,15 +215,26 @@ ...@@ -199,15 +215,26 @@
//自定义弹窗 保存 //自定义弹窗 保存
popSaveClick: function() { popSaveClick: function() {
this.isPopShow = false if (this.currenItem['watemark_text'] && this.currenItem['watemark_value']) {
debugger this.isPopShow = false
if (this.currenItem.type === 'title_text') { if (this.currenItem.type === 'title_text') {
this.result['lower_right']['title_text'] = this.currenItem['watemark_value'] 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.editingItem['enable'] = true
}
this.saveUserWatermark()
} else { } else {
this.editingItem['watemark_text'] = this.currenItem['watemark_text'] // 提示
this.editingItem['watemark_value'] = this.currenItem['watemark_value'] if (!this.currenItem['watemark_text']) {
this.showTipLeft = true
}
if (!this.currenItem['watemark_value']) {
this.showTipRight = true
}
} }
this.saveUserWatermark()
} }
...@@ -272,13 +299,13 @@ ...@@ -272,13 +299,13 @@
.itemNotice { .itemNotice {
font-size: 26rpx; font-size: 26rpx;
font-weight: bold;
color: #666666; color: #666666;
margin-top: 4rpx; margin-top: 4rpx;
} }
.itemSwitch { .itemSwitch {
margin-right: 30rpx; margin-right: 30rpx;
transform: scale(0.78, 0.75);
} }
.shadowBackView { .shadowBackView {
...@@ -314,18 +341,21 @@ ...@@ -314,18 +341,21 @@
.inputBackView { .inputBackView {
margin-top: 52rpx; margin-top: 52rpx;
width: 100%; width: 100%;
height: 90rpx;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
display: flex;
align-items: flex-start;
} }
.leftInputView { .leftInputView {
width: 220rpx; width: 220rpx;
height: 72rpx; height: 72rpx;
border: 2rpx solid #666666; border: 2rpx solid #666666;
margin-left: 30rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
...@@ -334,6 +364,17 @@ ...@@ -334,6 +364,17 @@
.leftInput { .leftInput {
width: 180rpx; width: 180rpx;
height: 32rpx; height: 32rpx;
}
.ph-pop-left-view {
margin-left: 30rpx;
}
.ph-pop-tip-view {
color:#F56C6C;
}
.ph-pop-mid-view {
margin-top: 20rpx;
} }
.rightInputView { .rightInputView {
......
...@@ -3,7 +3,8 @@ async function getUserId(token) { ...@@ -3,7 +3,8 @@ async function getUserId(token) {
"/myinfo/id", { "/myinfo/id", {
method: 'GET' method: 'GET'
}) })
return res ? res.data : "" console.log(res.data)
return res && res.status === '200' ? res.data : token
} }
module.exports = { module.exports = {
......
// 本文件中的json内容将在云函数【运行】时作为参数传给云函数。
// 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam
{
"token": "",
"classify_id": "79550af260555cc20afb34146966a2c4",
"system_id": "79550af260555cc20afb34156c94b32c",
"brand_id": "79550af260555cc20afb3417731a827c"
}
...@@ -6,7 +6,7 @@ exports.main = async (event, context) => { ...@@ -6,7 +6,7 @@ exports.main = async (event, context) => {
const db = uniCloud.database(); const db = uniCloud.database();
const _ = db.command const _ = db.command
const $ = db.command.aggregate const $ = db.command.aggregate
const user_id = getUserId(event.token) const user_id = await getUserId(event.token)
let res = await db.collection("standardV2").aggregate().lookup({ let res = await db.collection("standardV2").aggregate().lookup({
from: 'user_upload_file', from: 'user_upload_file',
let: { let: {
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
// 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam // 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam
{ {
"token": "" "token": "fdsadfsafsafsadfdsa",
"system_id": "79550af260555cc20afb34156c94b32c" "system_id": "79550af260555cc20afb34156c94b32c"
} }
...@@ -4,7 +4,7 @@ const { ...@@ -4,7 +4,7 @@ const {
} = require('user-common') } = require('user-common')
exports.main = async (event, context) => { exports.main = async (event, context) => {
//event为客户端上传的参数 //event为客户端上传的参数
const user_id = getUserId(event.token) const user_id = await getUserId(event.token)
const collection = uniCloud.database().collection("user_watermark").field({ const collection = uniCloud.database().collection("user_watermark").field({
'_id': false '_id': false
}) })
......
...@@ -4,7 +4,7 @@ const { ...@@ -4,7 +4,7 @@ const {
} = require('user-common') } = require('user-common')
exports.main = async (event, context) => { exports.main = async (event, context) => {
//event为客户端上传的参数 //event为客户端上传的参数
let workerId = getUserId(event.token) let workerId = await getUserId(event.token)
if (workerId) { if (workerId) {
await uniCloud.database().collection("user_upload_file").add({ await uniCloud.database().collection("user_upload_file").add({
"user_id": workerId, "user_id": workerId,
......
...@@ -4,9 +4,9 @@ const { ...@@ -4,9 +4,9 @@ const {
} = require('user-common') } = require('user-common')
exports.main = async (event, context) => { exports.main = async (event, context) => {
let user_id = getUserId(event.token) let user_id = await getUserId(event.token)
console.log(user_id);
const watermark = event.watermark const watermark = event.watermark
user_id = '12312313'
if (user_id) { if (user_id) {
watermark.user_id = user_id watermark.user_id = user_id
const collection = uniCloud.database().collection("user_watermark"); const collection = uniCloud.database().collection("user_watermark");
...@@ -15,9 +15,9 @@ exports.main = async (event, context) => { ...@@ -15,9 +15,9 @@ exports.main = async (event, context) => {
system_id: watermark.system_id system_id: watermark.system_id
}).get() }).get()
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
collection.doc(res.data[0]._id).update(watermark) await collection.doc(res.data[0]._id).update(watermark)
} else { } else {
collection.add(watermark) await collection.add(watermark)
} }
} }
//返回数据给客户端 //返回数据给客户端
......
// 本文件中的json内容将在云函数【运行】时作为参数传给云函数。
// 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam
{ {
"token": "12312313", "token": "fdsadfsafsafsadfdsa",
"watermark": { "watermark": {
"has_origin": true, "has_origin": true,
"lower_right": { "lower_right": {
"body": [{ "body": [{
"enable": true,
"watemark_text": "时间", "watemark_text": "时间",
"watemark_type": "时间", "watemark_type": "时间",
"watemark_value": "" "watemark_value": ""
}, { }, {
"enable": true,
"watemark_text": "地址", "watemark_text": "地址",
"watemark_type": "地址", "watemark_type": "地址",
"watemark_value": "" "watemark_value": ""
}, { }, {
"enable": true,
"watemark_text": "经度", "watemark_text": "经度",
"watemark_type": "经度", "watemark_type": "经度",
"watemark_value": "" "watemark_value": ""
}, { }, {
"enable": true,
"watemark_text": "纬度", "watemark_text": "纬度",
"watemark_type": "纬度", "watemark_type": "纬度",
"watemark_value": "" "watemark_value": ""
}], }, {
"title_text": "OR000000001111" "enable": false,
"watemark_text": "",
"watemark_type": "备注",
"watemark_value": ""
}, {
"watemark_value": "蓝天工程队3",
"enable": true,
"watemark_text": "工程队名称3",
"watemark_type": "备注"
}, {
"enable": true,
"watemark_text": "10000",
"watemark_type": "备注",
"watemark_value": "111111"
}, {
"enable": false,
"watemark_text": "",
"watemark_type": "备注",
"watemark_value": ""
}, {
"enable": false,
"watemark_text": "",
"watemark_type": "备注",
"watemark_value": ""
}]
}, },
"mid_text": "现场拍照", "mid_text": "现场拍照",
"system_id": "79550af260555cc20afb34156c94b32c", "system_id": "79550af260555cc20afb34156c94b32c",
"user_id": "" "user_id": "fdsadfsafsafsadfdsa"
} }
} }
\ No newline at end of file
...@@ -200,43 +200,51 @@ ...@@ -200,43 +200,51 @@
"has_origin": true, "has_origin": true,
"mid_text": "现场拍照", "mid_text": "现场拍照",
"lower_right": { "lower_right": {
"title_text": "",
"body": [{ "body": [{
"watemark_type": "时间", "watemark_type": "时间",
"watemark_text": "时间", "watemark_text": "时间",
"watemark_value": "" "watemark_value": "",
"enable": true
}, { }, {
"watemark_type": "地址", "watemark_type": "地址",
"watemark_text": "地址", "watemark_text": "地址",
"watemark_value": "" "watemark_value": "",
"enable": true
}, { }, {
"watemark_type": "经度", "watemark_type": "经度",
"watemark_text": "经度", "watemark_text": "经度",
"watemark_value": "" "watemark_value": "",
"enable": true
}, { }, {
"watemark_type": "纬度", "watemark_type": "纬度",
"watemark_text": "纬度", "watemark_text": "纬度",
"watemark_value": "" "watemark_value": "",
"enable": true
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}] }]
} }
}, { }, {
...@@ -245,43 +253,51 @@ ...@@ -245,43 +253,51 @@
"has_origin": true, "has_origin": true,
"mid_text": "现场拍照", "mid_text": "现场拍照",
"lower_right": { "lower_right": {
"title_text": "",
"body": [{ "body": [{
"watemark_type": "时间", "watemark_type": "时间",
"watemark_text": "时间", "watemark_text": "时间",
"watemark_value": "" "watemark_value": "",
"enable": true
}, { }, {
"watemark_type": "地址", "watemark_type": "地址",
"watemark_text": "地址", "watemark_text": "地址",
"watemark_value": "" "watemark_value": "",
"enable": true
}, { }, {
"watemark_type": "经度", "watemark_type": "经度",
"watemark_text": "经度", "watemark_text": "经度",
"watemark_value": "" "watemark_value": "",
"enable": true
}, { }, {
"watemark_type": "纬度", "watemark_type": "纬度",
"watemark_text": "纬度", "watemark_text": "纬度",
"watemark_value": "" "watemark_value": "",
"enable": true
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}] }]
} }
}, { }, {
...@@ -294,39 +310,48 @@ ...@@ -294,39 +310,48 @@
"body": [{ "body": [{
"watemark_type": "时间", "watemark_type": "时间",
"watemark_text": "时间", "watemark_text": "时间",
"watemark_value": "" "watemark_value": "",
"enable": true
}, { }, {
"watemark_type": "地址", "watemark_type": "地址",
"watemark_text": "地址", "watemark_text": "地址",
"watemark_value": "" "watemark_value": "",
"enable": true
}, { }, {
"watemark_type": "经度", "watemark_type": "经度",
"watemark_text": "经度", "watemark_text": "经度",
"watemark_value": "" "watemark_value": "",
"enable": true
}, { }, {
"watemark_type": "纬度", "watemark_type": "纬度",
"watemark_text": "纬度", "watemark_text": "纬度",
"watemark_value": "" "watemark_value": "",
"enable": true
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}, { }, {
"watemark_type": "备注", "watemark_type": "备注",
"watemark_text": "", "watemark_text": "",
"watemark_value": "" "watemark_value": "",
"enable": false
}] }]
} }
} }
......
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