123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- <template>
- <view class="informantion_mask">
- <view class="informantion_content" @tap.stop.prevent>
- <view class="informantion-title">
- <view>
- <view @click="showCloseempty" style="height: 10%;">
- <p class="informantion-title-p">公告</p>
- </view>
- <view v-if="showClose >2" class="close-btn uni-column">
- <uni-icons class="icon-gear" type="closeempty" size="30" style="z-index: 5;"
- @click="close"></uni-icons>
- </view>
- </view>
- <div v-html="message" class="informantion-title-span"></div>
- <!-- {{message}} -->
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import {
- normalizeProps,
- reactive,
- onMounted,
- ref,
- getCurrentInstance
- } from 'vue'
- import {
- onLoad,
- onReady,
- onUnload,
- onShow,
- onReachBottom,
- onBackPress
- } from '@dcloudio/uni-app'
- import {
- store
- } from '@/store/index.js'
- const message = ref('')
- const showClose = ref(0)
- onMounted(() => {
- uni.hideLoading();
- const instance = getCurrentInstance().proxy
- const eventChannel = instance.getOpenerEventChannel();
- eventChannel.on('notification', function(data) {
- console.log('notification', data)
- if (data && data.data) {
- message.value = data.data.content;
- }
- })
- })
- onMounted((options) => {
- console.log('from:' + options.from)
- })
- function showCloseempty() {
- showClose.value += 1
- }
- function close() {
- store.isNotification = true
- let pages = getCurrentPages();
- let index = 0
- for (let i = pages.length - 1; i >= 0; i--) {
- if (pages[i].$page.fullPath != "/pages/notification/index") {
- index = pages.length - i - 1;
- break
- }
- }
- uni.navigateBack({
- delta: index
- });
- console.log(pages)
- }
- </script>
- <style lang="scss">
- page {
- width: 100%;
- height: 100%;
- background: rgba(0, 0, 0, 0.4);
- }
- .informantion_mask {
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- }
- .informantion_content {
- width: 600rpx;
- height: 820rpx;
- // height: 70%;
- overflow: hidden;
- border-radius: 10rpx;
- background-color: white;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- padding-bottom: 20rpx;
- }
- .informantion-title-span {
- height: 82%;
- overflow: auto;
- margin-bottom: -20px;
- }
- .mask-header {
- height: 400rpx;
- position: relative;
- background-image: url('../../static/images/bj.png');
- background-repeat: no-repeat;
- background-size: cover;
- image {
- width: 40rpx;
- height: 40rpx;
- position: absolute;
- top: 20rpx;
- right: 20rpx;
- }
- }
- .close-btn {
- position: absolute;
- right: 24rpx;
- top: 24rpx;
- width: 40rpx;
- height: 40rpx;
- z-index: 1003;
- .close-btn-icon {
- width: 40rpx;
- }
- }
- .informantion-title {
- overflow: auto;
- text-align: center;
- padding: 0 40rpx;
- p {
- font-size: 35rpx;
- font-weight: bold;
- line-height: 80rpx;
- }
- span {
- color: #6C6C6C;
- }
- }
- .informantion-btn {
- height: 93rpx;
- width: 80%;
- margin: 0 auto;
- }
- </style>
|