除案例详情外全部完成

This commit is contained in:
zhcnyuyang 2025-05-11 04:25:08 +08:00
parent 72a80e5675
commit 90c653d46f
3 changed files with 54 additions and 231 deletions

View File

@ -17,75 +17,7 @@ import ExamplesContent from './ExamplesContent.vue';
<script>
import axios from 'axios';
export default {
name: "Examples",
data(){
return{
types:[],
titles:[],
error:null,
isLoading: false
}
},
methods:{
fetch_types:function (){
this.isLoading = true;
this.error = null;
axios.get('/api/examples/distinct?field=example_type')
.then(response => {
const resp = response.data;
if (Array.isArray(resp)) {
this.types = resp;
if (this.types.length === 0) {
this.error = "返回的数组为空";
}
} else {
this.error = "返回的数据不是数组";
this.types = [];
}
})
.catch(err => {
console.error(err);
this.error = '请求失败,请稍后重试';
this.types = [];
})
.finally(() => {
this.isLoading = false;
});
},
fetch_items:function(){
this.isLoading=true;
this.error=null;
const params = new URLSearchParams(window.location.search);
const type = params.get('type');
let reqarg='/api/examples?fields=id,brandname_cn,projectname_cn&populate=headimage';
if(type){
reqarg='/api/examples?fields=id,brandname_cn,projectname_cn&populate=headimage&filters[example_type]='+type;
}
axios.get(reqarg)
.then(response =>{
const resp = response.data;
if (resp && Array.isArray(resp.data)) {
this.titles = resp.data;
if(this.titles.length==0){
this.error = "返回的 JSON 对象中不存在 'data' 数组";
}
} else {
this.error = "返回的 JSON 对象中不存在 'data' 数组";
}
})
.catch(err => {
console.error(err);
this.error = '请求失败,请稍后重试';
})
.finally(() => {
this.isLoading = false;
});
}
},
mounted() {
this.fetch_types();
this.fetch_items();
}
name: "Examples"
}
</script>
@ -101,165 +33,4 @@ export default {
background-image: url('/ExamplesRes/Examplesbanner.png');
}
}
#listmain{
display: grid;
@include media-breakpoint-between(xs, md) {
margin-top: 48px;
grid-template-columns: repeat(1,1fr);
gap: 12px;
}
@include media-breakpoint-up(md) {
margin-top: 72px;
grid-template-columns: repeat(2,1fr);
gap: 24px;
}
@include media-breakpoint-between(xs, md) {
margin-left: 32px;
margin-right: 32px;
}
@include media-breakpoint-between(md,xxl){
margin-left: 100px;
margin-right: 100px;
}
@include media-breakpoint-up(xxl) {
margin-left: 256px;
margin-right: 256px;
}
}
.listblock{
position: relative;
aspect-ratio: 1.563;
@include media-breakpoint-up(md) {
}
}
.listblock img {
z-index: 0;
@include media-breakpoint-between(xs, md){
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
display: block;
}
@include media-breakpoint-up(md) {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
display: block;
}
}
#examplelist{
//width: 100%;
background-color: white;
@include media-breakpoint-between(xs, md) {
padding-top: 64px;
padding-bottom: 32px;
}
@include media-breakpoint-up(md) {
padding-top: 80px;
padding-bottom: 77px;
}
margin-left: 0;
margin-right: 0;
}
#typegrid {
display: grid;
@include media-breakpoint-between(xs, md) {
grid-template-columns: repeat(3,1fr) !important;
gap: 12px;
}
@include media-breakpoint-up(md) {
grid-template-columns: repeat(4,minmax(0,300px)) !important;
gap: 32px;
}
@include media-breakpoint-between(xs, md) {
margin-left: 32px;
margin-right: 32px;
}
@include media-breakpoint-between(md,xxl){
margin-left: 100px;
margin-right: 100px;
}
@include media-breakpoint-up(xxl) {
margin-left: 256px;
margin-right: 256px;
}
}
.typebar{
border: 1px solid #000000;//
display: flex;
justify-content: center;
align-items: center;
color: black;
background-color: white;
font-family: PingFangSC-Regular;
font-weight: normal;
overflow-wrap: break-word;
text-align: left;
transition: background 0.5s, color 0.5s; /* 0.5秒渐变 */
@include media-breakpoint-between(xs, md) {
height: 44px;
}
@include media-breakpoint-up(md) {
height: 74px;
font-size: 24px;
//line-height: 48px;
}
}
.typebar:hover{
background-color: black;
color: white;
}
.typebar.active {
/* 选中高亮样式 */
background-color: black;
color: white;
}
.itemtext{
position: absolute;
margin-left: 20px;
left:0;
margin-right: auto;
margin-bottom: 20px;
bottom: 0;
margin-top: auto;
display: flex;
flex-direction: column;
gap: 2px;
z-index: 2;
}
.upspan{
overflow-wrap: break-word;
color: rgba(255, 255, 255, 1);
font-size: 24px;
font-family: PingFangSC-Medium;
font-weight: 500;
text-align: left;
white-space: nowrap;
line-height: 33px;
}
.downspan{
overflow-wrap: break-word;
color: rgba(255, 255, 255, 1);
font-size: 16px;
font-family: PingFangSC-Regular;
font-weight: normal;
text-align: left;
white-space: nowrap;
line-height: 22px;
margin-top: 2px;
}
</style>

View File

@ -227,7 +227,7 @@ export default {
font-weight: normal;
overflow-wrap: break-word;
text-align: left;
transition: background 0.5s, color 0.5s; /* 0.5秒渐变 */
transition: background 0.5s, color 0.5s;
@include media-breakpoint-between(xs, md) {
height: 44px;

View File

@ -119,6 +119,14 @@ import Partners from './Tools/Partners.vue'
</div>
</div>
<ExamplesContent></ExamplesContent>
<a href="/Examples" style="text-decoration: none;">
<div style="display: flex;justify-content: center;
width: 100%;background-color: white;">
<div id="seemorebutton">
查看更多
</div>
</div>
</a>
<Partners></Partners>
</div>
</template>
@ -148,6 +156,50 @@ export default {
<style scoped lang="scss">
@import "src/publicstyle.scss";
#seemorebutton{
display: flex;
justify-content: center;
align-items: center;
width: 100%;
background-color: white;
max-width: 300px;
//height: 74px;
border: 2px solid #000000;
@include media-breakpoint-between(xs, md) {
margin-left: 32px;
margin-right: 32px;
}
@include media-breakpoint-between(md,xxl){
margin-left: 100px;
margin-right: 100px;
}
@include media-breakpoint-up(xxl) {
margin-left: 256px;
margin-right: 256px;
}
overflow-wrap: break-word;
color: rgba(13, 13, 13, 1);
//font-size: 24px;
font-family: PingFangSC-Medium;
font-weight: 500;
text-align: left;
line-height: 48px;
transition: background 0.5s, color 0.5s;
@include media-breakpoint-between(xs, md) {
height: 44px;
}
@include media-breakpoint-up(md) {
height: 74px;
font-size: 24px;
//line-height: 48px;
}
}
#seemorebutton:hover{
background-color: black;
color: white;
}
#hpbanner{
position: absolute;
top: 0;