完成了api获取

This commit is contained in:
2026-04-13 23:44:51 +08:00
parent c53a6b2640
commit fdda9425a7
12 changed files with 181 additions and 87 deletions

117
components/index_page.vue Normal file
View File

@@ -0,0 +1,117 @@
<template>
<view>
<text class="title">楷模列表</text>
<view class="page">
<view></view>
<view>
<p>中宣部授予肖文儒时代楷模楷模楷模楷模楷模楷模楷模楷模楷模楷模楷模楷模楷模楷模楷模</p>
<p>模特姓名肖文儒</p>
<p>38年来国家安全生产应急救援中心副主任兼工程师肖文儒参与过多次重大建设工程重大建设工程重大建设工程重大建设工程重大建设工程重大建设工程重大建设工程</p>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
result:[]
}
},
async onLoad() {
for(let i=1;i<4;i++){
this.result.push(this.requests("down", `appNotice/app-o/loopMapDetail?id=${i}`))
}
this.result = await Promise.all(this.result);
this.result=this.result.map(x=>[x.data.modelName,x.data.content,x.data.picPath])
console.log(this.result);
},
methods: {
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
}
}
}
</script>
<style>
template>view{
background-color: black;
}
.title {
display: block;
border-left: 5px firebrick solid;
font-weight: bold;
font-size: 1.3rem;
margin-bottom: 10px;
}
.page {
border-radius: 15px;
background-color: #fff;
height: 12vh;
display: flex;
border-radius: 15px;
align-items: center;
}
.page view:first-of-type {
width: 25%;
height: 75%;
margin: 3%;
background-color: red;
}
.page view:nth-child(2) {
width: 75%;
}
.page view:nth-child(2) p:first-of-type {
font-size: 1.2rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.page view:nth-child(2) p:nth-child(2) {
font-size: 0.9rem;
}
.page view:nth-child(2) p:nth-child(3) {
width: 100%;
font-size: 0.9rem;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-word;
}
</style>