康巴易测肤/伤疤uniapp小程序类
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

137 lines
2.7KB

  1. <template>
  2. <view class="photo-process">
  3. <!-- <u-navbar is-back="true" class="nav-bar" :border-bottom ="false" title-color="#333" title="图片识别" :custom-back="onNavBack">
  4. </u-navbar> -->
  5. <image class="photo-process-img" :src="detectFaceImg" mode="widthFix"></image>
  6. <cover-view class="action">
  7. <cover-view shape="circle" hover-class="none" class="btn" @click="onPhotoReSet">重拍</cover-view>
  8. <cover-view shape="circle" hover-class="none" class="btn full" @click="onSubmit">确认</cover-view>
  9. </cover-view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. data() {
  15. return {
  16. paddTopHeight: '',
  17. imgSize: null,
  18. props: {}
  19. }
  20. },
  21. computed: {
  22. detectFaceImg() {
  23. return this.$store.state.user.photoPath
  24. }
  25. },
  26. methods: {
  27. onNavBack() {
  28. uni.redirectTo({
  29. url: `/pages/index/index`,
  30. })
  31. },
  32. async onSubmit() {
  33. uni.redirectTo({
  34. url: `/pages/details/index`,
  35. })
  36. },
  37. onPhotoReSet() {
  38. // 重拍,返回拍照页面
  39. this.onNavBack();
  40. },
  41. getImgSize() {
  42. let that = this;
  43. if(that.detectFaceImg) {
  44. const fileSystemManager = uni.getFileSystemManager();
  45. // 获取文件状态
  46. fileSystemManager.stat({
  47. path: that.detectFaceImg,
  48. success: function (statRes) {
  49. console.log('文件大小:', statRes.stats.size);
  50. const fileSizeInMB = (statRes.stats.size / (1024 * 1024)).toFixed(2); // 转换为MB
  51. that.imgSize = fileSizeInMB;
  52. console.log('文件大小:', fileSizeInMB, 'MB'); // 输出文件大小,单位是MB// 文件大小,单位是字节
  53. },
  54. fail: function (err) {
  55. console.error('获取文件状态失败:', err);
  56. }
  57. });
  58. }
  59. }
  60. },
  61. onLoad() {
  62. // this.paddTopHeight = this.$util.getPaddTopheight();
  63. }
  64. }
  65. </script>
  66. <style lang="scss">
  67. .photo-process {
  68. height: 100vh;
  69. width: 100vw;
  70. overflow: hidden;
  71. .action {
  72. height: 120rpx;
  73. width: 100vw;
  74. position: fixed;
  75. bottom: 60rpx;
  76. left: 0;
  77. display: flex;
  78. justify-content: center;
  79. align-items: center;
  80. background: none;
  81. z-index: 9999;
  82. .btn {
  83. height: 70rpx;
  84. line-height: 70rpx;
  85. width: 266rpx;
  86. border: 4rpx solid #333;
  87. text-align: center;
  88. border-radius: 60rpx;
  89. font-family: OPPOSans;
  90. font-weight: bold;
  91. font-size: 32rpx;
  92. color: #333;
  93. &.full {
  94. background-color: #333;
  95. color: #F3D4A3;
  96. margin-left: 30rpx;
  97. font-weight: bold;
  98. }
  99. }
  100. }
  101. .nav-bar {
  102. }
  103. .photo-process-img {
  104. position: relative;
  105. height: 100vh;
  106. width: 100vw;
  107. }
  108. .canvas-con {
  109. position: relative;
  110. z-index: 999;
  111. #myCanvas {
  112. height: 100vh;
  113. width: 100vw;
  114. z-index: 999;
  115. }
  116. }
  117. }
  118. </style>