康巴易测肤/伤疤uniapp小程序类
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

129 lines
3.3KB

  1. <template>
  2. <view class="detect-face-con">
  3. <u-navbar is-back="true" class="nav-bar" title-color="#333" title="皮肤拍照" :custom-back="onNavBack"></u-navbar>
  4. <div class="comp" :style="{'top': paddTopHeight + 'px'}">
  5. <face-bio-assay :isDev="false" :top="paddTopHeight" :isShowNavbar="false" ref="faceDetect" @detectFailed="detectFailed" @photoChange="photoChange">
  6. </face-bio-assay>
  7. </div>
  8. </view>
  9. </template>
  10. <script>
  11. import faceBioAssay from '@/components/face-bio-assay/face-bio-assay.vue'
  12. export default {
  13. components: {
  14. faceBioAssay,
  15. },
  16. data() {
  17. return {
  18. paddTopHeight: '',
  19. props: {}
  20. }
  21. },
  22. onLoad(props) { //一定要onLoad,onShow在进入相机授权页面退回时会再次触发
  23. this.$refs.faceDetect.initData();
  24. // this.paddTopHeight = this.$util.getPaddTopheight();
  25. // let pages = getCurrentPages(); // 获取当前页面栈
  26. // let currentPage = pages[pages.length - 1]; // 获取当前页面实例
  27. // let currentPath = currentPage.route;
  28. // this.$store.commit('setForKey', {
  29. // key: 'currentPage',
  30. // value: currentPath,
  31. // });
  32. // if(props) {
  33. // this.props = {...props};
  34. // console.log("其他页面传递过来的参数", this.props);
  35. // }
  36. },
  37. methods: {
  38. onNavBack() {
  39. console.log("点击了返回", );
  40. if(this.props && this.props.mode !== '0') {
  41. let params = '';
  42. if(this.props.nuring === 'start') {
  43. params = `?imei=${this.props.imei}&isDetectFace=false&isFirstFace=false`;
  44. uni.redirectTo({
  45. url: `/pages/nursing/index${params}`,
  46. })
  47. } else if(this.props.nuring === 'end'){
  48. // 直接跳转到护理报告界面
  49. this.$u.route({
  50. type: 'redirectTo',
  51. url: '/pages/nursing/record/report',
  52. params: {
  53. id: this.props.logId || 0,
  54. workTime: this.$store.state.workTime,
  55. type: 'now',
  56. businessId: 3,
  57. },
  58. })
  59. } else {
  60. this.$u.route({
  61. type: 'switchTab',
  62. url: '/pages/index/index',
  63. })
  64. }
  65. } else {
  66. this.$u.route({
  67. type: 'switchTab',
  68. url: '/pages/index/index',
  69. })
  70. }
  71. },
  72. detectFailed(e) {
  73. if(e) {
  74. uni.showToast({
  75. title: "您未授权摄像头权限",
  76. icon: 'none'
  77. })
  78. // setTimeout(() => {
  79. // this.$u.route({
  80. // type: 'switchTab',
  81. // url: '/pages/index/index',
  82. // })
  83. // }, 1000)
  84. } else {
  85. uni.showToast({
  86. title: "摄像头加载失败~,请重试~",
  87. icon: 'none'
  88. })
  89. }
  90. /* uni.navigateBack() */
  91. },
  92. photoChange(path) {
  93. console.log("照相得到的本地路径", path);
  94. // 跳转页面
  95. // let params = `?imei=${this.props.imei}&isDetectFace=true&logId=${this.props.logId || 0}&nuring=${this.props.nuring}&mode=${this.props.mode}`;
  96. // uni.redirectTo({
  97. // url: `/pages/subPack/detect-face/photo-process${params}`,
  98. // })
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. .detect-face-con {
  105. height: 100vh;
  106. width: 100vw;
  107. // overflow: hidden;
  108. z-index: 950;
  109. .nav-bar{
  110. position: absolute;
  111. top: 0;
  112. left: 0;
  113. /* height: 80rpx !important; */
  114. font-weight: 500 !important;
  115. z-index: 9999;
  116. }
  117. .comp {
  118. position: relative;
  119. }
  120. }
  121. </style>