info copy.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <u-navbar :autoBack="false" :placeholder="true" :safeAreaInsetTop="true" :bgColor="proxy.$settingStore.themeColor.color">
  3. <template #left>
  4. <view class="u-navbar__content__left__item">
  5. <view class="u-navbar__content__left__item__title" style="color: #fff">消息</view>
  6. </view>
  7. </template>
  8. <template #right>
  9. <view class="u-navbar__content__right__item">
  10. <text class="iconfont oaIcon-qingchu" @click="handleIconClick('清除')"></text>
  11. </view>
  12. <view class="u-navbar__content__right__item">
  13. <text class="iconfont oaIcon-sousuo" @click="handleIconClick('搜索')"></text>
  14. </view>
  15. <view class="u-navbar__content__right__item">
  16. <text class="iconfont oaIcon-jiahao" @click="handleIconClick('加号')"></text>
  17. </view>
  18. </template>
  19. </u-navbar>
  20. <oa-scroll
  21. customClass="info-container scroll-height bg-white"
  22. :customStyle="{ height: `calc(100vh - (50px + ${proxy.$settingStore.barHightTop} + ${proxy.$settingStore.tabBarHeight}))` }"
  23. :refresherLoad="false"
  24. :refresherEnabled="true"
  25. :refresherEnabledTitle="false"
  26. :refresherDefaultStyle="'none'"
  27. :refresherThreshold="44"
  28. :refresherBackground="'#f5f6f7'"
  29. @refresh="init()"
  30. >
  31. <template #default>
  32. <view class="content-area" v-for="item in infoList" :key="item" @tap="goAppMessage(item.path)">
  33. <view class="content-area-avatar">
  34. <image class="image-bg" :src="item.img" />
  35. </view>
  36. <view class="content-area-child">
  37. <view class="uni-item mb5">
  38. <view class="uni-item-text font14" style="color: #000000">{{ item.label }}</view>
  39. <view class="uni-item-right font12" style="color: #909399">{{ item.time }}</view>
  40. </view>
  41. <view class="uni-item">
  42. <view class="uni-item-text font12" style="color: #909399">{{ item.cont }}</view>
  43. <view class="uni-item-right font12" style="margin: auto 0">
  44. <u-badge numberType="overflow" max="99" :value="item.badge"></u-badge>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. </oa-scroll>
  51. <oa-tabbar :tabbarValue="1"></oa-tabbar>
  52. </template>
  53. <script setup>
  54. /*----------------------------------依赖引入-----------------------------------*/
  55. import { onLoad, onShow, onHide, onLaunch } from "@dcloudio/uni-app";
  56. import { ref, onMounted, inject, shallowRef, reactive, getCurrentInstance, toRefs } from "vue";
  57. /*----------------------------------接口引入-----------------------------------*/
  58. import { getMceReceiveStatic } from "@/api/mine/info.js";
  59. /*----------------------------------组件引入-----------------------------------*/
  60. /*----------------------------------store引入-----------------------------------*/
  61. import { systemStores } from "@/store/modules/index";
  62. /*----------------------------------公共方法引入-----------------------------------*/
  63. /*----------------------------------公共变量-----------------------------------*/
  64. const { proxy } = getCurrentInstance();
  65. const systemStore = systemStores();
  66. const { message_type } = proxy.useDict("message_type");
  67. /*----------------------------------变量声明-----------------------------------*/
  68. const data = reactive({
  69. infoList: [
  70. {
  71. id: 1,
  72. label: "应用消息",
  73. img: "/static/images/common/appMessage.png",
  74. time: "5月15日",
  75. cont: "您收到一条最新消息,请及时查看",
  76. badge: 1,
  77. path: "/pages/common/appMessage/index",
  78. },
  79. // {
  80. // id: 2,
  81. // label: "消防知识库",
  82. // time: "5月15日",
  83. // cont: "您收到一条最新消息,请及时查看",
  84. // badge: 0,
  85. // },
  86. {
  87. id: 3,
  88. label: "告警通知",
  89. img: "/static/images/common/alarmMessage.png",
  90. time: "5月15日",
  91. cont: "您收到一条最新消息,请及时查看",
  92. badge: 0,
  93. path: "/pages/common/alarmMessage/index",
  94. },
  95. ],
  96. });
  97. const { infoList } = toRefs(data);
  98. function init() {
  99. getMceReceiveStatic().then((res) => {
  100. systemStore.infoList.messageCountData = res.data;
  101. systemStore.infoList.messageTypeData = message_type.value;
  102. res.data.infoTypeStatic.forEach((e) => {});
  103. });
  104. }
  105. function goAppMessage(path) {
  106. proxy.$tab.navigateTo(path);
  107. }
  108. function handleIconClick(type) {
  109. if (type === "清除") {
  110. } else if (type === "搜索") {
  111. proxy.$tab.navigateTo("/pages/common/searchSelect/index");
  112. } else if (type === "加号") {
  113. }
  114. }
  115. onShow(() => {
  116. init();
  117. });
  118. onLoad((options) => {
  119. uni.hideTabBar(); //隐藏自带tabbar
  120. });
  121. </script>
  122. <style lang="scss" scoped>
  123. .info-container {
  124. .content-area {
  125. display: flex;
  126. padding: 13px 13px 0 13px;
  127. &-avatar {
  128. display: flex;
  129. margin: auto 20upx auto 0;
  130. .image-bg {
  131. width: 40px;
  132. height: 40px;
  133. }
  134. }
  135. &-child {
  136. width: calc(100% - (32px + 0.625rem));
  137. justify-content: center;
  138. margin: auto;
  139. .uni-item {
  140. display: flex;
  141. white-space: nowrap;
  142. .uni-item-text {
  143. margin-right: auto;
  144. overflow: hidden;
  145. text-overflow: ellipsis;
  146. }
  147. .uni-item-right {
  148. width: auto;
  149. text-align: right;
  150. }
  151. }
  152. }
  153. }
  154. }
  155. </style>