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

368 lines
8.3 KiB

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