From 0894510c2e23062d1ddf43c184e9e4fccba4e330 Mon Sep 17 00:00:00 2001
From: yannqing <67121851@qq.com>
Date: Fri, 15 Mar 2024 01:04:34 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/js/request.js | 22 +++---------
src/views/ProjectPage/ProjectCard.vue | 50 ++++++++++++++++++---------
2 files changed, 38 insertions(+), 34 deletions(-)
diff --git a/src/js/request.js b/src/js/request.js
index 54445e9..ffa1796 100644
--- a/src/js/request.js
+++ b/src/js/request.js
@@ -535,26 +535,14 @@ const projectAdd =(token,data) => {
* 展示游客查看的项目
*/
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 isFinish = data.isFinish
const encodedTags = tags.map(tag => encodeURIComponent(tag));
- const queryString = `tags=${encodedTags.join('&tags=')}`;
+ const encodedIsFinish = isFinish.map(is => encodeURIComponent(is))
+ const queryTags = `tags=${encodedTags.join('&tags=')}`;
+ const queryIsFinish = `isFinish=${encodedIsFinish.join('&isFinish=')}`;
return axios({
- url:`${api}/project/get/custom?${queryString}`,
+ url:`${api}/project/get/custom?${queryTags}&${queryIsFinish}`,
method: "get",
headers:{
'Timestamp': getCurrentTimestamp()
diff --git a/src/views/ProjectPage/ProjectCard.vue b/src/views/ProjectPage/ProjectCard.vue
index a6debc6..fe7c65a 100644
--- a/src/views/ProjectPage/ProjectCard.vue
+++ b/src/views/ProjectPage/ProjectCard.vue
@@ -20,7 +20,7 @@
@@ -51,6 +51,11 @@ import router from "@/router/index.js";
const showButton = reactive([]);
const projects = ref([]);
const id =ref(1)
+const data = reactive({
+ id:null,
+ tags:[],
+ isFinish:[0,1,2,-1]
+})
// const pageSize = ref(20);
// const current1 = ref(3);
@@ -69,7 +74,7 @@ onMounted(() =>{
})
function getAllProject(){
request.projectGetCustom(data).then((res)=>{
- console.log("project-res:",res.data.data)
+ // console.log("project-res:",res.data.data)
// console.log("data:",data)
// Project.data= res.data.data.data
projects.value = res.data.data;
@@ -80,7 +85,29 @@ function getAllProject(){
const tagsData = ref([]);
const selectTags = ref([false, false, false, false]);
-const projStatus = ref();
+const options = [
+ {
+ label: '未开始',
+ value: 0,
+ },
+ {
+ label: '进行中',
+ value: 2,
+ },
+ {
+ label: '已完成',
+ value: 1,
+ },
+ {
+ label: '已暂停',
+ value: -1,
+ },
+]
+watch(() =>data.isFinish, async (newValue, oldValue) =>{
+ console.log("data.isFinish", data.isFinish)
+ getAllProject()
+})
+
const tagAll=ref(true)
const token = window.localStorage.getItem('token')
@@ -95,16 +122,9 @@ const handleClickAll=(checked)=>{
selectTags.value[index]=false
})
selectedTags.value = []
- // data.tags = []
- // getAllProject()
- // 发送获取全部数据的请求
- // request.projectGetCustom(selectedTagNames.value).then(res=>{
- // projects.value=res.data.data
- // console.log(res.data.data)
- // })
}
- console.log("selectedTags",selectedTags.value)
+ // console.log("selectedTags",selectedTags.value)
}
const selectedTags =ref([])
@@ -133,7 +153,7 @@ const handleChange = (tag, checked) => {
tagAll.value = true;
}
}
- console.log("selectedTags:", selectedTags.value)
+ // console.log("selectedTags:", selectedTags.value)
// data.tags = selectedTags.value
// getAllProject()
// 在这里触发向后端请求数据的操作,将selectedTags作为参数发送到后端
@@ -155,11 +175,7 @@ console.log(project.id)
// @click="selectedTags.web = !selectedTags.web"
-const data = reactive({
- id:null,
- tags:[],
- isFinish:[]
-})
+
watch(() => selectedTags.value.length, async (newValue, oldValue) =>{
data.tags = []
selectedTags.value.forEach((item,index)=>{