学员端小程序
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.

307 lines
8.9 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
1 year ago
11 months ago
1 year ago
1 year ago
11 months ago
12 months ago
1 year ago
11 months ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
11 months ago
11 months ago
1 year ago
11 months ago
11 months ago
11 months ago
1 year ago
1 year ago
  1. <template>
  2. <view class="pageBgImg">
  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="" v-if="form.value!=1">
  18. <!-- <view class="row" v-if="form.value==7">
  19. <view class="lab">国籍</view>
  20. <view class="rightCon">
  21. <view class="val">
  22. <input v-model="form.nationality" placeholder="请选择" @click="showType=true" disabled/></input>
  23. </view>
  24. <view class="icon">
  25. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  26. </view>
  27. </view>
  28. </view> -->
  29. <view class="row">
  30. <view class="lab">证件号码</view>
  31. <view class="rightCon">
  32. <view class="val">
  33. <input v-model="form.idcard" placeholder="请输入" /></input>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="row">
  38. <view class="lab">真实姓名</view>
  39. <view class="rightCon">
  40. <view class="val">
  41. <input v-model="form.name" placeholder="请输入" /></input>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="row">
  46. <view class="lab">性别</view>
  47. <view class="rightCon">
  48. <u-radio-group v-model="form.sex" :labelDisabled="false">
  49. <u-radio shape="circle" label="男" name="1" :labelDisabled="false"></u-radio>
  50. <view class="" style="width: 50rpx;"></view>
  51. <u-radio shape="circle" label="女" name="2" :labelDisabled="false"></u-radio>
  52. </u-radio-group>
  53. </view>
  54. </view>
  55. <view class="row">
  56. <view class="lab">户籍地址</view>
  57. <view class="rightCon">
  58. <view class="val">
  59. <input v-model="form.address" placeholder="请输入" /></input>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="card">
  66. <view class="row">
  67. <view class="lab">实名认证</view>
  68. <view class="rightCon">
  69. <view class="val" v-if="vuex_userInfo.applyStep>1" style="color: #1989FA;">已认证</view>
  70. <view class="val" v-else>待认证</view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="btnBg" @click="goNext">下一步</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. // return this.$goPage('/pages/indexEntry/enroll/registInfo/registInfo')
  186. // if(!this.form.value) return this.$u.toast('请选择证件类型')
  187. // this.$goPage('/pages/indexEntry/enroll/signContract/signContract?schoolId='+this.vuex_userInfo.schoolId)
  188. // return
  189. // 去签约
  190. if(this.vuex_userInfo.applyStep==3) {
  191. return this.$goPage('/pages/indexEntry/enroll/signContract/signContract')
  192. }
  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. // 不是身份证
  206. if(this.form.value!=1) {
  207. for(let key in this.formToast) {
  208. if(!this.form[key]) {
  209. return this.$u.toast(this.formToast[key])
  210. }
  211. }
  212. this.vuex_userInfo.address = this.form.address
  213. this.vuex_userInfo.name = this.form.name
  214. this.vuex_userInfo.sex = this.form.sex
  215. this.vuex_userInfo.idcard = this.form.idcard
  216. this.vuex_userInfo.nationality = (this.form.value==7||this.form.value==2)?'外国':'中国'
  217. this.vuex_userInfo.cardType = this.form.value
  218. return this.$goPage('/pages/indexEntry/enroll/registInfo/registInfo?realNameNo=1')
  219. }
  220. // 去实名
  221. if(!this.vuex_userInfo.applyStep||this.vuex_userInfo.applyStep<2) {
  222. const EidToken = await this.getpersonfaceFn()
  223. console.log(EidToken)
  224. this.goSDK(EidToken)
  225. }
  226. // this.$goPage('/pages/indexEntry/enroll/signContract/signContract')
  227. // this.$goPage('/pages/indexEntry/enroll/uploadAvatar/uploadAvatar')
  228. },
  229. // 示例方法
  230. goSDK(token) {
  231. let _this = this
  232. startEid({
  233. data: {
  234. token,
  235. },
  236. verifyDoneCallback(res) {
  237. const { token, verifyDone } = res;
  238. console.log('收到核身完成的res:', res);
  239. console.log('核身的token是:', token);
  240. uni.showLoading({
  241. title: '正在加载,请稍后……'
  242. })
  243. _this.GetDetectInfoEnhancedFn(token)
  244. console.log('是否完成核身:', verifyDone);
  245. },
  246. });
  247. },
  248. }
  249. }
  250. </script>
  251. <style>
  252. .input1::placeholder {
  253. color: red !important;
  254. }
  255. </style>
  256. <style lang="scss" scoped>
  257. .card {
  258. padding: 10rpx 46rpx 10rpx 32rpx;
  259. margin-bottom: 20rpx;
  260. .row {
  261. height: 100rpx;
  262. display: flex;
  263. align-items: center;
  264. .lab {
  265. width: 152rpx;
  266. }
  267. .rightCon {
  268. flex: 1;
  269. width: 0;
  270. display: flex;
  271. .val {
  272. flex: 1;
  273. width: 0;
  274. input {
  275. font-size: 28rpx;
  276. }
  277. }
  278. .icon {
  279. width: 30rpx;
  280. height: 30rpx;
  281. u-icon {
  282. color: #fff;
  283. }
  284. }
  285. }
  286. }
  287. }
  288. .btnBg {
  289. width: 396rpx;
  290. margin: 100rpx auto 0 auto;
  291. }
  292. </style>