Commit f57ec0a0 authored by zhoucong's avatar zhoucong

处理安卓手机相机组件圆角无效

parent 237539b8
......@@ -10,13 +10,15 @@ const request = (url = '', data = {}, type = 'POST') => {
return new Promise((resolve, reject) => {
uni.request({
method: type,
url: baseUrl + url+'?token='+uni.getStorageSync("openid"),
url: baseUrl + url+'?token='+uni.getStorageSync("token"),
data:data,
dataType: 'json',
}).then((response) => {
uni.hideLoading()
let [error, res] = response;
resolve(res.data);
}).catch(error => {
uni.hideLoading()
let [err, res] = error;
reject(err)
})
......
......@@ -84,7 +84,6 @@
this.getUserInfo() //获取用户信息
this.getScenicList() //获取景区列表
this.openCamera() //打开权限
},
onReady() { //代替 vue 里面的 mounted
},
......@@ -116,7 +115,6 @@
}
this.$request("distribution/vlog/getScenicList", data).then(res => {
if (res.code === "00") { //请求成功
console.log("景区列表", res.data.list);
this.scenicList = res.data.list
} else {
uni.showModal({
......@@ -124,14 +122,13 @@
showCancel: false
})
}
})
},
vlogRegister() { //用户注册
let data = {
"nickName": this.userInfo.nickname, //昵称
"nickName": this.userInfo.nickname.substr(0,10), //昵称
"userId": this.userInfo.openid, //用户id(用微信openid)
"phone": 18523953636, //手机
"phone": 17347895200, //手机
"outUserId": this.userInfo.openid, //用户Id, //外部应用id(用微信openid)
"userType": "WECHAT", //ALIPAY-支付宝小程序,WECHAT-微信小程序,OTHER-其他
"gender": this.userInfo.gender //0-男,1-女
......
......@@ -40,6 +40,7 @@
onShareAppMessage(res) { //分享
let productId = res.target.dataset.productid
let productUrl= res.target.dataset.producturl
if (res.from === "button") {
this.$request("wechatUser/myPage/updateVlogRecord", {
productId,
openid: uni.getStorageSync("openid")
......@@ -48,12 +49,17 @@
this.getMyVlogList()
}
})
if (res.from === "button") {
return {
title: '胖丁旅行',
type: 4,
path: '/pages/vlog/share/share?url='+productUrl,
}
}else{
return {
title: '胖丁旅行',
type: 4,
path: '/pages/vlog/vlogIndex/vlogIndex',
}
}
},
methods: {
......
<template>
<view class="content">
<view class="d1"></view>
<view class="d2"></view>
<camera class="camera" device-position="front" flash="off" @error="error"></camera>
<view class="bg">
<image src="../../../static/img/vlog/icon/camera.png"></image>
</view>
<camera class="camera" device-position="front" flash="off" @error="error" @initdone="initdone"></camera>
<view class="surface" v-show="show">
<view>请正对镜头</view>
<text>{{text}}</text>
</view>
<image class="photo" v-show="src" :src="src"></image>
<view class="hint">
<!-- <u-icon name="error-circle"></u-icon>
没有检测到人脸,请正对拍摄框拍摄哦~ -->
</view>
<view class="hint1">
<view class="item">
......@@ -33,7 +32,7 @@
<view>不遮挡面部</view>
</view>
</view>
<u-button v-if="buttonShow" type="success" size="medium" @click="scanFace">开始识别</u-button>
<u-button v-if="buttonShow" type="success" size="medium" @click="takePhoto">开始识别</u-button>
</view>
</template>
......@@ -64,21 +63,22 @@
optimalFramesNum: 3, //最优帧数量(默认填3就行)
enableImgBeauty: true //默认填true
}
this.$request("distribution/vlog/createVlog", data).then(res => {
if (res.code == "00") {
this.$request("distribution/vlog/createVlog",data).then(res => {
uni.showLoading({
title: '人脸识别中'
});
if (res.code === "00") {
setTimeout(() => {
this.$request("distribution/vlog/getVlogCreateInfo", {
userId: uni.getStorageSync("openid")
}).then(res => {
if (res.code == "00") {
uni.hideLoading()
if (res.code === "00") {
uni.showToast({
title: '识别成功',
duration: 1500
});
this.$u.route("pages/vlog/myVlog/myVlog")
} else {
uni.hideLoading()
uni.showModal({
title: '提示',
content: '识别失败,请重新扫脸',
......@@ -92,6 +92,10 @@
})
},
takePhoto() { //扫脸
this.buttonShow = false
this.src = "";
this.text = 3;
this.show = true;
var test = setInterval(() => {
this.text = this.text - 1;
if (this.text === -1) {
......@@ -115,16 +119,16 @@
}
}, 1000)
},
initdone(){//相机初始化完成自动开始拍照
this.takePhoto()
},
error(e) { //相机报错
console.log(e.detail);
uni.showModal({
title: '提示',
content: e.detail,
showCancel:false
});
},
scanFace() { //重新扫脸
this.buttonShow = false
this.src = "";
this.text = 3;
this.show = true;
this.takePhoto()
}
}
}
</script>
......@@ -132,40 +136,31 @@
<style lang="scss" scoped>
.content {
padding: 0 20rpx;
background-color: #ffffff;
height: 100%;
width: 100%;
text-align: center;
.d1 {
width: 500rpx;
height: 500rpx;
border-radius: 50%;
background-color: #CEE5FF;
.bg{
width: 650rpx;
height: 650rpx;
position: absolute;
top: 150rpx;
top: 80rpx;
left: 50%;
transform: translate(-40%)
transform: translate(-50%);
z-index: 5;
image{
width: 100%;
height: 100%;
}
.d2 {
width: 500rpx;
height: 500rpx;
border-radius: 50%;
background-color: #ECF5FF;
position: absolute;
top: 150rpx;
left: 50%;
transform: translate(-60%)
}
.camera {
width: 500rpx;
height: 500rpx;
width: 550rpx;
height: 550rpx;
border-radius: 50%;
position: absolute;
top: 150rpx;
top: 140rpx;
left: 50%;
transform: translate(-50%)
transform: translate(-50%);
}
.surface {
......@@ -179,36 +174,34 @@
text-align: center;
font-size: 40rpx;
color: #fff;
z-index: 3;
view {
margin: 100rpx 0;
}
text {
font-size: 70rpx;
}
}
.photo {
width: 500rpx;
height: 500rpx;
width: 550rpx;
height: 550rpx;
border-radius: 50%;
position: absolute;
top: 150rpx;
top: 140rpx;
left: 50%;
transform: translate(-50%)
transform: translate(-50%);
}
.hint {
color: red;
padding-top: 680rpx;
}
.hint1 {
height: 300rpx;
display: flex;
justify-content: space-between;
padding-top: 50rpx;
padding-left: 80rpx;
padding-right: 80rpx;
.item {
width: 30%;
......
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