This commit is contained in:
Air 2024-03-15 17:41:40 +08:00
parent 48cfcf75a0
commit bd9afbfefe
7 changed files with 69 additions and 19 deletions

View File

@ -104,6 +104,13 @@ export function AddPolitics(params) {
params: params,
});
}
export function selectPolitics(params) {
return http('/api/politics/selectPolitics', {
method: 'POST',
params: params,
});
}

BIN
src/assets/img/top2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 KiB

View File

@ -27,10 +27,10 @@
</div>
<div style="font-weight: 600;padding:0px 9rem;">
<n-input-group>
<n-input placeholder="请输入想找的问题" style="width: 17rem;"/>
<n-input v-model:value="searchName" placeholder="请输入想找的问题" style="width: 17rem;"/>
<n-flex :size="[1,0]">
<div>
<n-button :round="false" :bordered="false" color="#0051B1">
<n-button @click="tn('/search?name='+searchName)" :round="false" :bordered="false" color="#0051B1">
搜索
</n-button>
</div>
@ -127,6 +127,7 @@ const message = useMessage()
const router = useRouter()
const userPhone = ref();
const x = ref();
const searchName=ref();
onMounted(() => {
var item = sessionStorage.getItem('user');
if (item != null) {

View File

@ -54,7 +54,13 @@ const router = createRouter({
title: '洛阳百姓问政-提问' //title配置
},
component: () => import("../view/question/index.vue")
}
}, {
path: "/search",
meta: {
title: '洛阳百姓问政-搜索' //title配置
},
component: () => import("../view/search/index.vue")
}
],
});

View File

@ -113,7 +113,7 @@
</div>
<div style="margin-top: 30px;">
<n-flex justify="center" :size="[135,0]">
<div style="cursor: pointer;position: relative;">
<div style="cursor: pointer;position: relative;" @click="tn('/question')">
<img src="@/assets/img/zu1.png" style="width: 300px;"/>
<div
style="position: absolute;right: 20px;font-size: 2.5rem;color: #ffffff;top: 13px;font-weight: 600;">
@ -162,19 +162,7 @@
<n-carousel draggable :autoplay="true">
<img
class="carousel-img"
src="https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel1.jpeg"
>
<img
class="carousel-img"
src="https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel2.jpeg"
>
<img
class="carousel-img"
src="https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel3.jpeg"
>
<img
class="carousel-img"
src="https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel4.jpeg"
src="@/assets/img/top2.png"
>
</n-carousel>
</div>

48
src/view/search/index.vue Normal file
View File

@ -0,0 +1,48 @@
<template>
<Header/>
<div style="width: 50%;margin: 0 auto;padding: 30px 0px">
<div>关于{{politics_title}} 的搜索结果</div>
<div style="cursor: pointer;padding: 2.5px 0px;margin-top: 20px" v-for="(item,index) in list" @click="openTn('/info?id='+item.id)">
<n-flex justify="space-between" align="center">
<div class="txt-1" style="font-size: 17px;width: 30%" >
<div style="background-color: #0051B1;width: 5px;height: 5px;border-radius: 50%;display: inline-block;vertical-align: middle"></div>
<text class="news_title" style="vertical-align: middle;margin-left: 10px">{{item.politics_title}}</text>
</div>
<div style="color: #818794">{{item.createtime}}</div>
</n-flex>
</div>
</div>
<Footer/>
</template>
<script setup>
import Header from "@/components/Head.vue";
import Footer from "@/components/Footer.vue";
import {onMounted, reactive, ref} from "vue";
import {selectPolitics} from "@/api";
import {useMessage} from "naive-ui";
import {useRouter} from "vue-router";
const router = useRouter()
const politics_title = ref();
const list=ref();
onMounted(() => {
console.log("123");
politics_title.value=router.currentRoute.value.query.name;
getList();
})
const openTn = (url) => {
router.push(url);
}
const getList = () => {
selectPolitics({politics_title:politics_title.value}).then(res => {
console.log(res);
if (res.code == 200) {
list.value=res.data;
} else {
message.error(res.msg)
}
});
}
</script>
<style scoped>
</style>

View File

@ -24,9 +24,9 @@
<div style="padding: 20px;position: relative">
<div class="right_title">{{ leftList[leftListIndex] }}</div>
<div v-if="leftListIndex==0||leftListIndex==1||leftListIndex==3">
<div style="cursor: pointer;padding: 2.5px 0px;margin-top: 20px" v-for="(item,index) in list" @click="openTn(item)">
<div style="cursor: pointer;padding: 2.5px 0px;margin-top: 20px" v-for="(item,index) in list" >
<n-flex justify="space-between" align="center">
<div class="txt-1" style="font-size: 17px;width: 50%">
<div class="txt-1" style="font-size: 17px;width: 50%" @click="openTn(item)">
<div style="background-color: #0051B1;width: 5px;height: 5px;border-radius: 50%;display: inline-block;vertical-align: middle"></div>
<text class="news_title" style="vertical-align: middle;margin-left: 10px">{{item.politics_title}}</text>
</div>