PasswordRestAppeal.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  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>
  8. <div>
  9. <el-form :model="passwordRest" :rules="rules" ref="passwordRest" label-width="100px" class="demo-ruleForm">
  10. <el-form-item prop="mobile">
  11. <el-input v-model="passwordRest.mobile" placeholder="新手机号码"></el-input>
  12. </el-form-item>
  13. <el-form-item prop="code">
  14. <el-input type="text" v-model="passwordRest.code"
  15. v-bind:class="{ active: codeErrorChecked }"
  16. auto-complete="off" class="msg"
  17. placeholder="短信验证码"></el-input>
  18. <el-button type="primary" class="code"
  19. v-show="sendAccountCode"
  20. @click="getCheckCode"
  21. :disabled="getCodeBtnIsDisabled">获取验证码</el-button>
  22. <el-button type="primary" v-show="!sendAccountCode" class="code code-send">已发送({{account_time}}s)</el-button>
  23. <!--<span v-show="codeErrorChecked" class="tip codeError-tip" >验证码输入错误</span>-->
  24. </el-form-item>
  25. <el-form-item prop="password">
  26. <el-input type="password" v-model="passwordRest.password" auto-complete="off" placeholder="新密码"></el-input>
  27. <div class="pwd sm" v-show="showMsgTip1">密码强度 <em></em><em></em><em></em><span>弱</span></div>
  28. <div class="pwd md" v-show="showMsgTip2">密码强度 <em></em><em></em><em></em><span>中</span></div>
  29. <div class="pwd lar" v-show="showMsgTip3">密码强度 <em></em><em></em><em></em><span>强</span></div>
  30. <div class="pwd low" v-show="showMsgTip4">密码强度 <em></em><em></em><em></em></div>
  31. </el-form-item>
  32. <el-form-item prop="confirm">
  33. <el-input type="password" v-model="passwordRest.confirm" auto-complete="off" placeholder="密码确认"></el-input>
  34. </el-form-item>
  35. <el-form-item prop="description">
  36. <el-input type="textarea" v-model="passwordRest.description" placeholder="申诉说明"></el-input>
  37. <span class="tip description" v-show="descriptionTip">请描述您申诉的原因,并尽可能多地列举出证明此账号为您所有的证据</span>
  38. </el-form-item>
  39. <el-form-item prop="contactName">
  40. <el-input type="text" v-model="passwordRest.contactName" auto-complete="off" placeholder="姓名"></el-input>
  41. </el-form-item>
  42. <el-form-item prop="contactTel">
  43. <el-input type="text" v-model="passwordRest.contactTel" auto-complete="off" placeholder="联系电话"></el-input>
  44. </el-form-item>
  45. <el-form-item prop="contactEmail">
  46. <el-input type="text" v-model="passwordRest.contactEmail" auto-complete="off" placeholder="电子邮箱"></el-input>
  47. </el-form-item>
  48. <el-form-item>
  49. <a class="btn finish"
  50. @click="submit"
  51. :disabled="!checked || !mobileChecked || !codeChecked || !passwordChecked || !confirmChecked || !descriptionChecked || !contactNameChecked || !contactTelChecked || !contactEmailChecked">提交</a>
  52. </el-form-item>
  53. <el-form-item>
  54. <el-checkbox name="type" v-model="checked" @click="checkboxChecked"></el-checkbox>
  55. <span class="agree">我已阅读并同意 <a href="/common/agreement">《优软云服务条款》</a></span>
  56. </el-form-item>
  57. </el-form>
  58. </div>
  59. </div>
  60. <div class="content" v-show="!goNextStep">
  61. <div class="content-top">
  62. <h3>密码重置</h3>
  63. </div>
  64. <div class="content-bottom">
  65. <p class="passed"><img src="/images/all/pass.png" alt=""/>申诉已提交</p>
  66. <span>申诉内容已提交,请耐心等待审核</span>
  67. <div class="close-btn" @click="goReturn">关闭</div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </template>
  73. <script>
  74. export default {
  75. name: 'AccountAppeal',
  76. data () {
  77. var validateMobile = (rule, value, callback) => {
  78. if (value === '') {
  79. callback(new Error('请填写正确的手机号'))
  80. this.getCodeBtnIsDisabled = true
  81. this.mobileChecked = false
  82. } else {
  83. if (this.passwordRest.mobile !== '') {
  84. var reg = /^1[0-9]{10}$/
  85. if (!reg.test(value)) {
  86. callback(new Error('请填写正确的手机号'))
  87. this.getCodeBtnIsDisabled = true
  88. this.mobileChecked = false
  89. } else {
  90. this.getCodeBtnIsDisabled = false
  91. this.mobileChecked = true
  92. }
  93. }
  94. callback()
  95. }
  96. }
  97. var validateCode = (rule, value, callback) => {
  98. if (value === '') {
  99. callback(new Error('请填写正确的验证码'))
  100. this.codeErrorChecked = false
  101. this.codeChecked = false
  102. } else {
  103. if (this.passwordRest.code !== '') {
  104. if (this.token !== '') {
  105. if (this.passwordRest.code !== '' && this.passwordRest.mobile !== '') {
  106. let param = new FormData()
  107. param.append('mobile', this.passwordRest.mobile)
  108. param.append('code', this.passwordRest.code)
  109. param.append('token', this.token)
  110. let config = {
  111. headers: {'Content-Type': 'multipart/form-data'}
  112. }
  113. this.$http.post(`/appeal/check/mobile`, param, config)
  114. .then(response => {
  115. if (response.data.success) {
  116. this.codeChecked = true
  117. this.codeErrorChecked = false
  118. } else {
  119. this.codeErrorChecked = true
  120. this.codeChecked = false
  121. return Promise.reject(response.data)
  122. }
  123. }).catch(err => {
  124. this.$message.error(err.errMsg)
  125. })
  126. }
  127. } else {}
  128. }
  129. callback()
  130. }
  131. }
  132. var validatePassword = (rule, value, callback) => {
  133. if (this.passwordRest.password !== '') {
  134. if (value.length <= 20 && value.length >= 8) {
  135. var reg1 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]))|((?=.*[0-9])((?=.*[a-zA-Z]))(?=.*[^a-zA-Z0-9]))).*$/
  136. var reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
  137. if (reg1.test(value)) {
  138. // callback(new Error('密码强度强'))
  139. this.showMsgTip3 = true
  140. this.showMsgTip2 = false
  141. this.showMsgTip1 = false
  142. this.showMsgTip4 = false
  143. this.passwordChecked = true
  144. } else if (reg2.test(value)) {
  145. // callback(new Error('密码强度中'))
  146. this.showMsgTip2 = true
  147. this.showMsgTip3 = false
  148. this.showMsgTip1 = false
  149. this.showMsgTip4 = false
  150. this.passwordChecked = true
  151. } else {
  152. this.showMsgTip1 = true
  153. this.showMsgTip3 = false
  154. this.showMsgTip2 = false
  155. this.showMsgTip4 = false
  156. this.passwordChecked = false
  157. }
  158. } else {
  159. this.showMsgTip3 = false
  160. this.showMsgTip2 = false
  161. this.showMsgTip1 = false
  162. this.showMsgTip4 = true
  163. this.passwordChecked = false
  164. }
  165. }
  166. callback()
  167. }
  168. var validatePasswordTip = (rule, value, callback) => {
  169. if (value === '') {
  170. callback(new Error('请输入密码'))
  171. this.passwordChecked = false
  172. } else {
  173. if (this.passwordRest.password !== '') {
  174. if (value.length <= 20 && value.length >= 8) {
  175. var reg1 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]))|((?=.*[0-9])((?=.*[a-zA-Z]))(?=.*[^a-zA-Z0-9]))).*$/
  176. var reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
  177. if (reg1.test(value)) {
  178. this.passwordChecked = true
  179. } else if (reg2.test(value)) {
  180. this.passwordChecked = true
  181. } else {
  182. callback(new Error('密码须为8-20字符的英文、数字混合'))
  183. this.passwordChecked = false
  184. }
  185. } else {
  186. callback(new Error('密码须为8-20字符的英文、数字混合'))
  187. this.passwordChecked = false
  188. }
  189. }
  190. callback()
  191. }
  192. }
  193. var validateConfirm = (rule, value, callback) => {
  194. if (value === '') {
  195. callback(new Error('请再次输入密码'))
  196. this.confirmChecked = false
  197. } else if (value !== this.passwordRest.password) {
  198. callback(new Error('两次输入密码不一致!'))
  199. this.confirmChecked = false
  200. } else {
  201. this.confirmChecked = true
  202. callback()
  203. }
  204. }
  205. var validateDescription = (rule, value, callback) => {
  206. if (value === '') {
  207. callback(new Error('请填写申诉说明'))
  208. this.descriptionChecked = false
  209. this.descriptionTip = false
  210. } else {
  211. if (this.passwordRest.description !== '') {
  212. if (value.length >= 100) {
  213. callback(new Error('输入长度过长,100个字符以内'))
  214. this.descriptionChecked = false
  215. this.descriptionTip = false
  216. } else {
  217. this.descriptionChecked = true
  218. this.descriptionTip = false
  219. }
  220. }
  221. callback()
  222. }
  223. }
  224. var validateContactName = (rule, value, callback) => {
  225. if (value === '') {
  226. callback(new Error('请填写您的姓名'))
  227. this.contactNameChecked = false
  228. } else {
  229. if (this.passwordRest.contactName !== '') {
  230. if (value.length >= 20) {
  231. callback(new Error('输入长度过长,20个字符以内'))
  232. this.contactNameChecked = false
  233. } else {
  234. this.contactNameChecked = true
  235. }
  236. }
  237. callback()
  238. }
  239. }
  240. var validateContactTel = (rule, value, callback) => {
  241. if (value === '') {
  242. callback(new Error('请填写正确的联系电话'))
  243. this.contactTelChecked = false
  244. } else {
  245. if (this.passwordRest.contactTel !== '') {
  246. var reg = /^1[0-9]{10}$/
  247. if (!reg.test(value)) {
  248. callback(new Error('请填写正确的联系电话'))
  249. this.contactTelChecked = false
  250. } else {
  251. this.contactTelChecked = true
  252. }
  253. }
  254. callback()
  255. }
  256. }
  257. var validateContactEmail = (rule, value, callback) => {
  258. if (value === '') {
  259. callback(new Error('请填写正确的电子邮箱'))
  260. this.contactEmailChecked = false
  261. } else {
  262. if (this.passwordRest.contactEmail !== '') {
  263. var reg = /^([\w-])+(\.\w+)*@([\w-])+((\.\w{2,3}){1,3})$/
  264. if (!reg.test(value)) {
  265. callback(new Error('请输入正确的邮箱地址格式'))
  266. this.contactEmailChecked = false
  267. } else {
  268. this.contactEmailChecked = true
  269. }
  270. }
  271. callback()
  272. }
  273. }
  274. return {
  275. goNextStep: true,
  276. passwordRest: {
  277. mobile: '',
  278. code: '',
  279. password: '',
  280. conform: '',
  281. description: '',
  282. contactName: '',
  283. contactTel: '',
  284. contactEmail: ''
  285. },
  286. checked: true,
  287. sendAccountCode: true,
  288. account_time: 0,
  289. getCodeBtnIsDisabled: true,
  290. codeErrorChecked: false,
  291. descriptionTip: true,
  292. showMsgTip1: false,
  293. showMsgTip2: false,
  294. showMsgTip3: false,
  295. showMsgTip4: false,
  296. mobileChecked: false,
  297. codeChecked: false,
  298. passwordChecked: false,
  299. confirmChecked: false,
  300. descriptionChecked: false,
  301. contactNameChecked: false,
  302. contactTelChecked: false,
  303. contactEmailChecked: false,
  304. rules: {
  305. mobile: [
  306. {validator: validateMobile, trigger: 'blur'}
  307. ],
  308. code: [
  309. {validator: validateCode, trigger: 'blur'}
  310. ],
  311. password: [
  312. {validator: validatePassword, trigger: 'change'},
  313. {validator: validatePasswordTip, trigger: 'blur'}
  314. ],
  315. confirm: [
  316. {validator: validateConfirm, trigger: 'blur'}
  317. ],
  318. description: [
  319. {validator: validateDescription, trigger: 'blur'}
  320. ],
  321. contactName: [
  322. {validator: validateContactName, trigger: 'blur'}
  323. ],
  324. contactTel: [
  325. {validator: validateContactTel, trigger: 'blur'}
  326. ],
  327. contactEmail: [
  328. {validator: validateContactEmail, trigger: 'blur'}
  329. ]
  330. }
  331. }
  332. },
  333. methods: {
  334. // 判断我同意是否被选中
  335. checkboxChecked () {
  336. this.checked = !this.checked
  337. },
  338. // 获取校验码
  339. getCheckCode () {
  340. this.$http.get(`/appeal/check/mobile`, {params: {mobile: this.passwordRest.mobile}})
  341. .then(response => {
  342. this.token = response.data.content.token
  343. if (this.token !== '') {
  344. this.$message({
  345. message: '验证码已经发送到您的手机,请注意查收',
  346. type: 'success'
  347. })
  348. this.sendAccountCode = false
  349. this.account_time = 60
  350. var accountTime = setInterval(() => {
  351. this.account_time--
  352. if (this.account_time <= 0) {
  353. this.sendAccountCode = true
  354. clearInterval(accountTime)
  355. }
  356. }, 1000)
  357. }
  358. }).catch(err => {
  359. this.$message.error(err.errMsg)
  360. })
  361. },
  362. // 提交表单
  363. submit () {
  364. if (this.mobileChecked && this.codeChecked && this.passwordChecked && this.confirmChecked && this.descriptionChecked && this.contactNameChecked && this.contactTelChecked && this.contactEmailChecked && this.checked) {
  365. let param = new FormData()
  366. param.append('mobile', this.passwordRest.mobile)
  367. param.append('code', this.passwordRest.code)
  368. param.append('password', this.passwordRest.password)
  369. param.append('description', this.passwordRest.description)
  370. param.append('contactName', this.passwordRest.contactName)
  371. param.append('contactTel', this.passwordRest.contactTel)
  372. param.append('contactEmail', this.passwordRest.contactEmail)
  373. param.append('token', this.token)
  374. let config = {
  375. headers: {'Content-Type': 'multipart/form-data'}
  376. }
  377. this.$http.post('/appeal/resetPwd', param, config)
  378. .then(response => {
  379. if (response.data.success) {
  380. this.goNextStep = false
  381. // 待跳转到设置页面
  382. // window.loaction.href = ''
  383. } else {
  384. this.goNextStep = true
  385. return Promise.reject(response.data)
  386. }
  387. }).catch(err => {
  388. this.$message.error(err.errMsg)
  389. })
  390. }
  391. },
  392. // 跳转至个人页面
  393. goReturn () {
  394. // window.loaction.href = ''
  395. }
  396. }
  397. }
  398. </script>
  399. <style lang="scss" scoped>
  400. .certification {
  401. margin: 0 auto;
  402. width: 100%;
  403. background: #eee;
  404. .container{
  405. padding-top: 50px;
  406. margin: 0 auto;
  407. width: 980px;
  408. text-align: center;
  409. .content{
  410. padding: 0 50px;
  411. margin: 50px auto 0;
  412. width: 100%;
  413. text-align: center;
  414. background: #fff;
  415. .content-top{
  416. height: 80px;
  417. line-height: 80px;
  418. h3{
  419. margin-bottom: 0;
  420. font-size: 24px;
  421. color: #000;
  422. border-bottom: 1px solid #dcdcdc;
  423. }
  424. .step{
  425. position: relative;
  426. margin-top: 10px;
  427. img{
  428. width: 315px;
  429. height: 46px;
  430. }
  431. .step-item{
  432. position: absolute;
  433. top: 45px;
  434. left: 265px;
  435. span{
  436. margin-right: 85px;
  437. font-size: 14px;
  438. color: #b4b4b4;
  439. }
  440. span.active {
  441. color: #0076ad;
  442. }
  443. }
  444. }
  445. }
  446. form {
  447. padding-bottom: 44px;
  448. margin-top: 36px;
  449. input{
  450. padding: 0 0 0 18px;
  451. width: 360px;
  452. height: 44px;
  453. line-height: 44px;
  454. font-size: 14px;
  455. color: #000;
  456. border-radius: 0;
  457. }
  458. .pwd {
  459. margin: 6px 0 -15px 0;
  460. text-align: left;
  461. font-size: 13px;
  462. em{
  463. display: inline-block;
  464. margin: 0 8px 2px 0;
  465. width: 24px;
  466. height: 6px;
  467. &:first-child{
  468. margin-left: 10px;
  469. }
  470. }
  471. span{
  472. margin-left: 10px;
  473. font-size: 13px;
  474. }
  475. }
  476. .pwd.sm{
  477. color: #8c8c8c;
  478. em {
  479. background: #bfbfbf;
  480. &:first-child{
  481. background: #ff4e00;
  482. }
  483. }
  484. span{
  485. color: #ff4e00;
  486. }
  487. }
  488. .pwd.md{
  489. color: #8c8c8c;
  490. em {
  491. background: #22ac38;
  492. &:nth-child(3){
  493. background: #bfbfbf;
  494. }
  495. }
  496. span{
  497. color: #22ac38;
  498. }
  499. }
  500. .pwd.lar{
  501. color: #8c8c8c;
  502. em {
  503. background: #00a0e9;
  504. }
  505. span{
  506. color: #00a0e9;
  507. }
  508. }
  509. .pwd.low{
  510. color: #8c8c8c;
  511. em{
  512. background: #bfbfbf;
  513. }
  514. }
  515. span.tip{
  516. position: absolute;
  517. top: 0;
  518. right: -238px;
  519. font-size: 13px;
  520. color: #8c8c8c;
  521. a{
  522. font-size: 13px;
  523. color: #0076ad;
  524. }
  525. }
  526. span.tip.description {
  527. top: 10px;
  528. right: -266px;
  529. width: 245px;
  530. line-height: 18px;
  531. text-align: left;
  532. }
  533. span.tip.codeError-tip {
  534. right: -112px;
  535. color: #f56c6c;
  536. }
  537. i{
  538. position: absolute;
  539. top: 13px;
  540. left: 20px;
  541. font-size: 20px;
  542. color: #a0a0a0;
  543. }
  544. input[type='checkbox']{
  545. margin: 0 14px 0 55px;
  546. float: left;
  547. width: 16px;
  548. height: 16px;
  549. }
  550. span.agree{
  551. float: left;
  552. margin: 1px 0 0 10px;
  553. font-size: 14px;
  554. color: #8b8b8b;
  555. a{
  556. color: #0076ad;
  557. }
  558. }
  559. .form-group.agree{
  560. margin: 20px auto 0 !important;
  561. }
  562. .btn {
  563. margin: 34px 0 16px 0;
  564. width: 360px;
  565. height: 44px;
  566. line-height: 44px;
  567. font-size: 16px;
  568. color: #fff;
  569. background: #0076AD;
  570. border-radius: 3px;
  571. }
  572. }
  573. .content-bottom{
  574. margin-top: 35px;
  575. padding-bottom: 50px;
  576. p{
  577. font-size: 24px;
  578. color: #323232;
  579. img{
  580. margin-right: 20px;
  581. width: 30px;
  582. height: 28px;
  583. }
  584. }
  585. p.pass{
  586. font-size: 24px;
  587. color: #e77405;
  588. img{
  589. height: 30px;
  590. }
  591. }
  592. p.passed {
  593. color: #2ab300;
  594. img{
  595. height: 30px;
  596. }
  597. }
  598. span{
  599. display: inline-block;
  600. margin: 15px 0 140px 0;
  601. font-size: 14px;
  602. color: #8b8b8b;
  603. }
  604. .close-btn{
  605. margin: 0 auto;
  606. width: 200px;
  607. height: 36px;
  608. line-height: 36px;
  609. font-size: 14px;
  610. text-align: center;
  611. color: #323232;
  612. border: 1px solid #d2d2d2;
  613. border-radius: 3px;
  614. cursor: pointer ;
  615. }
  616. }
  617. }
  618. }
  619. }
  620. </style>