提交 61cf84cb 作者: 王定

feat: 完成农机租购模块,及农业政策新点新闻

上级 e49c9a30
......@@ -9,7 +9,24 @@ enum Api {
warning = '/warningInfo/list',
postConsultRecordAdd = '/server/consultRecord/add', // 添加咨询信息
getNewsList = '/news/list', // 分页列表查询
}
/**
* @param params 请求参数
* @description: 分页列表查询热门新闻管理
*/
export function getNewsList(params = {}) {
return otherHttp.get({
url: Api.getNewsList,
params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
}
/**
* @param params 添加
* @description: 添加咨询信息
......
......@@ -8,6 +8,34 @@ enum Api {
farmMachineAddFarm = '/farmMachine/machineWork/app/addFarm', // 发布农活服务
farmMachineEdit = '/farmMachine/machineWork/edit', // 编辑农机服务
farmMachineRegister = '/farmMachine/machineWork/app/register', // 参与服务
postMachineryAdd = '/server/machinery/add', // 农机商品管理-添加
postMachineryQueryById = '/server/machinery/listByEnterpriseId', // 按企业ID查询未删除农机
}
/**
* @param params 请求参数
* @description: 按企业ID查询未删除农机
*/
export function postMachineryQueryById(params = {}) {
return otherHttp.get({
url: Api.postMachineryQueryById,
params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
}
/**
* @param params 请求参数
* @description: 农机商品管理-添加
*/
export function postMachineryAdd(params = {}) {
return otherHttp.post({
url: Api.postMachineryAdd,
params,
})
}
/**
......
......@@ -727,6 +727,20 @@
{
"navigationBarTitleText" : "农机服务入驻申请"
}
},
{
"path" : "pages/nongjifuwu/detail",
"style" :
{
"navigationBarTitleText" : "详情"
}
},
{
"path" : "pages/nongyezhengce/nongyezhengce",
"style" :
{
"navigationBarTitleText" : "农业政策"
}
}
],
"easycom": {
......
......@@ -232,6 +232,7 @@
productInfo.maxSellPrice = "";
productInfo.unit = "";
productInfo.image = "";
pageData.productImageArr = [];
pageData.isPopupShow = true;
}
function makePhoneCall(){
......@@ -516,6 +517,6 @@
height: 80rpx;
position: fixed;
left: 30rpx;
bottom: 450rpx;
bottom: 20rpx;
}
</style>
......@@ -32,7 +32,7 @@
async function getList(params) {
if (pageData.loading) return
pageData.loading = true
NongzhiAPI.getEnterpriseList(params).then((res) => {
await NongzhiAPI.getEnterpriseList(params).then((res) => {
if (res.records.length > 0) {
const { records } = res
if (pageData.params.pageNo === 1) {
......@@ -52,7 +52,6 @@
function toDetail(item) {
console.log(item);
let param = encodeURIComponent(JSON.stringify({id:item.id,name:item.enterpriseName}));
Navigate.to(`/pages/kexinnongzi/detail?param=${param}`)
}
......@@ -79,7 +78,7 @@
</view>
<view class="page_content">
<view class="item_list" v-for="item in pageData.dataList" :key="item.id" @click="toDetail(item)">
<view class="item_list" v-for="item in pageData.dataList" :key="item.id">
<view class="item_left">
<image class="enterprise_logo" mode="aspectFit" :src="item.businessLicenseUrl" />
</view>
......@@ -87,20 +86,7 @@
<view class="item_name ellipsis">{{item.enterpriseName}}</view>
<view class="item_description ellipsis">{{item.businessScope}}</view>
<view class="item_details">
<view class="detail_btn">查看详情</view>
</view>
</view>
</view>
<view class="item_list" @click="toDetail({name:'中粮集团',id:8})">
<view class="item_left">
<image class="enterprise_logo" mode="aspectFit" src="" />
</view>
<view class="item_right">
<view class="item_name ellipsis">中粮集团</view>
<view class="item_description ellipsis">产品描述</view>
<view class="item_details">
<view class="detail_btn">查看详情</view>
<view class="detail_btn" @click="toDetail(item)">查看详情</view>
</view>
</view>
</view>
......
......@@ -51,8 +51,6 @@
if(pageData.search.serviceType == 1){
NongzhiAPI.getEnterpriseList(pageData.search)
.then((res) => {
console.log("猎取到了企业");
console.log(res);
const { records, total } = res
pageData.farmMachineList = [...pageData.farmMachineList, ...records]
pageData.total = total
......@@ -93,7 +91,7 @@
// 分类标签点击事件
function onCategoryTabClick(tab: any) {
console.log('点击分类标签:', tab)
pageData.search.serviceType = tab.id
pageData.search.serviceType = tab.id;
// 在这里添加具体的分类标签点击逻辑
pageData.search.pageNo = 1
pageData.farmMachineList = []
......@@ -130,6 +128,12 @@
// 触发搜索
search()
}
function toDetail(item) {
let param = encodeURIComponent(JSON.stringify({id:item.id,name:item.enterpriseName}));
Navigate.to(`/pages/nongjifuwu/detail?param=${param}`)
}
onNavigationBarButtonTap(() => {
/* pageData.search.scope = null
......@@ -150,7 +154,7 @@
<view class="codefun-flex-row codefun-justify-between section_2">
<text class="font_2 text_2">服务区域</text>
<view class="codefun-flex-row codefun-items-center" @click="pageData.show.address = true">
<text class="font_2 text_3">{{ getText(pageData.search.scope, ' / ') || '选择区域' }}</text>
<text class="font_2 text_3">{{ getText(pageData.search.scope, ' / ') || '选择市县乡镇' }}</text>
<image
class="codefun-shrink-0 image_7 codefun-ml-4"
src="/static/images/codefun/774cfe989f8417dc655fb301635f5893.png"
......@@ -184,7 +188,7 @@
<view class="text-ellipsis yr-item-product">公司主营: {{item.businessScope}}</view>
<view class="yr-item-info">
<view class="text-ellipsis yr-item-address">{{item.provinceName}}{{item.cityName}}{{item.districtName}}{{item.townName}}</view>
<view class="yr-item-detail">查看详情</view>
<view class="yr-item-detail" @click="toDetail(item)">查看详情</view>
</view>
</view>
</template>
......
<!-- src/pages/zhunongjinrong/zhunongjinrong.vue -->
<script setup lang="ts">
import { reactive, ref } from 'vue'
import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue';
import { getCurrentDateTime } from '@/utils/date'
import * as HomeAPI from '@/api/model/home'
import dayjs from 'dayjs'
let currentTab = ref('redian');
const pageData = reactive({
params: {
pageNo: 1,
pageSize: 10,
news:{
source:2
}
}, // 分页参数
hasMore: true, // 是否还有更多数据
loading: false, // 是否正在加载
dataList:[]
})
onShow(() => {
getListData();
})
async function getListData() {
if (pageData.loading) return
pageData.loading = true
await HomeAPI.getNewsList(pageData.params).then((res) => {
if (res.records.length > 0) {
const { records } = res
if (pageData.params.pageNo === 1) {
pageData.dataList = records
} else {
pageData.dataList = [...pageData.dataList, ...records]
}
pageData.hasMore = records.length === pageData.params.pageSize
pageData.params.pageNo++
} else {
pageData.hasMore = false
}
})
pageData.loading = false
}
function toNewsDetail(news) {
uni.navigateTo({
url: `/pages/news/detail?id=${news.id}`,
})
}
function switchTab(type){
pageData.dataList = [];
pageData.hasMore = true;
pageData.params.pageNo = 1;
if(type == 'redian'){
pageData.params.news.source = 2;
}
if(type == 'nongye'){
pageData.params.news.source = 3;
}
if(type == 'butie'){
pageData.params.news.source = 2;
}
currentTab.value = type;
getListData();
}
</script>
<template>
<view class="nongyezhengce-page">
<view class="nongyezhengce-content">
<scroll-view class="page-content" scroll-y @scrolltolower="getListData()" :show-scrollbar="false" >
<view class="top-tab">
<view class="tab-btn" :class="currentTab == 'redian' ? 'tab-active' : ''" @click="switchTab('redian')">
<image class="tab-icon" mode="heightFix" :src="`/static/images/home/${currentTab == 'redian' ?'redian_active':'redian_icon'}.png`" />
<text class="tab-text">热点新闻</text>
</view>
<view class="tab-btn" :class="currentTab == 'nongye' ? 'tab-active' : ''" @click="switchTab('nongye')">
<image class="tab-icon" mode="heightFix" :src="`/static/images/home/${currentTab == 'nongye' ?'nongye_active':'nongye_icon'}.png`" />
<text class="tab-text">农业政策</text>
</view>
<view class="tab-btn" :class="currentTab == 'butie' ? 'tab-active' : ''" @click="switchTab('butie')">
<image class="tab-icon" mode="heightFix" :src="`/static/images/home/${currentTab == 'butie' ?'butie_active':'butie_icon'}.png`" />
<text class="tab-text">购置补贴</text>
</view>
</view>
<view class="list-content">
<view class="content-item" v-for="item in pageData.dataList" :key="item.id" @click="toNewsDetail(item)">
<view class="item-content">{{item.title}}</view>
<view class="item-info">
<view class="item-time">{{ dayjs(item.publishDate).format('YYYY-MM-DD') }}</view>
<view class="item-views"><image class="views-icon" mode="widthFix" src="/static/images/home/views_icon.png" /><text>{{item.viewCount}}</text></view>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="loading-status">
<text v-if="pageData.loading">加载中...</text>
<text v-else-if="!pageData.hasMore">没有更多数据了</text>
<text v-else>上拉加载更多</text>
</view>
</view>
</template>
<style scoped lang="scss">
.nongyezhengce-page{
background-color: #e6f5e8;
overflow-y: auto;
}
.nongyezhengce-content{
width: 100vw;
height: calc(100vh - 88rpx);
display: flex;
justify-content: center;
.page-content{
width: 690rpx;
padding-top: 24rpx;
padding-bottom: 24rpx;
.top-tab{
display: flex;
justify-content: space-between;
.tab-btn{
width: 220rpx;
height: 72rpx;
border-radius: 9999px;
background: #FFFFFF;
color: #333333;
display: flex;
justify-content: center;
align-items: center;
.tab-icon{
height: 36rpx;
margin-right: 8rpx;
}
.tab-text{
font-size: 28rpx;
}
}
.tab-active{
background: #5DB66F;
color: #FFFFFF;
}
}
.list-content{
margin-top: 4rpx;
}
.content-item{
width: 690rpx;
border-radius: 8rpx;
background: #FFFFFF;
padding:20rpx;
margin-top: 20rpx;
.item-content{
font-size: 28rpx;
line-height: 40rpx;
text-align: justify;
color: #333333;
}
.item-info{
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 20rpx;
color: #666666;
font-size: 24rpx;
line-height: 40rpx;
font-weight: 400;
.views-icon{
width: 28rpx;
margin-right: 8rpx;
}
}
}
}
}
.loading-status {
background-color: #e6f5e8;
text-align: center;
padding: 20rpx;
color: #999;
font-size: 28rpx;
}
</style>
......@@ -298,10 +298,11 @@ function getServiceItems() {
type: 1,
}).then((res) => {
const { records } = res
console.log("菜单数据");
console.log(records);
records[0].jump_target = "/pages/nongyezhengce/nongyezhengce";
pageData.serviceItems = []
pageData.serviceItems = records
console.log("recordsrecordsrecordsrecords");
console.log(records);
})
}
function getWarningInfo() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论