ChangeStepNew.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. <template>
  2. <div class="validation">
  3. <div class="container">
  4. <div class="content">
  5. <div class="content-top">
  6. <h3>更换管理员</h3>
  7. <div class="step">
  8. <img src="/images/all/step02.png" alt=""/>
  9. <div class="step-item"><span class="active">身份验证</span><span class="active">输入新管理员信息</span><span>更换完成</span></div>
  10. </div>
  11. </div>
  12. <div class="content-bottom">
  13. <div>
  14. <el-form :model="valid2" :rules="rules2" ref="valid2" label-width="100px" class="demo-ruleForm">
  15. <el-form-item prop="newAdminName">
  16. <el-input v-model="valid2.newAdminName" placeholder="新管理员姓名"></el-input>
  17. </el-form-item>
  18. <el-form-item prop="mobile">
  19. <el-input v-model="valid2.mobile" placeholder="新管理员手机号"></el-input>
  20. </el-form-item>
  21. <el-form-item prop="code">
  22. <el-input type="text" v-model="valid2.code"
  23. v-bind:class="{ active: secondStepCodeErrorChecked }"
  24. auto-complete="off"
  25. class="msg"
  26. placeholder="短信验证码"></el-input>
  27. <el-button type="primary" class="code"
  28. v-show="showSecondStepCode"
  29. @click="getSecondCheckCode"
  30. :disabled="getCodeBtnIsDisabled">获取验证码</el-button>
  31. <el-button type="primary" v-show="!showSecondStepCode" class="code code-send">已发送({{second_step_time}}s)</el-button>
  32. <span v-show="secondStepCodeErrorChecked" class="tip codeError-tip">{{secondCodeErrorMsg}}</span>
  33. </el-form-item>
  34. <el-form-item prop="changeReason">
  35. <el-input type="textarea" v-model="valid2.changeReason" placeholder="申诉说明"></el-input>
  36. <span class="tip description" v-show="descriptionTip">请描述您申诉的原因,并尽可能多地列举出证明此企业账号为您所有的证据</span>
  37. </el-form-item>
  38. <el-form-item prop="contactTel">
  39. <el-input type="text" v-model="valid2.contactTel" auto-complete="off" placeholder="联系电话"></el-input>
  40. </el-form-item>
  41. <el-form-item>
  42. <a class="btn finish"
  43. :disabled="!newAdminNameChecked || !mobileSecondChecked || !secondCodeChecked || !changeReasonChecked || !contactTelChecked"
  44. @click="setNewMobile">确认</a>
  45. </el-form-item>
  46. </el-form>
  47. </div>
  48. </div>
  49. </div>
  50. <loading v-show="isShowLoading"/>
  51. </div>
  52. </div>
  53. </template>
  54. <script>
  55. import Loading from '~components/common/loading/Loading.vue'
  56. export default {
  57. name: 'validation',
  58. components: {
  59. Loading
  60. },
  61. props: ['tokenId'],
  62. middleware: 'authenticated',
  63. data () {
  64. // 第二步验证手机
  65. var validateNewAdminName = (rule, value, callback) => {
  66. if (value === '') {
  67. callback(new Error('请填写新管理员姓名'))
  68. this.newAdminNameChecked = false
  69. } else {
  70. if (this.valid2.newAdminName !== '') {
  71. if (value.length >= 20) {
  72. callback(new Error('输入长度过长,20个字符以内'))
  73. this.newAdminNameChecked = false
  74. } else {
  75. this.newAdminNameChecked = true
  76. }
  77. }
  78. callback()
  79. }
  80. }
  81. var validateSecondMobile = (rule, value, callback) => {
  82. if (value === '') {
  83. callback(new Error('请填写正确的手机号'))
  84. this.getCodeBtnIsDisabled = true
  85. this.mobileSecondChecked = false
  86. } else {
  87. if (this.valid2.mobile !== '') {
  88. var reg = /^1[0-9]{10}$/
  89. if (!reg.test(value)) {
  90. callback(new Error('请填写正确的手机号'))
  91. this.getCodeBtnIsDisabled = true
  92. this.mobileSecondChecked = false
  93. } else {
  94. this.getCodeBtnIsDisabled = false
  95. this.mobileSecondChecked = true
  96. }
  97. }
  98. callback()
  99. }
  100. }
  101. var validateSecondCode = (rule, value, callback) => {
  102. if (value === '') {
  103. callback(new Error('请填写正确的验证码'))
  104. this.secondStepCodeErrorChecked = false
  105. this.secondCodeChecked = false
  106. } else {
  107. if (this.valid2.code !== '') {
  108. if (this.valid2.mobile === '') {
  109. callback(new Error('请先填写正确的手机号'))
  110. } else {
  111. if (this.secondToken) {
  112. let param = new FormData()
  113. param.append('mobile', this.valid2.mobile)
  114. param.append('code', this.valid2.code)
  115. param.append('token', this.secondToken)
  116. let config = {
  117. headers: {'Content-Type': 'multipart/form-data'}
  118. }
  119. this.$http.post(`/sso/change/admin/check/newMobile`, param, config)
  120. .then(response => {
  121. if (response.data.success) {
  122. this.secondCodeChecked = true
  123. this.secondStepCodeErrorChecked = false
  124. } else {
  125. this.secondStepCodeErrorChecked = true
  126. this.secondCodeChecked = false
  127. return Promise.reject(response.data)
  128. }
  129. }).catch(err => {
  130. this.secondCodeErrorMsg = err.errMsg
  131. })
  132. } else {
  133. callback(new Error('请先获取验证码'))
  134. this.secondStepCodeErrorChecked = false
  135. this.secondCodeChecked = false
  136. }
  137. }
  138. }
  139. callback()
  140. }
  141. }
  142. var validateSecondChangeReason = (rule, value, callback) => {
  143. if (value === '') {
  144. callback(new Error('请填写申诉说明'))
  145. this.changeReasonChecked = false
  146. this.descriptionTip = false
  147. } else {
  148. if (this.valid2.changeReason !== '') {
  149. if (value.length >= 100) {
  150. callback(new Error('输入长度过长,100个字符以内'))
  151. this.changeReasonChecked = false
  152. this.descriptionTip = false
  153. } else {
  154. this.changeReasonChecked = true
  155. this.descriptionTip = false
  156. }
  157. }
  158. callback()
  159. }
  160. }
  161. var validateSecondContactTel = (rule, value, callback) => {
  162. if (value === '') {
  163. callback(new Error('请填写正确的联系电话'))
  164. this.contactTelChecked = false
  165. } else {
  166. if (this.valid2.contactTel !== '') {
  167. var reg = /^1[0-9]{10}$/
  168. if (!reg.test(value)) {
  169. callback(new Error('请填写正确的联系电话'))
  170. this.contactTelChecked = false
  171. } else {
  172. this.contactTelChecked = true
  173. }
  174. }
  175. callback()
  176. }
  177. }
  178. return {
  179. isShowLoading: false,
  180. second_step_time: 0,
  181. codeErrorChecked: false,
  182. secondStepCodeErrorChecked: false,
  183. secondCodeChecked: false,
  184. changeReasonChecked: false,
  185. contactTelChecked: false,
  186. descriptionTip: true,
  187. secondCodeErrorMsg: '',
  188. newAdminNameChecked: false,
  189. mobileSecondChecked: false,
  190. getCodeBtnIsDisabled: true,
  191. showSecondStepCode: true,
  192. valid2: {
  193. newAdminName: '',
  194. mobile: '',
  195. code: '',
  196. changeReason: '',
  197. contactTel: ''
  198. },
  199. rules2: {
  200. newAdminName: [
  201. {validator: validateNewAdminName, trigger: 'blur'}
  202. ],
  203. mobile: [
  204. {validator: validateSecondMobile, trigger: 'blur'}
  205. ],
  206. code: [
  207. {validator: validateSecondCode, trigger: 'blur'}
  208. ],
  209. changeReason: [
  210. {validator: validateSecondChangeReason, trigger: 'blur'}
  211. ],
  212. contactTel: [
  213. {validator: validateSecondContactTel, trigger: 'blur'}
  214. ]
  215. }
  216. }
  217. },
  218. methods: {
  219. // 获取第二步手机验证码
  220. getSecondCheckCode () {
  221. this.isShowLoading = true
  222. this.$http.get(`/sso/change/admin/check/newMobile`, {params: {mobile: this.valid2.mobile, token: this.tokenId ? this.tokenId : this.$route.query.token}})
  223. .then(response => {
  224. this.isShowLoading = false
  225. if (response.data.success) {
  226. this.secondToken = response.data.content.token
  227. if (this.secondToken !== '') {
  228. this.$message({
  229. message: '验证码已经发送到您的手机,请注意查收',
  230. type: 'success'
  231. })
  232. this.showSecondStepCode = false
  233. this.second_step_time = 60
  234. var secondStepTime = setInterval(() => {
  235. this.second_step_time--
  236. if (this.second_step_time <= 0) {
  237. this.showSecondStepCode = true
  238. clearInterval(secondStepTime)
  239. }
  240. }, 1000)
  241. }
  242. } else {
  243. return Promise.reject(response.data)
  244. }
  245. }).catch(err => {
  246. this.isShowLoading = false
  247. this.$message.error(err.errMsg)
  248. })
  249. },
  250. // 更换管理员确认
  251. setNewMobile () {
  252. if (this.newAdminNameChecked && this.mobileSecondChecked && this.secondCodeChecked && this.changeReasonChecked && this.contactTelChecked) {
  253. this.isShowLoading = true
  254. let param = new FormData()
  255. param.append('newAdminName', this.valid2.newAdminName)
  256. param.append('mobile', this.valid2.mobile)
  257. param.append('code', this.valid2.code)
  258. param.append('token', this.tokenId ? this.tokenId : this.$route.query.token)
  259. param.append('codeToken', this.secondToken)
  260. param.append('changeReason', this.valid2.changeReason)
  261. param.append('contactTel', this.valid2.contactTel)
  262. let config = {
  263. headers: {'Content-Type': 'multipart/form-data'}
  264. }
  265. this.$http.post(`/sso/change/admin`, param, config)
  266. .then(response => {
  267. this.isShowLoading = false
  268. if (response.data.success) {
  269. this.$emit('stepEvent', 'last')
  270. } else {
  271. return Promise.reject(response.data)
  272. }
  273. }).catch(err => {
  274. this.$message.error(err.errMsg)
  275. this.isShowLoading = false
  276. this.second_step_time = 0
  277. })
  278. }
  279. }
  280. }
  281. }
  282. </script>
  283. <style lang="scss" scoped>
  284. .validation {
  285. margin: 0 auto;
  286. width: 100%;
  287. background: #eee;
  288. .container{
  289. padding-top: 50px;
  290. margin: 0 auto;
  291. width: 980px;
  292. text-align: center;
  293. .content{
  294. padding: 0 50px;
  295. margin: 50px auto 0;
  296. width: 100%;
  297. /*height: 540px;*/
  298. text-align: center;
  299. background: #fff;
  300. .content-top{
  301. height: 80px;
  302. line-height: 80px;
  303. h3{
  304. margin-bottom: 0;
  305. font-size: 24px;
  306. color: #000;
  307. border-bottom: 1px solid #dcdcdc;
  308. }
  309. .step{
  310. position: relative;
  311. margin-top: 10px;
  312. img{
  313. width: 315px;
  314. height: 46px;
  315. }
  316. .step-item{
  317. position: absolute;
  318. top: 45px;
  319. left: 265px;
  320. span{
  321. margin-right: 57px;
  322. font-size: 14px;
  323. color: #b4b4b4;
  324. }
  325. span.active {
  326. color: #0076ad;
  327. }
  328. }
  329. }
  330. }
  331. form {
  332. margin-top: 150px;
  333. padding-bottom: 44px;
  334. input{
  335. padding: 0 0 0 18px;
  336. width: 360px;
  337. height: 44px;
  338. line-height: 44px;
  339. font-size: 14px;
  340. color: #000;
  341. border-radius: 0;
  342. }
  343. input.answer {
  344. background: url("/images/all/more.png") no-repeat 325px center;
  345. cursor: pointer;
  346. }
  347. ul{
  348. display: none;
  349. position: absolute;
  350. top: 44px;
  351. left: 0;
  352. width: 360px;
  353. background: #fff;
  354. box-shadow: 0 0 5px rgba(0,0,0,.5);
  355. -moz-box-shadow: 0 0 5px rgba(0,0,0,.5);
  356. -o-box-shadow: 0 0 5px rgba(0,0,0,.5);
  357. -webkit-box-shadow: 0 0 5px rgba(0,0,0,.5);
  358. z-index: 10;
  359. li{
  360. padding-left: 18px;
  361. width: 100%;
  362. height: 30px;
  363. line-height: 30px;
  364. text-align: left;
  365. font-size: 14px;
  366. color: #000;
  367. cursor: pointer;
  368. &:hover{
  369. background: #0076ad;
  370. color: #fff;
  371. }
  372. }
  373. }
  374. span.tip{
  375. position: absolute;
  376. top: 10px;
  377. right: -243px;
  378. width: 223px;
  379. line-height: 18px;
  380. text-align: left;
  381. font-size: 13px;
  382. color: #8c8c8c;
  383. a{
  384. font-size: 13px;
  385. color: #0076ad;
  386. }
  387. }
  388. span.tip.codeError-tip{
  389. position: absolute;
  390. top: 3px;
  391. left: 378px;
  392. width: 200px;
  393. text-align: left;
  394. color: #ff4949;
  395. font-size: 12px;
  396. }
  397. i{
  398. position: absolute;
  399. top: 13px;
  400. left: 20px;
  401. font-size: 20px;
  402. color: #a0a0a0;
  403. }
  404. .btn {
  405. margin: 34px 0 16px 0;
  406. width: 360px;
  407. height: 44px;
  408. line-height: 44px;
  409. font-size: 16px;
  410. color: #fff;
  411. background: #0076AD;
  412. border-radius: 3px;
  413. }
  414. }
  415. .content-bottom{
  416. margin: 155px auto 0;
  417. padding-bottom: 50px;
  418. width: 360px;
  419. div.warp{
  420. padding-bottom: 65px;
  421. }
  422. p{
  423. font-size: 24px;
  424. color: #323232;
  425. img{
  426. margin-right: 20px;
  427. width: 30px;
  428. height: 28px;
  429. }
  430. }
  431. p.pass{
  432. font-size: 24px;
  433. color: #e77405;
  434. img{
  435. height: 30px;
  436. }
  437. }
  438. p.passed {
  439. color: #2ab300;
  440. img{
  441. height: 30px;
  442. }
  443. }
  444. span{
  445. display: inline-block;
  446. font-size: 14px;
  447. color: #8b8b8b;
  448. }
  449. span.close-tip{
  450. margin: 15px 0 140px 0;
  451. }
  452. .close-btn{
  453. margin: 0 auto;
  454. width: 200px;
  455. height: 36px;
  456. line-height: 36px;
  457. font-size: 14px;
  458. text-align: center;
  459. color: #323232;
  460. border: 1px solid #d2d2d2;
  461. border-radius: 3px;
  462. cursor: pointer ;
  463. }
  464. span.use{
  465. display: inline-block;
  466. margin-bottom: 30px;
  467. width: 360px;
  468. font-size: 14px;
  469. color: #000;
  470. text-align: left;
  471. em{
  472. font-size: 14px;
  473. font-style: normal;
  474. color: #000;
  475. }
  476. }
  477. .form-group {
  478. margin: 0 auto 16px;
  479. position: relative;
  480. width: 360px;
  481. height: 44px;
  482. line-height: 44px;
  483. input{
  484. padding: 0 0 0 18px;
  485. width: 360px;
  486. height: 44px;
  487. line-height: 44px;
  488. font-size: 14px;
  489. color: #000;
  490. border-radius: 0;
  491. }
  492. input.msg{
  493. float: left;
  494. width: 210px;
  495. padding: 0 0 0 18px;
  496. height: 44px;
  497. line-height: 44px;
  498. font-size: 14px;
  499. color: #000;
  500. border-radius: 0;
  501. }
  502. span.msg{
  503. float: right;
  504. margin: 0;
  505. width: 130px;
  506. height: 44px;
  507. line-height: 44px;
  508. text-align: center ;
  509. font-size: 14px;
  510. color: #5a5a5a;
  511. background: #f4f4f4;
  512. border: 1px solid #dcdcdc;
  513. cursor: pointer;
  514. }
  515. span.msg.send{
  516. background: #d2d2d2;
  517. color: #fff;
  518. }
  519. }
  520. .btn {
  521. margin: 34px 0 10px 0;
  522. width: 360px;
  523. height: 44px;
  524. line-height: 44px;
  525. font-size: 16px;
  526. color: #fff;
  527. background: #0076AD;
  528. border-radius: 3px;
  529. }
  530. }
  531. .choose{
  532. margin: 155px auto 0;
  533. padding-bottom: 44px;
  534. div{
  535. padding: 0 15px;
  536. margin: 0 auto 16px;
  537. width: 360px;
  538. height: 60px;
  539. line-height: 60px;
  540. text-align: left;
  541. overflow: hidden;
  542. border: 1px solid #d2d2d2;
  543. cursor: pointer;
  544. &:hover,&.active{
  545. border-color: #0076ad;
  546. span{
  547. color: #0076ad;
  548. }
  549. i.second {
  550. color: #0076ad;
  551. }
  552. }
  553. img.first{
  554. float: left;
  555. margin: 24px 20px 0 0;
  556. font-size: 20px;
  557. color: #323232;
  558. }
  559. img.first.mob{
  560. margin: 22px 20px 0 5px;
  561. font-size: 28px;
  562. }
  563. i.second {
  564. float: right;
  565. margin: 20px 0 0 5px;
  566. font-size: 20px;
  567. color: #323232;
  568. }
  569. span{
  570. float: left;
  571. font-size: 14px;
  572. color: #323232;
  573. }
  574. }
  575. }
  576. a.return{
  577. position: absolute;
  578. left: 0;
  579. top: -15px;
  580. img{
  581. width: 34px !important;
  582. height: 34px !important;
  583. }
  584. }
  585. }
  586. }
  587. }
  588. </style>