人民医院前端

fontSizeSettingPass.vue 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <!-- <page-meta :root-font-size="getRootFontSize(1)"></page-meta> -->
  3. <view id="wrap">
  4. <view class="changeFont">
  5. <view class="changeFont_left"><text style="color: #ff0000; ">*</text>原密码:</view>
  6. <uni-easyinput v-model="oldpass" placeholder="原密码" type="password"/>
  7. </view>
  8. <view class="changeFont">
  9. <view class="changeFont_left"><text style="color: #ff0000; ">*</text>新密码:</view>
  10. <uni-easyinput v-model="newpass" placeholder="新密码(8-20位包含字母大小写,数字和下划线)" type="password"/>
  11. </view>
  12. <view class="changeFont">
  13. <view class="changeFont_left"><text style="color: #ff0000; ">*</text>确认密码:</view>
  14. <uni-easyinput v-model="confirmpass" placeholder="确认密码(8-20位包含字母大小写,数字和下划线)" type="password"/>
  15. </view>
  16. <view class="btnClass">
  17. <wButton class="wbutton" text="保存" :rotate="isRotate" @click="saveFont"></wButton>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import wButton from '@/components/watch-login/watch-button.vue' //button
  23. import { encrypt, decrypt } from "@/utils/jsencrypt";
  24. import md5 from '@/static/js/md5/md5.js'
  25. export default {
  26. data() {
  27. return {
  28. selectValue: 1,
  29. isRotate: false, //是否加载旋转
  30. range: [{
  31. value: 1,
  32. text: "小"
  33. },
  34. {
  35. value: 1.2,
  36. text: "中"
  37. },
  38. {
  39. value: 1.4,
  40. text: "大"
  41. },
  42. ],
  43. oldpass:'',
  44. newpass:'',
  45. confirmpass:''
  46. };
  47. },
  48. components: {
  49. wButton,
  50. },
  51. onLoad() {
  52. this.selectValue = uni.getStorageSync('fontSizeValue')
  53. },
  54. methods: {
  55. change(e) {
  56. console.log("e:", e);
  57. },
  58. saveFont() {
  59. const reg = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*_).{8,20}$/;
  60. if(!this.oldpass){
  61. this.$mHelper.toast("原密码不能为空");
  62. return
  63. }
  64. if(!this.newpass){
  65. this.$mHelper.toast("新密码不能为空");
  66. return
  67. }
  68. if(!this.confirmpass){
  69. this.$mHelper.toast("确认密码不能为空");
  70. return
  71. }
  72. if(this.confirmpass != this.newpass){
  73. this.$mHelper.toast("两次密码不一致,请重新输入");
  74. return
  75. }
  76. if(!reg.test(this.newpass) || !reg.test(this.confirmpass)){
  77. this.$mHelper.toast("密码不符合规范,请重新输入密码");
  78. return
  79. }
  80. const params={
  81. oldpwd: md5.hex_md5(this.oldpass),
  82. pwd: md5.hex_md5(this.confirmpass),
  83. username: uni.getStorageSync("userName"),
  84. usercode: uni.getStorageSync("userCode"),
  85. phone: "",
  86. }
  87. this.$http.get("UserAccount/ResetPwd", params).then((response) => {
  88. if (response.state == "success") {
  89. this.$mHelper.toast("恭喜你,重置密码成功!");
  90. }else{
  91. this.$mHelper.toast(response.message);
  92. }
  93. })
  94. },
  95. }
  96. }
  97. </script>
  98. <style scoped>
  99. #wrap {
  100. background: #fff;
  101. padding: 15px;
  102. }
  103. .btnClass {
  104. margin-top: 30px;
  105. }
  106. .fontContent {
  107. margin-top: 30px;
  108. }
  109. .changeFont_left {
  110. width: 25%;
  111. }
  112. .changeFont {
  113. margin-top: 30px;
  114. display: flex;
  115. background: #fff;
  116. line-height: 36px;
  117. }
  118. </style>