2.地图服务整合,新增腾讯地图接入功能 3.信息查询模块升级,实现详情页同步适配(含手机端) 4.接口数据优化,同步调整页面图片展示效果 5.文章内容扩容,提升页面视觉展示效果 6.顶部导航栏优化,实现PC端与手机端自适应调整
174 lines
4.7 KiB
Vue
174 lines
4.7 KiB
Vue
<template>
|
||
<div class="bg-[#ffffff]">
|
||
<!-- 头部导航和标题区域 -->
|
||
<div class="box_6 flex-col px-4 py-3">
|
||
<div class="group_1">
|
||
<div class="flex section_4 justify-start items-center mb-2">
|
||
<div>
|
||
<img class="thumbnail_1 w-6 h-6" referrerpolicy="no-referrer" src="public/images/home.png" />
|
||
</div>
|
||
<div class="text_13 text-sm mt-1 sm:mt-0">您的位置:首页>信息搜索</div>
|
||
</div>
|
||
<div class="text_14 text-center text-xl font-bold my-3">信息搜索</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 公告列表 -->
|
||
<div class="flex box_7 flex-col px-4 py-2" v-for="(item, index) in newsList" :key="index"
|
||
@click="goDetail(item)">
|
||
<div class="flex image-text_7 flex-col sm:flex-row justify-between mb-4 border-b pb-4">
|
||
<img class="image_1 w-full sm:w-24 h-auto sm:h-24 object-cover mb-3 sm:mb-0"
|
||
referrerpolicy="no-referrer" :src="item.news_image[0]" />
|
||
|
||
<div class="flex group_13 flex-col justify-between flex-1 sm:ml-4">
|
||
<div class="flex text-group_7 flex-col justify-between">
|
||
<div class="text_15 text-base font-medium mb-2">
|
||
<span>{{ item.news_title }} </span>
|
||
<span style="font-size: 12px;color: #999;margin-left: 10px;">{{ item.news_key }}</span>
|
||
</div>
|
||
<div class="text_16 text-sm text-gray-600 line-clamp-3">
|
||
{{ item.news_auto }}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="text-gray-500 text-center mt-[30px]" v-if="newsList.length == 0">
|
||
暂未找到内容...
|
||
</div>
|
||
<!-- 分页或底部区域 -->
|
||
<div class="flex flex-row justify-center my-4 py-4">
|
||
<n-pagination v-model:page="page" :item-count="total" :page-slot="7"
|
||
@update:page="getPageList"></n-pagination>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { NPagination } from 'naive-ui'
|
||
import { nextTick, ref } from 'vue'
|
||
import { useStore } from '~/store'
|
||
import $api from '@/service/webRequest'
|
||
const router = useRouter()
|
||
const route = useRoute()
|
||
const id = ref(route.params.id)
|
||
onMounted(() => {
|
||
// 在移动端视图下初始化
|
||
document.documentElement.style.fontSize = '16px';
|
||
const coMobile = /Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
||
if (coMobile) {
|
||
router.push('/phone_search/' + route.params.id)
|
||
} else {
|
||
router.push('/search/' + route.params.id)
|
||
}
|
||
getGroupList()
|
||
})
|
||
|
||
const newsList = ref([])
|
||
const page = ref(1)
|
||
const pageSize = ref(10)
|
||
const total = ref(0)
|
||
const gory_name = ref('');
|
||
const getGroupList = () => {
|
||
$api.post("/api/index/index", { content: id.value, page: page.value, pageSize: pageSize.value })
|
||
.then((res: any) => {
|
||
console.log(res)
|
||
newsList.value = res.data.data.list;
|
||
total.value = res.data.data.total_count;
|
||
//滚到页面最上面
|
||
window.scrollTo(0, 0)
|
||
})
|
||
.catch((err) => {
|
||
console.dir(err)
|
||
})
|
||
}
|
||
|
||
const getPageList = (p) => {
|
||
page.value = p;
|
||
getGroupList()
|
||
}
|
||
const goDetail = (item: any) => {
|
||
//router.push(`/info/${item.id}`)
|
||
window.open(`/phone_info/${item.id}`)
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
@import "@/assets/css/common.scss";
|
||
@import "@/assets/css/list.css";
|
||
|
||
/* 手机端适配样式 */
|
||
@media (max-width: 768px) {
|
||
|
||
.box_6,
|
||
.box_7 {
|
||
padding: 0px;
|
||
}
|
||
|
||
.text_14 {
|
||
font-size: 1.25rem;
|
||
margin-top: 30px;
|
||
text-align: left;
|
||
}
|
||
|
||
.text_15 {
|
||
font-size: 1rem;
|
||
}
|
||
|
||
.text_16 {
|
||
font-size: 0.875rem;
|
||
}
|
||
|
||
.group_1 {
|
||
padding-left: 30px;
|
||
}
|
||
|
||
.section_4 {
|
||
width: 100%;
|
||
height: auto;
|
||
}
|
||
|
||
.image-text_7 {
|
||
width: 100%;
|
||
margin: 0px;
|
||
height: 100%;
|
||
}
|
||
|
||
.image_1 {
|
||
width: 100%;
|
||
}
|
||
|
||
.box_7 {
|
||
height: auto;
|
||
}
|
||
|
||
.text-group_7 {
|
||
width: auto;
|
||
height: auto;
|
||
}
|
||
|
||
.text_15 {
|
||
width: 100%;
|
||
}
|
||
|
||
.text_16 {
|
||
width: 100%;
|
||
display: -webkit-box;
|
||
-webkit-line-clamp: 2;
|
||
-webkit-box-orient: vertical;
|
||
overflow: hidden;
|
||
margin-top: 10px;
|
||
}
|
||
|
||
.group_13 {
|
||
margin: 0px;
|
||
padding-left: 10px;
|
||
}
|
||
}
|
||
|
||
::v-deep .n-pagination .n-pagination-item:not(.n-pagination-item--disabled).n-pagination-item--active {
|
||
color: #1FC4C2;
|
||
border: 1px solid #1FC4C2;
|
||
}
|
||
</style>
|