1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <template>
- <view class="fui-wrap">
- <view class="search-content">
- <u-search placeholder="请输入关键字" v-model="keyword"></u-search>
- </view>
- <view class="u-page">
- <view class="u-page-title">
- <view class="line"></view>
- <view class="rectangle"></view>
- <view class="rectangle"></view>
- <view class="title-content">最新资讯</view>
- <view class="rectangle"></view>
- <view class="rectangle"></view>
- <view class="line"></view>
- </view>
- <item-list :ds="indexList" :onItemClick="onContentClick" />
- </view>
- </view>
- </template>
- <script>
- import { fetchContentInfo } from '@/common/api';
- import ItemList from '@/components/ItemList/index.vue';
- import { getImageUrl } from '@/util';
- export default {
- components: {
- ItemList,
- },
- data() {
- return {
- keyword: '',
- indexList: [],
- };
- },
- onLoad(option) {
- this.keyword = option?.keyword || '';
- this.loadmore();
- },
- methods: {
- async loadmore() {
- let result = [];
- const res = await fetchContentInfo({
- pageNum: 1,
- pageSize: 99,
- title: this.keyword,
- });
- if (res.rows.length > 0) {
- result = res.rows.map(item => {
- return {
- id: item.id,
- imgUrl: getImageUrl(item.thumbnail),
- title: item.title,
- date: item.createTime,
- };
- });
- }
- this.indexList = result;
- },
- onContentClick(item) {
- uni.navigateTo({
- url: `/pasb/pages/detail/index?id=${item.id}`,
- });
- },
- },
- };
- </script>
- <style lang="scss" src="./index.scss" />
|