changePswd.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <div class="dialog">
  3. <div class="dialog-header">
  4. <div class="dialog-title">
  5. <h1>您的密码过于简单</h1>
  6. <h1 style="margin-top: 10px;">请重新修改</h1>
  7. </div>
  8. <div class="dialog-main">
  9. <div class="dialog-content">
  10. <div class="dialog-content-item">
  11. <div class="dialog-content-item-content1">
  12. <span>
  13. 账号
  14. </span>
  15. <input v-model="account" type="text" placeholder="请输入新账户" class="input" />
  16. </div>
  17. <div class="dialog-content-item-content1">
  18. <span>
  19. <img src="@/assets/startIcon.svg" alt="字符" class="search-icon2" />
  20. 新密码
  21. </span>
  22. <input v-model="password" type="password" placeholder="请输入新密码" class="input" />
  23. </div>
  24. <div class="dialog-content-item-content1">
  25. <span>
  26. <img src="@/assets/startIcon.svg" alt="字符" class="search-icon2" />
  27. 新密码确认
  28. </span>
  29. <input v-model="password1" type="password" placeholder="请输入新密码" class="input" />
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="user_p">
  35. <p>
  36. 要确保您的帐户安全无虑,请设置安全系数高的密码,例如:密码应由字母或符号、数字组成.
  37. </p>
  38. </div>
  39. <button class="button" @click="confirmPswd">确认提交</button>
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. export default {
  45. name: 'changePswd',
  46. data() {
  47. return {
  48. userid: this.$route.query.userid,
  49. account: '',
  50. password: '',
  51. password1: ''
  52. }
  53. },
  54. methods: {
  55. getUser() {
  56. let params = {
  57. userid: this.userid
  58. };
  59. this.ajax
  60. .get(this.$store.state.api + "selectUser", params)
  61. .then(res => {
  62. this.account = res.data[0][0].accountNumber
  63. })
  64. .catch(err => {
  65. console.error(err);
  66. });
  67. },
  68. confirmPswd() {
  69. // 检查 password 和 password1 是否为空
  70. if (!this.password) {
  71. this.$message.error("请输入新密码");
  72. return;
  73. }
  74. if (!this.password1) {
  75. this.$message.error("请确认新密码");
  76. return;
  77. }
  78. const reg = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[A-Za-z\d]{8,16}$/;
  79. if (!reg.test(this.password)) {
  80. this.$message.error("密码长度为8-16位,且包含大小写字母");
  81. return;
  82. } else if (this.password != this.password1) {
  83. this.$message.error("两次新密码不相同");
  84. return;
  85. }
  86. let params = [
  87. {
  88. uid: this.userid,
  89. pa: this.password
  90. }
  91. ];
  92. this.ajax
  93. .post(this.$store.state.api + "iniPassword", params)
  94. .then((res) => {
  95. if (res.data.success == 1) {
  96. this.$message.success("修改成功")
  97. this.password = '';
  98. this.password1 = '';
  99. setTimeout(() => {
  100. window.topU.U.UF.F.closeWindow(window.topU.U.UF.UI.form.allForm['updatePaDialog'].form)
  101. }, 1000);
  102. }
  103. else {
  104. this.$message.error("修改失败");
  105. }
  106. })
  107. .catch((err) => {
  108. this.$message.error("修改失败");
  109. console.error(err);
  110. });
  111. }
  112. },
  113. mounted() {
  114. this.getUser()
  115. },
  116. }
  117. </script>
  118. <style scoped>
  119. html,
  120. body {
  121. height: 100%;
  122. margin: 0;
  123. display: flex;
  124. justify-content: center;
  125. align-items: center;
  126. }
  127. /* 弹窗整体大小 */
  128. .dialog {
  129. width: 100%;
  130. height: 100%;
  131. background-color: #fff;
  132. overflow: auto;
  133. }
  134. .dialog-header,
  135. .dialog-title,
  136. .dialog-main {
  137. padding: 20px;
  138. box-sizing: border-box;
  139. width: 100%;
  140. }
  141. .dialog-content-item-content1 {
  142. font-size: 15px;
  143. font-weight: 550;
  144. }
  145. .dialog-content-item-content1+.dialog-content-item-content1 {
  146. margin-top: 20px;
  147. }
  148. .changeTitle div {
  149. font-size: 32px;
  150. font-weight: bold;
  151. margin-bottom: 7px;
  152. }
  153. .dialog-content-item-content {
  154. font-size: 15px;
  155. font-weight: 550;
  156. margin-top: 20px;
  157. }
  158. /* input输入框样式 */
  159. .input {
  160. width: 100%;
  161. padding: 8px;
  162. margin-top: 10px;
  163. border: 1px solid #ccc;
  164. border-radius: 4px;
  165. background-color: #f0f2f5;
  166. height: 36px;
  167. outline: none;
  168. }
  169. .input>>>.el-input--suffix .el-input__inner {
  170. padding: 0
  171. }
  172. /* 用户协议框架 */
  173. .user_p {
  174. height: 50px;
  175. }
  176. .user_p p {
  177. color: #535353;
  178. font-size: 15px
  179. }
  180. /* 提交按钮样式 */
  181. .button {
  182. width: 100%;
  183. height: 50px;
  184. background-color: #3681fc;
  185. color: white;
  186. border: none;
  187. border-radius: 5px;
  188. font-size: 16px;
  189. cursor: pointer;
  190. text-align: center;
  191. margin-top: 10px;
  192. outline: none;
  193. }
  194. .search-icon2 {
  195. width: 10px;
  196. height: 10px;
  197. }
  198. </style>