修改数据对应问题

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);
emitter.emit('inputSea', {
keywords:inputSearch.value,
type: 2,
type: 1,
});
}
const getPageList = async () => {

View File

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

View File

@ -23,7 +23,7 @@
<div class="re_box">
<div class="re_box_item" >
<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_content">
{{ }}
@ -40,7 +40,7 @@
<n-tabs :bar-width="0" type="line"
class="custom-tabs" pane-style="background-color: #ffffff;">
<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">
{{index+1 > 10 ? index + 1 : '0'+(index+1) }}
</div>
@ -61,7 +61,7 @@
</div>
</n-tab-pane>
<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">
{{index+1 > 10 ? index + 1 : '0'+(index+1) }}
</div>
@ -112,7 +112,13 @@ const jinxList = ref([]);
const remList = ref([]);
const Newsdetailist = ref([]);
const detailId = ref(null);
const datas = ref(null);
const emit = defineEmits(['toSwpe'])
emitter.on('inputSea', (data) => {
console.log(data,111111)
datas.value = data;
getNewsdetail(data);
});
const getjinxList = async () => {
const res = await $api.post('/api/home.news/index',
{
@ -135,18 +141,27 @@ const getremList = async () => {
}
//
const gotoDetail = (id: number) => {
console.log(datas)
detailId.value = {
id: id,
type: '3'
type: datas.value.type
};
localStorage.setItem('detailId', JSON.stringify(detailId.value));
emit('toSwpe',6)
emitter.emit('detailId', detailId.value);
}
emitter.on('inputSea', (data) => {
console.log(data,111111)
getNewsdetail(data);
});
//
const gotoDetails = (id: number) => {
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) => {
//
@ -200,7 +215,7 @@ onMounted(() => {
height:100%;
background-image: url('/img/xwdt.png');
background-size: 100% 100%;
overflow-y: auto;
.fiximg {
img {
margin-bottom: 20px;
@ -265,8 +280,7 @@ onMounted(() => {
margin: 0 auto;
margin-top: 40px;
padding-left: 100px;
overflow-y: auto;
overflow: hidden;
.re_box_item {
width: 100%;
background: #ffffff;
@ -278,9 +292,9 @@ onMounted(() => {
/* 允许换行 */
justify-content: flex-start;
/* 项目左对齐 */
cursor: pointer;
.re_slice {
width: 841px;
// width: 841px;
border-bottom: 1px dashed #bbbbbb;
margin-top: 20px;
margin-bottom: 30px;

View File

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