index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="informantion_mask">
  3. <view class="informantion_content" @tap.stop.prevent>
  4. <view class="informantion-title">
  5. <view>
  6. <view @click="showCloseempty" style="height: 10%;">
  7. <p class="informantion-title-p">公告</p>
  8. </view>
  9. <view v-if="showClose >2" class="close-btn uni-column">
  10. <uni-icons class="icon-gear" type="closeempty" size="30" style="z-index: 5;"
  11. @click="close"></uni-icons>
  12. </view>
  13. </view>
  14. <div v-html="message" class="informantion-title-span"></div>
  15. <!-- {{message}} -->
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script setup>
  21. import {
  22. normalizeProps,
  23. reactive,
  24. onMounted,
  25. ref,
  26. getCurrentInstance
  27. } from 'vue'
  28. import {
  29. onLoad,
  30. onReady,
  31. onUnload,
  32. onShow,
  33. onReachBottom,
  34. onBackPress
  35. } from '@dcloudio/uni-app'
  36. import {
  37. store
  38. } from '@/store/index.js'
  39. const message = ref('')
  40. const showClose = ref(0)
  41. onMounted(() => {
  42. uni.hideLoading();
  43. const instance = getCurrentInstance().proxy
  44. const eventChannel = instance.getOpenerEventChannel();
  45. eventChannel.on('notification', function(data) {
  46. console.log('notification', data)
  47. if (data && data.data) {
  48. message.value = data.data.content;
  49. }
  50. })
  51. })
  52. onMounted((options) => {
  53. console.log('from:' + options.from)
  54. })
  55. function showCloseempty() {
  56. showClose.value += 1
  57. }
  58. function close() {
  59. store.isNotification = true
  60. let pages = getCurrentPages();
  61. uni.navigateBack({
  62. delta: pages.length - 2
  63. });
  64. console.log(pages)
  65. }
  66. </script>
  67. <style lang="scss">
  68. page {
  69. width: 100%;
  70. height: 100%;
  71. background: rgba(0, 0, 0, 0.4);
  72. }
  73. .informantion_mask {
  74. width: 100%;
  75. height: 100%;
  76. display: flex;
  77. flex-direction: row;
  78. justify-content: center;
  79. align-items: center;
  80. }
  81. .informantion_content {
  82. width: 600rpx;
  83. height: 820rpx;
  84. // height: 70%;
  85. overflow: hidden;
  86. border-radius: 10rpx;
  87. background-color: white;
  88. display: flex;
  89. flex-direction: column;
  90. justify-content: space-between;
  91. padding-bottom: 20rpx;
  92. }
  93. .informantion-title-span {
  94. height: 82%;
  95. overflow: auto;
  96. margin-bottom: -20px;
  97. }
  98. .mask-header {
  99. height: 400rpx;
  100. position: relative;
  101. background-image: url('../../static/images/bj.png');
  102. background-repeat: no-repeat;
  103. background-size: cover;
  104. image {
  105. width: 40rpx;
  106. height: 40rpx;
  107. position: absolute;
  108. top: 20rpx;
  109. right: 20rpx;
  110. }
  111. }
  112. .close-btn {
  113. position: absolute;
  114. right: 24rpx;
  115. top: 24rpx;
  116. width: 40rpx;
  117. height: 40rpx;
  118. z-index: 1003;
  119. .close-btn-icon {
  120. width: 40rpx;
  121. }
  122. }
  123. .informantion-title {
  124. overflow: auto;
  125. text-align: center;
  126. padding: 0 40rpx;
  127. p {
  128. font-size: 35rpx;
  129. font-weight: bold;
  130. line-height: 80rpx;
  131. }
  132. span {
  133. color: #6C6C6C;
  134. }
  135. }
  136. .informantion-btn {
  137. height: 93rpx;
  138. width: 80%;
  139. margin: 0 auto;
  140. }
  141. </style>