updataPassword.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="">
  3. <view class="body">
  4. 归属人:{{name}}
  5. </view>
  6. <form @submit="updata">
  7. <view class="body">
  8. 登录名:<input class="input" name="userName" :value=username />
  9. </view>
  10. <view class="body">
  11. 旧密码:<input class="input" password name="oldPassword" />
  12. </view>
  13. <view class="body">
  14. 新密码:<input class="input" password name="password" />
  15. </view>
  16. <view class="body">
  17. 确认密码:<input class="input" password name="password1" />
  18. </view>
  19. <view class="">
  20. <button type="primary" formType="submit" class="button">
  21. <p class="p">提交</p>
  22. </button>
  23. </view>
  24. </form>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. mapState,
  30. mapActions,
  31. mapMutations
  32. } from 'vuex'
  33. export default {
  34. data() {
  35. return {
  36. name: '',
  37. username: "",
  38. parm: {
  39. name: null,
  40. id: null
  41. },
  42. };
  43. },
  44. onPullDownRefresh() {},
  45. onShow() {
  46. var token = uni.getStorageSync("token");
  47. if (token.length > 1) {
  48. var name = uni.getStorageSync("name");
  49. this.name = name;
  50. this.username = uni.getStorageSync("globalUser").userName;
  51. } else {
  52. uni.reLaunch({
  53. url: '../Login/Login',
  54. });
  55. }
  56. },
  57. onLoad() {
  58. },
  59. methods: {
  60. // ...mapActions('chart', ['updata']),
  61. updata(event) {
  62. const {
  63. value: user
  64. } = event.detail;
  65. var password = user.password;
  66. var password1 = user.password1;
  67. if (password != password1) {
  68. uni.showModal({
  69. title: '提示',
  70. content: '两次输入密码不一致',
  71. });
  72. return null;
  73. }
  74. this.$store.dispatch('updataPassword', user).then(_ => {
  75. uni.showModal({
  76. title: '提示',
  77. content: _.message,
  78. success: function(res) {
  79. uni.navigateTo({
  80. url: '/pages/Login/Login',
  81. });
  82. }
  83. });
  84. });
  85. },
  86. }
  87. }
  88. </script>
  89. <style>
  90. .body {
  91. background-color: #FFFFFF;
  92. padding: 20upx 20upx 20upx 20upx;
  93. display: flex;
  94. flex-direction: row;
  95. justify-content: flex-start;
  96. }
  97. .input {
  98. /* padding: 10upx 20upx 10upx 0upx; */
  99. padding-left: 20upx;
  100. padding-top: 10upx;
  101. background-color: #FFFFFF;
  102. width: 500upx;
  103. height: 50upx;
  104. box-shadow: 0upx 0upx 20upx #D3D3D3;
  105. border-radius: 5upx;
  106. }
  107. .button {
  108. margin: auto;
  109. width: 60%;
  110. height: 100upx;
  111. }
  112. .p {
  113. /* #ifdef H5 */
  114. top: -13%;
  115. /* #endif */
  116. width: 80upx;
  117. height: 60upx;
  118. font-size: 40upx;
  119. padding-top: 6upx;
  120. /* #ifndef H5 */
  121. padding-top: 10upx;
  122. /* #endif */
  123. position: absolute;
  124. /* 水平居中 */
  125. left: 50%;
  126. -webkit-transform: translateX(-50%);
  127. transform: translateX(-50%);
  128. }
  129. </style>