123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <template>
- <view class="fui-wrap">
- <view class="search-content">
- <u-search placeholder="请输入关键字" v-model="keyword" @custom="onSearch" @search="onSearch"></u-search>
- </view>
- <u-swiper :list="list" imgMode="aspectFill" :radius='0' :height="240" />
- <u-notice-bar :text="msg" direction="column" :more-icon="false" color="#5af" bg-color="#d6e8f7"></u-notice-bar>
- <view style="width: 100%; margin-top: 20rpx">
- <u-grid
- :border="false"
- :col="3"
- @click="click"
- >
- <u-grid-item
- v-for="(baseListItem,baseListIndex) in baseList"
- :key="baseListIndex"
- >
- <view class="grid-item-icon" :style="[baseListItem.style]">
- <image :src="baseListItem.icon"></image>
- </view>
- <text class="grid-text">{{ baseListItem.title }}</text>
- </u-grid-item>
- </u-grid>
- </view>
- <u-gap height="10" bgColor="#bbb"></u-gap>
- <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';
- import { fetchMsgList, fetchViewCfgList } from '@/common/api';
- import { COMP_CODE } from '@/common/EnumConst';
- export default {
- components: {
- ItemList,
- },
- data() {
- return {
- keyword: '',
- list: [
- ],
- msg: [],
- baseList: [
- ],
- indexList: [],
- styleObj: {
- "backgroundColor": "#000"
- }
- };
- },
- onLoad() {
- this.loadMsg();
- this.loadmore();
- this.viewCfg();
- },
- methods: {
- click() {
- },
- onContentClick(item) {
- uni.navigateTo({
- url: `/pasb/pages/detail/index?id=${item.id}`,
- });
- },
- async loadmore() {
- const res = await fetchContentInfo({
- pageNum: 1,
- pageSize: 99,
- });
- this.indexList = res.rows.map(item => {
- return {
- id: item.id,
- imgUrl: getImageUrl(item.thumbnail),
- title: item.title,
- date: item.createTime,
- };
- });
- },
- async loadMsg() {
- let result = [];
- const res = await fetchMsgList({
- pageNum: 1,
- pageSize: 99,
- });
- if (res.rows.length > 0) {
- result = res.rows.map(item => item.msg);
- }
- this.msg = result;
- },
- async viewCfg() {
- let result = [];
- const res = await fetchViewCfgList({
- pageNum: 1,
- pageSize: 99,
- });
- if (res.rows.length > 0) {
- result = res.rows.map(item => item.msg);
- const index_ctl = res.rows.filter((item) => item.compCode === COMP_CODE.index_ctl);
- const index_swip = res.rows.filter((item) => item.compCode === COMP_CODE.index_swip);
- this.list = index_swip.map(item => getImageUrl(item.iconUri));
- this.baseList = index_ctl.map(item => {
- return {
- icon: getImageUrl(item.iconUri),
- style: JSON.parse(item.style),
- title: item.labelTxt,
- };
- });
- }
- },
- onSearch(val) {
- uni.reLaunch({
- url: `/pages/tabbar/news/index?keyword=${val}`,
- });
- },
- },
- onShareAppMessage() {
- return {
- title: 'First UI组件库',
- };
- },
- };
- </script>
- <style lang="scss" src="./index.scss">
- </style>
|