index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. <view class="u-page"
  27. :style="{
  28. background: `url(${getImageUrl(ICON_CFG.theme_bg)}) no-repeat `,
  29. backgroundSize: '100%',
  30. }">
  31. <view class="u-page-title">
  32. <view class="title-content">主题研讨交流</view>
  33. </view>
  34. <item-list-simple :ds="indexList" :onItemClick="onContentClick" />
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import { fetchContentInfo, fetchMsgList, fetchViewCfgList } from '@/common/api';
  40. import { COMP_CODE, ICON_CFG, MEETING_TYPE } from '@/common/EnumConst';
  41. import ItemListSimple from '@/components/ItemListSimple/index.vue';
  42. import { getImageUrl, setStorageObj, storageKey } from '@/util';
  43. export default {
  44. computed: {
  45. ICON_CFG() {
  46. return ICON_CFG;
  47. },
  48. },
  49. components: {
  50. ItemListSimple,
  51. },
  52. data() {
  53. return {
  54. keyword: '',
  55. list: [],
  56. msg: [],
  57. baseList: [],
  58. indexList: [],
  59. styleObj: {
  60. 'backgroundColor': '#000',
  61. },
  62. };
  63. },
  64. onLoad() {
  65. this.loadMsg();
  66. this.loadmore();
  67. this.viewCfg();
  68. },
  69. methods: {
  70. getImageUrl,
  71. click() {
  72. },
  73. onContentClick(item) {
  74. setStorageObj(storageKey.regtheme, {
  75. type: MEETING_TYPE.theme.value,
  76. id: item.id,
  77. });
  78. uni.navigateTo({
  79. url: `/pasbrg/pages/regtheme/index?type=${MEETING_TYPE.theme.value}&id=${item.id}`,
  80. });
  81. },
  82. async loadmore() {
  83. const res = await fetchContentInfo({
  84. pageNum: 1,
  85. pageSize: 99,
  86. contentType: 4,
  87. });
  88. this.indexList = res.rows.map(item => {
  89. return {
  90. id: item.id,
  91. imgUrl: getImageUrl(item.thumbnail),
  92. title: item.title,
  93. date: item.createTime,
  94. };
  95. });
  96. },
  97. async loadMsg() {
  98. let result = [];
  99. const res = await fetchMsgList({
  100. pageNum: 1,
  101. pageSize: 99,
  102. });
  103. if (res.rows.length > 0) {
  104. result = res.rows.map(item => item.msg);
  105. }
  106. this.msg = result;
  107. },
  108. async viewCfg() {
  109. let result = [];
  110. const res = await fetchViewCfgList({
  111. pageNum: 1,
  112. pageSize: 99,
  113. });
  114. if (res.rows.length > 0) {
  115. result = res.rows.map(item => item.msg);
  116. const index_ctl = res.rows.filter((item) => item.compCode === COMP_CODE.index_ctl);
  117. const index_swip = res.rows.filter((item) => item.compCode === COMP_CODE.index_swip);
  118. this.list = index_swip.map(item => getImageUrl(item.iconUri));
  119. this.baseList = index_ctl.map(item => {
  120. return {
  121. icon: getImageUrl(item.iconUri),
  122. style: JSON.parse(item.style),
  123. title: item.labelTxt,
  124. url: item.url,
  125. };
  126. });
  127. }
  128. },
  129. // onSearch(val) {
  130. // uni.reLaunch({
  131. // url: `/pages/tabbar/news/index?keyword=${val}`,
  132. // });
  133. // },
  134. onItemClick(item) {
  135. if (item.url) {
  136. uni.navigateTo({
  137. url: item.url,
  138. });
  139. }
  140. },
  141. },
  142. onShareAppMessage() {
  143. return {
  144. title: 'First UI组件库',
  145. };
  146. },
  147. };
  148. </script>
  149. <style lang="scss" src="./index.scss">
  150. </style>