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
5097b821
Commit
5097b821
authored
Mar 27, 2021
by
李俊赕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
page-page-combine
parent
d6a89814
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
142 additions
and
94 deletions
+142
-94
App.vue
take-order/App.vue
+7
-0
standard.vue
take-order/components/photo/standard.vue
+1
-2
pages.json
take-order/pages.json
+2
-4
preview.vue
take-order/pages/photo/preview.vue
+92
-33
take.vue
take-order/pages/photo/take.vue
+40
-55
icon-light-auto.png
take-order/static/photo/icon-light-auto.png
+0
-0
icon-light-off.png
take-order/static/photo/icon-light-off.png
+0
-0
icon-light-on.png
take-order/static/photo/icon-light-on.png
+0
-0
No files found.
take-order/App.vue
View file @
5097b821
...
...
@@ -109,8 +109,15 @@
classifyId
:
''
,
// 分类id
systemId
:
''
,
// 系统id
},
currentItemLength
:
0
,
//已拍摄照片张数
productList
:[],
currentItem
:
null
,
// 选择的某一项
setting
:
null
,
//自定义设置
waterSetting
:
null
,
// 水印设置
tempPath
:{
origin
:
''
,
// 缓存拍照图片
mixWater
:
''
// 缓存水印拍照图片
}
},
// 用户信息
tempUserInfo
:
''
,
// 临时用户选项
...
...
take-order/components/photo/standard.vue
View file @
5097b821
<!-- 拍照规范弹窗 -->
<
template
>
<view
class=
"standard-box"
>
简单了解的了解到了家里的经历的阶段了
<swiper
class=
"swiper-box"
:current=
"swiperCurrent"
@
transition=
"transition"
@
animationfinish=
"animationfinish"
>
<swiper-item
class=
"swiper-item"
key=
"swiper1"
>
<view
class=
"title"
>
...
...
@@ -40,7 +40,6 @@
}
}
},
},
data
()
{
return
{
...
...
take-order/pages.json
View file @
5097b821
...
...
@@ -70,9 +70,6 @@
},
{
"path"
:
"pages/settle/select"
,
"style"
:
{
...
...
@@ -148,7 +145,8 @@
"style"
:
{
"navigationBarTitleText"
:
"照片预览"
,
"navigationBarBackgroundColor"
:
"#333333"
,
"backgroundColor"
:
"#FFFFFF"
"backgroundColor"
:
"#FFFFFF"
,
"navigationBarTextStyle"
:
"white"
}
},
...
...
take-order/pages/photo/preview.vue
View file @
5097b821
<
template
>
<view>
<view
class=
"contentView"
>
<image
class=
"pic"
:src=
"
images[0]"
mode=
"widthFix
"
@
click=
"showPreviewFn"
></image>
<image
class=
"pic"
:src=
"
files[0]"
mode=
"aspectFill
"
@
click=
"showPreviewFn"
></image>
</view>
<view
class=
"bottomView"
>
<image
class=
"
remakeIco
n"
:src=
"btn_remake"
@
click=
"remakePhoto"
></image>
<image
class=
"
continueIco
n"
:src=
"btn_continue"
@
click=
"continuePhoto"
></image>
<image
class=
"
bt
n"
:src=
"btn_remake"
@
click=
"remakePhoto"
></image>
<image
class=
"
bt
n"
:src=
"btn_continue"
@
click=
"continuePhoto"
></image>
</view>
</view>
</
template
>
...
...
@@ -29,21 +29,69 @@
},
onLoad
(
e
)
{
getApp
().
trackPage
(
'照片预览页'
)
console
.
log
(
e
,
'e'
)
const
globalTempPath
=
getApp
().
globalData
.
photo
.
tempPath
if
(
globalTempPath
&&
globalTempPath
.
mixWater
){
this
.
files
=
[
globalTempPath
.
mixWater
]
}
if
(
e
.
standardId
)
{
this
.
standardId
=
e
.
standardId
}
if
(
e
.
img
)
{
this
.
images
=
[
e
.
img
]
this
.
downloadImages
()
//
this.downloadImages()
}
console
.
log
(
this
.
images
,
'this.images'
)
this
.
token
=
getApp
().
globalData
.
token
},
methods
:
{
// 保存照片到本地
async
saveTempToLocal
(
tempImagePath
)
{
//has_origin //是否保存原图
let
that
=
this
const
photo
=
getApp
().
globalData
.
photo
if
(
!
photo
.
tempPath
){
return
}
let
path
=
''
if
(
photo
.
tempPath
.
origin
&&
photo
.
waterSetting
&&
photo
.
waterSetting
.
has_origin
){
// 保存原图到本地
path
=
photo
.
tempPath
.
origin
let
result
=
await
this
.
saveLocal
(
path
)
if
(
result
){
uni
.
showToast
({
icon
:
'none'
,
title
:
'已将照片原图保存到本地相册'
})
}
}
if
(
photo
.
tempPath
.
mixWater
){
// 保存水印处理图片到本地
path
=
photo
.
tempPath
.
mixWater
let
result1
=
await
this
.
saveLocal
(
path
)
if
(
result1
){
uni
.
showToast
({
icon
:
'none'
,
title
:
'已将水印图片保存到本地相册'
})
}
}
uni
.
hideLoading
()
},
saveLocal
(
path
){
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
saveImageToPhotosAlbum
({
filePath
:
path
,
success
()
{
resolve
(
true
)
},
fail
()
{
reject
(
'保存失败'
)
}
})
})
},
showPreviewFn
(
img
)
{
uni
.
previewImage
({
current
:
0
,
...
...
@@ -59,14 +107,17 @@
// 重拍图片
remakePhoto
()
{
uni
.
navigate
To
({
url
:
'/pages/photo/take'
uni
.
navigate
Back
({
delta
:
1
})
},
// 确认图片
continuePhoto
()
{
let
self
=
this
uni
.
showLoading
({
title
:
'图片保存中……'
})
self
.
confirmUpload
(
true
)
},
submitFile
()
{
...
...
@@ -81,9 +132,21 @@
console
.
log
(
res
,
"云服务保存图片"
);
if
(
res
.
result
)
{
// TODO 参数是否要来回传递
uni
.
navigateTo
({
url
:
'/pages/photo/list'
})
self
.
saveTempToLocal
()
const
photo
=
getApp
().
globalData
.
photo
photo
.
currentItemLength
++
// photo.currentItem.
// 当前项的图片显示
// 拍照项张数目增加 等于10张
if
(
photo
.
currentItemLength
<
10
){
uni
.
navigateBack
({
delta
:
1
})
}
else
{
uni
.
redirectTo
({
url
:
"pages/photo/list"
})
}
}
else
{
uni
.
showToast
({
title
:
'图片上传失败'
...
...
@@ -115,42 +178,38 @@
}
</
script
>
<
style
>
<
style
lang=
"scss"
>
.contentView
{
background-color
:
#333333
;
padding-top
:
120
rpx
;
height
:
880
rpx
;
/* padding-top: 120rpx; */
padding-bottom
:
228rpx
;
height
:
100vh
;
display
:
flex
;
flex-direction
:
column
;
}
.pic
{
flex
:
1
;
width
:
100%
;
height
:
760
rpx
;
/* height:auto */
/* height: 760rpx; */
}
.bottomView
{
box-shadow
:
0
0
1rpx
6rpx
rgba
(
255
,
255
,
255
,
0
.05
);
background-color
:
#333333
;
width
:
100%
;
height
:
326
rpx
;
padding
:
70
rpx
;
position
:
fixed
;
bottom
:
0
;
display
:
flex
;
flex-direction
:
column-reverse
;
justify-content
:
space-around
;
align-items
:
center
;
}
.remakeIcon
{
width
:
200
rpx
;
height
:
88
rpx
;
position
:
fixed
;
left
:
80
rpx
;
bottom
:
176
rpx
;
}
.continueIcon
{
width
:
200
rpx
;
height
:
88
rpx
;
position
:
fixed
;
right
:
80
rpx
;
bottom
:
176
rpx
;
.btn
{
display
:
block
;
width
:
200rpx
;
height
:
88rpx
;
}
}
</
style
>
take-order/pages/photo/take.vue
View file @
5097b821
...
...
@@ -4,7 +4,7 @@
<cover-view
class=
"header-box"
:style=
"
{'height':navHeight + 'rpx'}">
<cover-view
class=
"inner"
>
<cover-image
@
click=
"setCameraInfo('devicePosition')"
class=
"icon"
mode=
"aspectFit"
src=
"/static/photo/icon-switch.png"
></cover-image>
<cover-image
@
click=
"setCameraInfo('flash')"
class=
"icon"
mode=
"aspectFit"
src=
"/static/photo/icon-light.png
"
></cover-image>
<cover-image
@
click=
"setCameraInfo('flash')"
class=
"icon"
mode=
"aspectFit"
:src=
"'/static/photo/icon-light-' + cameraInfo.flash +'.png'
"
></cover-image>
<cover-image
@
click=
"goPage('/pages/photo/setting')"
class=
"icon"
mode=
"aspectFit"
src=
"/static/photo/icon-setting.png"
></cover-image>
</cover-view>
</cover-view>
...
...
@@ -24,7 +24,7 @@
<cover-image
class=
'icon'
src=
'/static/photo/icon-standard.png'
@
click=
"standardShow = true"
>
</cover-image>
</cover-view>
<canvas
canvas-id=
"canvas"
id=
"photoCanvas"
class=
"canvas"
:style=
"
{'width':750 + 'rpx','height': cameraHeight + 'rpx'}">
</canvas>
<view
v-
show
=
"standardShow"
class=
"page-mask"
:z-index=
"10000"
>
<view
v-
if
=
"standardShow"
class=
"page-mask"
:z-index=
"10000"
>
<photo-standard
:currentItem=
"currentItem"
/>
<view
class=
"btn-close"
@
click=
"standardShow = false"
>
<image
class=
"icon icon-close"
mode=
"aspectFit"
src=
"/static/photo/icon-close.png"
></cover-image>
...
...
@@ -50,9 +50,9 @@
name
:
'111'
,
images
:[
'https://qn-static.banshouhui.com/live_mark.png'
,
'https://qn-static.banshouhui.com/live_mark.png'
,
'https://qn-static.banshouhui.com/live_mark.png'
],
},
standardShow
:
tru
e
,
standardShow
:
fals
e
,
cameraInfo
:{
devicePosition
:
'
front
'
,
devicePosition
:
'
back
'
,
flash
:
'auto'
},
waterInfo
:
{
...
...
@@ -64,8 +64,8 @@
},
tempImgs
:{
'markImage'
:
''
,
// 拍照水印
'
noMarkPhoto
'
:
''
,
// 无水印照片
'm
arkPhoto
'
:
''
,
// 有水印照片
'
origin
'
:
''
,
// 无水印照片
'm
ixWater
'
:
''
,
// 有水印照片
},
authSetting
:
{
camera
:
false
,
// 相机授权
...
...
@@ -88,13 +88,18 @@
this
.
getMarkPath
()
this
.
currentItem
=
photo
.
currentItem
},
compute
:
{},
compute
:
{
setting
(){
const
photo
=
getApp
().
globalData
.
photo
return
photo
.
setting
||
null
}
},
watch
:
{
'authSetting.camera'
(
val
)
{
if
(
val
)
{
// this.cameraChange = true
}
}
}
,
},
onShow
()
{
this
.
initData
()
...
...
@@ -131,7 +136,7 @@
val
=
val
===
'back'
?
'front'
:
'back'
break
;
case
'flash'
:
val
=
val
===
'auto'
?
'on'
:
'auto'
val
=
val
===
'auto'
?
'on'
:
(
val
===
'on'
?
'off'
:
'auto'
)
break
;
defalut
:
...
...
@@ -267,13 +272,21 @@
})
},
getDrawTxtArr
(){
// 获取绘制数组
let
arr
=
[]
// 包含经纬度
const
waterInfo
=
this
.
waterInfo
arr
=
[
'经度: '
+
waterInfo
.
longitude
,
'维度: '
+
waterInfo
.
latitude
,
'地址: '
+
waterInfo
.
address
,
'时间: '
+
waterInfo
.
date
]
return
arr
},
/* ---------------------- 拍照流程 ---------------------- */
// 第一步:拍照
takePhoto
()
{
wx
.
createCameraContext
().
takePhoto
({
quality
:
"high"
}).
then
(
res
=>
{
this
.
tempImgs
.
noMarkPhoto
=
res
.
tempImagePath
this
.
tempImgs
.
origin
=
res
.
tempImagePath
this
.
drawCanvas
(
res
.
tempImagePath
)
})
},
...
...
@@ -283,11 +296,13 @@
title
:
'数据处理中...'
,
icon
:
'loading'
})
const
globalTempPath
=
getApp
().
globalData
.
photo
.
tempPath
const
ratio
=
this
.
ratio
let
canvasWidth
=
this
.
cameraWidth
*
ratio
let
canvasHeight
=
this
.
cameraHeight
*
ratio
const
waterInfo
=
this
.
waterInfo
this
.
showImage
=
true
const
drawTxtArr
=
this
.
getDrawTxtArr
()
//将原图画到canvas上面
let
canvas
=
uni
.
createCanvasContext
(
"canvas"
,
this
)
canvas
.
rect
(
0
,
0
,
canvasWidth
,
canvasHeight
)
...
...
@@ -299,10 +314,14 @@
canvas
.
setFillStyle
(
'#f2f2f2'
)
let
h
=
1
let
txtHeight
=
18
canvas
.
fillText
(
'经度: '
+
waterInfo
.
longitude
,
20
,
canvasHeight
-
txtHeight
*
h
++
);
canvas
.
fillText
(
'维度: '
+
waterInfo
.
latitude
,
20
,
canvasHeight
-
txtHeight
*
h
++
);
canvas
.
fillText
(
'地址: '
+
waterInfo
.
address
,
20
,
canvasHeight
-
txtHeight
*
h
++
);
canvas
.
fillText
(
'时间: '
+
waterInfo
.
date
,
20
,
canvasHeight
-
txtHeight
*
h
++
);
for
(
let
i
=
0
;
i
<
drawTxtArr
.
length
;
i
++
){
const
txt
=
drawTxtArr
[
i
]
canvas
.
fillText
(
txt
,
10
,
canvasHeight
-
txtHeight
*
h
++
);
}
// canvas.fillText('经度: ' + waterInfo.longitude, 10, canvasHeight - txtHeight * h++);
// canvas.fillText('维度: ' + waterInfo.latitude, 10, canvasHeight - txtHeight * h++);
// 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
.
draw
(
false
,
...
...
@@ -312,8 +331,11 @@
height
:
canvasHeight
,
canvasId
:
'canvas'
,
success
:
(
res
)
=>
{
this
.
tempImgs
.
markPhoto
=
res
.
tempFilePath
this
.
saveToLocal
(
res
.
tempFilePath
)
this
.
tempImgs
.
mixWater
=
res
.
tempFilePath
globalTempPath
.
origin
=
this
.
tempImgs
.
origin
globalTempPath
.
mixWater
=
res
.
tempFilePath
this
.
goPage
(
'/pages/photo/preview'
)
// this.saveToLocal(res.tempFilePath)
},
fail
:
(
res
)
=>
{
console
.
log
(
res
);
...
...
@@ -322,10 +344,11 @@
uni
.
hideLoading
();
}
},
this
);
},
50
0
))
},
50
))
},
// 第三步:保存到本地
saveToLocal
(
tempImagePath
)
{
//has_origin //是否保存原图
let
that
=
this
uni
.
saveImageToPhotosAlbum
({
filePath
:
tempImagePath
,
...
...
@@ -345,44 +368,6 @@
urls
:
[
img
]
});
},
//第五步: 保存到本地相册
saveToLocal
(
tempImagePath
)
{
let
that
=
this
uni
.
saveImageToPhotosAlbum
({
filePath
:
tempImagePath
,
success
()
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'已将照片保存到本地相册'
})
// let timer = setTimeout(() => {
// that.goBack()
// }, 1500)
},
fail
()
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'保存本地相册失败'
})
uni
.
setStorage
({
key
:
'photo_tempPath'
,
data
:
tempImagePath
,
success
:
function
()
{
console
.
log
(
'tempImagePath save success'
);
let
timer
=
setTimeout
(()
=>
{
that
.
showAlbumAuthModal
()
},
1500
)
}
});
}
})
},
//获取当前时间
getTime
:
function
()
{
let
date
=
new
Date
(),
...
...
take-order/static/photo/icon-light-auto.png
0 → 100644
View file @
5097b821
2.03 KB
take-order/static/photo/icon-light-off.png
0 → 100644
View file @
5097b821
2.46 KB
take-order/static/photo/icon-light-on.png
0 → 100644
View file @
5097b821
1.42 KB
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