index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view class="fui-wrap">
  3. <!-- <view class="search-content">-->
  4. <!-- <u-search placeholder="请输入关键字" v-model="keyword" @custom="onSearch" @search="onSearch"></u-search>-->
  5. <!-- </view>-->
  6. <u-swiper :list="list" imgMode="aspectFit" :radius='10' :height="240" />
  7. <u-notice-bar :text="msg" direction="column" :more-icon="false" color="#5af" bg-color="#d6e8f7"></u-notice-bar>
  8. <view style="width: 100%; margin-top: 20rpx">
  9. <u-grid
  10. :border="false"
  11. :col="3"
  12. @click="click"
  13. >
  14. <u-grid-item
  15. v-for="(baseListItem,baseListIndex) in baseList"
  16. :key="baseListIndex"
  17. @click="$u.throttle(()=>onItemClick(baseListItem), 500)"
  18. >
  19. <view class="grid-item-icon" :style="[baseListItem.style]">
  20. <image :src="baseListItem.icon"></image>
  21. </view>
  22. <text class="grid-text">{{ baseListItem.title }}</text>
  23. </u-grid-item>
  24. </u-grid>
  25. </view>
  26. <u-gap height="10" bgColor="#bbb"></u-gap>
  27. <view class="u-page">
  28. <view class="u-page-title">
  29. <view class="line"></view>
  30. <view class="rectangle"></view>
  31. <view class="rectangle"></view>
  32. <view class="title-content">主题研讨报名</view>
  33. <view class="rectangle"></view>
  34. <view class="rectangle"></view>
  35. <view class="line"></view>
  36. </view>
  37. <item-list :ds="indexList" :onItemClick="onContentClick" />
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import { fetchContentInfo, fetchMsgList, fetchViewCfgList } from '@/common/api';
  43. import { COMP_CODE, MEETING_TYPE } from '@/common/EnumConst';
  44. import ItemList from '@/components/ItemList/index.vue';
  45. import { getImageUrl, setStorageObj, storageKey } from '@/util';
  46. export default {
  47. components: {
  48. ItemList,
  49. },
  50. data() {
  51. return {
  52. keyword: '',
  53. list: [],
  54. msg: [],
  55. baseList: [],
  56. indexList: [],
  57. styleObj: {
  58. 'backgroundColor': '#000',
  59. },
  60. };
  61. },
  62. onLoad() {
  63. this.loadMsg();
  64. this.loadmore();
  65. this.viewCfg();
  66. },
  67. methods: {
  68. click() {
  69. },
  70. onContentClick(item) {
  71. setStorageObj(storageKey.regtheme, {
  72. type: MEETING_TYPE.theme.value,
  73. id: item.id,
  74. });
  75. uni.navigateTo({
  76. url: `/pasbrg/pages/regtheme/index?type=${MEETING_TYPE.theme.value}&id=${item.id}`,
  77. });
  78. },
  79. async loadmore() {
  80. const res = await fetchContentInfo({
  81. pageNum: 1,
  82. pageSize: 99,
  83. contentType: 4,
  84. });
  85. this.indexList = res.rows.map(item => {
  86. return {
  87. id: item.id,
  88. imgUrl: getImageUrl(item.thumbnail),
  89. title: item.title,
  90. date: item.createTime,
  91. };
  92. });
  93. },
  94. async loadMsg() {
  95. let result = [];
  96. const res = await fetchMsgList({
  97. pageNum: 1,
  98. pageSize: 99,
  99. });
  100. if (res.rows.length > 0) {
  101. result = res.rows.map(item => item.msg);
  102. }
  103. this.msg = result;
  104. },
  105. async viewCfg() {
  106. let result = [];
  107. const res = await fetchViewCfgList({
  108. pageNum: 1,
  109. pageSize: 99,
  110. });
  111. if (res.rows.length > 0) {
  112. result = res.rows.map(item => item.msg);
  113. const index_ctl = res.rows.filter((item) => item.compCode === COMP_CODE.index_ctl);
  114. const index_swip = res.rows.filter((item) => item.compCode === COMP_CODE.index_swip);
  115. this.list = index_swip.map(item => getImageUrl(item.iconUri));
  116. this.baseList = index_ctl.map(item => {
  117. return {
  118. icon: getImageUrl(item.iconUri),
  119. style: JSON.parse(item.style),
  120. title: item.labelTxt,
  121. url: item.url,
  122. };
  123. });
  124. }
  125. },
  126. // onSearch(val) {
  127. // uni.reLaunch({
  128. // url: `/pages/tabbar/news/index?keyword=${val}`,
  129. // });
  130. // },
  131. onItemClick(item) {
  132. if (item.url) {
  133. uni.navigateTo({
  134. url: item.url,
  135. });
  136. }
  137. },
  138. },
  139. onShareAppMessage() {
  140. return {
  141. title: 'First UI组件库',
  142. };
  143. },
  144. };
  145. </script>
  146. <style lang="scss" src="./index.scss">
  147. </style>