Commit 022407ce authored by 李俊赕's avatar 李俊赕

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

parents 5097b821 f82046bc
...@@ -125,9 +125,11 @@ ...@@ -125,9 +125,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
} }
}, },
{ {
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<view class="topTitle"><text>{{ dataItem.title }}</text></view> <view class="topTitle"><text>{{ dataItem.title }}</text></view>
<view class="ph-pr-content"> <view class="ph-pr-content">
<view v-for="(item,ikey) in dataItem.data" <view v-for="(item,ikey) in dataItem.data"
:class="param[dataItem.type] === item._id ? 'select-item-view' : 'item-view'" :class="param[dataItem.type] === item.id ? 'select-item-view' : 'item-view'"
@click="itemClick(dataItem.type, item)" :key="item._id"> @click="itemClick(dataItem.type, item, ikey)" :key="item.id">
<text class="itemTitle">{{item.name}}</text> <text class="itemTitle">{{item.name}}</text>
</view> </view>
</view> </view>
...@@ -59,8 +59,7 @@ ...@@ -59,8 +59,7 @@
}, },
onLoad(e) { onLoad(e) {
getApp().trackPage('选择产品页') getApp().trackPage('选择产品页')
this.getclassifyList() this.getRelationDictionaryV2()
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
let shareObj = { let shareObj = {
...@@ -73,68 +72,45 @@ ...@@ -73,68 +72,45 @@
return shareObj return shareObj
}, },
methods: { methods: {
getRelationDictionaryV2: function() {
getclassifyList: function() { this.$u.cloudApi.getRelationDictionaryV2().then(res => {
console.log('V2:')
let that = this
this.$u.cloudApi.getClassifyDictionary().then(res => {
console.log('获取产品数据:')
console.log(res) console.log(res)
if (res.result && res.result.data) { if (res && res.result) {
that.classifyList = res.result.data this.classifyList = res.result
that.param.classifyId = that.classifyList[0]._id this.param.classifyId = res.result[0].id
that.$u.cloudApi.getRelationDictionary({ this.systemList = res.result[0].child
"classify_id": that.param.classifyId,
"field": "system_id"
}).then(res1 => {
that.systemList = res1.result
})
} }
}) })
}, },
//选择 点击 //选择 点击
itemClick: function(type, item) { itemClick: function(type, item, ikey) {
switch (type) { switch (type) {
case 'classifyId': case 'classifyId':
this.param = { this.param = {
classifyId: item._id, classifyId: item.id,
systemId: '', systemId: '',
brandId: '' brandId: ''
} }
this.selectedAll = false this.selectedAll = false
this.systemList = [] this.systemList = this.classifyList[ikey].child
this.brandList = [] this.brandList = []
this.$u.cloudApi.getRelationDictionary({
"classify_id": this.param.classifyId,
"field": "system_id"
}).then(res => {
this.systemList = res.result
})
break break
case 'systemId': case 'systemId':
this.param = { this.param = {
classifyId: this.param.classifyId, classifyId: this.param.classifyId,
systemId: item._id, systemId: item.id,
brandId: '' brandId: ''
} }
this.selectedAll = false this.selectedAll = false
this.brandList = [] this.brandList = this.systemList[ikey].child
this.$u.cloudApi.getRelationDictionary({
"classify_id": this.param.classifyId,
"system_id": this.param.systemId,
"field": "brand_id"
}).then(res => {
console.log('获取品牌数据:', res)
this.brandList = res.result
})
break break
case 'brandId': case 'brandId':
this.param.brandId = item._id this.param.brandId = item.id
this.selectedAll = true this.selectedAll = true
this.brandName = item.name this.brandName = item.name
break break
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<script> <script>
import qiniup from '@/components/upload/qiniup'; import qiniup from '@/components/upload/qiniup';
const app = getApp()
export default { export default {
mixins: [qiniup], mixins: [qiniup],
data() { data() {
...@@ -25,9 +26,18 @@ ...@@ -25,9 +26,18 @@
fileMaps: [], fileMaps: [],
keys: [], keys: [],
token: '', token: '',
product: '',
} }
}, },
onLoad(e) { onLoad(e) {
// 获取照片选项对象
const product = app.globalData.photo.product
this.product = `?brandId=${product.brandId}&brand=${product.brandName}&classifyId=${product.classifyId}&systemId=${product.systemId}`
if(app.globalData.photo.currentItem) {
// 获取规格Id
this.standardId = app.globalData.photo.currentItem._id
}
getApp().trackPage('照片预览页') getApp().trackPage('照片预览页')
const globalTempPath = getApp().globalData.photo.tempPath const globalTempPath = getApp().globalData.photo.tempPath
if(globalTempPath && globalTempPath.mixWater){ if(globalTempPath && globalTempPath.mixWater){
...@@ -41,6 +51,9 @@ ...@@ -41,6 +51,9 @@
this.images = [e.img] this.images = [e.img]
// this.downloadImages() // this.downloadImages()
} }
// if() {
// }
console.log(this.images, 'this.images') console.log(this.images, 'this.images')
this.token = getApp().globalData.token this.token = getApp().globalData.token
...@@ -122,6 +135,7 @@ ...@@ -122,6 +135,7 @@
}, },
submitFile() { submitFile() {
let self = this let self = this
if(self.keys.length) { if(self.keys.length) {
for (let s of self.keys) { for (let s of self.keys) {
self.$u.cloudApi.saveImage({ self.$u.cloudApi.saveImage({
......
<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