修改数据对应问题

This commit is contained in:
张凯 2025-05-30 17:25:15 +08:00
parent 99edaff05a
commit 692eaad26c
4 changed files with 30 additions and 16 deletions

View File

@ -112,7 +112,7 @@ const toSearch =() => {
emit('toSwpe',9); emit('toSwpe',9);
emitter.emit('inputSea', { emitter.emit('inputSea', {
keywords:inputSearch.value, keywords:inputSearch.value,
type: 2, type: 1,
}); });
} }
const getPageList = async () => { const getPageList = async () => {

View File

@ -98,7 +98,7 @@ const toSearch =() => {
emit('toSwpe',9); emit('toSwpe',9);
emitter.emit('inputSea', { emitter.emit('inputSea', {
keywords:inputSearch.value, keywords:inputSearch.value,
type: 2, type: 3,
}); });
} }
const getPageList = async () => { const getPageList = async () => {

View File

@ -23,7 +23,7 @@
<div class="re_box"> <div class="re_box">
<div class="re_box_item" > <div class="re_box_item" >
<div class='re_mian'>找到结果{{Newsdetailist.length}}</div> <div class='re_mian'>找到结果{{Newsdetailist.length}}</div>
<div v-for=" item,index in Newsdetailist" :key="index" @click="gotoDetail(item.id)"> <div v-for=" item,index in Newsdetailist" :key="index" @click="gotoDetail(item.id)" style="width: 100%;">
<div class="re_title">{{ item.title }}</div> <div class="re_title">{{ item.title }}</div>
<!-- <div class="re_content"> <!-- <div class="re_content">
{{ }} {{ }}
@ -40,7 +40,7 @@
<n-tabs :bar-width="0" type="line" <n-tabs :bar-width="0" type="line"
class="custom-tabs" pane-style="background-color: #ffffff;"> class="custom-tabs" pane-style="background-color: #ffffff;">
<n-tab-pane name="oasis" tab="热门推荐" style="padding: 30px;"> <n-tab-pane name="oasis" tab="热门推荐" style="padding: 30px;">
<div class="flex flex-row" v-for="item,index in remList" :key="index" style="padding-bottom:30px;"> <div class="flex flex-row" v-for="item,index in remList" :key="index" style="padding-bottom:30px;cursor: pointer;" @click="gotoDetails(item.id)">
<div class="number_t" v-if="index == 0 || index == 1 || index == 2"> <div class="number_t" v-if="index == 0 || index == 1 || index == 2">
{{index+1 > 10 ? index + 1 : '0'+(index+1) }} {{index+1 > 10 ? index + 1 : '0'+(index+1) }}
</div> </div>
@ -61,7 +61,7 @@
</div> </div>
</n-tab-pane> </n-tab-pane>
<n-tab-pane name="jay chou" tab="精选文章" style="padding: 30px;"> <n-tab-pane name="jay chou" tab="精选文章" style="padding: 30px;">
<div class="flex flex-row" v-for="item,index in jinxList" :key="index" style="padding-bottom:30px;"> <div class="flex flex-row" v-for="item,index in jinxList" :key="index" style="padding-bottom:30px;cursor: pointer;" @click="gotoDetails(item.id)">
<div class="number_t" v-if="index == 0 || index == 1 || index == 2"> <div class="number_t" v-if="index == 0 || index == 1 || index == 2">
{{index+1 > 10 ? index + 1 : '0'+(index+1) }} {{index+1 > 10 ? index + 1 : '0'+(index+1) }}
</div> </div>
@ -112,7 +112,13 @@ const jinxList = ref([]);
const remList = ref([]); const remList = ref([]);
const Newsdetailist = ref([]); const Newsdetailist = ref([]);
const detailId = ref(null); const detailId = ref(null);
const datas = ref(null);
const emit = defineEmits(['toSwpe']) const emit = defineEmits(['toSwpe'])
emitter.on('inputSea', (data) => {
console.log(data,111111)
datas.value = data;
getNewsdetail(data);
});
const getjinxList = async () => { const getjinxList = async () => {
const res = await $api.post('/api/home.news/index', const res = await $api.post('/api/home.news/index',
{ {
@ -135,18 +141,27 @@ const getremList = async () => {
} }
// //
const gotoDetail = (id: number) => { const gotoDetail = (id: number) => {
console.log(datas)
detailId.value = { detailId.value = {
id: id, id: id,
type: '3' type: datas.value.type
}; };
localStorage.setItem('detailId', JSON.stringify(detailId.value)); localStorage.setItem('detailId', JSON.stringify(detailId.value));
emit('toSwpe',6) emit('toSwpe',6)
emitter.emit('detailId', detailId.value); emitter.emit('detailId', detailId.value);
} }
emitter.on('inputSea', (data) => { //
console.log(data,111111) const gotoDetails = (id: number) => {
getNewsdetail(data); console.log(datas)
}); detailId.value = {
id: id,
type: 1
};
localStorage.setItem('detailId', JSON.stringify(detailId.value));
emit('toSwpe',6)
emitter.emit('detailId', detailId.value);
}
// // // //
const getNewsdetail = async (data:object) => { const getNewsdetail = async (data:object) => {
// //
@ -200,7 +215,7 @@ onMounted(() => {
height:100%; height:100%;
background-image: url('/img/xwdt.png'); background-image: url('/img/xwdt.png');
background-size: 100% 100%; background-size: 100% 100%;
overflow-y: auto;
.fiximg { .fiximg {
img { img {
margin-bottom: 20px; margin-bottom: 20px;
@ -265,8 +280,7 @@ onMounted(() => {
margin: 0 auto; margin: 0 auto;
margin-top: 40px; margin-top: 40px;
padding-left: 100px; padding-left: 100px;
overflow-y: auto; overflow: hidden;
.re_box_item { .re_box_item {
width: 100%; width: 100%;
background: #ffffff; background: #ffffff;
@ -278,9 +292,9 @@ onMounted(() => {
/* 允许换行 */ /* 允许换行 */
justify-content: flex-start; justify-content: flex-start;
/* 项目左对齐 */ /* 项目左对齐 */
cursor: pointer;
.re_slice { .re_slice {
width: 841px; // width: 841px;
border-bottom: 1px dashed #bbbbbb; border-bottom: 1px dashed #bbbbbb;
margin-top: 20px; margin-top: 20px;
margin-bottom: 30px; margin-bottom: 30px;

View File

@ -45,7 +45,7 @@
</swiper-slide> </swiper-slide>
<!-- 搜索详情 --> <!-- 搜索详情 -->
<swiper-slide :show="isSearch" id="searchid"> <swiper-slide :show="isSearch" id="searchid">
<AppSearchdel ></AppSearchdel> <AppSearchdel @toSwpe="toswiper"></AppSearchdel>
</swiper-slide> </swiper-slide>
</swiper> </swiper>