修复bug

This commit is contained in:
yannqing 2024-03-15 01:04:34 +08:00
parent 3b4b566f8f
commit 0894510c2e
2 changed files with 38 additions and 34 deletions

View File

@ -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()

View File

@ -20,7 +20,7 @@
</a-checkable-tag>
</div>
<div class="">
<a-checkbox-group v-model:value="projStatus" :options="['进行中','已完成']" class="mr-3" />
<a-checkbox-group v-model:value="data.isFinish" :options="options" class="mr-3" />
</div>
</div>
@ -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)=>{