文章获取逻辑改为根据创建时间

This commit is contained in:
zhcnyuyang 2025-05-23 23:04:54 +08:00
parent ad70789af5
commit df31006038
2 changed files with 7 additions and 7 deletions

View File

@ -23,8 +23,8 @@ export default {
this.isLoading=true;
this.error=null;
const params = new URLSearchParams(window.location.search);
const pageid = params.get('id');
axios.get('/api/examples?populate=*&filters[id]='+pageid)
const pagecreatedAt = params.get('createdAt');
axios.get('/api/examples?populate=*&filters[createdAt]='+pagecreatedAt)
.then(response =>{
const resp = response.data;
if(resp.meta.pagination.total==0){
@ -61,7 +61,7 @@ export default {
const params = new URLSearchParams(window.location.search);
const id = params.get('id');
if (!id) {
window.location.href = '/Err404';
// window.location.href = '/Err404';
}
this.fetchpsginfos();
},

View File

@ -23,7 +23,7 @@
<a
v-for="item in titles"
:key="item.id"
:href="`/ExampleItem?id=${item.id}`"
:href="`/ExampleItem?createdAt=${item.createdAt}`"
>
<div class="listblock">
<img :src="`https://cms.yangprivate.site${item.headimage.formats.large.url}`" alt="" />
@ -87,13 +87,13 @@ export default {
const params = new URLSearchParams(window.location.search);
const type = params.get('type');
console.log('type!',type);
let reqarg='/api/examples?fields=id,brandname_cn,projectname_cn&populate=headimage&sort=createdAt:desc';
let reqarg='/api/examples?fields=id,brandname_cn,projectname_cn,createdAt&populate=headimage&sort=createdAt:desc';
if(type){
console.log('type!',type);
reqarg='/api/examples?fields=id,brandname_cn,projectname_cn&populate=headimage&filters[example_type]='+type+'&sort=createdAt:desc';
reqarg='/api/examples?fields=id,brandname_cn,projectname_cn,createdAt&populate=headimage&filters[example_type]='+type+'&sort=createdAt:desc';
}
if (this.$route.name != 'Examples'){
let reqarg='/api/examples?fields=id,brandname_cn,projectname_cn&populate=headimage&pagination[page]=1&pagination[pageSize]=5&sort=createdAt:desc';
let reqarg='/api/examples?fields=id,brandname_cn,projectname_cn,createdAt&populate=headimage&pagination[page]=1&pagination[pageSize]=5&sort=createdAt:desc';
}
axios.get(reqarg)
.then(response =>{