index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <u-sticky class="shadow-default" bgColor="#fff" style="top: 0">
  3. <u-tabs :list="tabsList" :current="tabsCurrent" @click="tabsClick" lineColor="#333" :activeStyle="{ color: '#333' }" :inactiveStyle="{ color: '#909399' }" :scrollable="true"></u-tabs>
  4. </u-sticky>
  5. <scroll-view class="scroll-height" :scroll-y="true" :scroll-into-view="scrollIntoView" :data-theme="'theme-' + proxy.$settingStore.themeColor.name" style="padding-bottom: 44px">
  6. <view class="applicationInfo-container">
  7. <view class="content-area" v-show="tabsCurrent == 0">
  8. <u-empty v-show="allInfoList.length <= 0" text="暂无数据" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"> </u-empty>
  9. <view :id="index == allInfoList.length - 1 ? 'bottomInfo' : ''" v-for="(all, index) in allInfoList" :key="index" v-show="allInfoList.length > 0" @click="goContentDetails(all)">
  10. <view class="content-area-time text-sm">{{ all.listTime }}</view>
  11. <view class="content-area-center radius bg-white">
  12. <view class="content-area-center-title">{{ all.typeTitle }}</view>
  13. <view class="content-area-center-cont">{{ all.listTitle }}</view>
  14. <view class="content-area-center-buttom text-sm">查看详情 </view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="content-area" v-show="tabsCurrent == 1">
  19. <u-empty v-show="noticeList.length <= 0" text="暂无数据" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"> </u-empty>
  20. <view :id="index == noticeList.length - 1 ? 'bottomInfo' : ''" v-for="(all, index) in noticeList" :key="index" v-show="noticeList.length > 0" @click="goContentDetails(all)">
  21. <view class="content-area-time text-sm">{{ all.listTime }}</view>
  22. <view class="content-area-center radius bg-white">
  23. <view class="content-area-center-title">{{ all.typeTitle }}</view>
  24. <view class="content-area-center-cont">{{ all.listTitle }}</view>
  25. <view class="content-area-center-buttom text-sm">查看详情 </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </scroll-view>
  31. </template>
  32. <script setup>
  33. import { onLoad, onShow, onReady, onHide, onLaunch, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
  34. import { ref, reactive, computed, getCurrentInstance, toRefs, inject } from "vue";
  35. import { publicStores, useStores } from "@/store/modules/index";
  36. import { infoList } from "@/api/common/applicationInfo.js";
  37. const useStore = useStores();
  38. const { proxy } = getCurrentInstance();
  39. const data = reactive({
  40. scrollIntoView: "",
  41. tabsList: [
  42. {
  43. name: "全部",
  44. },
  45. {
  46. name: "通知公告",
  47. },
  48. ],
  49. tabsCurrent: 0,
  50. allInfoList: [],
  51. noticeList: [],
  52. });
  53. const { scrollIntoView, scrollIntoViewBool, tabsList, tabsCurrent, allInfoList, noticeList } = toRefs(data);
  54. /**
  55. * @初始化
  56. */
  57. function init() {
  58. infoListApi();
  59. }
  60. /**
  61. * @tabs点击事件
  62. */
  63. function tabsClick(e) {
  64. tabsCurrent.value = e.index;
  65. }
  66. /**
  67. * @跳转
  68. */
  69. function goContentDetails(e) {
  70. if (e.type == "通知公告") {
  71. proxy.$tab.navigateTo(`/pages/common/textview/index1?title=${e.typeTitle}&content=${e.listContent}&contentTitle=${e.listTitle}`);
  72. }
  73. }
  74. /**
  75. * @通知公告列表
  76. * @api接口调用
  77. */
  78. function infoListApi() {
  79. proxy.$modal.loading("加载中");
  80. infoList({
  81. pageNum: 1,
  82. pageSize: 20000,
  83. }).then((requset) => {
  84. if (requset.status === "SUCCESS") {
  85. requset.data.rows.forEach((el) => {
  86. allInfoList.value.push({
  87. type: "通知公告",
  88. typeTitle: el.noticeType === "1" ? "系统通知" : el.noticeType === "2" ? "系统公告" : "系统消息",
  89. listTime: proxy.$common.jktTimes(el.createTime),
  90. listCreateTime: el.createTime,
  91. listTitle: el.noticeTitle,
  92. listContent: el.noticeContent,
  93. });
  94. noticeList.value.push({
  95. type: "通知公告",
  96. typeTitle: el.noticeType === "1" ? "系统通知" : el.noticeType === "2" ? "系统公告" : "系统消息",
  97. listTime: proxy.$common.jktTimes(el.createTime),
  98. listCreateTime: proxy.$common.jktTimes(el.createTime),
  99. listTitle: el.noticeTitle,
  100. listContent: el.noticeContent,
  101. });
  102. });
  103. setTimeout(() => {
  104. scrollIntoView.value = "bottomInfo";
  105. }, 0);
  106. setTimeout(() => {
  107. proxy.$modal.closeLoading();
  108. }, 100);
  109. }
  110. });
  111. }
  112. onLoad((options) => {
  113. init();
  114. });
  115. onReady(() => {});
  116. onShow(() => {
  117. //调用系统主题颜色
  118. proxy.$settingStore.systemThemeColor([1]);
  119. });
  120. // 自定义导航事件
  121. onNavigationBarButtonTap((e) => {
  122. if (e.float == "right") {
  123. proxy.$tab.navigateTo("/pages/mine/setting/index");
  124. }
  125. });
  126. </script>
  127. <style lang="scss" scoped>
  128. :deep(.uni-page-head__title) {
  129. opacity: 1 !important;
  130. }
  131. .applicationInfo-container {
  132. padding-bottom: 1px;
  133. .content-area {
  134. &-time {
  135. padding: 10px 0;
  136. text-align: center;
  137. color: #909399;
  138. }
  139. &-center {
  140. margin: 0 10px 20px 10px;
  141. padding: 15px;
  142. overflow: hidden;
  143. &-title {
  144. margin: 0 0 15px 0;
  145. color: #909399;
  146. }
  147. &-cont {
  148. font-weight: 600;
  149. }
  150. &-buttom {
  151. float: right;
  152. color: #2a98ff;
  153. }
  154. }
  155. }
  156. }
  157. </style>