Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
SunWuyuan committed Dec 22, 2024
1 parent 1aabf54 commit 9b36832
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 152 deletions.
32 changes: 0 additions & 32 deletions 1.html

This file was deleted.

92 changes: 0 additions & 92 deletions 2.html

This file was deleted.

11 changes: 3 additions & 8 deletions src/components/AddTolist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
color="primary"
@click="
item.include == true
? deleteProjectFromList(item.id)
? removeProjectFromList(item.id)
: addProjectToList(item.id)
"
>
Expand Down Expand Up @@ -51,10 +51,6 @@ export default {
this.projectLists = (
await request({
url: "/projectlist/check?projectid=" + this.$route.params.id,
data: {
userid: this.userinfo.id,
projectid: this.$route.params.id,
},
method: "get",
})
).data;
Expand All @@ -78,11 +74,10 @@ export default {
this.getProjectList();
});
},
async deleteProjectFromList(id) {
async removeProjectFromList(id) {
await request({
url: "/projectlist/delete",
url: "/projectlist/remove",
data: {
userid: this.userinfo.id,
projectid: this.$route.params.id,
listid: id,
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/EditProjectListConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default {
this.isVisible = true;
},
async getProjectList(listid) {
await request.get("/projectlist/" + listid).then((res) => {
await request.get("/projectlist/listid/" + listid).then((res) => {
console.log(res);
this.$toast.add({
severity: "info",
Expand All @@ -106,7 +106,7 @@ export default {
},
async updateProjectList(listid) {
await request
.put("/projectlist/" + listid, this.newListInfo)
.post("/projectlist/update/" + listid, this.newListInfo)
.then((res) => {
console.log(res);
this.$toast.add({
Expand Down
2 changes: 1 addition & 1 deletion src/components/NewProjectList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default {
this.isVisibleDialog = true;
},
async newProjectList() {
await request.post("/projectlist/", this.projectInfo).then((res) => {
await request.post("/projectlist/create", this.projectInfo).then((res) => {
console.log(res);
this.$toast.add({
severity: "info",
Expand Down
59 changes: 59 additions & 0 deletions src/components/ProjectStar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<template>
<v-btn @click="ToggleStarProject()" :color="star ? 'yellow' : ''">Star</v-btn
>{{ projectLists }}
</template>
<script>
import NewProjectList from "@/components/NewProjectList.vue";
import { localuser } from "@/stores/user";
import request from "../axios/axios";
export default {
components: { NewProjectList },
name: "addtolist",
data() {
return {
localuser: localuser,
userinfo: localuser.user,
newProjectListDialog: false,
projectLists: "",
star: false,
};
},
methods: {
getStarStatus() {
request({
url: `/projectlist/checkstar?projectid=${this.$route.params.id}`,
method: "get",
}).then((res) => {
this.star = res.star;
});
},
ToggleStarProject() {
if (this.star==0) {
request({
url: `/projectlist/star`,
method: "post",
data: {
projectid: this.$route.params.id,
},
}).then((res) => {
this.star = res.star;
});
} else {
request({
url: `/projectlist/unstar`,
method: "post",
data: {
projectid: this.$route.params.id,
},
}).then((res) => {
this.star = res.star;
});
}
},
},
mounted() {
this.getStarStatus();
},
};
</script>
4 changes: 2 additions & 2 deletions src/pages/projectlist/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</v-card-text>
</v-card>
<br />
<ProjectsCards :projects="projectlist.data"></ProjectsCards><br />
<ProjectsCards :projects="projectlist.projects"></ProjectsCards><br />

<Comment
:url="'projectlist-' + this.$route.params.id"
Expand Down Expand Up @@ -91,7 +91,7 @@ export default {
methods: {
async getprojectlist() {
this.projectlist = await request({
url: "/projectlist/" + this.$route.params.id,
url: "/projectlist/listid/" + this.$route.params.id,
method: "get",
});
if (this.projectlist.status == "1") {
Expand Down
28 changes: 14 additions & 14 deletions src/pages/projectlist/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ import { localuser } from "@/stores/user";
import request from "../../axios/axios";
import { useHead } from "@unhead/vue";
export default {
components: { NewProjectList, EditProjectListConfig },
components: {NewProjectList, EditProjectListConfig},
name: "projectlist",
async created() {
if (this.localuser.islogin == false) {
this.$router.push("/account/login");
}
},
data() {
return {
localuser: localuser,
Expand All @@ -80,29 +84,25 @@ export default {
lists: [],
};
},
setup() {
useHead({
title: "列表",
});
},
async created() {
if (this.localuser.islogin == false) {
this.$router.push("/account/login");
}
},
methods: {
async getProjectList() {
this.lists = (
await request({
url: `/projectlist/user/${this.localuser.user.userid}`,
url: `/projectlist/my`,
method: "get",
})
).data;
},
},
mounted() {
this.getProjectList();
},
name: "projectlist",
setup() {
useHead({
title: "列表",
});
},
};
</script>
2 changes: 1 addition & 1 deletion src/pages/user/[...id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default {
async getProjectList() {
this.lists = (
await request({
url: `/projectlist/user/${this.userinfo.info.user.id}/public`,
url: `/projectlist/userid/${this.userinfo.info.user.id}/public`,
method: "get",
})
).data;
Expand Down

0 comments on commit 9b36832

Please sign in to comment.