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

366 lines
8.2 KiB

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