eye.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * @Description: file content
  3. * @Version: 2.0
  4. * @Author: ljl
  5. * @Date: 2022-06-22 17:25:55
  6. * @LastEditors: ljl
  7. * @LastEditTime: 2022-07-15 21:35:09
  8. * @FilePath: \zyypt-ssb-vue_app\src\mixins\eye.js
  9. */
  10. import { getCookies, setCookies } from "@/utils/auth";
  11. //控制名称显隐
  12. function eye() {
  13. return {
  14. data() {
  15. return {
  16. eyeLock: true,
  17. info: {
  18. idcard: "",
  19. name: ''
  20. },
  21. }
  22. },
  23. methods: {
  24. eye(handleStyle) {
  25. if (handleStyle == 'refresh') {
  26. let eyeLock = getCookies('eyeLock')
  27. if (eyeLock) {
  28. this.eyeLock = JSON.parse(eyeLock)
  29. } else {
  30. this.eyeLock = true
  31. }
  32. } else {
  33. setCookies('eyeLock', this.eyeLock)
  34. }
  35. if (this.eyeLock) {
  36. this.info.name = new Array(this.info.name.length).join('*') + this.info.name.substr(-1)
  37. this.info.idcard = new Array(this.info.idcard.length-3).join('*') + this.info.idcard.substr(-4)
  38. this.eyeLock = !this.eyeLock;
  39. } else {
  40. if (getCookies('relativeInfo')) {
  41. this.info = JSON.parse(getCookies('relativeInfo'))
  42. } else {
  43. this.info = JSON.parse(getCookies('myInfo'))
  44. }
  45. this.eyeLock = !this.eyeLock;
  46. }
  47. },
  48. },
  49. }
  50. }
  51. export { eye }