index.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <view class="meeting-info-container">
  3. <view class="search-content">
  4. <u-search placeholder="请输入关键字" v-model="keyword" @custom="onSearch" @search="onSearch"></u-search>
  5. </view>
  6. <view class="u-page">
  7. <item-list :ds="indexList" :onItemClick="onContentClick" />
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. import { fetchContentInfo } from '@/common/api';
  13. import ItemList from '@/components/ItemList/index.vue';
  14. import { getImageUrl } from '@/util';
  15. export default {
  16. components: {
  17. ItemList,
  18. },
  19. data() {
  20. return {
  21. keyword: '',
  22. indexList: [],
  23. };
  24. },
  25. onLoad() {
  26. this.loadmore();
  27. },
  28. methods: {
  29. onContentClick(item) {
  30. uni.navigateTo({
  31. url: `/pasb/pages/detail/index?id=${item.id}`,
  32. });
  33. },
  34. async loadmore(keyword = '') {
  35. const res = await fetchContentInfo({
  36. pageNum: 1,
  37. pageSize: 99,
  38. contentType: 3,
  39. title: keyword,
  40. });
  41. this.indexList = res.rows.map(item => {
  42. return {
  43. id: item.id,
  44. imgUrl: getImageUrl(item.thumbnail),
  45. title: item.title,
  46. date: item.createTime,
  47. };
  48. });
  49. },
  50. onSearch(val) {
  51. this.loadmore(val);
  52. },
  53. },
  54. onShareAppMessage() {
  55. return {
  56. title: 'First UI组件库',
  57. };
  58. },
  59. };
  60. </script>
  61. <style lang="scss" src="./index.scss">
  62. </style>