PasswordStepBefore.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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/step01.png" alt=""/>
  9. <div class="step-item"><span class="active">账号验证</span><span>密码设置</span><span>设置完成</span></div>
  10. <a @click="chooseWay('select')" class="return"><img src="/images/all/return.png" alt=""/></a>
  11. </div>
  12. </div>
  13. <div class="content-bottom">
  14. <div>
  15. <el-form :model="valid1" :rules="rules1" ref="valid1" label-width="100px" class="demo-ruleForm" style="margin-top: 0;">
  16. <el-form-item prop="password">
  17. <el-input type="password" v-model="valid1.password"
  18. auto-complete="off"
  19. placeholder="请输入当前密码"></el-input>
  20. </el-form-item>
  21. <el-form-item>
  22. <a class="btn finish"
  23. :disabled="!oldPasswordChecked"
  24. @click="goPasswordNextStep">下一步</a>
  25. </el-form-item>
  26. </el-form>
  27. </div>
  28. </div>
  29. </div>
  30. <loading v-show="isShowLoading"/>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. import Loading from '~components/common/loading/Loading.vue'
  36. export default {
  37. name: 'validation',
  38. components: {
  39. Loading
  40. },
  41. data () {
  42. // 第一步验证原密码
  43. var validateFirstPassword = (rule, value, callback) => {
  44. if (value === '') {
  45. callback(new Error('请填写原密码'))
  46. this.oldPasswordChecked = false
  47. } else {
  48. if (this.valid1.password !== '') {
  49. if (this.valid1.password.length >= 20) {
  50. callback(new Error('密码长度不超过20个字符'))
  51. this.oldPasswordChecked = false
  52. } else {
  53. this.oldPasswordChecked = true
  54. }
  55. }
  56. callback()
  57. }
  58. }
  59. return {
  60. isShowLoading: false,
  61. oldPasswordChecked: false,
  62. valid1: {
  63. password: ''
  64. },
  65. rules1: {
  66. password: [
  67. {validator: validateFirstPassword, trigger: 'blur'}
  68. ]
  69. }
  70. }
  71. },
  72. methods: {
  73. // 选择方式
  74. chooseWay (type) {
  75. this.$emit('stepEvent', type)
  76. },
  77. // 原密码验证
  78. goPasswordNextStep () {
  79. if (this.oldPasswordChecked) {
  80. this.isShowLoading = true
  81. let param = new FormData()
  82. param.append('password', this.valid1.password)
  83. let config = {
  84. headers: {'Content-Type': 'multipart/form-data'}
  85. }
  86. this.$http.post(`/sso/resetPwd/check/password`, param, config)
  87. .then(response => {
  88. this.isShowLoading = false
  89. if (response.data.success) {
  90. this.$emit('stepEvent', 'security')
  91. this.$emit('tokenEvent', response.data.content.token)
  92. } else {
  93. return Promise.reject(response.data)
  94. }
  95. }).catch(err => {
  96. this.isShowLoading = false
  97. this.$message.error(err.errMsg)
  98. })
  99. }
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .validation {
  106. margin: 0 auto;
  107. width: 100%;
  108. background: #eee;
  109. .container{
  110. padding-top: 50px;
  111. margin: 0 auto;
  112. width: 980px;
  113. text-align: center;
  114. .content{
  115. padding: 0 50px;
  116. margin: 50px auto 0;
  117. width: 100%;
  118. /*height: 540px;*/
  119. text-align: center;
  120. background: #fff;
  121. .content-top{
  122. height: 80px;
  123. line-height: 80px;
  124. h3{
  125. margin-bottom: 0;
  126. font-size: 24px;
  127. color: #000;
  128. border-bottom: 1px solid #dcdcdc;
  129. }
  130. .step{
  131. position: relative;
  132. margin-top: 10px;
  133. img{
  134. width: 315px;
  135. height: 46px;
  136. }
  137. .step-item{
  138. position: absolute;
  139. top: 45px;
  140. left: 265px;
  141. span{
  142. margin-right: 85px;
  143. font-size: 14px;
  144. color: #b4b4b4;
  145. }
  146. span.active {
  147. color: #0076ad;
  148. }
  149. }
  150. }
  151. }
  152. form {
  153. margin-top: 150px;
  154. padding-bottom: 44px;
  155. input{
  156. padding: 0 0 0 18px;
  157. width: 360px;
  158. height: 44px;
  159. line-height: 44px;
  160. font-size: 14px;
  161. color: #000;
  162. border-radius: 0;
  163. }
  164. input.answer {
  165. background: url("/images/all/more.png") no-repeat 325px center;
  166. cursor: pointer;
  167. }
  168. ul{
  169. display: none;
  170. position: absolute;
  171. top: 44px;
  172. left: 0;
  173. width: 360px;
  174. background: #fff;
  175. box-shadow: 0 0 5px rgba(0,0,0,.5);
  176. -moz-box-shadow: 0 0 5px rgba(0,0,0,.5);
  177. -o-box-shadow: 0 0 5px rgba(0,0,0,.5);
  178. -webkit-box-shadow: 0 0 5px rgba(0,0,0,.5);
  179. z-index: 10;
  180. li{
  181. padding-left: 18px;
  182. width: 100%;
  183. height: 30px;
  184. line-height: 30px;
  185. text-align: left;
  186. font-size: 14px;
  187. color: #000;
  188. cursor: pointer;
  189. &:hover{
  190. background: #0076ad;
  191. color: #fff;
  192. }
  193. }
  194. }
  195. span.tip{
  196. position: absolute;
  197. top: 0;
  198. right: -238px;
  199. font-size: 13px;
  200. color: #8c8c8c;
  201. a{
  202. font-size: 13px;
  203. color: #0076ad;
  204. }
  205. }
  206. span.tip.codeError-tip{
  207. position: absolute;
  208. top: 3px;
  209. left: 378px;
  210. width: 200px;
  211. text-align: left;
  212. color: #ff4949;
  213. font-size: 12px;
  214. }
  215. i{
  216. position: absolute;
  217. top: 13px;
  218. left: 20px;
  219. font-size: 20px;
  220. color: #a0a0a0;
  221. }
  222. .btn {
  223. margin: 34px 0 16px 0;
  224. width: 360px;
  225. height: 44px;
  226. line-height: 44px;
  227. font-size: 16px;
  228. color: #fff;
  229. background: #0076AD;
  230. border-radius: 3px;
  231. }
  232. }
  233. .content-bottom{
  234. margin: 155px auto 0;
  235. padding-bottom: 50px;
  236. width: 360px;
  237. div.warp{
  238. padding-bottom: 65px;
  239. }
  240. p{
  241. font-size: 24px;
  242. color: #323232;
  243. img{
  244. margin-right: 20px;
  245. width: 30px;
  246. height: 28px;
  247. }
  248. }
  249. p.pass{
  250. font-size: 24px;
  251. color: #e77405;
  252. img{
  253. height: 30px;
  254. }
  255. }
  256. p.passed {
  257. color: #2ab300;
  258. img{
  259. height: 30px;
  260. }
  261. }
  262. span{
  263. display: inline-block;
  264. font-size: 14px;
  265. color: #8b8b8b;
  266. }
  267. span.close-tip{
  268. margin: 15px 0 140px 0;
  269. }
  270. .close-btn{
  271. margin: 0 auto;
  272. width: 200px;
  273. height: 36px;
  274. line-height: 36px;
  275. font-size: 14px;
  276. text-align: center;
  277. color: #323232;
  278. border: 1px solid #d2d2d2;
  279. border-radius: 3px;
  280. cursor: pointer ;
  281. }
  282. span.use{
  283. display: inline-block;
  284. margin-bottom: 30px;
  285. width: 360px;
  286. font-size: 14px;
  287. color: #000;
  288. text-align: left;
  289. em{
  290. font-size: 14px;
  291. font-style: normal;
  292. color: #000;
  293. }
  294. }
  295. .form-group {
  296. margin: 0 auto 16px;
  297. position: relative;
  298. width: 360px;
  299. height: 44px;
  300. line-height: 44px;
  301. input{
  302. padding: 0 0 0 18px;
  303. width: 360px;
  304. height: 44px;
  305. line-height: 44px;
  306. font-size: 14px;
  307. color: #000;
  308. border-radius: 0;
  309. }
  310. input.msg{
  311. float: left;
  312. width: 210px;
  313. padding: 0 0 0 18px;
  314. height: 44px;
  315. line-height: 44px;
  316. font-size: 14px;
  317. color: #000;
  318. border-radius: 0;
  319. }
  320. span.msg{
  321. float: right;
  322. margin: 0;
  323. width: 130px;
  324. height: 44px;
  325. line-height: 44px;
  326. text-align: center ;
  327. font-size: 14px;
  328. color: #5a5a5a;
  329. background: #f4f4f4;
  330. border: 1px solid #dcdcdc;
  331. cursor: pointer;
  332. }
  333. span.msg.send{
  334. background: #d2d2d2;
  335. color: #fff;
  336. }
  337. }
  338. .btn {
  339. margin: 34px 0 10px 0;
  340. width: 360px;
  341. height: 44px;
  342. line-height: 44px;
  343. font-size: 16px;
  344. color: #fff;
  345. background: #0076AD;
  346. border-radius: 3px;
  347. }
  348. }
  349. .choose{
  350. margin: 155px auto 0;
  351. padding-bottom: 44px;
  352. div{
  353. padding: 0 15px;
  354. margin: 0 auto 16px;
  355. width: 360px;
  356. height: 60px;
  357. line-height: 60px;
  358. text-align: left;
  359. overflow: hidden;
  360. border: 1px solid #d2d2d2;
  361. cursor: pointer;
  362. &:hover,&.active{
  363. border-color: #0076ad;
  364. span{
  365. color: #0076ad;
  366. }
  367. i.second {
  368. color: #0076ad;
  369. }
  370. }
  371. img.first{
  372. float: left;
  373. margin: 24px 20px 0 0;
  374. font-size: 20px;
  375. color: #323232;
  376. }
  377. img.first.mob{
  378. margin: 22px 20px 0 5px;
  379. font-size: 28px;
  380. }
  381. i.second {
  382. float: right;
  383. margin: 20px 0 0 5px;
  384. font-size: 20px;
  385. color: #323232;
  386. }
  387. span{
  388. float: left;
  389. font-size: 14px;
  390. color: #323232;
  391. }
  392. }
  393. }
  394. a.return{
  395. position: absolute;
  396. left: 0;
  397. top: -15px;
  398. img{
  399. width: 34px !important;
  400. height: 34px !important;
  401. }
  402. }
  403. }
  404. }
  405. }
  406. </style>