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

317 lines
9.2 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="pageBg">
  3. <!-- <topNavbar :title="title"></topNavbar> -->
  4. <view class="pad">
  5. <view class="card">
  6. <view class="row">
  7. <view class="lab">证件类型</view>
  8. <view class="rightCon">
  9. <view class="val" @click="showType=true">
  10. <input v-model="form.typeName" placeholder="请选择" class="input1" style="pointer-events: none;" disabled/></input>
  11. </view>
  12. <view class="icon">
  13. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="row" v-if="form.value==1">
  18. <view class="lab">实名认证</view>
  19. <view class="rightCon">
  20. <view class="val" v-if="vuex_userInfo.applyStep>1" style="color: #1989FA;">已认证</view>
  21. <view class="val" v-else>待认证</view>
  22. </view>
  23. </view>
  24. <view class="" v-else>
  25. <!-- <view class="row" v-if="form.value==7">
  26. <view class="lab">国籍</view>
  27. <view class="rightCon">
  28. <view class="val">
  29. <input v-model="form.nationality" placeholder="请选择" @click="showType=true" disabled/></input>
  30. </view>
  31. <view class="icon">
  32. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  33. </view>
  34. </view>
  35. </view> -->
  36. <view class="row">
  37. <view class="lab">证件号码</view>
  38. <view class="rightCon">
  39. <view class="val">
  40. <input v-model="form.idcard" placeholder="请输入" /></input>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="row">
  45. <view class="lab">真实姓名</view>
  46. <view class="rightCon">
  47. <view class="val">
  48. <input v-model="form.name" placeholder="请输入" /></input>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="row">
  53. <view class="lab">性别</view>
  54. <view class="rightCon">
  55. <u-radio-group v-model="form.sex" :labelDisabled="false">
  56. <u-radio shape="circle" label="男" name="1" :labelDisabled="false"></u-radio>
  57. <view class="" style="width: 50rpx;"></view>
  58. <u-radio shape="circle" label="女" name="2" :labelDisabled="false"></u-radio>
  59. </u-radio-group>
  60. </view>
  61. </view>
  62. <view class="row">
  63. <view class="lab">户籍地址</view>
  64. <view class="rightCon">
  65. <view class="val">
  66. <input v-model="form.address" placeholder="请输入" /></input>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="footerBtn pad">
  73. <view class="btnBg" @click="goNext">下一步</view>
  74. </view>
  75. </view>
  76. <u-picker :show="showType" :columns="typeArr" keyName="label" @confirm="confirmType" @cancel="showType=false"></u-picker>
  77. </view>
  78. </template>
  79. <script>
  80. import { getpersonface, GetDetectInfoEnhanced, getCardType } from '@/config/api.js'
  81. import { website } from '@/config/site.config.js'
  82. import { startEid } from '@/mp_ecard_sdk/main';
  83. export default {
  84. data() {
  85. return {
  86. form: {
  87. value: 1,
  88. nationality: '中国',
  89. idcard: '',
  90. name: '',
  91. sex: '1',
  92. address: '',
  93. typeName: '身份证',
  94. },
  95. formToast: {
  96. idcard: '请输入证件号码',
  97. name: '请输入真实姓名',
  98. sex: '请选择性别',
  99. address: '请输入户籍地址',
  100. },
  101. showType: false,
  102. typeArr: [],
  103. title: '学员报名'
  104. }
  105. // 报名进度(0:待报名,1:已选驾校,2:已实名制,3:已填写报名信息,4:已签署合同,5:待支付,6:已支付)
  106. },
  107. onLoad(options) {
  108. if(options.tit) {
  109. this.title = options.tit
  110. }
  111. // this.GetDetectInfoEnhancedFn()
  112. this.getCardTypeFn()
  113. },
  114. methods: {
  115. // 获取证件类型
  116. async getCardTypeFn() {
  117. const {data: res} = await getCardType()
  118. this.typeArr = [res]
  119. await this.$store.dispatch('getUserInfo')
  120. if(this.vuex_userInfo.applyStep>1) {
  121. res.forEach(item=>{
  122. if(item.value==this.vuex_userInfo.cardType ){
  123. this.form.typeName = item.label
  124. }
  125. })
  126. }
  127. console.log(res)
  128. },
  129. confirmType(val) {
  130. let item = val.value[0]
  131. console.log(item)
  132. this.form.value = item.value
  133. this.form.typeName = item.label
  134. this.showType = false
  135. },
  136. async getpersonfaceFn() {
  137. const {data: res} = await getpersonface({MerchantId: '0NSJ2312271333064407'})
  138. let obj = JSON.parse(res)
  139. // this.link = obj.Url
  140. // this.$store.commit('updateBizToken', obj.BizToken)
  141. this.EidToken = obj.EidToken
  142. return obj.EidToken
  143. // #ifdef H5
  144. window.open(this.link, '_blank')
  145. // #endif
  146. // var regex = /\[.*?\]/;
  147. // alert(obj.BizToken)
  148. // this.GetDetectInfoEnhancedFn(obj.BizToken)
  149. // #ifdef MP-WEIXIN
  150. this.$store.commit('updateWebVeiwUrl', this.link)
  151. uni.navigateTo({
  152. url: '/pages/indexEntry/enroll/realName/webView'
  153. })
  154. // #endif
  155. console.log(obj)
  156. },
  157. async GetDetectInfoEnhancedFn(EidToken) {
  158. // let obj = {
  159. // ruleId: 2,
  160. // redirectUrl: website + '/pages/indexEntry/enroll/registInfo/registInfo',
  161. // bizToken: 'C9C2BC8E-8336-4071-84B3-8170E283E6CA',
  162. // userId: this.userId
  163. // }
  164. const res = await GetDetectInfoEnhanced({EidToken, userId: this.userId, InfoType: 1})
  165. if(res.code!=0) return
  166. let obj = JSON.parse(res.data).Text
  167. if(obj.Comparemsg!=='成功') return
  168. let userInfo = {
  169. address: obj.OcrAddress,
  170. name: obj.OcrName,
  171. idcard: obj.OcrIdCard,
  172. sex: obj.OcrGender=='女'?2:1,
  173. applyStep: 2
  174. }
  175. let info = Object.assign(this.$store.state.user.vuex_userInfo, userInfo)
  176. this.$store.commit('update_vuex_userInfo', info)
  177. console.log('请求结果来了')
  178. console.log(userInfo)
  179. console.log(this.$store.state.user.vuex_userInfo)
  180. uni.hideLoading()
  181. this.$goPage('/pages/indexEntry/enroll/registInfo/registInfo')
  182. // uni.setStorageSync(obj2)
  183. },
  184. async goNext() {
  185. // if(!this.form.value) return this.$u.toast('请选择证件类型')
  186. // this.$goPage('/pages/indexEntry/enroll/signContract/signContract?schoolId='+this.vuex_userInfo.schoolId)
  187. // return
  188. // 去签约
  189. // if(this.vuex_userInfo.applyStep==3) {
  190. // return this.$goPage('/pages/indexEntry/enroll/signContract/signContract')
  191. // }
  192. // return this.$goPage('/pages/indexEntry/enroll/registInfo/registInfo')
  193. // 去填表
  194. if(this.vuex_userInfo.applyStep==2) {
  195. if(this.title=='学员信息') {
  196. // 非平台学员
  197. return this.$goPage('/pages/indexEntry/NonPlatformStudentInfo/NonPlatformStudentInfo')
  198. }
  199. return this.$goPage('/pages/indexEntry/enroll/registInfo/registInfo')
  200. }
  201. // 去支付
  202. // if(this.vuex_userInfo.applyStep==4||this.vuex_userInfo.applyStep==5) {
  203. // return this.$goPage('/pages/indexEntry/enroll/payment/payment')
  204. // }
  205. if(this.vuex_userInfo.applyStep>1&&this.vuex_userInfo.applyStep<5) {
  206. return this.$goPage('/pages/indexEntry/enroll/registInfo/registInfo')
  207. }
  208. // 不是身份证
  209. if(this.form.value!=1) {
  210. for(let key in this.formToast) {
  211. if(!this.form[key]) {
  212. return this.$u.toast(this.formToast[key])
  213. }
  214. }
  215. this.vuex_userInfo.address = this.form.address
  216. this.vuex_userInfo.name = this.form.name
  217. this.vuex_userInfo.sex = this.form.sex
  218. this.vuex_userInfo.idcard = this.form.idcard
  219. this.vuex_userInfo.nationality = (this.form.value==7||this.form.value==2)?'外国':'中国'
  220. this.vuex_userInfo.cardType = this.form.value
  221. return this.$goPage('/pages/indexEntry/enroll/uploadAvatar/uploadAvatar')
  222. }
  223. // 去实名
  224. if(!this.vuex_userInfo.applyStep||this.vuex_userInfo.applyStep<2) {
  225. const EidToken = await this.getpersonfaceFn()
  226. console.log(EidToken)
  227. this.goSDK(EidToken)
  228. }
  229. // this.$goPage('/pages/indexEntry/enroll/signContract/signContract')
  230. // this.$goPage('/pages/indexEntry/enroll/uploadAvatar/uploadAvatar')
  231. },
  232. // 示例方法
  233. goSDK(token) {
  234. let _this = this
  235. startEid({
  236. data: {
  237. token,
  238. },
  239. verifyDoneCallback(res) {
  240. const { token, verifyDone } = res;
  241. console.log('收到核身完成的res:', res);
  242. console.log('核身的token是:', token);
  243. uni.showLoading({
  244. title: '正在加载,请稍后……'
  245. })
  246. _this.GetDetectInfoEnhancedFn(token)
  247. console.log('是否完成核身:', verifyDone);
  248. },
  249. });
  250. },
  251. }
  252. }
  253. </script>
  254. <style>
  255. .input1::placeholder {
  256. color: red !important;
  257. }
  258. </style>
  259. <style lang="scss" scoped>
  260. .card {
  261. padding: 10rpx 46rpx 10rpx 32rpx;
  262. margin-bottom: 20rpx;
  263. .row {
  264. height: 100rpx;
  265. display: flex;
  266. align-items: center;
  267. .lab {
  268. width: 152rpx;
  269. }
  270. .rightCon {
  271. flex: 1;
  272. width: 0;
  273. display: flex;
  274. .val {
  275. flex: 1;
  276. width: 0;
  277. input {
  278. font-size: 28rpx;
  279. }
  280. }
  281. .icon {
  282. width: 30rpx;
  283. height: 30rpx;
  284. u-icon {
  285. color: #fff;
  286. }
  287. }
  288. }
  289. }
  290. }
  291. .footerBtn {
  292. position: fixed;
  293. left: 0;
  294. width: 100%;
  295. bottom: 30rpx;
  296. }
  297. .btnBg {
  298. width: 100%;
  299. height: 88rpx;
  300. text-align: center;
  301. }
  302. </style>