nirf data menu
parent
eb77cd5e0a
commit
86d6e41d49
|
@ -392,6 +392,16 @@
|
||||||
>NAAC</router-link
|
>NAAC</router-link
|
||||||
>
|
>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem v-slot="{ active }">
|
||||||
|
<router-link
|
||||||
|
to="/nirf-data"
|
||||||
|
:class="[
|
||||||
|
active ? 'bg-gray-100 text-gray-900' : 'text-gray-700',
|
||||||
|
'block px-1 py-2 text-sm',
|
||||||
|
]"
|
||||||
|
>NIRF Data</router-link
|
||||||
|
>
|
||||||
|
</MenuItem>
|
||||||
<MenuItem v-slot="{ active }">
|
<MenuItem v-slot="{ active }">
|
||||||
<router-link
|
<router-link
|
||||||
to="/aqar"
|
to="/aqar"
|
||||||
|
|
|
@ -1,33 +1,89 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="container-fluid bg-white mx-auto mt-3 p-0">
|
<div class="container bg-white mx-auto mt-3 p-4">
|
||||||
<div v-if="isLoading">
|
<div v-if="isLoading">
|
||||||
<h2 class="ml-28 text-4xl">Loading ...</h2>
|
<h2>Loading ...</h2>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<div v-html="page[0].content" class="container mx-auto">
|
<!-- <h2>{{page[0].title}}</h2> -->
|
||||||
|
<div v-html="page[0].content" ></div>
|
||||||
|
<div v-if="fileAttached">
|
||||||
|
<h2>Attachments.</h2>
|
||||||
|
<ul>
|
||||||
|
<li v-for="(file, index) in files">
|
||||||
|
{{index+1}}.
|
||||||
|
<a class="text-blue-600" :href="`https://api8.siliconpin.com/assets/` + file.id+'?download' " :download="file.filename_download">
|
||||||
|
{{ file.filename_download }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
page: null,
|
page: null,
|
||||||
|
fileAttached:false,
|
||||||
|
files: [],
|
||||||
isLoading: true
|
isLoading: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
fetch('https://api8.siliconpin.com/items/scc22?filter[slug][_eq]=' + this.$route.params.id)
|
fetch('https://api8.siliconpin.com/items/scc22?filter[slug][_eq]=' + this.$route.params.id)
|
||||||
// fetch('https://api8.siliconpin.com/items/scc22?slug=about-us')
|
.then((response) => {
|
||||||
.then(response => response.json())
|
if (response.ok) {
|
||||||
.then(data => {
|
return response.json();
|
||||||
this.page = data.data
|
}
|
||||||
console.log(data)
|
throw new Error('Something went wrong');
|
||||||
this.isLoading = false
|
})
|
||||||
})
|
.then(jsonPageData => {
|
||||||
|
this.page = jsonPageData.data
|
||||||
|
console.log(this.page)
|
||||||
|
this.isLoading = false
|
||||||
|
return jsonPageData.data[0].id
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then((pageID) => {
|
||||||
|
fetch('https://api8.siliconpin.com/items/scc22_files_1?filter[scc22_id][_in]=' + pageID)
|
||||||
|
.then(resp => resp.json())
|
||||||
|
.then(file => {
|
||||||
|
let attIDs = ''
|
||||||
|
let t = 0
|
||||||
|
file.data.forEach(ids => {
|
||||||
|
if (t == 0) attIDs = ids.directus_files_id
|
||||||
|
else attIDs = attIDs + ',' + ids.directus_files_id
|
||||||
|
t++
|
||||||
|
});
|
||||||
|
if(t>0) this.fileAttached=true
|
||||||
|
return attIDs
|
||||||
|
})
|
||||||
|
.then((attIDs) => {
|
||||||
|
fetch('https://api8.siliconpin.com/files?filter[id][_in]=' + attIDs)
|
||||||
|
.then(resp => resp.json())
|
||||||
|
.then(file => {
|
||||||
|
this.files = file.data
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// getAttachments(att) {
|
||||||
|
|
||||||
|
// console.log(att)
|
||||||
|
// // fetch('https://api8.siliconpin.com/items/ecom55?filter[slug][_eq]=' + this.$route.params.id)
|
||||||
|
// // .then(response => response.json())
|
||||||
|
// // .then(data => this.itemByCategory = data)
|
||||||
|
// // console.log(this.itemByCategory)
|
||||||
|
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue