notice with attachments download
parent
97ba2d9034
commit
acdf4d154f
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Vite, Vue3, Tailwind CSS</title>
|
<title>Sreechaitanya College, Habra</title>
|
||||||
<!-- <link
|
<!-- <link
|
||||||
rel="preload"
|
rel="preload"
|
||||||
href="/font/Inter-roman.var.woff2"
|
href="/font/Inter-roman.var.woff2"
|
||||||
|
|
|
@ -8,20 +8,18 @@
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="files">
|
<div v-if="fileAttached">
|
||||||
<h2>Attachments</h2>
|
<h2>Attachments</h2>
|
||||||
<div v-for="(file, index) in files">
|
<div v-for="(file, index) in files">
|
||||||
{{index+1}}<a :href="'https://api8.siliconpin.com/assets/' + file.directus_files_id">
|
|
||||||
<h3> {{ file.directus_files_id }}</h3>
|
{{index+1}}
|
||||||
|
<a target="_blank" :href="`https://api8.siliconpin.com/assets/` + file.id+'?download' " :download="file.filename_download">
|
||||||
|
<h3> {{ file.filename_download }}</h3>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- <div>{{page[0].attachments[0]}}</div> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -38,33 +36,43 @@ export default {
|
||||||
},
|
},
|
||||||
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)
|
||||||
.then(response => response.json())
|
.then((response) => {
|
||||||
.then(data => {
|
if (response.ok) {
|
||||||
this.page = data.data
|
return response.json();
|
||||||
this.isLoading = false
|
}
|
||||||
|
throw new Error('Something went wrong');
|
||||||
fetch('https://api8.siliconpin.com/items/scc22_files_1?filter[scc22_id][_in]=' + this.page[0].id)
|
|
||||||
.then(resp => resp.json())
|
|
||||||
.then(file => {
|
|
||||||
this.files = file.data
|
|
||||||
// this.files = file.data
|
|
||||||
this.fileAttached=true
|
|
||||||
// attach.data.forEach(fileID=> this.files.push(fileID.directus_files_id))
|
|
||||||
// console.log(file.data)
|
|
||||||
// this.attachments.push(attach.data[0].directus_files_id)
|
|
||||||
})
|
|
||||||
let attIDs = ''
|
|
||||||
let t = 0
|
|
||||||
this.files.forEach(ids => {
|
|
||||||
if (t == 0) attIDs = ids
|
|
||||||
else attIDs = attIDs + ',' + ids
|
|
||||||
t++
|
|
||||||
console.log(attIDs)
|
|
||||||
});
|
|
||||||
if(this.fileAttached){}
|
|
||||||
// console.log(Object.assign({}, this.files))
|
|
||||||
// console.log(this.files)
|
|
||||||
})
|
})
|
||||||
|
.then(jsonPageData => {
|
||||||
|
this.page = jsonPageData.data
|
||||||
|
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: {
|
methods: {
|
||||||
// getAttachments(att) {
|
// getAttachments(att) {
|
||||||
|
|
Loading…
Reference in New Issue