|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
-
- <template>
- <view class="detect-face-con">
- <u-navbar is-back="true" class="nav-bar" title-color="#333" title="皮肤拍照" :custom-back="onNavBack"></u-navbar>
- <div class="comp" :style="{'top': paddTopHeight + 'px'}">
- <face-bio-assay :isDev="false" :top="paddTopHeight" :isShowNavbar="false" ref="faceDetect" @detectFailed="detectFailed" @photoChange="photoChange">
- </face-bio-assay>
- </div>
-
- </view>
- </template>
-
- <script>
- import faceBioAssay from '@/components/face-bio-assay/face-bio-assay.vue'
- export default {
- components: {
- faceBioAssay,
- },
- data() {
- return {
- paddTopHeight: '',
- props: {}
- }
- },
- onLoad(props) { //一定要onLoad,onShow在进入相机授权页面退回时会再次触发
- this.$refs.faceDetect.initData();
- // this.paddTopHeight = this.$util.getPaddTopheight();
- // let pages = getCurrentPages(); // 获取当前页面栈
- // let currentPage = pages[pages.length - 1]; // 获取当前页面实例
- // let currentPath = currentPage.route;
- // this.$store.commit('setForKey', {
- // key: 'currentPage',
- // value: currentPath,
- // });
- // if(props) {
- // this.props = {...props};
- // console.log("其他页面传递过来的参数", this.props);
- // }
- },
- methods: {
- onNavBack() {
- console.log("点击了返回", );
-
- if(this.props && this.props.mode !== '0') {
- let params = '';
- if(this.props.nuring === 'start') {
- params = `?imei=${this.props.imei}&isDetectFace=false&isFirstFace=false`;
- uni.redirectTo({
- url: `/pages/nursing/index${params}`,
- })
- } else if(this.props.nuring === 'end'){
- // 直接跳转到护理报告界面
- this.$u.route({
- type: 'redirectTo',
- url: '/pages/nursing/record/report',
- params: {
- id: this.props.logId || 0,
- workTime: this.$store.state.workTime,
- type: 'now',
- businessId: 3,
- },
- })
- } else {
- this.$u.route({
- type: 'switchTab',
- url: '/pages/index/index',
- })
- }
- } else {
- this.$u.route({
- type: 'switchTab',
- url: '/pages/index/index',
- })
- }
-
- },
- detectFailed(e) {
- if(e) {
- uni.showToast({
- title: "您未授权摄像头权限",
- icon: 'none'
- })
- // setTimeout(() => {
- // this.$u.route({
- // type: 'switchTab',
- // url: '/pages/index/index',
- // })
- // }, 1000)
- } else {
- uni.showToast({
- title: "摄像头加载失败~,请重试~",
- icon: 'none'
- })
- }
-
- /* uni.navigateBack() */
- },
- photoChange(path) {
- console.log("照相得到的本地路径", path);
- // 跳转页面
- // let params = `?imei=${this.props.imei}&isDetectFace=true&logId=${this.props.logId || 0}&nuring=${this.props.nuring}&mode=${this.props.mode}`;
- // uni.redirectTo({
- // url: `/pages/subPack/detect-face/photo-process${params}`,
- // })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .detect-face-con {
- height: 100vh;
- width: 100vw;
- // overflow: hidden;
- z-index: 950;
- .nav-bar{
- position: absolute;
- top: 0;
- left: 0;
- /* height: 80rpx !important; */
- font-weight: 500 !important;
- z-index: 9999;
- }
- .comp {
- position: relative;
- }
-
- }
-
- </style>
|