diff --git a/Yi.Bbs.Vue3/public/login.svg b/Yi.Bbs.Vue3/public/login.svg
new file mode 100644
index 00000000..7801fe4b
--- /dev/null
+++ b/Yi.Bbs.Vue3/public/login.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Yi.Bbs.Vue3/src/apis/commentApi.js b/Yi.Bbs.Vue3/src/apis/commentApi.js
index 305f811d..1615c9d9 100644
--- a/Yi.Bbs.Vue3/src/apis/commentApi.js
+++ b/Yi.Bbs.Vue3/src/apis/commentApi.js
@@ -15,9 +15,10 @@ export function add(data) {
});
}
-export function del(ids) {
+export function del(data) {
return request({
- url: `/comment/${ids}`,
+ url: `/comment`,
method: "delete",
+ data: data,
});
}
diff --git a/Yi.Bbs.Vue3/src/assets/common/icons/login.svg b/Yi.Bbs.Vue3/src/assets/common/icons/login.svg
new file mode 100644
index 00000000..7801fe4b
--- /dev/null
+++ b/Yi.Bbs.Vue3/src/assets/common/icons/login.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Yi.Bbs.Vue3/src/assets/common/icons/logo.ico b/Yi.Bbs.Vue3/src/assets/common/icons/logo.ico
new file mode 100644
index 00000000..7650ebd0
Binary files /dev/null and b/Yi.Bbs.Vue3/src/assets/common/icons/logo.ico differ
diff --git a/Yi.Bbs.Vue3/src/components/AvatarInfo.vue b/Yi.Bbs.Vue3/src/components/AvatarInfo.vue
index b2fc999f..8c7f0a74 100644
--- a/Yi.Bbs.Vue3/src/components/AvatarInfo.vue
+++ b/Yi.Bbs.Vue3/src/components/AvatarInfo.vue
@@ -96,7 +96,7 @@ const Init = () => {
userInfo.nick = userStore.name;
userInfo.role = userStore.role;
userInfo.id = userStore.id;
- iconUrl.value = iconUrlHandler(userInfo.icon);
+ iconUrl.value = userInfo.icon;
}
};
@@ -134,7 +134,8 @@ const Init = () => {
}
.el-avatar {
- margin-right: 1.2rem;
+ margin-right: 1rem;
+ --el-avatar-bg-color: none;
}
.remarks {
diff --git a/Yi.Bbs.Vue3/src/components/CommentInfo.vue b/Yi.Bbs.Vue3/src/components/CommentInfo.vue
index fc262af8..15863ef7 100644
--- a/Yi.Bbs.Vue3/src/components/CommentInfo.vue
+++ b/Yi.Bbs.Vue3/src/components/CommentInfo.vue
@@ -5,22 +5,30 @@
-
共{{total}}个评论
-
+ 共{{ total }}个评论
+
+
最新
最热
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
@@ -30,72 +38,123 @@
{{ item.content }}
{{ item.creationTime }}
-
+
- 0
- 回复
- 删除
+
+ 0
+ 回复
+ 删除
-
-
+
\ No newline at end of file
+
diff --git a/Yi.Bbs.Vue3/src/layout/AppHeader.vue b/Yi.Bbs.Vue3/src/layout/AppHeader.vue
index c4029c3e..b1624350 100644
--- a/Yi.Bbs.Vue3/src/layout/AppHeader.vue
+++ b/Yi.Bbs.Vue3/src/layout/AppHeader.vue
@@ -2,7 +2,7 @@
@@ -69,6 +72,9 @@ import { ref } from "vue";
import { useRouter } from "vue-router";
import useUserStore from "@/stores/user.js";
import useConfigStore from "@/stores/config";
+import useAuths from "@/hooks/useAuths";
+
+const { getToken } = useAuths();
const configStore = useConfigStore();
const router = useRouter();
const userStore = useUserStore();
@@ -99,12 +105,16 @@ const enterIndex = () => {
const enterProfile = () => {
router.push("/profile");
};
-
+const toLogin = () => {
+ router.push("/login");
+};
const search = () => {
var routerPer = { path: `/discuss`, query: { q: searchText.value } };
searchText.value = "";
router.push(routerPer);
};
+
+const isLogin = getToken("AccessToken") ? true : false;
diff --git a/Yi.Bbs.Vue3/src/permission.js b/Yi.Bbs.Vue3/src/permission.js
index 7abc3acc..181de09b 100644
--- a/Yi.Bbs.Vue3/src/permission.js
+++ b/Yi.Bbs.Vue3/src/permission.js
@@ -42,6 +42,7 @@ router.beforeEach((to, from, next) => {
next();
} else {
next();
+ useUserStore().resetInfo();
// next(`/login?redirect=${to.path}&unTourist=true`); // 否则全部重定向到登录页
NProgress.done();
}
diff --git a/Yi.Bbs.Vue3/src/stores/user.js b/Yi.Bbs.Vue3/src/stores/user.js
index 05d51a85..e945ee21 100644
--- a/Yi.Bbs.Vue3/src/stores/user.js
+++ b/Yi.Bbs.Vue3/src/stores/user.js
@@ -1,4 +1,4 @@
-import { login, logout, getInfo, register } from "@/apis/accountApi";
+import { login, logout, register } from "@/apis/accountApi";
import { getUserDetailInfo } from "@/apis/auth";
import useAuths from "@/hooks/useAuths";
import { defineStore } from "pinia";
@@ -106,6 +106,15 @@ const useUserStore = defineStore("user", {
});
});
},
+ // 重置用户信息
+ resetInfo() {
+ this.roles = [];
+ this.permissions = [];
+ this.name = "未登录";
+ this.icon = "/login.svg";
+ this.userName = "";
+ this.id = "";
+ },
},
});
export default useUserStore;
diff --git a/Yi.Bbs.Vue3/src/views/Discuss.vue b/Yi.Bbs.Vue3/src/views/Discuss.vue
index 4ed7b6e8..803acc68 100644
--- a/Yi.Bbs.Vue3/src/views/Discuss.vue
+++ b/Yi.Bbs.Vue3/src/views/Discuss.vue
@@ -10,7 +10,7 @@
- 重置
+ 重置
import DisscussCard from "@/components/DisscussCard.vue";
import { getList, getTopList } from "@/apis/discussApi.js";
-import { onMounted, ref, reactive } from "vue";
+import { ref, reactive, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
import BottomInfo from "@/components/BottomInfo.vue";
+
//数据定义
const route = useRoute();
const router = useRouter();
@@ -127,19 +128,29 @@ const handleClick = async (tab, event) => {
await loadDiscussList();
};
-onMounted(async () => {
- if (route.query.q != undefined) {
- query.title = route.query.q ?? "";
- router.push("/discuss");
- }
- await loadDiscussList();
-});
+// onMounted(async () => {
+// if (route.query.q != undefined) {
+// query.title = route.query.q ?? "";
+// router.push("/discuss");
+// }
+// await loadDiscussList();
+// });
+
+// 重置
+const handleReset = () => {
+ query.skipCount = 1;
+ query.maxResultCount = 10;
+ query.title = "";
+ query.plateId = route.params.plateId;
+ query.type = activeName.value;
+ loadDiscussList();
+};
//加载discuss
const loadDiscussList = async () => {
const response = await getList(query);
discussList.value = response.data.items;
- total.value = Number(response.data.total);
+ total.value = Number(response.data.totalCount);
//全查,无需参数
const topResponse = await getTopList();
@@ -159,6 +170,18 @@ const enterEditArticle = () => {
};
router.push(routerPer);
};
+
+watch(
+ () => route.query.q,
+ async (val) => {
+ console.log(val);
+ if (val) {
+ query.title = val ?? "";
+ }
+ loadDiscussList();
+ },
+ { immediate: true }
+);