diff --git a/src/js/request.js b/src/js/request.js index 61d6e9e..54445e9 100644 --- a/src/js/request.js +++ b/src/js/request.js @@ -534,18 +534,47 @@ const projectAdd =(token,data) => { /** * 展示游客查看的项目 */ -const projectGetCustom = () =>{ +const projectGetCustom = (data) =>{ + // const tags = ['web','大数据'] + // const params = { + // tags: + // } + // const config = { + // headers: { + // 'Timestamp': getCurrentTimestamp(), + // // 添加其他需要的头部信息 + // } + // }; + // return axios.get(api+"/project/get/custom", { + // params, + // config + // }) + + const tags = data.tags + const encodedTags = tags.map(tag => encodeURIComponent(tag)); + const queryString = `tags=${encodedTags.join('&tags=')}`; return axios({ - url:api+ "/project/get/custom", + url:`${api}/project/get/custom?${queryString}`, method: "get", - data: { - tags: ["web"] - }, headers:{ 'Timestamp': getCurrentTimestamp() } }) } +// projectGetCustom().interceptors.request.use(config => { +// let url = config.url +// if (config.params) { +// url += '?' +// const keys = Object.keys(config.params) +// for (const key of keys) { +// url += `${key}=${encodeURIComponent(config.params[key])}&` +// } +// url = url.substring(0, url.length-1) +// config.params = {} +// } +// config.url = url +// return config +// }) diff --git a/src/views/ProjectPage/ProjectCard.vue b/src/views/ProjectPage/ProjectCard.vue index c69eb15..a6debc6 100644 --- a/src/views/ProjectPage/ProjectCard.vue +++ b/src/views/ProjectPage/ProjectCard.vue @@ -68,7 +68,7 @@ onMounted(() =>{ getAllProject() }) function getAllProject(){ - request.projectGetCustom().then((res)=>{ + request.projectGetCustom(data).then((res)=>{ console.log("project-res:",res.data.data) // console.log("data:",data) // Project.data= res.data.data.data @@ -156,8 +156,8 @@ console.log(project.id) // @click="selectedTags.web = !selectedTags.web" const data = reactive({ - id:1, - tags:['web','ai'], + id:null, + tags:[], isFinish:[] }) watch(() => selectedTags.value.length, async (newValue, oldValue) =>{