RealNameCertification.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <template>
  2. <div class="certification">
  3. <div class="container">
  4. <div class="content" v-show="goNextStep">
  5. <div class="content-top">
  6. <h3>实名认证</h3>
  7. <div class="step">
  8. <img src="/images/all/step01.png" alt=""/>
  9. <div class="step-item"><span class="active">认证申请</span><span>等待审核</span><span>审核结果</span></div>
  10. </div>
  11. </div>
  12. <div>
  13. <el-form :model="certification" :rules="rules" ref="certification" label-width="100px" class="demo-ruleForm">
  14. <el-form-item prop="realName">
  15. <el-input type="text" v-model="certification.realName"
  16. auto-complete="off"
  17. placeholder="真实姓名"></el-input>
  18. </el-form-item>
  19. <el-form-item prop="idCard">
  20. <el-input type="text" v-model="certification.idCard"
  21. auto-complete="off"
  22. v-bind:class="{ active: idCardHasCertification }"
  23. placeholder="身份证号"></el-input>
  24. <span class="tip" v-show="idCardHasCertification">身份已被认证,请确认。<a href="https://www.ubtob.com/contact">仍有问题?</a></span>
  25. </el-form-item>
  26. <el-form-item>
  27. <a class="btn finish"
  28. @click="submitRealName"
  29. :disabled="!checked || !realNameChecked || !idCardChecked">提交</a>
  30. </el-form-item>
  31. <el-form-item>
  32. <el-checkbox name="type" v-model="checked" @click="checkboxIsChecked"></el-checkbox>
  33. <span class="agree">我已阅读并同意 <a href="/common/agreement">《优软云服务条款》</a></span>
  34. </el-form-item>
  35. </el-form>
  36. </div>
  37. </div>
  38. <div class="content" v-show="!goNextStep">
  39. <div class="content-top">
  40. <h3>实名认证</h3>
  41. <div class="step">
  42. <img src="/images/all/step02.png" alt=""/>
  43. <div class="step-item"><span class="active">认证申请</span><span class="active">等待审核</span><span>审核结果</span></div>
  44. </div>
  45. </div>
  46. <div class="content-bottom">
  47. <p><img src="/images/all/await.png" alt=""/>实名认证申请已提交,等待审核中</p>
  48. <span>我们会在1个工作日内审核您的资料,请耐心等待...</span>
  49. <div class="close-btn" @click="goCloudCenter">关闭</div>
  50. </div>
  51. </div>
  52. <div class="content" style="display: none">
  53. <div class="content-top">
  54. <h3>实名认证</h3>
  55. <div class="step">
  56. <img src="/images/all/step03.png" alt=""/>
  57. <div class="step-item"><span class="active">认证申请</span><span class="active">等待审核</span><span class="active">审核结果</span></div>
  58. </div>
  59. </div>
  60. <div class="content-bottom">
  61. <p class="pass"><img src="/images/all/times.png" alt=""/>审核不通过</p>
  62. <span>您好,您提交的实名认证资料未通过审核,请重新认证</span>
  63. <div class="close-btn">重新认证</div>
  64. </div>
  65. </div>
  66. <div class="content" style="display: none">
  67. <div class="content-top">
  68. <h3>实名认证</h3>
  69. <div class="step">
  70. <img src="/images/all/step03.png" alt=""/>
  71. <div class="step-item"><span class="active">认证申请</span><span class="active">等待审核</span><span class="active">审核结果</span></div>
  72. </div>
  73. </div>
  74. <div class="content-bottom">
  75. <p class="passed"><img src="/images/all/pass.png" alt=""/>审核通过</p>
  76. <span>恭喜您,您提交的实名认证申请通过审核了!</span>
  77. <div class="close-btn">关闭</div>
  78. </div>
  79. </div>
  80. <loading v-show="isShowLoading"/>
  81. </div>
  82. </div>
  83. </template>
  84. <script>
  85. import Loading from '~components/common/loading/Loading.vue'
  86. export default {
  87. components: {
  88. Loading
  89. },
  90. name: 'realNameCertification',
  91. data () {
  92. var validateRealName = (rule, value, callback) => {
  93. if (value === '') {
  94. callback(new Error('请填写您的真实姓名'))
  95. this.realNameChecked = false
  96. } else {
  97. if (this.certification.realName !== '') {
  98. if (value.length > 20) {
  99. callback(new Error('输入长度过长,20个字符以内'))
  100. this.realNameChecked = false
  101. } else {
  102. this.realNameChecked = true
  103. }
  104. }
  105. callback()
  106. }
  107. }
  108. var validateIdCard = (rule, value, callback) => {
  109. if (value === '') {
  110. callback(new Error('请填写您的身份证号'))
  111. this.idCardChecked = false
  112. this.idCardHasCertification = false
  113. } else {
  114. if (this.certification.idCard !== '') {
  115. var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
  116. if (reg.test(value)) {
  117. this.$http.get(`/api/user/idCard/valid`, {params: {idCard: this.certification.idCard}})
  118. .then(response => {
  119. if (response.data.content.isValid) {
  120. this.idCardChecked = false
  121. this.idCardHasCertification = true
  122. } else {
  123. this.idCardChecked = true
  124. this.idCardHasCertification = false
  125. return Promise.reject(response.data)
  126. }
  127. }).catch(err => {
  128. this.$message.error(err.errMsg)
  129. console.log(err.content.isValid)
  130. })
  131. } else {
  132. this.idCardChecked = false
  133. this.idCardHasCertification = false
  134. callback(new Error('请填写正确的身份证号'))
  135. }
  136. }
  137. callback()
  138. }
  139. }
  140. return {
  141. isShowLoading: false,
  142. goNextStep: true,
  143. showMsgTip: false,
  144. checked: true,
  145. certification: {
  146. realName: '',
  147. idCard: ''
  148. },
  149. realNameChecked: false,
  150. idCardChecked: false,
  151. idCardHasCertification: false,
  152. rules: {
  153. realName: [
  154. {validator: validateRealName, trigger: 'blur'}
  155. ],
  156. idCard: [
  157. {validator: validateIdCard, trigger: 'blur'}
  158. ]
  159. }
  160. }
  161. },
  162. computed: {
  163. logged () {
  164. return this.$store.state.option.isLogin.data.content
  165. }
  166. },
  167. mounted () {
  168. // 验证是否登录
  169. this.$nextTick(() => {
  170. this.isLogin()
  171. // 刷新统计信息
  172. setInterval(() => {
  173. this.isLogin()
  174. }, 10000)
  175. })
  176. },
  177. methods: {
  178. // 我同意是否被选中
  179. checkboxIsChecked () {
  180. this.checked = !this.checked
  181. },
  182. // 判断用户是否登录
  183. isLogin () {
  184. if (!this.logged.isLogin) {
  185. // 未登录跳到登录页面
  186. // window.location.href = '/'
  187. }
  188. },
  189. submitRealName () {
  190. if (this.checked && this.realNameChecked && this.idCardChecked) {
  191. this.isShowLoading = true
  192. let param = new FormData()
  193. param.append('realName', this.certification.realName)
  194. param.append('idCard', this.certification.idCard)
  195. let config = {
  196. headers: {'Content-Type': 'multipart/form-data'}
  197. }
  198. this.$http.post('/valid/user/identity/submit', param, config)
  199. .then(response => {
  200. this.isShowLoading = false
  201. if (response.data.success) {
  202. this.goNextStep = false
  203. } else {
  204. this.goNextStep = true
  205. return Promise.reject(response.data)
  206. }
  207. }).catch(err => {
  208. this.isShowLoading = false
  209. this.$message.error(err.errMsg)
  210. })
  211. }
  212. },
  213. // 跳转至个人中心页面
  214. goCloudCenter () {
  215. window.location.href = '/cloudcenter'
  216. }
  217. }
  218. }
  219. </script>
  220. <style lang="scss" scoped>
  221. .certification {
  222. margin: 0 auto;
  223. width: 100%;
  224. background: #eee;
  225. .container{
  226. padding-top: 50px;
  227. margin: 0 auto;
  228. width: 980px;
  229. text-align: center;
  230. .content{
  231. padding: 0 50px;
  232. margin: 50px auto 0;
  233. width: 100%;
  234. text-align: center;
  235. background: #fff;
  236. .content-top{
  237. height: 80px;
  238. line-height: 80px;
  239. h3{
  240. margin-bottom: 0;
  241. font-size: 24px;
  242. color: #000;
  243. border-bottom: 1px solid #dcdcdc;
  244. }
  245. .step{
  246. position: relative;
  247. margin-top: 10px;
  248. img{
  249. width: 315px;
  250. height: 46px;
  251. }
  252. .step-item{
  253. position: absolute;
  254. top: 45px;
  255. left: 265px;
  256. span{
  257. margin-right: 85px;
  258. font-size: 14px;
  259. color: #b4b4b4;
  260. }
  261. span.active {
  262. color: #0076ad;
  263. }
  264. }
  265. }
  266. }
  267. form {
  268. padding-bottom: 44px;
  269. margin-top: 152px;
  270. input{
  271. padding: 0 0 0 18px;
  272. width: 360px;
  273. height: 44px;
  274. line-height: 44px;
  275. font-size: 14px;
  276. color: #000;
  277. border-radius: 0;
  278. }
  279. span.tip{
  280. position: absolute;
  281. top: 0;
  282. right: -238px;
  283. font-size: 13px;
  284. color: #8c8c8c;
  285. a{
  286. font-size: 13px;
  287. color: #0076ad;
  288. }
  289. }
  290. i{
  291. position: absolute;
  292. top: 13px;
  293. left: 20px;
  294. font-size: 20px;
  295. color: #a0a0a0;
  296. }
  297. input[type='checkbox']{
  298. margin: 0 14px 0 55px;
  299. float: left;
  300. width: 16px;
  301. height: 16px;
  302. }
  303. span.agree{
  304. float: left;
  305. margin: 1px 0 0 10px;
  306. font-size: 14px;
  307. color: #8b8b8b;
  308. a{
  309. color: #0076ad;
  310. }
  311. }
  312. .form-group.agree{
  313. margin: 20px auto 0 !important;
  314. }
  315. .btn {
  316. margin: 34px 0 16px 0;
  317. width: 360px;
  318. height: 44px;
  319. line-height: 44px;
  320. font-size: 16px;
  321. color: #fff;
  322. background: #0076AD;
  323. border-radius: 3px;
  324. }
  325. }
  326. .content-bottom{
  327. margin-top: 155px;
  328. padding-bottom: 50px;
  329. p{
  330. font-size: 24px;
  331. color: #323232;
  332. img{
  333. margin-right: 20px;
  334. width: 30px;
  335. height: 28px;
  336. }
  337. }
  338. p.pass{
  339. font-size: 24px;
  340. color: #e77405;
  341. img{
  342. height: 30px;
  343. }
  344. }
  345. p.passed {
  346. color: #2ab300;
  347. img{
  348. height: 30px;
  349. }
  350. }
  351. span{
  352. display: inline-block;
  353. margin: 15px 0 140px 0;
  354. font-size: 14px;
  355. color: #8b8b8b;
  356. }
  357. .close-btn{
  358. margin: 0 auto;
  359. width: 200px;
  360. height: 36px;
  361. line-height: 36px;
  362. font-size: 14px;
  363. text-align: center;
  364. color: #323232;
  365. border: 1px solid #d2d2d2;
  366. border-radius: 3px;
  367. cursor: pointer ;
  368. }
  369. }
  370. }
  371. }
  372. }
  373. </style>