Merge branch 'dev' of http://47.109.205.240:3000/Web/daimp-front into dev
This commit is contained in:
commit
a2f27394ea
19
sub-operation-service/src/apis/farmingService.js
Normal file
19
sub-operation-service/src/apis/farmingService.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import request from '@/utils/axios';
|
||||||
|
|
||||||
|
// 农事服务
|
||||||
|
|
||||||
|
// 获取农事政策分类查询数据
|
||||||
|
export function informationList(params = {}) {
|
||||||
|
return request('contentManage/information/informationPage', {
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取农资分类查询数据
|
||||||
|
export function informationDetail(id, params = {}) {
|
||||||
|
return request(`contentManage/information/informationInfo/${id}`, {
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
@ -6,12 +6,12 @@
|
|||||||
<el-card shadow="hover" style="border-radius: 16px">
|
<el-card shadow="hover" style="border-radius: 16px">
|
||||||
<h2 style="text-align: left">农业政策</h2>
|
<h2 style="text-align: left">农业政策</h2>
|
||||||
<div v-for="(item, index) in tableData" :key="index" class="card-item">
|
<div v-for="(item, index) in tableData" :key="index" class="card-item">
|
||||||
<div style="width: 49%"><img :src="getAssetsFile(item.imgPath)" alt="" width="100%" /></div>
|
<div style="width: 49%; background-color: white"><img :src="item.coverUrl" alt="" width="100%" style="height: 250px" /></div>
|
||||||
<div style="width: 49%; display: flex; flex-direction: column; justify-content: space-between">
|
<div style="width: 49%; display: flex; flex-direction: column; justify-content: space-between">
|
||||||
<div>
|
<div>
|
||||||
<div style="font-size: 20px; font-weight: bold">{{ item.title }}</div>
|
<div style="font-size: 20px; font-weight: bold">{{ item.title }}</div>
|
||||||
<div style="font-size: 14px; margin-top: 20px">
|
<div style="font-size: 14px; margin-top: 20px">
|
||||||
{{ item.desc }}
|
{{ item.content }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -29,10 +29,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import common from '../components/common.vue';
|
import common from '../components/common.vue';
|
||||||
import { getAssetsFile } from '@/utils/index.js';
|
import { getAssetsFile } from '@/utils/index.js';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import { informationList } from '@/apis/farmingService.js';
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
/* --------------- data --------------- */
|
/* --------------- data --------------- */
|
||||||
@ -59,10 +60,43 @@ const tableData = ref([
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const pagination = ref({
|
||||||
|
total: 0,
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
});
|
||||||
|
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
/* --------------- methods --------------- */
|
/* --------------- methods --------------- */
|
||||||
// #region
|
// #region
|
||||||
|
onMounted(() => {
|
||||||
|
queryList();
|
||||||
|
});
|
||||||
|
|
||||||
|
const extractText = (htmlText, maxChars = 80) => {
|
||||||
|
// 去除 HTML 标签
|
||||||
|
const cleanText = htmlText.replace(/<[^>]+>/g, '');
|
||||||
|
// 去除多余空格和换行
|
||||||
|
const trimmedText = cleanText.replace(/\s+/g, ' ').trim();
|
||||||
|
// 取前 20 个字
|
||||||
|
return trimmedText.substring(0, maxChars);
|
||||||
|
};
|
||||||
|
|
||||||
|
const queryList = () => {
|
||||||
|
informationList({ current: pagination.value.page, size: pagination.value.size }).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
tableData.value = res.data.records;
|
||||||
|
for (let i in res.data.records) {
|
||||||
|
tableData.value[i].content = extractText(res.data.records[i].content);
|
||||||
|
if (tableData.value[i].content.length > 80) {
|
||||||
|
tableData.value[i].content += '...';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const goDetail = (id) => {
|
const goDetail = (id) => {
|
||||||
router.push('/sub-operation-service/farmService/consult/policy/detail?id=' + id);
|
router.push('/sub-operation-service/farmService/consult/policy/detail?id=' + id);
|
||||||
};
|
};
|
||||||
|
File diff suppressed because one or more lines are too long
@ -145,10 +145,6 @@ const mockData = ref([
|
|||||||
content:
|
content:
|
||||||
'适用对象:农户。<p>授信额度:单户贷款最高1000万元。</p><p>贷款期限:最长10年。</p><p>担保方式:信用、保证、抵押、质押。</p><p>利率:以各地实际利率为准。</p>',
|
'适用对象:农户。<p>授信额度:单户贷款最高1000万元。</p><p>贷款期限:最长10年。</p><p>担保方式:信用、保证、抵押、质押。</p><p>利率:以各地实际利率为准。</p>',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: '三、办理渠道',
|
|
||||||
content: '邮储银行各大开办信贷业务的网点。客户服务热线:95580。',
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user