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
64ca950b
Commit
64ca950b
authored
Dec 31, 2020
by
李俊赕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
take-init
parent
dc9669ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
22 deletions
+20
-22
preview.vue
take-order/pages/photo/preview.vue
+4
-3
try.vue
take-order/pages/photo/try.vue
+16
-19
No files found.
take-order/pages/photo/preview.vue
View file @
64ca950b
<
template
>
<view>
<image
class=
"pic"
:src=
"images[0]"
mode=
"aspectFill"
></image>
<image
class=
"pic"
:src=
"images[0]"
mode=
"aspectFill"
@
click=
"showPreviewFn"
></image>
</view>
</
template
>
...
...
@@ -8,7 +8,8 @@
export
default
{
data
()
{
return
{
protocolContent
:
''
protocolContent
:
''
,
images
:[]
}
},
onLoad
(
e
)
{
...
...
@@ -16,7 +17,7 @@
if
(
e
.
img
){
this
.
images
=
[
e
.
img
]
}
console
.
log
(
this
.
images
,
'this.images'
)
},
methods
:
{
...
...
take-order/pages/photo/try.vue
View file @
64ca950b
...
...
@@ -11,9 +11,10 @@
<cover-image
class=
"liveWatermarkNormal"
mode=
"aspectFit"
:src=
"liveWaterMarkImage"
></cover-image>
</camera>
<cover-view
class=
"bottomView"
>
<cover-image
class=
"backIcon"
:src=
"icon_arrow_down"
mode=
""
@
click=
"goBack"
></cover-image>
<!--cover-image class='switchIcon' :src='icon_switch_white' @click="switchClick()">
</cover-image-->
<cover-image
class=
'takeIcon'
:src=
'icon_take'
@
click=
"takePhoto()"
>
</cover-image>
<cover-image
class=
"backIcon resultIcon"
v-if=
"restultImage"
:src=
"restultImage"
mode=
""
@
click=
"goPage"
></cover-image>
<!--cover-image class='flashIcon' :src='icon_light_on_white' @click="flashClick()">
</cover-image-->
</cover-view>
<canvas
v-show=
'showImage'
canvas-id=
"canvas"
:style=
"
{'width':canvasWidth+'px','height': canvasHeight + 'px'}">
</canvas>
...
...
@@ -70,13 +71,17 @@
goPage
(){
// 进入图片预览页
},
goBack
(){
uni
.
navigateBack
({
delta
:
2
});
},
getSystemInfo
()
{
// 获取设备信息
try
{
const
res
=
uni
.
getSystemInfoSync
();
this
.
canvasWidth
=
res
.
windowWidth
*
2
this
.
canvasHeight
=
res
.
windowHeight
*
2
console
.
log
(
res
.
windowWidth
,
'res.windowWidth'
,
res
.
windowHeight
,
'res.windowHeight'
)
}
catch
(
e
)
{
// error
}
...
...
@@ -96,9 +101,6 @@
success
:
function
(
res
)
{
that
.
longitude
=
'经度:'
+
res
.
longitude
that
.
latitude
=
'纬度:'
+
res
.
latitude
console
.
log
(
'当前位置的经度:'
+
res
.
longitude
);
console
.
log
(
'当前位置的纬度:'
+
res
.
latitude
);
console
.
log
(
'当前位置的地址:'
+
res
.
address
);
}
});
},
...
...
@@ -110,13 +112,11 @@
url
:
this
.
icon_live_mark
,
//仅为示例,并非真实的资源
success
:
(
res
)
=>
{
if
(
res
.
statusCode
===
200
)
{
console
.
log
(
'水印图片 下载成功'
)
that
.
markPath
=
res
.
tempFilePath
console
.
log
(
'markPath:'
+
that
.
markPath
)
}
},
fail
()
{
console
.
log
(
'水印图片 下载失败'
)
//
console.log('水印图片 下载失败')
}
})
...
...
@@ -128,9 +128,7 @@
this
.
ctx
.
takePhoto
({
quality
:
'high'
,
success
:
(
res
)
=>
{
console
.
log
(
'拍照成功'
)
console
.
log
(
res
)
//this.imageChange(res)
this
.
getImageInfo
(
res
.
tempImagePath
)
...
...
@@ -148,7 +146,6 @@
uni
.
getImageInfo
({
src
:
tempImagePath
,
success
(
res
)
{
console
.
log
(
'获取图片信息成功'
)
that
.
width
=
res
.
width
+
'px'
;
that
.
height
=
res
.
height
+
'px'
;
...
...
@@ -163,10 +160,8 @@
title
:
'数据处理中...'
,
icon
:
'loading'
})
console
.
log
(
'绘制画布'
)
let
canvasWidth
=
this
.
canvasWidth
let
canvasHeight
=
this
.
canvasHeight
console
.
log
(
canvasWidth
,
'canvasWidth'
,
canvasHeight
,
'canvasHeight'
)
this
.
showImage
=
true
//将原图画到canvas上面
this
.
canvas
=
uni
.
createCanvasContext
(
"canvas"
,
this
)
...
...
@@ -211,11 +206,11 @@
canvasId
:
'canvas'
,
success
:
(
res
)
=>
{
self
.
saveToLocal
(
res
.
tempFilePath
)
console
.
log
(
res
.
tempFilePath
,
'res.tempFilePath-canvasImage'
)
// this.$emit('canvasImage', res.tempFilePath);
// if (this.showPreview) {
this
.
restultImage
=
res
.
tempFilePath
self
.
showPreviewFn
(
res
.
tempFilePath
);
//
this.restultImage = res.tempFilePath
//
self.showPreviewFn(res.tempFilePath);
// }
},
fail
:
(
res
)
=>
{
...
...
@@ -240,15 +235,17 @@
uni
.
saveImageToPhotosAlbum
({
filePath
:
tempImagePath
,
success
()
{
console
.
log
(
'保存本地相册 成功'
)
uni
.
showToast
({
icon
:
'none'
,
title
:
'已将照片保存到本地相册'
})
let
timer
=
setTimeout
(()
=>
{
that
.
goBack
()
},
0
)
},
fail
()
{
console
.
log
(
'保存本地相册 失败'
)
//
console.log('保存本地相册 失败')
uni
.
showToast
({
icon
:
'none'
,
title
:
'保存本地相册失败'
...
...
@@ -348,7 +345,7 @@
z-index
:
6
;
}
.backIcon
.resultIcon
{
.backIcon
{
background-color
:
#FFFFFF
;
width
:
54
rpx
;
height
:
54
rpx
;
...
...
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