index.vue 4.2 KB

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