人民医院前端

fontSizeSettingPass.vue 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. isAllow:"",
  30. isRotate: false, //是否加载旋转
  31. range: [{
  32. value: 1,
  33. text: "小"
  34. },
  35. {
  36. value: 1.2,
  37. text: "中"
  38. },
  39. {
  40. value: 1.4,
  41. text: "大"
  42. },
  43. ],
  44. oldpass:'',
  45. newpass:'',
  46. confirmpass:''
  47. };
  48. },
  49. components: {
  50. wButton,
  51. },
  52. onLoad() {
  53. this.selectValue = uni.getStorageSync('fontSizeValue')
  54. },
  55. methods: {
  56. change(e) {
  57. console.log("e:", e);
  58. },
  59. getAllowDept(){
  60. const params = {}
  61. this.$http.get('Index/GetUserDept', params).then(res=>{
  62. if(res.message == '需要选择科室'){
  63. this.isAllow = "1"
  64. }else{
  65. this.isAllow = "0"
  66. }
  67. uni.setStorageSync('isAllow', this.isAllow)
  68. uni.switchTab({
  69. url: '/pages/myTask/myTask'
  70. });
  71. })
  72. },
  73. saveFont() {
  74. const reg = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,20}$/;
  75. if(!this.oldpass){
  76. this.$mHelper.toast("原密码不能为空");
  77. return
  78. }
  79. if(!this.newpass){
  80. this.$mHelper.toast("新密码不能为空");
  81. return
  82. }
  83. if(this.newpass == this.oldpass){
  84. this.$mHelper.toast("新密码不能和原密码相同!");
  85. return
  86. }
  87. if(!this.confirmpass){
  88. this.$mHelper.toast("确认密码不能为空");
  89. return
  90. }
  91. if(this.confirmpass != this.newpass){
  92. this.$mHelper.toast("两次密码不一致,请重新输入");
  93. return
  94. }
  95. if(!reg.test(this.newpass) || !reg.test(this.confirmpass)){
  96. this.$mHelper.toast("密码不符合规范,请重新输入密码");
  97. return
  98. }
  99. const params={
  100. oldpwd: md5.hex_md5(this.oldpass),
  101. pwd: md5.hex_md5(this.confirmpass),
  102. // username: uni.getStorageSync("userName"),
  103. usercode: uni.getStorageSync("userCode"),
  104. }
  105. this.$http.get("UserAccount/ResetPwd", params).then((response) => {
  106. if (response.state == "success") {
  107. this.$mHelper.toast("恭喜你,重置密码成功!");
  108. this.getAllowDept()
  109. }else{
  110. this.$mHelper.toast(response.message);
  111. }
  112. })
  113. },
  114. }
  115. }
  116. </script>
  117. <style scoped>
  118. #wrap {
  119. background: #fff;
  120. padding: 15px;
  121. }
  122. .btnClass {
  123. margin-top: 30px;
  124. }
  125. .fontContent {
  126. margin-top: 30px;
  127. }
  128. .changeFont_left {
  129. width: 25%;
  130. }
  131. .changeFont {
  132. margin-top: 30px;
  133. display: flex;
  134. background: #fff;
  135. line-height: 36px;
  136. }
  137. </style>