洛阳学员端
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.

322 lines
7.2 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
6 months ago
6 months ago
  1. <template>
  2. <view class="main">
  3. <view class="signAndOut">
  4. <view class="top_row">
  5. <view class="flex-box">
  6. <view class="icon">
  7. <image src="@/static/images/carIcon/home_icon_buzhou@2x.png" mode=""></image>
  8. </view>
  9. <view class="txt">步骤</view>
  10. </view>
  11. <view class="flex-box">
  12. <view class="icon">
  13. <image src="@/static/images/carIcon/home_icon_zhuangtai@2x.png" mode=""></image>
  14. </view>
  15. <view class="txt">状态</view>
  16. </view>
  17. </view>
  18. <view class="step">
  19. <view class="li" :class="{active: step1}">
  20. <view class="leftIcon" >
  21. <view class="icon">1</view>
  22. <view class="line" ></view>
  23. </view>
  24. <view class="textCon">
  25. <view class="text">信息认证</view>
  26. <view class="redTps" v-if="!step1">失败原因{{stepFailureReason}}</view>
  27. </view>
  28. <view class="btn" :class="{red: !step1}">{{step1?'通过': '不通过'}}</view>
  29. </view>
  30. <view class="li" :class="{active: step2}">
  31. <view class="leftIcon">
  32. <view class="icon">2</view>
  33. <view class="line" ></view>
  34. </view>
  35. <view class="textCon">
  36. <view class="text">人脸识别</view>
  37. <view class="redTps"></view>
  38. </view>
  39. <view class="btn" v-if="step2">通过</view>
  40. </view>
  41. <view class="li" :class="{active: step3}">
  42. <view class="leftIcon">
  43. <view class="icon">3</view>
  44. </view>
  45. <view class="textCon">
  46. <view class="text">信息同步</view>
  47. <view class="redTps"></view>
  48. </view>
  49. <view class="btn" v-if="step3">通过</view>
  50. </view>
  51. </view>
  52. <view class="footBtn">
  53. <view class="oneBtn" :class="{active: btnActive}" v-if="!step1" @click="Recertification">重新认证</view>
  54. <view class="oneBtn" :class="{active: step3}" v-else @click="goBack">我知道了</view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. import { getInitBodyFaceVerify, getDescribeBodyFaceVerify, operationSigin, vailStudentInfo, signOutAuth } from '@/config/api.js'
  61. export default {
  62. data() {
  63. return {
  64. deviceCode: 0,
  65. stepFailureReason: '未通过',
  66. step1: false,
  67. step2: false,
  68. step3: false,
  69. params: {}
  70. }
  71. },
  72. onLoad(options) {
  73. this.vailStudentInfoFn()
  74. },
  75. computed: {
  76. btnActive() {
  77. if(this.step1&&(!this.step2||!this.step3)) {
  78. return true
  79. }else {
  80. return false
  81. }
  82. }
  83. },
  84. methods: {
  85. // 信息校验
  86. async vailStudentInfoFn() {
  87. // await this.$store.dispatch('getCity')
  88. if(!this.vuex_cityInfo.lat) return
  89. let schoolCoach = this.$store.state.school.schoolCoach
  90. this.params = {
  91. coachId: schoolCoach.coachId||'1760856426781200385',
  92. stduentId: this.studentId,
  93. lng: this.vuex_cityInfo.lng,
  94. lat: this.vuex_cityInfo.lat,
  95. key: schoolCoach.key||'f83d5b1c-5524-43c7-bb2c-8540dba69ccb',
  96. type: schoolCoach.QrType
  97. }
  98. console.log(this.params)
  99. const res = await vailStudentInfo(this.params)
  100. if(res.code=='200240213') {
  101. this.stepFailureReason = res.msg
  102. }
  103. if(res.data==true) {
  104. this.step1 = true
  105. this.getInitFaceVerifyFn()
  106. }
  107. console.log(res)
  108. },
  109. // 人脸对比
  110. async getInitFaceVerifyFn() {
  111. const verifyPlugin = uni.requireNativePlugin('AP-FaceDetectModule');
  112. var metaInfo = verifyPlugin.getMetaInfo()
  113. if(typeof metaInfo =='object' ) {
  114. metaInfo = JSON.stringify(metaInfo)
  115. }
  116. console.log(metaInfo)
  117. const res = await getInitBodyFaceVerify({metaInfo, userId : this.userId})
  118. console.log(res)
  119. let certifyId = res.data.body.resultObject.certifyId
  120. let _this = this
  121. verifyPlugin.verify({
  122. certifyId,
  123. // extParams: {
  124. // kIdentityParamKeyIdCardFaceOnly: 'YES'
  125. // }
  126. }, function(response){
  127. console.log(response)
  128. if(response.code==1000) {
  129. getDescribeBodyFaceVerify({certifyId,}).then((useRes)=>{
  130. _this.step2 = true
  131. _this.siginFn()
  132. })
  133. }else if(response.code==2006) {
  134. this.$u.toast('认证失败!请确定是本人后再重试')
  135. }
  136. });
  137. },
  138. // 签到签退
  139. async siginFn() {
  140. let fn = operationSigin
  141. if(this.params.type==3) {
  142. fn = signOutAuth
  143. }
  144. const res = fn(this.params)
  145. if(res.code=='200240213') {
  146. this.$u.toast(res.msg)
  147. }
  148. if(res.data==true) {
  149. this.step3 = true
  150. let msg = '签到成功'
  151. if(this.params.type==2) this.$u.toast('签退成功')
  152. setTimeout(()=>{
  153. uni.navigateBack()
  154. },1000)
  155. }
  156. },
  157. // 重新认证
  158. Recertification() {
  159. if(!this.step2) {
  160. getInitFaceVerifyFn()
  161. }
  162. if(!this.step3) {
  163. this.siginFn()
  164. }
  165. }
  166. }
  167. }
  168. </script>
  169. <style lang="scss" scoped>
  170. .main {
  171. padding: 10rpx 32rpx;
  172. }
  173. .signAndOut {
  174. width: 100%;
  175. height: calc(100vh - 150rpx);
  176. background-color: #fff;
  177. padding: 48rpx;
  178. border-radius: 16rpx;
  179. position: relative;
  180. .footBtn {
  181. padding: 48rpx 100rpx;
  182. position: absolute;
  183. left: 0;
  184. width: 100%;
  185. bottom: 60rpx;
  186. }
  187. .top_row {
  188. display: flex;
  189. justify-content: space-between;
  190. padding: 0 0 0 52rpx;
  191. .flex-box {
  192. display: flex;
  193. align-items: center;
  194. .icon {
  195. width: 28rpx;
  196. height: 28rpx;
  197. image {
  198. display: block;
  199. width: 100%;
  200. height: 100%;
  201. }
  202. }
  203. .txt {
  204. font-size: 28rpx;
  205. color: #FD6401;
  206. margin-left: 14rpx;
  207. }
  208. }
  209. }
  210. .step {
  211. padding: 50rpx 0 0 0;
  212. .li {
  213. width: 100%;
  214. display: flex;
  215. height: 256rpx;
  216. // padding: 0 0 8rpx 0;
  217. .leftIcon {
  218. width: 56rpx;
  219. height: 100%;
  220. position: relative;
  221. .icon {
  222. width: 56rpx;
  223. height: 56rpx;
  224. border-radius: 50%;
  225. font-size: 24rpx;
  226. color: #333;
  227. text-align: center;
  228. line-height: 56rpx;
  229. background: url('../../../../static/images/carIcon/home_icon_weidao@2x.png');
  230. background-size: 100% 100%;
  231. }
  232. .line {
  233. position: absolute;
  234. left: 26rpx;
  235. top: 50rpx;
  236. width: 5rpx;
  237. height: 200rpx;
  238. border: 2rpx solid;
  239. border-image: linear-gradient(180deg, rgba(238, 238, 238, 1), rgba(216, 216, 216, 1)) 2 2;
  240. }
  241. }
  242. .textCon {
  243. flex: 1;
  244. padding: 0 0 0 8rpx;
  245. font-weight: 550;
  246. .text {
  247. font-size: 36rpx;
  248. color: #363A44;
  249. }
  250. .redTps {
  251. font-size: 28rpx;
  252. color: #E63633;
  253. }
  254. }
  255. .btn {
  256. width: 108rpx;
  257. height: 52rpx;
  258. text-align: center;
  259. line-height: 52rpx;
  260. color: #ffffff;
  261. background: linear-gradient(180deg, #53D3E5 0%, #3593FB 100%);
  262. border-radius: 8rpx;
  263. &.red {
  264. background: linear-gradient(180deg, #ea7c48 0%, #f54e40 100%);
  265. }
  266. }
  267. &.active {
  268. .leftIcon {
  269. .icon {
  270. // background: url('../../../static/images/icon/home_icon_yiguo@2x.png');
  271. background-size: 100% 100%;
  272. }
  273. .line {
  274. border-image: linear-gradient(180deg, rgba(83, 211, 229, 1), rgba(53, 147, 251, 1)) 2 2;
  275. }
  276. }
  277. }
  278. }
  279. }
  280. }
  281. .oneBtn {
  282. width: 100%;
  283. height: 96rpx;
  284. border-radius: 48rpx;
  285. font-size: 36rpx;
  286. color: #fff;
  287. background: linear-gradient(180deg, #EEEEEE 0%, #D8D8D8 100%);
  288. text-align: center;
  289. line-height: 96rpx;
  290. &.active {
  291. background: linear-gradient(180deg, #3593FB 0%, #53D3E5 100%);
  292. }
  293. }
  294. </style>