1
0
forked from PGL/Clyde

added ListResearch App

This commit is contained in:
Bartha Maxime 2024-04-18 17:17:29 +02:00
parent 14c5423328
commit fed567e9ab
8 changed files with 88 additions and 8 deletions

View File

@ -29,6 +29,7 @@ app.manage.profile=Manage profile
app.studentList=Students List
app.users=Users
app.manage.researcherProfile=Manage researcher profile
app.list.researches = List researches
request.moreInfos=More Infos
request.accept=Accept
request.refuse=Refuse

View File

@ -29,6 +29,7 @@ app.manage.profile=Gérer le profil
app.studentList=Liste des étudiants
app.users=Utilisateurs
app.manage.researcherProfile= gérer son profil de chercheur
app.list.researches = lister les recherches
request.moreInfos=Plus d'Infos
request.accept=Accepter
request.refuse=Refuser

View File

@ -1,8 +1,83 @@
<script setup>
import { ref} from "vue";
import FilterComponent from "@/Apps/ScientificPublications/FilterComponent.vue";
import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vue";
import {getFile, fetchResearches, addView} from "@/rest/ScientificPublications/ManageResearch.js";
const input = ref("")
const isFilterOpened = ref(false);
const isResearchOpened = ref(false);
const articleToDisplay = ref(Object)
const researchList = ref(await fetchResearches(1));
const props = defineProps({
filters: ref([""]),
});
const openFilter = () => {
isFilterOpened.value = true;
};
const closeFilter = () => {
isFilterOpened.value = false;
};
const submitFilters = ()=>{
}
const openResearch = (article) => {
isResearchOpened.value = true;
articleToDisplay.value = article;
}
const closeResearch = () => {
isResearchOpened.value =false;
articleToDisplay.value = null;
}
const downloadBibTex = (research) => {
getFile(research.bibTexLocation)
}
const downloadArticle = (research) => {
addView(research.pdfLocation)
getFile(research.pdfLocation)
}
function downloadCoAuthors(){
//todo
const data = JSON.stringify(researcher.value);
const blob = new Blob([data], {type:"application/json"});
return URL.createObjectURL(blob);
}
function searchInList(list, searchInput) {
let retList = []
for (let i = 0; i < list.length; i++) {
if (lDistance(list[i].title, searchInput) < 10 || list[i].title.toUpperCase().indexOf(searchInput.toUpperCase()) > -1){
retList.push(list[i])
}
}
return retList
}
function lDistance(s,t){
if (!s.length) return t.length;
if (!t.length) return s.length;
const arr = [];
for (let i = 0; i <= t.length; i++) {
arr[i] = [i];
for (let j = 1; j <= s.length; j++) {
arr[i][j] =
i === 0
? j
: Math.min(
arr[i - 1][j] + 1,
arr[i][j - 1] + 1,
arr[i - 1][j - 1] + (s[j - 1] === t[i - 1] ? 0 : 1)
);
}
}
return arr[t.length][s.length];
}
</script>

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, reactive } from "vue";
import { ref} from "vue";
import FilterComponent from "@/Apps/ScientificPublications/FilterComponent.vue";
import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vue";
import {fetchResearches, } from "@/rest/ScientificPublications/ResearcherProfile.js";
@ -10,7 +10,6 @@ const isFilterOpened = ref(false);
const isResearchOpened = ref(false);
const isPostResearchOpened = ref(false);
const articleToDisplay = ref()
const filters = ref([]);
const changing = ref(false);
let toModify= Object.assign({}, {});

View File

@ -9,8 +9,8 @@
import { ref, reactive } from "vue";
import FilterComponent from "@/Apps/ScientificPublications/FilterComponent.vue";
import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vue";
import {fetchResearcher, fetchResearches, fetchStats, addView} from "@/rest/ScientificPublications/ResearcherProfile.js";
import {getFile} from "@/rest/ScientificPublications/ManageResearch.js";
import {fetchResearcher, fetchResearches, fetchStats} from "@/rest/ScientificPublications/ResearcherProfile.js";
import {getFile, addView} from "@/rest/ScientificPublications/ManageResearch.js";
const input = ref("");
const statsOf = ref("");
const statsBy = ref("");

View File

@ -31,3 +31,6 @@ export async function getFile(url){
const restURL = import.meta.env.VITE_CLYDE_MODE === 'container' ? "http://localhost:8000": import.meta.env.DEV ? "http://localhost:5173" : "https://clyde.herisson.ovh/api"
await fetch(restURL + "/"+url, {method: "GET"})
}
export async function addView(url){
return restPost("/addview/" +url)
}

View File

@ -11,6 +11,3 @@ export async function fetchResearches(id){
export async function fetchStats(id){
return restGet("/stats/" +id)
}
export async function addView(url){
return restPost("/addview/" +url)
}

View File

@ -13,6 +13,7 @@ import AboutStudent from "@/Apps/Inscription/AboutStudent.vue";
import Msg from "@/Apps/Msg.vue"
import ManageRequests from "@/Apps/Inscription/ManageRequests.vue";
import ManageResearcherProfile from "@/Apps/ScientificPublications/ManageResearcherProfile.vue";
import ListResearches from "@/Apps/ScientificPublications/ListResearches.vue";
const apps = {
'/login': LoginPage,
@ -23,9 +24,11 @@ const apps = {
'/students-list' : Students,
'/manage-researcher-profile' : ManageResearcherProfile,
'/msg' : Msg,
'/researches' : ListResearches
}
const appsList = {
'ListResearches': {path:'#/researches', icon:'fa-book-bookmark',text:i18n("app.list.researches")},
'Msg': { path: '#/msg', icon: 'fa-comment', text: i18n("app.messages") },
'Notification': { path: '#/notifs', icon: 'fa-bell', text: i18n("app.notifications") },
'Forum': { path: '#/forum', icon: 'fa-envelope', text: i18n("app.forum") },
@ -35,6 +38,7 @@ const appsList = {
'StudentsList':{ path: '#/students-list',icon: 'fa-users',text: i18n("app.studentList")},
'UsersList':{ path: '#/users-list',icon: 'fa-users',text: i18n("app.users")},
'ManageResearcherProfile':{path:'#/manage-researcher-profile',icon:'fa-book-bookmark',text:i18n("app.manage.researcherProfile")},
}
const currentPath = ref(window.location.hash)