Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
take_order
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
和慭琛
take_order
Commits
aee78d69
Commit
aee78d69
authored
Mar 29, 2021
by
Facius
Browse files
Options
Browse Files
Download
Plain Diff
代码冲突
parents
da5ff8fc
614e27d5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
138 additions
and
71 deletions
+138
-71
App.vue
take-order/App.vue
+10
-7
preview.vue
take-order/pages/photo/preview.vue
+11
-9
setting.vue
take-order/pages/photo/setting.vue
+5
-4
take.vue
take-order/pages/photo/take.vue
+76
-39
getUserWatermark.param.json
...oudfunctions/getUserWatermark/getUserWatermark.param.json
+1
-1
index.js
...er/uniCloud-tcb/cloudfunctions/saveUserWatermark/index.js
+2
-2
saveUserWatermark.param.json
...dfunctions/saveUserWatermark/saveUserWatermark.param.json
+33
-9
No files found.
take-order/App.vue
View file @
aee78d69
...
@@ -130,14 +130,17 @@
...
@@ -130,14 +130,17 @@
this
.
checkUpdate
()
this
.
checkUpdate
()
var
that
=
this
var
that
=
this
uni
.
getStorage
({
that
.
globalData
.
token
=
util
.
getToken
()
key
:
'token'
,
console
.
log
(
that
.
globalData
.
token
,
'that.globalData.token'
)
success
:
function
(
res
)
{
that
.
initAPIneedToken
()
that
.
globalData
.
token
=
res
.
data
// uni.getStorage({
that
.
initAPIneedToken
()
// key: 'token',
// success: function (res) {
// that.globalData.token = res.data
// that.initAPIneedToken()
}
//
}
})
//
})
this
.
getProtocolContent
()
this
.
getProtocolContent
()
...
...
take-order/pages/photo/preview.vue
View file @
aee78d69
...
@@ -137,15 +137,17 @@
...
@@ -137,15 +137,17 @@
// photo.currentItem.
// photo.currentItem.
// 当前项的图片显示
// 当前项的图片显示
// 拍照项张数目增加 等于10张
// 拍照项张数目增加 等于10张
if
(
photo
.
currentItemLength
<
10
){
let
timer
=
setTimeout
(()
=>
{
uni
.
navigateBack
({
if
(
photo
.
currentItemLength
<
10
){
delta
:
1
uni
.
navigateBack
({
})
delta
:
1
}
else
{
})
uni
.
redirectTo
({
}
else
{
url
:
"pages/photo/list"
uni
.
redirectTo
({
})
url
:
"pages/photo/list"
}
})
}
},
2000
)
}
else
{
}
else
{
uni
.
showToast
({
uni
.
showToast
({
title
:
'图片上传失败'
title
:
'图片上传失败'
...
...
take-order/pages/photo/setting.vue
View file @
aee78d69
...
@@ -132,11 +132,12 @@
...
@@ -132,11 +132,12 @@
'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
)
{
if
(
res
.
result
==
true
)
{
const
photo
=
getApp
().
globalData
.
photo
const
photo
=
getApp
().
globalData
.
photo
photo
.
waterSetting
=
this
.
result
console
.
log
(
this
.
result
,
'this.result'
)
}
photo
.
waterSetting
=
this
.
result
}
this
.
$nextTick
(
function
()
{
this
.
$nextTick
(
function
()
{
uni
.
hideLoading
();
uni
.
hideLoading
();
...
...
take-order/pages/photo/take.vue
View file @
aee78d69
...
@@ -13,10 +13,11 @@
...
@@ -13,10 +13,11 @@
<camera
class=
"camera-box"
v-if=
"cameraChange&&!standardShow"
:device-position=
"cameraInfo.devicePosition"
<camera
class=
"camera-box"
v-if=
"cameraChange&&!standardShow"
:device-position=
"cameraInfo.devicePosition"
:flash=
"cameraInfo.flash"
:style=
"
{'height':cameraHeight + 'rpx'}" @error="cameraError">
:flash=
"cameraInfo.flash"
:style=
"
{'height':cameraHeight + 'rpx'}" @error="cameraError">
<cover-view
class=
"mark-box"
>
<cover-view
class=
"mark-box"
>
<cover-view
class=
"txt u-m-t-30"
>
经度:
{{
waterInfo
.
longitude
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt big u-m-t-20"
>
{{
titleTxt
}}
</cover-view>
<cover-view
class=
"txt u-m-t-10"
>
维度:
{{
waterInfo
.
latitude
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt u-m-t-20"
v-for=
"(txt,index) in settingTxtArr"
:key=
"index"
>
{{
txt
}}
</cover-view>
<!--
<cover-view
class=
"txt u-m-t-10"
>
维度:
{{
waterInfo
.
latitude
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt u-m-t-10"
>
地址:
{{
waterInfo
.
address
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt u-m-t-10"
>
地址:
{{
waterInfo
.
address
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt u-m-t-10"
>
时间:
{{
waterInfo
.
date
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt u-m-t-10"
>
时间:
{{
waterInfo
.
date
||
'正在获取中...'
}}
</cover-view>
-->
</cover-view>
</cover-view>
<cover-image
class=
"mark-water"
mode=
"aspectFit"
:src=
"waterInfo.markImage"
></cover-image>
<cover-image
class=
"mark-water"
mode=
"aspectFit"
:src=
"waterInfo.markImage"
></cover-image>
</camera>
</camera>
...
@@ -83,6 +84,7 @@
...
@@ -83,6 +84,7 @@
cameraHeight
:
1000
,
// (4 / 3 * 750) 图片比例4:3
cameraHeight
:
1000
,
// (4 / 3 * 750) 图片比例4:3
ratio
:
0
,
ratio
:
0
,
cameraChange
:
true
,
cameraChange
:
true
,
waterSetting
:
null
,
}
}
},
},
onLoad
(
e
)
{
onLoad
(
e
)
{
...
@@ -95,13 +97,45 @@
...
@@ -95,13 +97,45 @@
this
.
getMarkPath
()
this
.
getMarkPath
()
this
.
currentItem
=
photo
.
currentItem
this
.
currentItem
=
photo
.
currentItem
},
},
compute
:
{
computed
:
{
waterSetting
()
{
titleTxt
(){
// photo.waterSetting
const
waterSetting
=
this
.
waterSetting
const
photo
=
getApp
().
globalData
.
photo
let
txt
=
''
console
.
log
(
photo
.
waterSetting
,
'photo.waterSetting'
)
if
(
!
waterSetting
||
!
waterSetting
.
lower_right
){
return
photo
.
waterSetting
||
null
return
''
}
txt
=
waterSetting
.
lower_right
&&
waterSetting
.
lower_right
.
title_text
||
''
console
.
log
(
txt
,
'title_text'
,
'waterSetting'
,
waterSetting
)
return
txt
},
settingTxtArr
(){
let
arr
=
[]
// 包含经纬度
const
waterInfo
=
this
.
waterInfo
arr
=
[
'经度: '
+
waterInfo
.
longitude
,
'纬度: '
+
waterInfo
.
latitude
,
'地址: '
+
waterInfo
.
address
,
'时间: '
+
waterInfo
.
date
]
let
settingTxtArr
=
[]
const
typeArr
=
[
'经度'
,
'纬度'
,
'地址'
,
'时间'
]
const
waterSetting
=
this
.
waterSetting
if
(
!
waterSetting
||
!
waterSetting
.
lower_right
||
!
waterSetting
.
lower_right
.
body
)
{
return
arr
}
const
settingArr
=
waterSetting
.
lower_right
.
body
settingArr
.
map
(
item
=>
{
const
idx
=
typeArr
.
indexOf
(
item
.
watemark_type
)
if
(
item
.
enable
&&
(
idx
>
-
1
||
(
item
.
watemark_value
&&
item
.
watemark_text
)))
{
if
(
idx
>
-
1
)
{
settingTxtArr
.
push
(
arr
[
idx
])
}
else
{
settingTxtArr
.
push
(
item
.
watemark_text
+
': '
+
item
.
watemark_value
)
}
}
})
console
.
log
(
settingTxtArr
,
'settingTxtArr'
)
return
settingTxtArr
}
}
},
},
watch
:
{
watch
:
{
'authSetting.camera'
(
val
)
{
'authSetting.camera'
(
val
)
{
...
@@ -126,7 +160,7 @@
...
@@ -126,7 +160,7 @@
methods
:
{
methods
:
{
goBack
()
{
goBack
()
{
uni
.
navigateBack
({
uni
.
navigateBack
({
delta
:
2
delta
:
2
})
})
// uni.redirectTo({
// uni.redirectTo({
// url: '/pages/photo/list'
// url: '/pages/photo/list'
...
@@ -141,10 +175,10 @@
...
@@ -141,10 +175,10 @@
},
},
updateTime
()
{
updateTime
()
{
this
.
waterInfo
.
date
=
this
.
getTime
()
this
.
waterInfo
.
date
=
this
.
getTime
()
let
timer
=
setTimeout
(()
=>
{
//
let timer = setTimeout(() => {
clearTimeout
(
timer
);
//
clearTimeout(timer);
this
.
updateTime
()
//
this.updateTime()
},
1000
)
//
}, 1000)
},
},
setCameraInfo
(
type
)
{
setCameraInfo
(
type
)
{
// 设置相机前置后置、闪关灯等
// 设置相机前置后置、闪关灯等
...
@@ -168,6 +202,7 @@
...
@@ -168,6 +202,7 @@
const
globalData
=
getApp
().
globalData
const
globalData
=
getApp
().
globalData
this
.
navHeight
=
globalData
.
navHeight
this
.
navHeight
=
globalData
.
navHeight
this
.
ratio
=
globalData
.
screenHeight
/
globalData
.
rpxScreenHeight
this
.
ratio
=
globalData
.
screenHeight
/
globalData
.
rpxScreenHeight
this
.
waterSetting
=
getApp
().
globalData
.
photo
.
waterSetting
// this.cameraHeight = globalData.rpxScreenHeight
// this.cameraHeight = globalData.rpxScreenHeight
},
},
baiduLocation
()
{
baiduLocation
()
{
...
@@ -291,16 +326,6 @@
...
@@ -291,16 +326,6 @@
})
})
},
},
getDrawTxtArr
()
{
// 获取绘制数组
let
arr
=
[]
// 包含经纬度
const
waterInfo
=
this
.
waterInfo
arr
=
[
'经度: '
+
waterInfo
.
longitude
,
'维度: '
+
waterInfo
.
latitude
,
'地址: '
+
waterInfo
.
address
,
'时间: '
+
waterInfo
.
date
]
return
arr
},
/* ---------------------- 拍照流程 ---------------------- */
/* ---------------------- 拍照流程 ---------------------- */
// 第一步:拍照
// 第一步:拍照
takePhoto
()
{
takePhoto
()
{
...
@@ -317,34 +342,42 @@
...
@@ -317,34 +342,42 @@
title
:
'数据处理中...'
,
title
:
'数据处理中...'
,
icon
:
'loading'
icon
:
'loading'
})
})
const
waterSetting
=
this
.
waterSetting
const
globalTempPath
=
getApp
().
globalData
.
photo
.
tempPath
const
globalTempPath
=
getApp
().
globalData
.
photo
.
tempPath
const
ratio
=
this
.
ratio
const
ratio
=
this
.
ratio
let
canvasWidth
=
this
.
cameraWidth
*
ratio
let
canvasWidth
=
this
.
cameraWidth
*
ratio
let
canvasHeight
=
this
.
cameraHeight
*
ratio
let
canvasHeight
=
this
.
cameraHeight
*
ratio
const
waterInfo
=
this
.
waterInfo
const
waterInfo
=
this
.
waterInfo
this
.
showImage
=
true
this
.
showImage
=
true
const
drawTxtArr
=
this
.
getDrawTxtArr
()
const
settingTxtArr
=
this
.
settingTxtArr
//将原图画到canvas上面
//将原图画到canvas上面
let
canvas
=
uni
.
createCanvasContext
(
"canvas"
,
this
)
let
canvas
=
uni
.
createCanvasContext
(
"canvas"
,
this
)
canvas
.
rect
(
0
,
0
,
canvasWidth
,
canvasHeight
)
canvas
.
rect
(
0
,
0
,
canvasWidth
,
canvasHeight
)
canvas
.
drawImage
(
tempPath
,
0
,
0
,
canvasWidth
,
canvasHeight
)
canvas
.
drawImage
(
tempPath
,
0
,
0
,
canvasWidth
,
canvasHeight
)
// this.canvas.draw()
// this.canvas.draw()
//加入 水印文字
canvas
.
setFontSize
(
14
)
canvas
.
setFillStyle
(
'#f2f2f2'
)
let
h
=
1
let
h
=
1
let
txtHeight
=
18
let
txtHeight
=
20
for
(
let
i
=
0
;
i
<
drawTxtArr
.
length
;
i
++
)
{
const
title
=
this
.
titleTxt
const
txt
=
drawTxtArr
[
i
]
if
(
title
){
canvas
.
setFontSize
(
20
)
canvas
.
setFillStyle
(
'#f2f2f2'
)
canvas
.
fillText
(
title
,
10
,
canvasHeight
-
txtHeight
*
h
++
);
}
//加入 水印文字
txtHeight
=
18
for
(
let
i
=
0
;
i
<
settingTxtArr
.
length
;
i
++
)
{
canvas
.
setFontSize
(
14
)
canvas
.
setFillStyle
(
'#f2f2f2'
)
const
txt
=
settingTxtArr
[
i
]
canvas
.
fillText
(
txt
,
10
,
canvasHeight
-
txtHeight
*
h
++
);
canvas
.
fillText
(
txt
,
10
,
canvasHeight
-
txtHeight
*
h
++
);
}
}
// canvas.fillText('经度: ' + waterInfo.longitude, 10, canvasHeight - txtHeight * h++);
// canvas.fillText('维度: ' + waterInfo.latitude, 10, canvasHeight - txtHeight * h++);
if
(
this
.
waterSetting
&&
this
.
waterSetting
.
mid_text
){
// canvas.fillText('地址: ' + waterInfo.address, 10, canvasHeight - txtHeight * h++);
//加入 水印图片
// canvas.fillText('时间: ' + waterInfo.date, 10, canvasHeight - txtHeight * h++);
canvas
.
drawImage
(
this
.
tempImgs
.
markImage
,
canvasWidth
/
2
-
100
,
canvasHeight
/
2
-
25
,
200
,
50
)
//加入 水印图片
}
canvas
.
drawImage
(
this
.
tempImgs
.
markImage
,
canvasWidth
/
2
-
100
,
canvasHeight
/
2
-
25
,
200
,
50
)
//
canvas.drawImage(this.tempImgs.markImage, canvasWidth / 2 - 100, canvasHeight / 2 - 25, 200, 50)
canvas
.
draw
(
false
,
canvas
.
draw
(
false
,
setTimeout
(()
=>
{
setTimeout
(()
=>
{
uni
.
canvasToTempFilePath
({
uni
.
canvasToTempFilePath
({
...
@@ -455,11 +488,15 @@
...
@@ -455,11 +488,15 @@
.mark-box
{
.mark-box
{
position
:
absolute
;
position
:
absolute
;
left
:
0
;
left
:
0
;
bottom
:
20rpx
;
bottom
:
0
;
padding
:
20rpx
;
padding
:
20rpx
;
.txt
{
.txt
{
font-size
:
28rpx
;
color
:
#fff
;
color
:
#fff
;
.big
{
font-size
:
32rpx
;
}
}
}
}
}
...
...
take-order/uniCloud-tcb/cloudfunctions/getUserWatermark/getUserWatermark.param.json
View file @
aee78d69
...
@@ -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"
:
"
666666666666"
"token"
:
"
fdsadfsafsafsadfdsa"
,
"system_id"
:
"79550af260555cc20afb34156c94b32c"
"system_id"
:
"79550af260555cc20afb34156c94b32c"
}
}
take-order/uniCloud-tcb/cloudfunctions/saveUserWatermark/index.js
View file @
aee78d69
...
@@ -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
)
}
}
}
}
//返回数据给客户端
//返回数据给客户端
...
...
take-order/uniCloud-tcb/cloudfunctions/saveUserWatermark/saveUserWatermark.param.json
View file @
aee78d69
//
本文件中的json内容将在云函数【运行】时作为参数传给云函数。
//
配置教程参考:https
:
//uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam
{
{
"token"
:
"
666666666666
"
,
"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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment