toastIndex.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <section class="toastBox" @click="closeToast" v-if="!!type">
  3. <div class="toastArea">
  4. <div class="toastContent" @click.stop="()=>{}" ref="toastContent">
  5. <!--实名认证-->
  6. <realNameAuth v-if="type === 'openRealNameAuth'"/>
  7. <!--工作经历-->
  8. <workHistory v-if="type === 'openWorkHistory'" :dataInfo="dataInfo" :submitRefresh="submitRefresh"/>
  9. <!--最高学历认证-->
  10. <Education v-if="type === 'openEducation'" :dataInfo="dataInfo" :submitRefresh="submitRefresh"/>
  11. <i class="el-icon-close closeIcon" @click="closeToast"></i>
  12. </div>
  13. </div>
  14. </section>
  15. </template>
  16. <script>
  17. import realNameAuth from './toast/realNameAuth'
  18. import workHistory from './toast/workHistory'
  19. import Education from './toast/education'
  20. export default {
  21. components: { realNameAuth, workHistory, Education },
  22. props: {
  23. closeToast: {
  24. type: Function,
  25. required: true
  26. },
  27. type: {
  28. type: String,
  29. default: ''
  30. },
  31. dataInfo: {
  32. type: Object,
  33. default: function () {
  34. return {}
  35. }
  36. },
  37. submitRefresh: {
  38. type: Function,
  39. default: function () {
  40. }
  41. },
  42. },
  43. watch: {
  44. type: function () {
  45. console.log('typeChange', this.type)
  46. this.resizeFn()
  47. }
  48. },
  49. data() {
  50. return {
  51. mobile: this.$deviceType.isMobile()
  52. }
  53. },
  54. created() {
  55. },
  56. mounted() {
  57. this.resizeFn()
  58. window.onresize = this.resizeFn
  59. },
  60. methods: {
  61. resizeFn() {
  62. this.$nextTick(()=>{
  63. if (this.type) {
  64. let domContent = this.$refs.toastContent
  65. if (document.body.clientHeight - 50 <= domContent.clientHeight) {
  66. domContent.style.transform = `scale(${(document.body.clientHeight - 100)/domContent.clientHeight})`
  67. domContent.style.transformOrigin = `center`
  68. } else if (document.body.clientWidth - 50 <= domContent.clientWidth) {
  69. domContent.style.transform = `scale(${(document.body.clientWidth - 100)/domContent.clientWidth})`
  70. domContent.style.transformOrigin = `center`
  71. } else {
  72. domContent.style.transform = `scale(1)`
  73. domContent.style.transformOrigin = `center`
  74. }
  75. }
  76. })
  77. }
  78. },
  79. };
  80. </script>
  81. <style scoped lang="scss">
  82. .toastBox {
  83. width: 100vw;
  84. height: 100vh;
  85. position: fixed;
  86. left: 0;
  87. top: 0;
  88. z-index: 1010;
  89. background: rgba(0, 0, 0, 0.2);
  90. p {
  91. margin-bottom: 0;
  92. }
  93. .toastArea {
  94. width: 100vw;
  95. height: 100vh;
  96. display: flex;
  97. justify-content: center;
  98. align-items: center;
  99. .toastContent {
  100. position: absolute;
  101. min-width: 100px;
  102. min-height: 100px;
  103. background: rgba(255, 255, 255, 1);
  104. border-radius: 11px;
  105. }
  106. .closeIcon {
  107. position: absolute;
  108. right: 23px;
  109. top: 32px;
  110. width: 18px;
  111. height: 18px;
  112. color: #666666;
  113. font-size: 20px;
  114. font-weight: 600;
  115. transform: scale(1.2);
  116. transform-origin: center;
  117. cursor: pointer;
  118. }
  119. }
  120. }
  121. </style>