RealNameCertification.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  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.usoftchina.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. })
  130. } else {
  131. this.idCardChecked = false
  132. this.idCardHasCertification = false
  133. callback(new Error('请填写正确的身份证号'))
  134. }
  135. }
  136. callback()
  137. }
  138. }
  139. return {
  140. isShowLoading: false,
  141. goNextStep: true,
  142. showMsgTip: false,
  143. checked: true,
  144. certification: {
  145. realName: '',
  146. idCard: ''
  147. },
  148. realNameChecked: false,
  149. idCardChecked: false,
  150. idCardHasCertification: false,
  151. rules: {
  152. realName: [
  153. {validator: validateRealName, trigger: 'blur'}
  154. ],
  155. idCard: [
  156. {validator: validateIdCard, trigger: 'blur'}
  157. ]
  158. }
  159. }
  160. },
  161. computed: {
  162. logged () {
  163. return this.$store.state.option.isLogin.data.content
  164. }
  165. },
  166. mounted () {
  167. // 验证是否登录
  168. this.$nextTick(() => {
  169. this.isLogin()
  170. // 刷新统计信息
  171. setInterval(() => {
  172. this.isLogin()
  173. }, 10000)
  174. })
  175. },
  176. methods: {
  177. // 我同意是否被选中
  178. checkboxIsChecked () {
  179. this.checked = !this.checked
  180. },
  181. // 判断用户是否登录
  182. isLogin () {
  183. if (this.logged && !this.logged.isLogin) {
  184. // 未登录跳到登录页面
  185. // window.location.href = '/'
  186. }
  187. },
  188. submitRealName () {
  189. if (this.checked && this.realNameChecked && this.idCardChecked) {
  190. this.isShowLoading = true
  191. let param = new FormData()
  192. param.append('realName', this.certification.realName)
  193. param.append('idCard', this.certification.idCard)
  194. let config = {
  195. headers: {'Content-Type': 'multipart/form-data'}
  196. }
  197. this.$http.post('/valid/user/identity/submit', param, config)
  198. .then(response => {
  199. this.isShowLoading = false
  200. if (response.data.success) {
  201. this.goNextStep = false
  202. } else {
  203. this.goNextStep = true
  204. return Promise.reject(response.data)
  205. }
  206. }).catch(err => {
  207. this.isShowLoading = false
  208. this.$message.error(err.errMsg)
  209. })
  210. }
  211. },
  212. // 跳转至个人中心页面
  213. goCloudCenter () {
  214. if (this.$route.query.returnURL) {
  215. window.location.href = decodeURIComponent(this.$route.query.returnURL)
  216. } else {
  217. this.$router.push('/cloudcenter')
  218. }
  219. }
  220. }
  221. }
  222. </script>
  223. <style lang="scss" scoped>
  224. .certification {
  225. margin: 0 auto;
  226. width: 100%;
  227. background: #eee;
  228. .container{
  229. padding-top: 50px;
  230. margin: 0 auto;
  231. width: 980px;
  232. text-align: center;
  233. .content{
  234. padding: 0 50px;
  235. margin: 50px auto 0;
  236. width: 100%;
  237. text-align: center;
  238. background: #fff;
  239. .content-top{
  240. height: 80px;
  241. line-height: 80px;
  242. h3{
  243. margin-bottom: 0;
  244. font-size: 24px;
  245. color: #000;
  246. border-bottom: 1px solid #dcdcdc;
  247. }
  248. .step{
  249. position: relative;
  250. margin-top: 10px;
  251. img{
  252. width: 315px;
  253. height: 46px;
  254. }
  255. .step-item{
  256. position: absolute;
  257. top: 45px;
  258. left: 265px;
  259. span{
  260. margin-right: 85px;
  261. font-size: 14px;
  262. color: #b4b4b4;
  263. }
  264. span.active {
  265. color: #0076ad;
  266. }
  267. }
  268. }
  269. }
  270. form {
  271. padding-bottom: 44px;
  272. margin-top: 152px;
  273. input{
  274. padding: 0 0 0 18px;
  275. width: 360px;
  276. height: 44px;
  277. line-height: 44px;
  278. font-size: 14px;
  279. color: #000;
  280. border-radius: 0;
  281. }
  282. span.tip{
  283. position: absolute;
  284. top: 0;
  285. right: -238px;
  286. font-size: 13px;
  287. color: #8c8c8c;
  288. a{
  289. font-size: 13px;
  290. color: #0076ad;
  291. }
  292. }
  293. i{
  294. position: absolute;
  295. top: 13px;
  296. left: 20px;
  297. font-size: 20px;
  298. color: #a0a0a0;
  299. }
  300. input[type='checkbox']{
  301. margin: 0 14px 0 55px;
  302. float: left;
  303. width: 16px;
  304. height: 16px;
  305. }
  306. span.agree{
  307. float: left;
  308. margin: 1px 0 0 10px;
  309. font-size: 14px;
  310. color: #8b8b8b;
  311. a{
  312. color: #0076ad;
  313. }
  314. }
  315. .form-group.agree{
  316. margin: 20px auto 0 !important;
  317. }
  318. .btn {
  319. margin: 34px 0 16px 0;
  320. width: 360px;
  321. height: 44px;
  322. line-height: 44px;
  323. font-size: 16px;
  324. color: #fff;
  325. background: #0076AD;
  326. border-radius: 3px;
  327. }
  328. }
  329. .content-bottom{
  330. margin-top: 155px;
  331. padding-bottom: 50px;
  332. p{
  333. font-size: 24px;
  334. color: #323232;
  335. img{
  336. margin-right: 20px;
  337. width: 30px;
  338. height: 28px;
  339. }
  340. }
  341. p.pass{
  342. font-size: 24px;
  343. color: #e77405;
  344. img{
  345. height: 30px;
  346. }
  347. }
  348. p.passed {
  349. color: #2ab300;
  350. img{
  351. height: 30px;
  352. }
  353. }
  354. span{
  355. display: inline-block;
  356. margin: 15px 0 140px 0;
  357. font-size: 14px;
  358. color: #8b8b8b;
  359. }
  360. .close-btn{
  361. margin: 0 auto;
  362. width: 200px;
  363. height: 36px;
  364. line-height: 36px;
  365. font-size: 14px;
  366. text-align: center;
  367. color: #323232;
  368. border: 1px solid #d2d2d2;
  369. border-radius: 3px;
  370. cursor: pointer ;
  371. }
  372. }
  373. }
  374. }
  375. }
  376. </style>