【PT.SCC实名制管理系统】24.10.01 -30天,考勤打卡小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

201 lines
4.3 KiB

6 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <!-- 人脸识别 -->
  2. <template>
  3. <view class="human-face">
  4. <!-- 自定义导航栏 -->
  5. <uni-nav-bar dark :fixed="true" shadow background-color="var(--main-color)" status-bar left-icon="left"
  6. title="人脸识别" @clickLeft="$utils.navigateBack" />
  7. <!-- 人脸识别说明标题 -->
  8. <view class="human-face-title">为保证本人操作请进行人脸验证</view>
  9. <!-- 人脸识别图片 -->
  10. <view class="human-face-img">
  11. <image v-if="!isPhoto"
  12. src="https://tennis-oss.xzaiyp.top/2024-10-22/508376c5-64b2-472f-8e25-a2469b632a39.png" mode="widthFix">
  13. </image>
  14. </view>
  15. <!-- 人脸识别说明 -->
  16. <view class="human-face-desc">
  17. 人脸认证仅能由<text class="name">{{ userInfo.auth.name }}</text>本人完成验证时请将镜头对准您的脸部
  18. </view>
  19. <!-- 说明 -->
  20. <view class="desc">
  21. <view class="desc-item">
  22. <image src="https://tennis-oss.xzaiyp.top/2024-10-22/a0bf2da9-c25a-4d5c-8c77-7318bd86227d.png"
  23. mode="widthFix"></image>
  24. <view class="text">避免遮挡</view>
  25. </view>
  26. <view class="desc-item">
  27. <image src="https://tennis-oss.xzaiyp.top/2024-10-22/feb72bfb-8271-4e48-8081-d72811543918.png"
  28. mode="widthFix"></image>
  29. <view class="text">光线充足</view>
  30. </view>
  31. <view class="desc-item">
  32. <image src="https://tennis-oss.xzaiyp.top/2024-10-22/5fd8a6a7-a13e-44d6-acf1-a7ada94c699d.png"
  33. mode="widthFix"></image>
  34. <view class="text">正对充足</view>
  35. </view>
  36. </view>
  37. <!-- 立即核验 -->
  38. <div @click="photo" class="btn">
  39. 立即核验
  40. </div>
  41. </view>
  42. </template>
  43. <script>
  44. import position from '@/utils/position.js'
  45. import {
  46. mapState
  47. } from 'vuex'
  48. export default {
  49. name: "HumanFace",
  50. data() {
  51. return {
  52. isPhoto: false,
  53. form : {
  54. pic : '',
  55. },
  56. }
  57. },
  58. computed: {
  59. ...mapState(['teamList', 'userInfo']),
  60. },
  61. onShow() {
  62. let self = this
  63. position.getLocationDetail()
  64. .then(res => {
  65. console.log(res);
  66. self.form.lat = res.position.latitude
  67. self.form.lon = res.position.longitude
  68. self.form.address = res.address
  69. })
  70. },
  71. methods: {
  72. // 人脸认证通过后拍照
  73. photo() {
  74. let self = this
  75. uni.chooseImage({
  76. count: 1, //默认9
  77. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  78. sourceType: ['camera '], //这要注意,camera掉拍照,album是打开手机相册
  79. success: function(res) {
  80. console.log(JSON.stringify(res.tempFilePaths));
  81. //后续在这里上传文件
  82. self.$Oss.ossUpload(res.tempFilePaths[0]).then(url => {
  83. self.form.pic = url
  84. self.submit()
  85. })
  86. // uni.navigateTo({
  87. // url: "/pages/subPack/punchCard/punchCard"
  88. // })
  89. }
  90. });
  91. },
  92. submit(){
  93. if (this.$utils.verificationAll(this.form, {
  94. lat : '经纬度缺失,请打开GPS',
  95. lon : '经纬度缺失,请打开GPS',
  96. address : '获取地址失败',
  97. pic : '请拍照',
  98. })) {
  99. return
  100. }
  101. this.$api('clock', this.form, res => {
  102. if(res.code == 200){
  103. uni.showToast({
  104. title: '打卡成功',
  105. icon:'none'
  106. })
  107. setTimeout(uni.navigateBack, 1000, -1)
  108. }
  109. })
  110. },
  111. }
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. .human-face {
  116. min-height: 100vh;
  117. background: white;
  118. // 人脸识别说明标题
  119. .human-face-title {
  120. font-size: 35rpx;
  121. font-weight: bold;
  122. margin: 60rpx 0rpx;
  123. text-align: center;
  124. }
  125. // 人脸识别图片
  126. .human-face-img {
  127. display: flex;
  128. justify-content: center;
  129. image {
  130. width: 70%;
  131. }
  132. }
  133. // 人脸识别说明
  134. .human-face-desc {
  135. color: #707070;
  136. width: 55%;
  137. font-size: 30rpx;
  138. margin: 30rpx auto;
  139. text-align: center;
  140. .name {
  141. color: $main-color;
  142. }
  143. }
  144. // 说明
  145. .desc {
  146. width: 80%;
  147. display: flex;
  148. flex-wrap: wrap;
  149. margin: 100rpx auto;
  150. .desc-item {
  151. width: 33.33%;
  152. display: flex;
  153. flex-direction: column;
  154. align-items: center;
  155. justify-content: center;
  156. image {
  157. width: 50%;
  158. }
  159. .text {
  160. font-size: 30rpx;
  161. color: #707070;
  162. margin-top: 10rpx;
  163. }
  164. }
  165. }
  166. // 立即核验
  167. .btn {
  168. display: flex;
  169. align-items: center;
  170. justify-content: center;
  171. width: 83%;
  172. background: $main-color;
  173. color: white;
  174. height: 100rpx;
  175. border-radius: 50rpx;
  176. margin: 0rpx auto;
  177. }
  178. }
  179. </style>