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
01df1405
Commit
01df1405
authored
Mar 20, 2021
by
李俊赕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edit-setting
parent
872b4d15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
293 additions
and
241 deletions
+293
-241
take.vue
take-order/pages/photo/take.vue
+293
-241
No files found.
take-order/pages/photo/take.vue
View file @
01df1405
...
@@ -8,26 +8,23 @@
...
@@ -8,26 +8,23 @@
<cover-image
bindtap=
"changeScale"
class=
"icon"
mode=
"aspectFit"
src=
"/static/photo/icon-setting.png"
></cover-image>
<cover-image
bindtap=
"changeScale"
class=
"icon"
mode=
"aspectFit"
src=
"/static/photo/icon-setting.png"
></cover-image>
</cover-view>
</cover-view>
</cover-view>
</cover-view>
<camera
class=
"camera-box"
device-position=
"front"
flash=
"on"
:style=
"
{'height':cameraHeight + 'rpx','line-height':cameraHeight + 'rpx'}" @error="cameraRefuse">
<camera
class=
"camera-box"
v-if=
"cameraChange"
device-position=
"front"
flash=
"on"
:style=
"
{'height':cameraHeight + 'rpx'}"
@error="cameraError">
<cover-view
class=
"mark-box"
>
<cover-view
class=
"mark-box"
>
<cover-view
class=
"txt u-m-l-20 u-m-t-30"
>
经度:
{{
longitude
}}
</cover-view>
<cover-view
class=
"txt u-m-l-20 u-m-t-30"
>
经度:
{{
waterInfo
.
longitude
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt u-m-l-20 u-m-t-10"
>
维度:
{{
latitude
}}
</cover-view>
<cover-view
class=
"txt u-m-l-20 u-m-t-10"
>
维度:
{{
waterInfo
.
latitude
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt u-m-l-20 u-m-t-10"
>
地址:
{{
address
}}
</cover-view>
<cover-view
class=
"txt u-m-l-20 u-m-t-10"
>
地址:
{{
waterInfo
.
address
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt u-m-l-20 u-m-t-10"
>
时间:
{{
date
}}
</cover-view>
<cover-view
class=
"txt u-m-l-20 u-m-t-10"
>
时间:
{{
waterInfo
.
date
||
'正在获取中...'
}}
</cover-view>
</cover-view>
</cover-view>
<cover-image
class=
"mark-water liveWatermarkNormal"
mode=
"aspectFit"
:src=
"
liveWaterM
arkImage"
></cover-image>
<cover-image
class=
"mark-water liveWatermarkNormal"
mode=
"aspectFit"
:src=
"
waterInfo.m
arkImage"
></cover-image>
</camera>
</camera>
<cover-view
class=
"bottom-box"
>
<cover-view
class=
"bottom-box"
>
<cover-image
class=
"icon"
:src=
"icon_arrow_down"
mode=
""
@
click=
"simpleBack"
></cover-image>
<cover-image
class=
"icon"
:src=
"icon_arrow_down"
mode=
""
@
click=
"simpleBack"
></cover-image>
<cover-image
class=
'icon-take icon'
src=
'/static/photo/icon-take.png'
@
click=
"takePhoto
()
"
>
</cover-image>
<cover-image
class=
'icon-take icon'
src=
'/static/photo/icon-take.png'
@
click=
"takePhoto"
>
</cover-image>
<cover-view
class=
"txt"
>
拍照要求
</cover-view>
<cover-view
class=
"txt"
>
拍照要求
</cover-view>
</cover-view>
</cover-view>
<canvas
v-show=
'showImage'
canvas-id=
"canvas"
:style=
"
{'width':canvasWidth+'px','height': canvasHeight + 'px'}">
</canvas>
<canvas
v-show=
'showImage'
canvas-id=
"canvas"
:style=
"
{'width':750 + 'rpx','height': cameraHeight + 'rpx'}">
</canvas>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
...
@@ -45,29 +42,40 @@
...
@@ -45,29 +42,40 @@
image
:
""
,
image
:
""
,
showImage
:
false
,
showImage
:
false
,
canvas
:
null
,
canvas
:
null
,
longitude
:
'正在获取中...'
,
longitude
:
'正在获取中...'
,
latitude
:
'正在获取中...'
,
latitude
:
'正在获取中...'
,
address
:
'正在获取中...'
,
address
:
'正在获取中...'
,
date
:
'
正在获取中...
'
,
date
:
''
,
icon_location
:
'https://qn-static.banshouhui.com/take_order/icon/location.png'
,
//
icon_location: 'https://qn-static.banshouhui.com/take_order/icon/location.png',
scale
:
"4_3"
,
//
scale: "4_3",
icon_take
:
'https://qn-static.banshouhui.com/take.png'
,
//
icon_take: 'https://qn-static.banshouhui.com/take.png',
icon_switch_white
:
'https://qn-static.banshouhui.com/switch_white.png'
,
//
icon_switch_white: 'https://qn-static.banshouhui.com/switch_white.png',
icon_light_on_white
:
'https://qn-static.banshouhui.com/light_on_white.png'
,
//
icon_light_on_white: 'https://qn-static.banshouhui.com/light_on_white.png',
liveWaterMarkImage
:
'/static/live_mark.png'
,
//
liveWaterMarkImage: '/static/live_mark.png',
icon_arrow_down
:
'https://qn-static.banshouhui.com/arrow_down.png'
,
//
icon_arrow_down: 'https://qn-static.banshouhui.com/arrow_down.png',
icon_live_mark
:
'https://qn-static.banshouhui.com/live_mark.png'
,
//
icon_live_mark: 'https://qn-static.banshouhui.com/live_mark.png',
width
:
''
,
width
:
''
,
height
:
''
,
height
:
''
,
markPath
:
''
,
markPath
:
''
,
canvasWidth
:
0
,
canvasWidth
:
0
,
canvasHeight
:
0
,
canvasHeight
:
0
,
restuleImage
:
''
,
restuleImage
:
''
,
authSetting
:
[],
waterInfo
:
{
longitude
:
''
,
// 经度
navHeight
:
0
,
latitude
:
''
,
// 维度
cameraHeight
:(
4
/
3
*
750
),
address
:
''
,
//地址
date
:
''
,
//日期
markImage
:
'/static/live_mark.png'
},
authSetting
:
{
camera
:
false
,
// 相机授权
location
:
false
,
// 位置授权
},
navHeight
:
0
,
cameraHeight
:
1000
,
// (4 / 3 * 750) 图片比例4:3
cameraChange
:
true
,
}
}
},
},
onLoad
(
e
)
{
onLoad
(
e
)
{
...
@@ -83,10 +91,17 @@
...
@@ -83,10 +91,17 @@
})
})
//this.address = ''
//this.address = ''
},
},
compute
:
{},
watch
:
{
'authSetting.camera'
(
val
)
{
if
(
val
)
{
// this.cameraChange = true
}
}
},
onShow
()
{
onShow
()
{
const
globalData
=
getApp
().
globalData
this
.
initData
()
console
.
log
(
globalData
,
'globalData'
)
this
.
navHeight
=
globalData
.
navHeight
// this.cameraHeight = globalData.rpxScreenHeight
// this.cameraHeight = globalData.rpxScreenHeight
// uni.authorize({
// uni.authorize({
// scope: 'scope.writePhotosAlbum',
// scope: 'scope.writePhotosAlbum',
...
@@ -97,74 +112,118 @@
...
@@ -97,74 +112,118 @@
// })
// })
},
},
methods
:
{
methods
:
{
initData
()
{
const
globalData
=
getApp
().
globalData
this
.
navHeight
=
globalData
.
navHeight
// this.cameraHeight = globalData.rpxScreenHeight
},
baiduLocation
()
{
baiduLocation
()
{
console
.
log
(
'baiduLocation'
)
// 百度sdk解析经纬度
let
a
=
this
,
let
a
=
this
,
t
=
function
()
{
t
=
function
()
{
let
t
=
{
let
t
=
{
success
:
function
(
res
)
{
success
:
function
(
res
)
{
let
e
=
res
.
wxMarkerData
[
0
];
let
e
=
res
.
wxMarkerData
[
0
];
console
.
log
(
e
,
e
.
address
,
'e.address'
)
let
i
=
e
.
address
;
let
i
=
e
.
address
;
a
.
address
=
i
a
.
address
=
i
// a.setData({
// addressValue: i
// }), o.globalData.addressValue = i, a.initWatermarkBoxHeightAndWidth();
},
},
fail
:
function
(
a
)
{
fail
:
function
(
a
)
{
console
.
log
(
a
,
'a'
)
console
.
log
(
a
,
'a'
)
// n.error(a), console.log(a);
}
}
};
};
if
(
a
.
latitude
&&
a
.
longitude
)
{
if
(
a
.
latitude
&&
a
.
longitude
)
{
let
e
=
a
.
latitude
+
","
+
a
.
longitude
;
let
e
=
a
.
latitude
+
","
+
a
.
longitude
;
// let e = "113.88308" + ',' + "22.55329"
// let e = "22.55329" + ',' + "113.88308"
t
.
location
=
e
;
t
.
location
=
e
;
}
}
h
.
regeocoding
(
t
);
h
.
regeocoding
(
t
);
};
};
t
()
t
()
},
},
goPage
()
{
cameraError
:
function
(
e
)
{
// 进入图片预览页
const
{
errMsg
}
=
e
.
detail
console
.
log
(
e
.
detail
,
'e.detail'
)
if
(
errMsg
!==
'insertCamera:fail auth deny'
)
{
return
}
this
.
showSettingModal
(
'camera'
)
},
},
//获取位置
simpleBack
(){
getLocation
()
{
const
FileSystemManager
=
wx
.
getFileSystemManager
()
let
that
=
this
FileSystemManager
.
getSavedFileList
({
uni
.
getLocation
({
success
(
res
)
{
type
:
'gcj02'
,
console
.
log
(
res
,
'res-getSavedFileList'
)
success
:
function
(
res
)
{
if
(
res
.
fileList
.
length
>
0
){
console
.
log
(
res
,
'res'
)
wx
.
removeSavedFile
({
that
.
longitude
=
parseFloat
(
res
.
longitude
).
toFixed
(
4
)
filePath
:
res
.
fileList
[
0
].
filePath
,
that
.
latitude
=
parseFloat
(
res
.
latitude
).
toFixed
(
3
)
complete
(
res
)
{
console
.
log
(
that
.
longitude
,
'that.longitude'
,
that
.
latitude
,
'that.latitude'
)
console
.
log
(
res
)
that
.
baiduLocation
()
}
},
})
fail
(
err
)
{
}
console
.
log
(
'err-location'
,
'err'
)
that
.
showSettingModal
(
'location'
)
// that.showLocationAuthModal('')
}
}
});
},
showSettingModal
(
type
)
{
console
.
log
(
type
,
'showModal-type'
)
type
=
type
||
'camera'
const
self
=
this
let
authSetting
=
{
'camera'
:
{
content
:
'将无法进行拍照'
,
method
:
''
},
'location'
:
{
content
:
'将无法定位当前位置'
,
method
:
''
},
'writePhotosAlbum'
:
{
content
:
'将无法保存图片到本地'
,
method
:
''
}
}
let
content
=
authSetting
[
type
].
content
uni
.
showModal
({
content
:
'拒绝授权'
+
content
+
',是否去设置打开?'
,
confirmText
:
"确认"
,
cancelText
:
'取消'
,
success
(
res
)
{
if
(
res
.
confirm
)
{
self
.
openSetting
()
}
},
fail
()
{}
})
})
return
},
wx
.
getSavedFileList
({
openSetting
()
{
success
(
res
)
{
// 打开设置
console
.
log
(
res
,
'res'
)
let
self
=
this
if
(
res
.
fileList
.
length
>
0
){
this
.
cameraChange
=
false
wx
.
removeSavedFile
({
wx
.
openSetting
({
filePath
:
res
.
fileList
[
0
].
filePath
,
success
(
res
)
{
complete
(
res
)
{
console
.
log
(
res
,
'res-setting'
)
console
.
log
(
res
)
const
authSetting
=
res
.
authSetting
}
if
(
authSetting
[
'scope.userLocation'
])
{
})
// 位置授权成功
}
self
.
authSetting
.
location
=
true
}
self
.
getLocation
()
}
if
(
res
.
authSetting
[
'scope.camera'
])
{
this
.
cameraChange
=
true
self
.
authSetting
.
camera
=
true
}
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
])
{
self
.
authSetting
.
writePhotosAlbum
=
true
}
}
})
})
return
uni
.
navigateBack
({
//delta: 2
});
},
},
goBack
()
{
goBack
()
{
let
pages
=
getCurrentPages
();
let
pages
=
getCurrentPages
();
...
@@ -192,83 +251,67 @@
...
@@ -192,83 +251,67 @@
})
})
},
},
//获取位置
getLocation
()
{
let
that
=
this
uni
.
getLocation
({
type
:
'gcj02'
,
success
:
function
(
res
)
{
console
.
log
(
res
,
'res'
)
that
.
longitude
=
parseFloat
(
res
.
longitude
).
toFixed
(
4
)
that
.
latitude
=
parseFloat
(
res
.
latitude
).
toFixed
(
3
)
console
.
log
(
that
.
longitude
,
'that.longitude'
,
that
.
latitude
,
'that.latitude'
)
that
.
baiduLocation
()
},
fail
()
{
that
.
showLocationAuthModal
()
}
});
},
//定位 再次授权弹窗
//定位 再次授权弹窗
showLocationAuthModal
:
function
()
{
showLocationAuthModal
:
function
()
{
let
that
=
this
let
that
=
this
uni
.
showModal
({
uni
.
showModal
({
content
:
'拒绝授权将无法定位当前位置,是否去设置打开?'
,
content
:
'拒绝授权将无法定位当前位置,是否去设置打开?'
,
confirmText
:
"确认"
,
confirmText
:
"确认"
,
cancelText
:
'取消'
,
cancelText
:
'取消'
,
success
(
res
)
{
success
(
res
)
{
if
(
res
.
confirm
)
{
if
(
res
.
confirm
)
{
that
.
openLocationSetting
()
that
.
openLocationSetting
()
}
}
if
(
res
.
cancel
)
{
if
(
res
.
cancel
)
{
uni
.
navigateBack
({
uni
.
navigateBack
({
})
})
}
}
},
},
fail
()
{
fail
()
{
console
.
log
(
''
)
console
.
log
(
''
)
}
}
})
})
},
},
//定位设置界面
//定位设置界面
openLocationSetting
()
{
//
openLocationSetting() {
let
that
=
this
//
let that = this
wx
.
openSetting
({
//
wx.openSetting({
success
(
res
)
{
//
success(res) {
console
.
log
(
res
,
'openSetting.res'
)
//
console.log(res, 'openSetting.res')
console
.
log
(
res
.
authSetting
,
'openSetting.res.authSetting'
)
//
console.log(res.authSetting, 'openSetting.res.authSetting')
console
.
log
(
res
.
authSetting
[
'scope.camera'
],
'openSetting.res.authSetting.scope.camera'
)
//
console.log(res.authSetting['scope.camera'], 'openSetting.res.authSetting.scope.camera')
console
.
log
(
res
.
authSetting
[
'scope.userLocation'
],
'openSetting.res.authSetting.scope.userLocation'
)
//
console.log(res.authSetting['scope.userLocation'], 'openSetting.res.authSetting.scope.userLocation')
if
(
res
.
authSetting
[
'scope.userLocation'
]
&&
res
.
authSetting
[
'scope.userLocation'
]
==
true
){
//
if( res.authSetting['scope.userLocation'] && res.authSetting['scope.userLocation'] == true){
console
.
log
(
'33333location reload page'
)
//
console.log('33333location reload page')
that
.
getLocation
()
//
that.getLocation()
}
else
{
//
}else{
that
.
showLocationAuthModal
()
//
that.showLocationAuthModal()
console
.
log
(
'444444'
)
//
console.log('444444')
}
//
}
}
//
}
})
//
})
},
//
},
//刷新当前页
//刷新当前页
reloadPage
:
function
()
{
reloadPage
:
function
()
{
uni
.
redirectTo
({
uni
.
redirectTo
({
url
:
'/pages/photo/try'
url
:
'/pages/photo/try'
});
});
},
},
...
@@ -291,71 +334,69 @@
...
@@ -291,71 +334,69 @@
callback
(
res
)
{
callback
(
res
)
{
console
.
log
(
res
,
'res-callback'
)
console
.
log
(
res
,
'res-callback'
)
},
},
//相机设置界面
//相机设置界面
openCameraSetting
()
{
openCameraSetting
()
{
let
that
=
this
let
that
=
this
wx
.
openSetting
({
wx
.
openSetting
({
success
(
res
)
{
success
(
res
)
{
console
.
log
(
res
,
'openSetting.res'
)
console
.
log
(
res
,
'openSetting.res'
)
console
.
log
(
res
.
authSetting
,
'openSetting.res.authSetting'
)
console
.
log
(
res
.
authSetting
,
'openSetting.res.authSetting'
)
console
.
log
(
res
.
authSetting
[
'scope.camera'
],
'openSetting.res.authSetting.scope.camera'
)
console
.
log
(
res
.
authSetting
[
'scope.camera'
],
'openSetting.res.authSetting.scope.camera'
)
console
.
log
(
res
.
authSetting
[
'scope.userInfo'
],
'openSetting.res.authSetting.scope.userInfo'
)
console
.
log
(
res
.
authSetting
[
'scope.userInfo'
],
'openSetting.res.authSetting.scope.userInfo'
)
if
(
res
.
authSetting
[
'scope.camera'
]
&&
res
.
authSetting
[
'scope.camera'
]
==
true
){
if
(
res
.
authSetting
[
'scope.camera'
]
&&
res
.
authSetting
[
'scope.camera'
]
==
true
)
{
console
.
log
(
'11111camera reload page'
)
that
.
reloadPage
()
that
.
reloadPage
()
}
else
{
}
else
{
that
.
showCameraAuthModal
()
that
.
showCameraAuthModal
()
console
.
log
(
'222222'
)
}
}
}
}
})
})
},
},
//相机 再次授权弹窗
//相机 再次授权弹窗
showCameraAuthModal
:
function
()
{
showCameraAuthModal
:
function
()
{
let
that
=
this
let
that
=
this
uni
.
showModal
({
uni
.
showModal
({
content
:
'拒绝授权将无法拍照,是否去设置打开?'
,
content
:
'拒绝授权将无法拍照,是否去设置打开?'
,
confirmText
:
"确认"
,
confirmText
:
"确认"
,
cancelText
:
'取消'
,
cancelText
:
'取消'
,
success
(
res
)
{
success
(
res
)
{
if
(
res
.
confirm
)
{
if
(
res
.
confirm
)
{
that
.
openCameraSetting
()
that
.
openCameraSetting
()
}
}
if
(
res
.
cancel
)
{
if
(
res
.
cancel
)
{
uni
.
navigateBack
({
uni
.
navigateBack
({
})
})
}
}
},
},
fail
()
{
fail
()
{
console
.
log
(
''
)
console
.
log
(
''
)
}
}
})
})
},
},
//相机拒绝授权
//相机拒绝授权
cameraRefuse
:
function
()
{
cameraRefuse
:
function
()
{
console
.
log
(
'相机拒绝授权'
)
console
.
log
(
'相机拒绝授权'
)
this
.
showCameraAuthModal
()
this
.
showCameraAuthModal
()
},
},
//第一步: 拍照
//第一步: 拍照
takePhoto
()
{
takePhoto
()
{
console
.
log
((
new
Date
).
getTime
(),
'开始渲染'
)
console
.
log
((
new
Date
).
getTime
(),
'开始渲染'
)
this
.
ctx
.
takePhoto
({
this
.
ctx
.
takePhoto
({
quality
:
'high'
,
quality
:
'high'
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
...
@@ -405,11 +446,11 @@
...
@@ -405,11 +446,11 @@
this
.
canvas
.
setFillStyle
(
'#f2f2f2'
)
this
.
canvas
.
setFillStyle
(
'#f2f2f2'
)
let
h
=
1
let
h
=
1
let
txtHeight
=
36
let
txtHeight
=
36
this
.
canvas
.
fillText
(
'经度: '
+
this
.
longitude
,
20
,
canvasHeight
-
txtHeight
*
h
++
);
this
.
canvas
.
fillText
(
'经度: '
+
this
.
longitude
,
20
,
canvasHeight
-
txtHeight
*
h
++
);
this
.
canvas
.
fillText
(
'维度: '
+
this
.
latitude
,
20
,
canvasHeight
-
txtHeight
*
h
++
);
this
.
canvas
.
fillText
(
'维度: '
+
this
.
latitude
,
20
,
canvasHeight
-
txtHeight
*
h
++
);
this
.
canvas
.
fillText
(
'地址: '
+
this
.
address
,
20
,
canvasHeight
-
txtHeight
*
h
++
);
this
.
canvas
.
fillText
(
'地址: '
+
this
.
address
,
20
,
canvasHeight
-
txtHeight
*
h
++
);
this
.
canvas
.
fillText
(
'时间: '
+
this
.
date
,
20
,
canvasHeight
-
txtHeight
*
h
++
);
this
.
canvas
.
fillText
(
'时间: '
+
this
.
date
,
20
,
canvasHeight
-
txtHeight
*
h
++
);
//加入 水印图片
//加入 水印图片
this
.
canvas
.
drawImage
(
this
.
markPath
,
canvasWidth
/
2
-
200
,
canvasHeight
/
2
-
50
,
400
,
100
)
this
.
canvas
.
drawImage
(
this
.
markPath
,
canvasWidth
/
2
-
200
,
canvasHeight
/
2
-
50
,
400
,
100
)
...
@@ -430,8 +471,8 @@
...
@@ -430,8 +471,8 @@
let
self
=
this
let
self
=
this
this
.
canvas
.
draw
(
false
,
this
.
canvas
.
draw
(
false
,
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
log
((
new
Date
).
getTime
(),
'结束渲染'
)
console
.
log
((
new
Date
).
getTime
(),
'结束渲染'
)
uni
.
canvasToTempFilePath
({
uni
.
canvasToTempFilePath
({
// x: 0,
// x: 0,
// y: 0,
// y: 0,
...
@@ -439,13 +480,13 @@
...
@@ -439,13 +480,13 @@
height
:
Number
(
this
.
canvasHeight
),
height
:
Number
(
this
.
canvasHeight
),
canvasId
:
'canvas'
,
canvasId
:
'canvas'
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
self
.
saveToLocal
(
res
.
tempFilePath
)
self
.
saveToLocal
(
res
.
tempFilePath
)
const
FileSystemManager
=
wx
.
getFileSystemManager
()
const
FileSystemManager
=
wx
.
getFileSystemManager
()
FileSystemManager
.
saveFile
({
FileSystemManager
.
saveFile
({
tempFilePath
:
res
.
tempFilePath
,
tempFilePath
:
res
.
tempFilePath
,
success
(
res
)
{
success
(
res
)
{
console
.
log
(
res
,
'res-saveFile'
)
console
.
log
(
res
,
'res-saveFile'
)
}
}
})
})
// this.$emit('canvasImage', res.tempFilePath);
// this.$emit('canvasImage', res.tempFilePath);
...
@@ -486,31 +527,31 @@
...
@@ -486,31 +527,31 @@
},
},
fail
()
{
fail
()
{
// console.log('保存本地相册 失败')
// console.log('保存本地相册 失败')
///*
///*
uni
.
showToast
({
uni
.
showToast
({
icon
:
'none'
,
icon
:
'none'
,
title
:
'保存本地相册失败'
title
:
'保存本地相册失败'
})
})
uni
.
setStorage
({
uni
.
setStorage
({
key
:
'photo_tempPath'
,
key
:
'photo_tempPath'
,
data
:
tempImagePath
,
data
:
tempImagePath
,
success
:
function
()
{
success
:
function
()
{
console
.
log
(
'tempImagePath save success'
);
console
.
log
(
'tempImagePath save success'
);
let
timer
=
setTimeout
(()
=>
{
let
timer
=
setTimeout
(()
=>
{
that
.
showAlbumAuthModal
()
that
.
showAlbumAuthModal
()
},
1500
)
},
1500
)
}
}
});
});
//*/
//*/
/*
/*
let txt = '保存本地相册失败'
let txt = '保存本地相册失败'
...
@@ -550,68 +591,68 @@
...
@@ -550,68 +591,68 @@
}
}
})
})
},
},
//相册 再次授权弹窗
//相册 再次授权弹窗
showAlbumAuthModal
:
function
()
{
showAlbumAuthModal
:
function
()
{
let
that
=
this
let
that
=
this
uni
.
showModal
({
uni
.
showModal
({
content
:
'拒绝授权照片将无法保存到本地相册,是否去设置打开?'
,
content
:
'拒绝授权照片将无法保存到本地相册,是否去设置打开?'
,
confirmText
:
"确认"
,
confirmText
:
"确认"
,
cancelText
:
'取消'
,
cancelText
:
'取消'
,
success
(
res
)
{
success
(
res
)
{
if
(
res
.
confirm
)
{
if
(
res
.
confirm
)
{
that
.
openAlbumSetting
()
that
.
openAlbumSetting
()
}
}
if
(
res
.
cancel
)
{
if
(
res
.
cancel
)
{
uni
.
navigateBack
({
uni
.
navigateBack
({
})
})
}
}
},
},
fail
()
{
fail
()
{
console
.
log
(
''
)
console
.
log
(
''
)
}
}
})
})
},
},
//相机设置界面
//相机设置界面
openAlbumSetting
()
{
openAlbumSetting
()
{
let
that
=
this
let
that
=
this
wx
.
openSetting
({
wx
.
openSetting
({
success
(
res
)
{
success
(
res
)
{
console
.
log
(
res
,
'openSetting.res'
)
console
.
log
(
res
,
'openSetting.res'
)
console
.
log
(
res
.
authSetting
,
'openSetting.res.authSetting'
)
console
.
log
(
res
.
authSetting
,
'openSetting.res.authSetting'
)
console
.
log
(
res
.
authSetting
[
'scope.writePhotosAlbum'
],
'openSetting.res.authSetting.scope.writePhotosAlbum'
)
console
.
log
(
res
.
authSetting
[
'scope.writePhotosAlbum'
],
'openSetting.res.authSetting.scope.writePhotosAlbum'
)
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
]
&&
res
.
authSetting
[
'scope.writePhotosAlbum'
]
==
true
)
{
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
]
&&
res
.
authSetting
[
'scope.writePhotosAlbum'
]
==
true
)
{
console
.
log
(
'11111camera reload page'
)
console
.
log
(
'11111camera reload page'
)
uni
.
getStorage
({
uni
.
getStorage
({
key
:
'photo_tempPath'
,
key
:
'photo_tempPath'
,
success
:
function
(
res
)
{
success
:
function
(
res
)
{
that
.
saveToLocal
(
res
.
data
)
that
.
saveToLocal
(
res
.
data
)
}
}
})
})
//that.reloadPage()
//that.reloadPage()
}
else
{
}
else
{
that
.
showAlbumAuthModal
()
that
.
showAlbumAuthModal
()
console
.
log
(
'222222'
)
console
.
log
(
'222222'
)
}
}
}
}
})
})
},
},
//获取当前时间
//获取当前时间
...
@@ -633,36 +674,40 @@
...
@@ -633,36 +674,40 @@
}
}
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
.camera-container
{
.camera-container
{
// padding-top:var(--status-bar-height);
// padding-top:var(--status-bar-height);
min-height
:
100vh
;
min-height
:
100vh
;
background-color
:
black
;
background-color
:
black
;
}
}
.header-box
{
.header-box
{
// padding:10rpx 20rpx;
// padding:10rpx 20rpx;
position
:
relative
;
position
:
relative
;
.inner
{
.inner
{
display
:
flex
;
display
:
flex
;
position
:
absolute
;
position
:
absolute
;
left
:
0
;
right
:
0
;
left
:
0
;
bottom
:
0
;
right
:
0
;
bottom
:
0
;
}
}
.icon
{
margin
:
20rpx
;
.icon
{
margin
:
20rpx
;
display
:
block
;
display
:
block
;
width
:
50rpx
;
width
:
50rpx
;
height
:
50rpx
;
height
:
50rpx
;
}
}
}
}
.camera-box
{
.camera-box
{
position
:
relative
;
position
:
relative
;
width
:
100%
;
width
:
100%
;
height
:
100vh
;
//
height: 100vh;
z-index
:
1
;
z-index
:
1
;
}
}
.mark-water
{
.mark-water
{
position
:
absolute
;
position
:
absolute
;
left
:
50%
;
left
:
50%
;
top
:
50%
;
top
:
50%
;
...
@@ -671,41 +716,48 @@
...
@@ -671,41 +716,48 @@
height
:
90rpx
;
height
:
90rpx
;
z-index
:
6
;
z-index
:
6
;
}
}
.mark-box
{
.mark-box
{
position
:
absolute
;
position
:
absolute
;
left
:
0
;
left
:
0
;
bottom
:
20rpx
;
bottom
:
20rpx
;
padding
:
20rpx
;
padding
:
20rpx
;
.txt
{
.txt
{
color
:
#fff
;
color
:
#fff
;
}
}
}
}
.bottom-box
{
.bottom-box
{
position
:
absolute
;
position
:
absolute
;
left
:
0
;
right
:
0
;
left
:
0
;
right
:
0
;
bottom
:
0
;
bottom
:
0
;
z-index
:
5
;
z-index
:
5
;
height
:
160rpx
;
height
:
160rpx
;
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
padding
:
20rpx
;
padding
:
20rpx
;
align-items
:
center
;
align-items
:
center
;
background-color
:
black
;
background-color
:
black
;
.txt
{
line-height
:
60rpx
;
.txt
{
color
:
#fff
;
line-height
:
60rpx
;
color
:
#fff
;
}
}
.icon
{
.icon
{
display
:
block
;
display
:
block
;
width
:
60rpx
;
width
:
60rpx
;
height
:
60rpx
;
height
:
60rpx
;
&
.icon-take
{
width
:
150rpx
;
&
.icon-take
{
height
:
150rpx
;
width
:
150rpx
;
height
:
150rpx
;
}
}
}
}
}
}
// .blackBackColor {
// .blackBackColor {
// background-color: #000000;
// background-color: #000000;
// overflow: hidden;
// overflow: hidden;
...
...
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