提交 14005f92 作者: 吴佳伟

fix: 预警消息接口对接

上级 c98e4a98
......@@ -6,6 +6,7 @@ enum Api {
productMarketList = '/online/cgform/api/getData/5b71e11020d44366b2d130e200c7a640', // 热门产地行情
serviceStatsList = '/online/cgform/api/getData/491863dde351404da63a1a6e8c699c4c', // 服务展示窗
agricultureClassList = '/online/cgform/api/getData/311c300e05694ba69a063d04c8572e9e', // 农技课堂
warning = '/warningInfo/list'
}
/**
......@@ -65,3 +66,14 @@ export function agricultureClassList(params = {}) {
params,
})
}
/**
* @param params 请求参数
* @returns 获取预警数据
*/
export function warning(params = {}) {
return otherHttp.get({
url: Api.warning,
params,
})
}
......@@ -137,6 +137,8 @@
getServiceStatsList()
// 农技课堂
getAgricultureClassList()
// 预警信息
getWarning()
})
// 下拉刷新
......@@ -218,14 +220,7 @@
serviceItems: [],
// 新闻资讯
newsItems: [
{
id: 1,
type: '最新预警',
title: '积极防范持续高温对农作物的影响',
date: dayjs().format('YYYY-MM-DD'),
},
],
newsItems: [],
// 农产品行情
productMarket: {
......@@ -355,6 +350,13 @@
})
}
function getWarning() {
HomeAPI.warning().then((res) => {
const { records } = res
pageData.newsItems = records
})
}
// 菜单点击事件
function onMenuItemClick(item: any) {
console.log('点击菜单项:', item)
......@@ -570,23 +572,41 @@
<text class="font_2 mt-11">{{ item.name }}</text>
</view>
</view>
<view class="codefun-flex-row codefun-justify-between codefun-items-center section_6">
<view class="codefun-flex-col">
<swiper
:autoplay="true"
:interval="3000"
:duration="500"
:circular="true"
:vertical="true"
:indicator-dots="false"
class="codefun-flex-row codefun-justify-between codefun-items-center section_6 warn-scroll"
>
<swiper-item
id="scroll-view-content"
v-for="item of pageData.newsItems"
:key="item.id"
class="codefun-flex-col"
>
<view class="codefun-flex-row codefun-items-baseline" style="align-items: center">
<view class="font_5 text_17">{{ pageData.newsItems[0].type }}</view>
<view class="font_5 text_17">最新预警</view>
<view
class="codefun-flex-row"
style="flex-flow: column; justify-content: space-around; height: 90rpx"
style="flex-flow: column; justify-content: space-around; height: 90rpx; width: calc(100% - 110rpx)"
>
<view class="font_2 text_18 ml-11">{{ pageData.newsItems[0].title }}</view>
<text class="text-26 text_20 text_21 ml-11">{{
pageData.newsItems[0].date
}}</text>
</view>
</view>
<view
class="font_2 text_18 ml-11"
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis"
>{{ item.title }}</view
>
<text class="text-26 text_20 text_21 ml-11">{{ item.warningDate }}</text>
</view>
<image class="image_13" src="/static/images/codefun/64d85a99ca3de5fab9ce0e8dc71aa791.png" />
<image
class="warn-image"
src="/static/images/codefun/64d85a99ca3de5fab9ce0e8dc71aa791.png"
/>
</view>
</swiper-item>
</swiper>
</view>
<view class="codefun-self-end section_7" />
</view>
......@@ -636,7 +656,7 @@
text_26: !product.isUp,
}"
>
{{ `${product.isUp ? '' : '-'}${product.percent}%` }}
{{ `${product.percent}%` }}
</text>
</view>
<!-- <view
......@@ -1154,6 +1174,17 @@
line-height: 17.18rpx;
}
}
.warn-scroll {
width: 655rpx;
height: 90rpx;
.warn-image {
border-radius: 16rpx;
mix-blend-mode: NOTTHROUGH;
width: 32rpx;
height: 32rpx;
}
}
.image_13 {
border-radius: 16rpx;
mix-blend-mode: NOTTHROUGH;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论