Files
files/pages/index/index.vue
2026-04-14 16:39:58 +08:00

254 lines
5.2 KiB
Vue

<template>
<view class="begin">
<view class="headers">
<text class="text1">时代楷模</text>
<view class="div" v-if="banner_title">
{{banner_title.data.topicContent}}
</view>
<view class="headers_middle">
<swiper :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000">
<swiper-item v-if="banner_content">
<view class="swiper-item">
</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">
</view>
</swiper-item>
</swiper>
</view>
<view class="headers_bottom">
<view class="bottom_left">
<text>楷模</text>
<br>公告
</view>
<view class="bottom_right">
<p>2021年河北省最美基层高校毕业生先进事迹发布</p>
<p>河北省委宣传部省人社局在最美河北最美河北最美河北最美河北最美河北最美河北最美河北最美河北</p>
</view>
>
</view>
</view>
<view>
<card class="card" v-for="imagepath of imagepaths" :image_path="imagepath.path" :value="imagepath.value">
</card>
</view>
<view>
<text class="title">楷模列表</text>
<indexpage ref="as" :end="part_nums"></indexpage>
</view>
<button @click="showmore()">显示更多</button>
<view class="index_end">
<view class="nav_bottom" v-for="path_image in endbottom">
<image :src="path_image[0]"></image>
<p>{{path_image[1]}}</p>
</view>
</view>
</view>
</template>
<script>
import card from "../../components/card.vue"
import indexpage from "../../components/index_page.vue"
export default {
components: {
card,
indexpage
},
data() {
const imagepath = Array.from({
length: 4
}).map((_, x) => `../../static/c${x+1}.png`)
const textarray = ["首页", "公益", "心得", "我的"]
const endbottom = imagepath.map((value, index) => [value, textarray[index]])
return {
endbottom,
banner_title: null,
part_nums: 5,
banner_content:null
}
},
computed: {
imagepaths() {
let Path = Array.from({
length: 6
}, (_, x) => `../../static/c${x+1}.png`);
let value = ["楷模列表", "英雄故事", "身边英雄", "物资捐赠", "数据分析", "更多"]
return Path.map((path, index) => ({
path: path,
value: value[index]
}))
}
},
methods: {
showmore() {
this.part_nums = 10
},
async requests(updown,path) {
let response
if (updown == "up") {
response = await fetch(`http://124.93.196.45:10091/Neusoft/times-model${path}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"password": "0CYdq6Hn",
"username": "6dOMIgIU"
})
})
} else if (updown == "down") {
response = await fetch(`http://124.93.196.45:10091/Neusoft/times-model${path}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization": "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImJjYtrrMxSx0OvYuqZ_0UL738RhVLuq-IxBIyHH1kt0gXAANbdsg"
},
})
}
const data = await response.json()
console.log(data)
return data
}
},
async mounted() {
this.banner_title = await this.requests("down","/appNotice/app-o/modelSpirit")
this.banner_content =await this.requests("down","/appNotice/app-o/modelSpirit")
},
}
</script>
<style>
* {
padding: 0;
margin: 0;
}
.begin {
background-color: rgb(246, 246, 246);
}
.text1 {
display: block;
text-align: center;
font-size: 1.4rem;
color: rgb(195, 5, 15);
font-weight: bold;
padding-bottom: 3%;
background-color: #fff !important;
}
.headers .div {
color: #ffffff;
background-color: rgb(195, 5, 15);
text-align: center;
padding: 3%;
font-size: 1.1rem;
}
.headers_middle {
height: 20vh;
border: 1px red solid;
background-color: #fff !important;
}
.headers_bottom {
height: 10vh;
display: flex;
margin: 5px 15px;
align-items: center;
border-radius: 15px;
background-color: #fff !important;
}
.bottom_left {
width: 20%;
font-weight: bold;
font-size: 1.3rem;
text-align: center;
border-right: 2px #999999 solid;
}
.bottom_left text {
color: rgb(195, 5, 15);
margin-bottom: 1%;
}
.bottom_right {
width: 80%;
height: 10vh;
border-radius: 0px 15px 15px 0px;
}
.bottom_right p {
margin-left: 5%;
}
.bottom_right p:first-child {
font-size: 1.2rem;
margin-bottom: 2%;
}
.bottom_right p:nth-child(2) {
font-size: 0.9rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.headers+view {
background-color: #fff;
margin: 10px 15px;
border-radius: 15px;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
justify-items: center;
}
.card {
width: 55%;
text-align: center;
}
.headers+view+view {
background-color: rgb(246, 246, 246);
margin: 10px 15px;
padding-bottom: 10px;
}
.title {
display: block;
border-left: 5px firebrick solid;
font-weight: bold;
font-size: 1.3rem;
margin-bottom: 10px;
}
.index_end {
display: flex;
justify-content: space-around;
}
.nav_bottom {
display: flex;
flex-direction: column;
align-items: center;
}
.nav_bottom image {
width: 6vw;
height: 3vh;
}
.nav_bottom:nth-child(1) p {
color: #C2050F;
}
</style>