【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.

203 lines
4.4 KiB

7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 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.addressDetail.name
  69. })
  70. },
  71. methods: {
  72. //返回首页
  73. toHome() {
  74. uni.navigateTo({
  75. url: "/pages/index/index"
  76. })
  77. },
  78. // 人脸认证通过后拍照
  79. photo() {
  80. let self = this
  81. uni.chooseImage({
  82. count: 1, //默认9
  83. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  84. sourceType: ['camera '], //这要注意,camera掉拍照,album是打开手机相册
  85. success: function(res) {
  86. console.log(JSON.stringify(res.tempFilePaths));
  87. //后续在这里上传文件
  88. self.$Oss.ossUpload(res.tempFilePaths[0]).then(url => {
  89. self.form.pic = url
  90. self.submit()
  91. })
  92. // uni.navigateTo({
  93. // url: "/pages/subPack/punchCard/punchCard"
  94. // })
  95. }
  96. });
  97. },
  98. submit(){
  99. if (this.$utils.verificationAll(this.form, {
  100. lat : '经纬度缺失,请打开GPS',
  101. lon : '经纬度缺失,请打开GPS',
  102. address : '获取地址失败',
  103. pic : '请拍照',
  104. })) {
  105. return
  106. }
  107. this.$api('clock', this.form, res => {
  108. if(res.code == 200){
  109. uni.reLaunch({
  110. url: '/pages/index/index'
  111. })
  112. }
  113. })
  114. },
  115. }
  116. }
  117. </script>
  118. <style lang="scss" scoped>
  119. .human-face {
  120. min-height: 100vh;
  121. background: white;
  122. // 人脸识别说明标题
  123. .human-face-title {
  124. font-size: 35rpx;
  125. font-weight: bold;
  126. margin: 60rpx 0rpx;
  127. text-align: center;
  128. }
  129. // 人脸识别图片
  130. .human-face-img {
  131. display: flex;
  132. justify-content: center;
  133. image {
  134. width: 70%;
  135. }
  136. }
  137. // 人脸识别说明
  138. .human-face-desc {
  139. color: #707070;
  140. width: 55%;
  141. font-size: 30rpx;
  142. margin: 30rpx auto;
  143. text-align: center;
  144. .name {
  145. color: $main-color;
  146. }
  147. }
  148. // 说明
  149. .desc {
  150. width: 80%;
  151. display: flex;
  152. flex-wrap: wrap;
  153. margin: 100rpx auto;
  154. .desc-item {
  155. width: 33.33%;
  156. display: flex;
  157. flex-direction: column;
  158. align-items: center;
  159. justify-content: center;
  160. image {
  161. width: 50%;
  162. }
  163. .text {
  164. font-size: 30rpx;
  165. color: #707070;
  166. margin-top: 10rpx;
  167. }
  168. }
  169. }
  170. // 立即核验
  171. .btn {
  172. display: flex;
  173. align-items: center;
  174. justify-content: center;
  175. width: 83%;
  176. background: $main-color;
  177. color: white;
  178. height: 100rpx;
  179. border-radius: 50rpx;
  180. margin: 0rpx auto;
  181. }
  182. }
  183. </style>