info.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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">消息({{ stystemStore.infoList.static.total || 0 }})</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-shezhi" @click="handleIconClick('设置')"></text>
  17. </view>
  18. </template>
  19. </u-navbar>
  20. <scroll-view class="info-container bg-white" scroll-y :style="`height: calc(100vh - (50px + ${proxy.$settingStore.barHightTop} + ${proxy.$settingStore.tabBarHeight}))`">
  21. <view class="content-area" v-for="item in stystemStore.infoList.static.infoTypeStatic" :key="item" @tap="goAppMessage(`/pages/common/appMessage/index?type=${item.type}`)">
  22. <view class="content-area-avatar">
  23. <image class="image-bg" :src="item.img" />
  24. <view class="uni_top_right font12" style="margin: auto 0">
  25. <u-badge numberType="overflow" max="99" :value="item.notReadCount"></u-badge>
  26. </view>
  27. </view>
  28. <view class="content-area-child">
  29. <view class="uni-item mb5 ml10">
  30. <view class="uni-item-text font14" style="color: #000000">{{ item.label }}</view>
  31. </view>
  32. <view class="uni-item">
  33. <view class="uni-item-text font12" style="color: #909399">{{ item.cont }}</view>
  34. </view>
  35. </view>
  36. </view>
  37. </scroll-view>
  38. <oa-tabbar :tabbarValue="1"></oa-tabbar>
  39. </template>
  40. <script setup>
  41. /*----------------------------------依赖引入-----------------------------------*/
  42. import { onLoad, onShow, onHide, onLaunch } from "@dcloudio/uni-app";
  43. import { ref, onMounted, inject, shallowRef, reactive, getCurrentInstance, toRefs } from "vue";
  44. /*----------------------------------接口引入-----------------------------------*/
  45. import { getMceReceiveStatic, getDictList } from "@/api/mine/info.js";
  46. /*----------------------------------组件引入-----------------------------------*/
  47. /*----------------------------------store引入-----------------------------------*/
  48. import { stystemStores } from "@/store/modules/index";
  49. /*----------------------------------公共方法引入-----------------------------------*/
  50. /*----------------------------------公共变量-----------------------------------*/
  51. const { proxy } = getCurrentInstance();
  52. const stystemStore = stystemStores();
  53. /*----------------------------------变量声明-----------------------------------*/
  54. const data = reactive({
  55. infoList: [
  56. {
  57. id: 1,
  58. label: "应用消息",
  59. img: "/static/images/common/appMessage.png",
  60. time: "5月15日",
  61. cont: "您收到一条最新消息,请及时查看",
  62. badge: 1,
  63. path: "/pages/common/appMessage/index",
  64. },
  65. // {
  66. // id: 2,
  67. // label: "消防知识库",
  68. // time: "5月15日",
  69. // cont: "您收到一条最新消息,请及时查看",
  70. // badge: 0,
  71. // },
  72. {
  73. id: 3,
  74. label: "告警通知",
  75. img: "/static/images/common/alarmMessage.png",
  76. time: "5月15日",
  77. cont: "您收到一条最新消息,请及时查看",
  78. badge: 0,
  79. path: "/pages/common/alarmMessage/index",
  80. },
  81. ],
  82. });
  83. const { infoList } = toRefs(data);
  84. function init() {
  85. getMceReceiveStatic().then((res) => {
  86. getDictList({
  87. dictType: "sys_message_type",
  88. }).then((res1) => {
  89. let receiveStatic = { infoTypeStatic:res.data.infoTypeStatic ,total:res.data.notReadCount }
  90. let dictList = res1.data.rows
  91. if(receiveStatic.infoTypeStatic.length>0){
  92. for (let i = 0; i < receiveStatic.infoTypeStatic.length; i++) {
  93. for (let j = 0; j < dictList.length; j++) {
  94. if(receiveStatic.infoTypeStatic[i].infoType == dictList[j].dictValue){
  95. receiveStatic.infoTypeStatic[i].label = dictList[j].dictLabel
  96. receiveStatic.infoTypeStatic[i].type = dictList[j].dictValue
  97. if(receiveStatic.infoTypeStatic[i].infoType == 1){
  98. receiveStatic.infoTypeStatic[i].img = "/static/images/common/noticeMessage.png"
  99. }
  100. if(receiveStatic.infoTypeStatic[i].infoType == 2){
  101. receiveStatic.infoTypeStatic[i].img = "/static/images/common/inspectionMessage.png"
  102. }
  103. if(receiveStatic.infoTypeStatic[i].infoType == 3){
  104. receiveStatic.infoTypeStatic[i].img = "/static/images/common/meetingMessage.png"
  105. }
  106. if(receiveStatic.infoTypeStatic[i].infoType == 4){
  107. receiveStatic.infoTypeStatic[i].img = "/static/images/common/alarmMessage.png"
  108. }
  109. }
  110. }
  111. }
  112. }
  113. stystemStore.infoList.static = receiveStatic;
  114. });
  115. });
  116. }
  117. function goAppMessage(path) {
  118. proxy.$tab.navigateTo(path);
  119. }
  120. function handleIconClick(type) {
  121. if (type === "设置") {
  122. proxy.$tab.navigateTo("/pages/mine/msg/index")
  123. }
  124. }
  125. onShow(() => {
  126. init();
  127. });
  128. onLoad((options) => {
  129. uni.hideTabBar(); //隐藏自带tabbar
  130. });
  131. </script>
  132. <style lang="scss" scoped>
  133. .info-container {
  134. padding:0 12px;
  135. .content-area {
  136. display: flex;
  137. padding: 13px 13px 13px 0px;
  138. border-bottom:1px solid #EDEDED;
  139. &-avatar {
  140. display: flex;
  141. margin: auto 20upx auto 0;
  142. position: relative;
  143. .image-bg {
  144. width: 40px;
  145. height: 40px;
  146. }
  147. .uni_top_right{
  148. position: absolute;
  149. right:-10px;
  150. top:-4px;
  151. }
  152. }
  153. &-child {
  154. width: calc(100% - (32px + 0.625rem));
  155. justify-content: center;
  156. margin: auto;
  157. .uni-item {
  158. display: flex;
  159. white-space: nowrap;
  160. .uni-item-text {
  161. margin-right: auto;
  162. overflow: hidden;
  163. text-overflow: ellipsis;
  164. }
  165. .uni-item-right {
  166. width: auto;
  167. text-align: right;
  168. }
  169. }
  170. }
  171. }
  172. }
  173. </style>