Browse Source

政策类型改为接口

master
mk 1 week ago
parent
commit
9d5581df3e
  1. 4
      epmet-apartment-front/index.html
  2. 9
      src/api/policy.ts
  3. 26
      src/views/Home.vue
  4. 28
      src/views/policy/index.vue
  5. 2
      src/views/showings/components/HouseList.vue

4
epmet-apartment-front/index.html

@ -7,8 +7,8 @@
<link rel="apple-touch-icon" href="/favicon.svg">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>青岛市免租金住房保障平台</title>
<script type="module" crossorigin src="/epmet-apartment-front/static/index-BVgo4W5B.js"></script>
<link rel="stylesheet" crossorigin href="/epmet-apartment-front/static/index-D3RZvDxJ.css">
<script type="module" crossorigin src="/epmet-apartment-front/static/index-30fuTdlf.js"></script>
<link rel="stylesheet" crossorigin href="/epmet-apartment-front/static/index-CM8JTdPf.css">
</head>
<body>
<div id="app"></div>

9
src/api/policy.ts

@ -17,3 +17,12 @@ export const gePolicytList = (params: object) => {
export const getPolicyInfo = (id: number) => {
return request.get(`/asdh5/mzPolicy/${id}`)
}
/**
*
* @returns
*/
export const getPolicyType = () => {
return request.get('/system/dict/data/list?dictType=policy_type')
}

26
src/views/Home.vue

@ -46,7 +46,7 @@ import homeLogo from '@/assets/images/home/logo.png'
import text1 from '@/assets/images/home/text1.png'
import text2 from '@/assets/images/home/text2.png'
import { getStaticInfoByApartmen } from '@/api/index'
import { gePolicytList } from '@/api/policy'
import { gePolicytList, getPolicyType } from '@/api/policy'
import navBg from "@/assets/images/home/navBg.png";
import nav1 from "@/assets/images/home/nav1.png";
import nav2 from "@/assets/images/home/nav2.png";
@ -90,24 +90,13 @@ const navList = [
},
];
// tabList
const tabList = reactive([
{
dictLabel: "最新",
dictValue: "0",
},
{
dictLabel: "住房政策",
dictValue: "1",
},
{
dictLabel: "人才政策",
dictValue: "2",
},
{
dictLabel: "就业政策",
dictValue: "3",
},
const tabList = ref([
]);
const getPolicyTypeList = async () => {
const res = (await getPolicyType()) as unknown as ApiResponse<{rows: any[]}>;
tabList.value = [{dictLabel: '最新', dictValue: '0'}, ...(res.rows || [])];
console.log(tabList.value);
}
const active = ref('0')
const top3 = ref([])
@ -147,6 +136,7 @@ const handleClickTab = (item) => {
}
//
getPolicyTypeList()
getPolicyList()
getList()
</script>

28
src/views/policy/index.vue

@ -86,25 +86,9 @@
<script setup lang="ts">
import { ref, reactive, onMounted, onUnmounted } from "vue";
import { useRoute, useRouter } from "vue-router";
import { gePolicytList, getPolicyInfo } from "@/api/policy";
import { gePolicytList, getPolicyInfo, getPolicyType } from "@/api/policy";
// tabList
const tabList = reactive([
{
dictLabel: "最新",
dictValue: "0",
},
{
dictLabel: "住房政策",
dictValue: "1",
},
{
dictLabel: "人才政策",
dictValue: "2",
},
{
dictLabel: "就业政策",
dictValue: "3",
},
const tabList = ref([
]);
const active = ref("0");
//
@ -151,7 +135,7 @@ const getList = async () => {
return false;
};
//
const res = (await gePolicytList(joinIn)) as unknown as ApiResponse<PolicyItem[]>;
const res = (await gePolicytList(joinIn)) as unknown as ApiResponse<{rows: PolicyItem[]}>;
const data = res.data || [];
list.value = [...list.value, ...data];
if (data.length < joinIn.pageSize) {
@ -188,6 +172,11 @@ const handleBack = () => {
router.push('/policy');
getList();
}
const getPolicyTypeList = async () => {
const res = (await getPolicyType()) as unknown as ApiResponse<{rows: any[]}>;
tabList.value = [{dictLabel: '最新', dictValue: '0'}, ...(res.rows || [])];
console.log(tabList.value);
}
//
onMounted(() => {
//
@ -197,6 +186,7 @@ onMounted(() => {
if (id) {
toPolicyDetail(id);
} else {
getPolicyTypeList();
getList();
}
});

2
src/views/showings/components/HouseList.vue

@ -1,6 +1,6 @@
<template>
<div class="w-[420px] h-[344px] overflow-y-auto">
<div>选择房型</div>
<div>选择乐业社区</div>
<el-divider />
<div class="flex flex-col">
<div class="flex gap-5" v-for="(item, index) in list" :key="index" @click="toHouseDetail(item)">

Loading…
Cancel
Save