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

365 lines
8.2 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 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="!step3" @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, signOut, reSignOut } 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. count: 0
  71. }
  72. },
  73. onLoad(options) {
  74. this.vailStudentInfoFn()
  75. },
  76. computed: {
  77. btnActive() {
  78. if(this.step1&&(!this.step2||!this.step3)) {
  79. return true
  80. }else {
  81. return false
  82. }
  83. }
  84. },
  85. methods: {
  86. // 信息校验
  87. async vailStudentInfoFn() {
  88. // await this.$store.dispatch('getCity')
  89. if(!this.vuex_cityInfo.lat) return
  90. let schoolCoach = this.$store.state.school.schoolCoach
  91. this.params = {
  92. coachId: schoolCoach.id ,
  93. stduentId: this.studentId,
  94. lng: this.vuex_cityInfo.lng,
  95. lat: this.vuex_cityInfo.lat,
  96. key: schoolCoach.key,
  97. type: schoolCoach.QrType,
  98. }
  99. let fn = vailStudentInfo
  100. if(this.params.type==3) {
  101. fn = signOutAuth
  102. }
  103. console.log(this.params)
  104. const res = await fn(this.params)
  105. console.log('第一步校验信息')
  106. console.log(res)
  107. console.log(res.msg)
  108. if(res.code=='200240213') {
  109. this.stepFailureReason = res.msg
  110. if(res.msg=='学员未签退,请先签退') {
  111. if(!this.count) {
  112. this.count ++
  113. console.log('来这了?')
  114. const res2 = await reSignOut({coachId: this.params.coachId})
  115. console.log('来这没有?')
  116. this.vailStudentInfoFn()
  117. console.log('补签结果')
  118. console.log(res2)
  119. }
  120. }
  121. }
  122. if(res.code==0) {
  123. this.step1 = true
  124. this.params.key = res.data
  125. // this.siginFn()
  126. this.getInitFaceVerifyFn()
  127. }
  128. console.log(res)
  129. },
  130. // 人脸对比
  131. async getInitFaceVerifyFn() {
  132. const verifyPlugin = uni.requireNativePlugin('AP-FaceDetectModule');
  133. var metaInfo = verifyPlugin.getMetaInfo()
  134. if(typeof metaInfo =='object' ) {
  135. metaInfo = JSON.stringify(metaInfo)
  136. }
  137. console.log(metaInfo)
  138. const res = await getInitBodyFaceVerify({metaInfo, userId : this.userId})
  139. console.log(res)
  140. let certifyId = res.data.body.resultObject.certifyId
  141. let _this = this
  142. verifyPlugin.verify({
  143. certifyId,
  144. // extParams: {
  145. // kIdentityParamKeyIdCardFaceOnly: 'YES'
  146. // }
  147. }, function(response){
  148. console.log(response)
  149. if(response.code==1000) {
  150. getDescribeBodyFaceVerify({certifyId,}).then((useRes)=>{
  151. _this.step2 = true
  152. _this.params.certifyId = certifyId
  153. _this.siginFn()
  154. })
  155. }else if(response.code==2006) {
  156. _this.$u.toast('认证失败!请确定是本人后再重试')
  157. }else {
  158. _this.$u.toast(response.msg)
  159. }
  160. });
  161. },
  162. // 签到签退
  163. async siginFn() {
  164. let fn = operationSigin
  165. let obj = this.params
  166. if(this.params.type==3) {
  167. fn = signOut
  168. obj = {
  169. "certifyId": this.params.certifyId,
  170. "signKey": this.params.key,
  171. "coachId": this.params.coachId
  172. }
  173. }
  174. console.log(obj)
  175. const res = await fn(obj)
  176. if(res.code=='200240213') {
  177. this.$u.toast(res.msg)
  178. }
  179. console.log('签到结果')
  180. console.log(res)
  181. if(res.code==0) {
  182. this.step3 = true
  183. let msg = '签到成功'
  184. if(this.params.type==3) {
  185. msg = '签退成功'
  186. }
  187. this.$u.toast(msg)
  188. setTimeout(()=>{
  189. uni.navigateBack()
  190. },1000)
  191. }
  192. },
  193. // 重新认证
  194. Recertification() {
  195. if(!this.step1) return
  196. if(!this.step2) {
  197. // this.siginFn()
  198. this.getInitFaceVerifyFn()
  199. }
  200. if(!this.step3) {
  201. this.siginFn()
  202. }
  203. },
  204. goBack() {
  205. uni.navigateBack()
  206. }
  207. }
  208. }
  209. </script>
  210. <style lang="scss" scoped>
  211. .main {
  212. padding: 10rpx 32rpx;
  213. }
  214. .signAndOut {
  215. width: 100%;
  216. height: calc(100vh - 150rpx);
  217. background-color: #fff;
  218. padding: 48rpx;
  219. border-radius: 16rpx;
  220. position: relative;
  221. .footBtn {
  222. padding: 48rpx 100rpx;
  223. position: absolute;
  224. left: 0;
  225. width: 100%;
  226. bottom: 60rpx;
  227. }
  228. .top_row {
  229. display: flex;
  230. justify-content: space-between;
  231. padding: 0 0 0 52rpx;
  232. .flex-box {
  233. display: flex;
  234. align-items: center;
  235. .icon {
  236. width: 28rpx;
  237. height: 28rpx;
  238. image {
  239. display: block;
  240. width: 100%;
  241. height: 100%;
  242. }
  243. }
  244. .txt {
  245. font-size: 28rpx;
  246. color: #FD6401;
  247. margin-left: 14rpx;
  248. }
  249. }
  250. }
  251. .step {
  252. padding: 50rpx 0 0 0;
  253. .li {
  254. width: 100%;
  255. display: flex;
  256. height: 256rpx;
  257. // padding: 0 0 8rpx 0;
  258. .leftIcon {
  259. width: 56rpx;
  260. height: 100%;
  261. position: relative;
  262. .icon {
  263. width: 56rpx;
  264. height: 56rpx;
  265. border-radius: 50%;
  266. font-size: 24rpx;
  267. color: #333;
  268. text-align: center;
  269. line-height: 56rpx;
  270. background: url('../../../../static/images/carIcon/home_icon_weidao@2x.png');
  271. background-size: 100% 100%;
  272. }
  273. .line {
  274. position: absolute;
  275. left: 26rpx;
  276. top: 50rpx;
  277. width: 5rpx;
  278. height: 200rpx;
  279. border: 2rpx solid;
  280. border-image: linear-gradient(180deg, rgba(238, 238, 238, 1), rgba(216, 216, 216, 1)) 2 2;
  281. }
  282. }
  283. .textCon {
  284. flex: 1;
  285. padding: 0 0 0 8rpx;
  286. font-weight: 550;
  287. .text {
  288. font-size: 36rpx;
  289. color: #363A44;
  290. }
  291. .redTps {
  292. font-size: 28rpx;
  293. color: #E63633;
  294. }
  295. }
  296. .btn {
  297. width: 108rpx;
  298. height: 52rpx;
  299. text-align: center;
  300. line-height: 52rpx;
  301. color: #ffffff;
  302. background: linear-gradient(180deg, #53D3E5 0%, #3593FB 100%);
  303. border-radius: 8rpx;
  304. &.red {
  305. background: linear-gradient(180deg, #ea7c48 0%, #f54e40 100%);
  306. }
  307. }
  308. &.active {
  309. .leftIcon {
  310. .icon {
  311. // background: url('../../../static/images/icon/home_icon_yiguo@2x.png');
  312. background-size: 100% 100%;
  313. }
  314. .line {
  315. border-image: linear-gradient(180deg, rgba(83, 211, 229, 1), rgba(53, 147, 251, 1)) 2 2;
  316. }
  317. }
  318. }
  319. }
  320. }
  321. }
  322. .oneBtn {
  323. width: 100%;
  324. height: 96rpx;
  325. border-radius: 48rpx;
  326. font-size: 36rpx;
  327. color: #fff;
  328. background: linear-gradient(180deg, #EEEEEE 0%, #D8D8D8 100%);
  329. text-align: center;
  330. line-height: 96rpx;
  331. &.active {
  332. background: linear-gradient(180deg, #3593FB 0%, #53D3E5 100%);
  333. }
  334. }
  335. </style>