ResetPasswordByUrl.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div class="hello">
  3. <Header> </Header>
  4. <el-container>
  5. <el-card class="center-card">
  6. <el-form status-icon label-width="0px" class="demo-ruleForm">
  7. <h2>重置密码</h2>
  8. <el-form-item label="" >
  9. <el-input type="password" auto-complete="off" placeholder="请输入新密码" v-model="new_password"></el-input>
  10. </el-form-item>
  11. <el-form-item label="" >
  12. <el-button type="primary" style="width:100%;" @click="onSubmit" >提交</el-button>
  13. </el-form-item>
  14. <el-form-item label="" >
  15. <router-link to="/user/login">去登录</router-link>
  16. &nbsp;&nbsp;&nbsp;
  17. </el-form-item>
  18. </el-form>
  19. </el-card>
  20. </el-container>
  21. <Footer> </Footer>
  22. </div>
  23. </template>
  24. <script>
  25. export default {
  26. name: '',
  27. components : {
  28. },
  29. data () {
  30. return {
  31. new_password: '',
  32. }
  33. },
  34. methods: {
  35. onSubmit() {
  36. //this.$message.success(this.username);
  37. var that = this ;
  38. var url = DocConfig.server+'/api/user/resetPasswordByUrl';
  39. var params = new URLSearchParams();
  40. params.append('new_password', this.new_password);
  41. params.append('uid', this.$route.query.uid);
  42. params.append('email', this.$route.query.email);
  43. params.append('token', this.$route.query.token);
  44. that.axios.post(url, params)
  45. .then(function (response) {
  46. if (response.data.error_code === 0 ) {
  47. let redirect = decodeURIComponent(that.$route.query.redirect || '/item/index');
  48. that.$router.replace({
  49. path: redirect
  50. });
  51. }else{
  52. that.$alert(response.data.error_message);
  53. }
  54. });
  55. }
  56. },
  57. mounted() {
  58. /*给body添加类,设置背景色*/
  59. document.getElementsByTagName("body")[0].className="grey-bg";
  60. document.title = this.$route.meta.title;
  61. },
  62. beforeDestroy(){
  63. /*去掉添加的背景色*/
  64. document.body.removeAttribute("class","grey-bg");
  65. }
  66. }
  67. </script>
  68. <!-- Add "scoped" attribute to limit CSS to this component only -->
  69. <style scoped>
  70. .center-card a {
  71. font-size: 12px;
  72. }
  73. .center-card{
  74. text-align: center;
  75. }
  76. .v_code_img{
  77. margin-top: 20px;
  78. }
  79. </style>