修复bug
This commit is contained in:
parent
3b4b566f8f
commit
0894510c2e
@ -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()
|
||||
|
@ -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)=>{
|
||||
|
Loading…
x
Reference in New Issue
Block a user