Merge branch 'abp' of https://gitee.com/ccnetcore/Yi into abp
This commit is contained in:
1
Yi.Bbs.Vue3/public/login.svg
Normal file
1
Yi.Bbs.Vue3/public/login.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1702690681392" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3423" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M575.215 547.318c53.367-24.316 90.562-78.011 90.562-140.522 0-85.257-69.149-154.383-154.406-154.383-85.299 0-154.427 69.126-154.427 154.383 0 62.49 37.172 116.185 90.562 140.522-87.156 27.24-150.586 108.698-150.586 204.715 0 12.071 9.779 21.827 21.827 21.827s21.827-9.756 21.827-21.827c0-94.161 76.613-170.774 170.776-170.774 94.184 0 170.797 76.613 170.797 170.774 0 12.071 9.756 21.827 21.827 21.827 12.07 0 21.827-9.756 21.827-21.827 0.021-95.994-63.43-177.475-150.586-204.715zM400.621 406.817c0-61.072 49.678-110.729 110.773-110.729 61.072 0 110.75 49.657 110.75 110.729 0 61.094-49.678 110.794-110.75 110.794-61.095 0-110.773-49.7-110.773-110.794z" p-id="3424" fill="#515151"></path><path d="M511.371 960.81c-246.951 0-447.869-200.918-447.869-447.891 0-246.93 200.919-447.871 447.869-447.871 246.973 0 447.892 200.919 447.892 447.871 0 246.973-200.919 447.891-447.892 447.891z m0-854.269c-224.098 0-406.398 182.301-406.398 406.377s182.3 406.397 406.398 406.397c224.099 0 406.42-182.321 406.42-406.397S735.47 106.541 511.371 106.541z" p-id="3425" fill="#515151"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
1
Yi.Bbs.Vue3/src/assets/common/icons/login.svg
Normal file
1
Yi.Bbs.Vue3/src/assets/common/icons/login.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1702690681392" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3423" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M575.215 547.318c53.367-24.316 90.562-78.011 90.562-140.522 0-85.257-69.149-154.383-154.406-154.383-85.299 0-154.427 69.126-154.427 154.383 0 62.49 37.172 116.185 90.562 140.522-87.156 27.24-150.586 108.698-150.586 204.715 0 12.071 9.779 21.827 21.827 21.827s21.827-9.756 21.827-21.827c0-94.161 76.613-170.774 170.776-170.774 94.184 0 170.797 76.613 170.797 170.774 0 12.071 9.756 21.827 21.827 21.827 12.07 0 21.827-9.756 21.827-21.827 0.021-95.994-63.43-177.475-150.586-204.715zM400.621 406.817c0-61.072 49.678-110.729 110.773-110.729 61.072 0 110.75 49.657 110.75 110.729 0 61.094-49.678 110.794-110.75 110.794-61.095 0-110.773-49.7-110.773-110.794z" p-id="3424" fill="#515151"></path><path d="M511.371 960.81c-246.951 0-447.869-200.918-447.869-447.891 0-246.93 200.919-447.871 447.869-447.871 246.973 0 447.892 200.919 447.892 447.871 0 246.973-200.919 447.891-447.892 447.891z m0-854.269c-224.098 0-406.398 182.301-406.398 406.377s182.3 406.397 406.398 406.397c224.099 0 406.42-182.321 406.42-406.397S735.47 106.541 511.371 106.541z" p-id="3425" fill="#515151"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Yi.Bbs.Vue3/src/assets/common/icons/logo.ico
Normal file
BIN
Yi.Bbs.Vue3/src/assets/common/icons/logo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
@@ -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;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -134,7 +134,8 @@ const Init = () => {
|
||||
}
|
||||
|
||||
.el-avatar {
|
||||
margin-right: 1.2rem;
|
||||
margin-right: 1rem;
|
||||
--el-avatar-bg-color: none;
|
||||
}
|
||||
|
||||
.remarks {
|
||||
|
||||
@@ -5,22 +5,30 @@
|
||||
</el-tabs>
|
||||
|
||||
<div class="total">
|
||||
<div style="align-self: center;"> 共{{total}}个评论</div>
|
||||
<div> <el-radio-group v-model="selectRadio">
|
||||
<div style="align-self: center">共{{ total }}个评论</div>
|
||||
<div>
|
||||
<el-radio-group v-model="selectRadio">
|
||||
<el-radio-button label="new" name="new">最新</el-radio-button>
|
||||
<el-radio-button label="host" name="host">最热</el-radio-button>
|
||||
</el-radio-group></div>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-divider />
|
||||
<div v-hasPer="['bbs:comment:add']">
|
||||
<el-input
|
||||
v-model="topContent"
|
||||
placeholder="发表一个友善的评论吧~"
|
||||
:rows="5"
|
||||
type="textarea"
|
||||
></el-input>
|
||||
<el-button @click="addTopComment" type="primary" class="btn-top-comment"
|
||||
>发表评论</el-button
|
||||
>
|
||||
<el-button class="btn-top-comment">其他</el-button>
|
||||
|
||||
<el-divider />
|
||||
<div v-hasPer="['bbs:comment:add']">
|
||||
<el-input v-model="topContent" placeholder="发表一个友善的评论吧~" :rows="5" type="textarea"></el-input>
|
||||
<el-button @click="addTopComment" type="primary" class="btn-top-comment" >发表评论</el-button>
|
||||
<el-button class="btn-top-comment">其他</el-button>
|
||||
|
||||
<el-divider />
|
||||
</div>
|
||||
<el-divider />
|
||||
</div>
|
||||
|
||||
<!-- 开始评论主体 -->
|
||||
|
||||
@@ -30,72 +38,123 @@
|
||||
{{ item.content }}
|
||||
</div>
|
||||
<span class="time"> {{ item.creationTime }} </span>
|
||||
<span class="pointer"><el-icon>
|
||||
<span class="pointer"
|
||||
><el-icon>
|
||||
<Pointer />
|
||||
</el-icon> 0</span>
|
||||
<el-button type="primary" @click="replay(item.createUser.nick, item.id, item.id)" size="large" text v-hasPer="['bbs:comment:add']">回复</el-button>
|
||||
<el-button type="danger" @click="delComment(item.id)" size="large" text v-hasPer="['bbs:comment:remove']">删除</el-button>
|
||||
</el-icon>
|
||||
0</span
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="replay(item.createUser.nick, item.id, item.id)"
|
||||
size="large"
|
||||
text
|
||||
v-hasPer="['bbs:comment:add']"
|
||||
>回复</el-button
|
||||
>
|
||||
<el-button
|
||||
type="danger"
|
||||
@click="delComment(item.id)"
|
||||
size="large"
|
||||
text
|
||||
v-hasPer="['bbs:comment:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
<div v-show="replayId == item.id" class="input-reply">
|
||||
<el-input v-model="form.content" :placeholder="placeholder" :rows="3" type="textarea"></el-input>
|
||||
<el-input
|
||||
v-model="form.content"
|
||||
:placeholder="placeholder"
|
||||
:rows="3"
|
||||
type="textarea"
|
||||
></el-input>
|
||||
<div class="btn-reply">
|
||||
<el-button @click="addComment" type="primary" v-hasPer="['bbs:comment:add']">回复</el-button>
|
||||
|
||||
<el-button
|
||||
@click="addComment"
|
||||
type="primary"
|
||||
v-hasPer="['bbs:comment:add']"
|
||||
>回复</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 开始子评论主体 -->
|
||||
<div v-for="children in item.children" :key="children.id" class="comment2">
|
||||
|
||||
<div style="display: flex ;">
|
||||
<div style="display: flex">
|
||||
<AvatarInfo :userInfo="children.createUser" />
|
||||
<span style="align-self: center;color:#606266;"> 回复@{{ children.commentedUser.nick }}</span>
|
||||
<span style="align-self: center; color: #606266">
|
||||
回复@{{ children.commentedUser.nick }}</span
|
||||
>
|
||||
</div>
|
||||
<div class="content">
|
||||
{{ children.content }}
|
||||
</div>
|
||||
<span class="time">{{ children.creationTime }} </span>
|
||||
<span class="pointer"> <el-icon>
|
||||
<Pointer />
|
||||
</el-icon>0</span>
|
||||
<el-button type="primary" @click="replay(children.createUser.nick, children.id, item.id)" size="large" text v-hasPer="['bbs:comment:add']">回复</el-button>
|
||||
<el-button type="danger" @click="delComment(children.id)" size="large" text v-hasPer="['bbs:comment:remove']">删除</el-button>
|
||||
<span class="pointer">
|
||||
<el-icon> <Pointer /> </el-icon>0</span
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="replay(children.createUser.nick, children.id, item.id)"
|
||||
size="large"
|
||||
text
|
||||
v-hasPer="['bbs:comment:add']"
|
||||
>回复</el-button
|
||||
>
|
||||
<el-button
|
||||
type="danger"
|
||||
@click="delComment(children.id)"
|
||||
size="large"
|
||||
text
|
||||
v-hasPer="['bbs:comment:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
<div v-show="replayId == children.id" class="input-reply">
|
||||
<el-input v-model="form.content" :placeholder="placeholder" :rows="3" type="textarea"></el-input>
|
||||
<div class="btn-reply">
|
||||
<el-button @click="addComment" type="primary" v-hasPer="['bbs:comment:add']">回复</el-button>
|
||||
<el-input
|
||||
v-model="form.content"
|
||||
:placeholder="placeholder"
|
||||
:rows="3"
|
||||
type="textarea"
|
||||
></el-input>
|
||||
<div class="btn-reply">
|
||||
<el-button
|
||||
@click="addComment"
|
||||
type="primary"
|
||||
v-hasPer="['bbs:comment:add']"
|
||||
>回复</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<el-divider />
|
||||
|
||||
</div>
|
||||
<el-empty v-show="commentList.length<=0" description="评论空空如也,快来抢占沙发~" />
|
||||
<el-empty
|
||||
v-show="commentList.length <= 0"
|
||||
description="评论空空如也,快来抢占沙发~"
|
||||
/>
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, reactive, ref } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { getListByDiscussId, add ,del} from "@/apis/commentApi.js";
|
||||
import AvatarInfo from './AvatarInfo.vue';
|
||||
import { getListByDiscussId, add, del } from "@/apis/commentApi.js";
|
||||
import AvatarInfo from "./AvatarInfo.vue";
|
||||
//数据定义
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const commentList = ref([]);
|
||||
const query = reactive({});
|
||||
const topContent=ref('');
|
||||
const topContent = ref("");
|
||||
//当前回复id
|
||||
const replayId = ref('');
|
||||
const replayId = ref("");
|
||||
//回复文本框
|
||||
const placeholder = ref('')
|
||||
const placeholder = ref("");
|
||||
|
||||
//选择类型:评论
|
||||
const activeName = ref('comment');
|
||||
const activeName = ref("comment");
|
||||
//选择 最新
|
||||
const selectRadio = ref('new');
|
||||
const selectRadio = ref("new");
|
||||
//评论总数
|
||||
const total=ref(0);
|
||||
const total = ref(0);
|
||||
const form = reactive({
|
||||
content: "",
|
||||
discussId: route.params.discussId,
|
||||
@@ -107,57 +166,53 @@ onMounted(async () => {
|
||||
await loadComment();
|
||||
});
|
||||
const loadComment = async () => {
|
||||
topContent.value='';
|
||||
form.content = '';
|
||||
topContent.value = "";
|
||||
form.content = "";
|
||||
const response = await getListByDiscussId(route.params.discussId, query);
|
||||
commentList.value = response.data.items;
|
||||
total.value=response.data.total
|
||||
total.value = response.data.total;
|
||||
};
|
||||
const addTopComment = async () => {
|
||||
form.parentId = 0;
|
||||
form.rootId = 0;
|
||||
form.content=topContent.value;
|
||||
form.parentId = "00000000-0000-0000-0000-000000000000";
|
||||
form.rootId = "00000000-0000-0000-0000-000000000000";
|
||||
form.content = topContent.value;
|
||||
await addComment();
|
||||
}
|
||||
};
|
||||
const addComment = async () => {
|
||||
if(form.content.length<=0)
|
||||
{
|
||||
ElMessage.error('输入评论不能为空!')
|
||||
return
|
||||
if (form.content.length <= 0) {
|
||||
ElMessage.error("输入评论不能为空!");
|
||||
return;
|
||||
}
|
||||
await add(form);
|
||||
await loadComment();
|
||||
ElMessage({
|
||||
message: '评论发表成功!',
|
||||
type: 'success',
|
||||
})
|
||||
message: "评论发表成功!",
|
||||
type: "success",
|
||||
});
|
||||
};
|
||||
const delComment=async(ids)=>{
|
||||
const delComment = async (ids) => {
|
||||
ElMessageBox.confirm(`确定是否删除编号[${ids}]的评论吗?`, "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
}).then(async () => {
|
||||
|
||||
await del(ids);
|
||||
await loadComment();
|
||||
ElMessage({
|
||||
message: '评论已删除!',
|
||||
type: 'success',
|
||||
})
|
||||
await del({ id: [ids] });
|
||||
await loadComment();
|
||||
ElMessage({
|
||||
message: "评论已删除!",
|
||||
type: "success",
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
const replay = async (parentUserName, parentId, rootId) => {
|
||||
replayId.value = parentId;
|
||||
form.parentId = parentId;
|
||||
form.rootId = rootId;
|
||||
placeholder.value = `回复@${parentUserName}`;
|
||||
}
|
||||
};
|
||||
|
||||
//切换 评论、相关内容
|
||||
const handleClick = () => { }
|
||||
const handleClick = () => {};
|
||||
</script>
|
||||
<style scoped>
|
||||
.input-reply {
|
||||
@@ -175,7 +230,7 @@ const handleClick = () => { }
|
||||
}
|
||||
|
||||
.time {
|
||||
color: #8C8C8C;
|
||||
color: #8c8c8c;
|
||||
}
|
||||
|
||||
.content {
|
||||
@@ -186,7 +241,6 @@ const handleClick = () => { }
|
||||
display: flex;
|
||||
|
||||
justify-content: space-between;
|
||||
|
||||
}
|
||||
|
||||
.comment2 {
|
||||
@@ -201,4 +255,4 @@ const handleClick = () => { }
|
||||
margin-top: 0.5rem;
|
||||
margin-right: 1rem;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="header">
|
||||
<div class="logo" @click="enterIndex">
|
||||
<div class="image">
|
||||
<img class="img-icon" src="@/assets/common/icons/dog.svg" />
|
||||
<img class="img-icon" src="@/assets/common/icons/logo.ico" />
|
||||
</div>
|
||||
<div class="text">{{ configStore.name }}</div>
|
||||
</div>
|
||||
@@ -51,13 +51,16 @@
|
||||
<el-dropdown trigger="click">
|
||||
<AvatarInfo :size="30" :isSelf="true" />
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-menu v-if="isLogin">
|
||||
<el-dropdown-item @click="enterProfile"
|
||||
>进入个人中心</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item @click="enterProfile">其他</el-dropdown-item>
|
||||
<el-dropdown-item @click="logout">登出</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
<el-dropdown-menu v-else="isLogin">
|
||||
<el-dropdown-item @click="toLogin">去登录</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
@@ -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;
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -129,8 +139,8 @@ const search = () => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.image {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
@@ -62,6 +62,6 @@ const handleScroll = () => {
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 99;
|
||||
z-index: 99999;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -42,6 +42,7 @@ router.beforeEach((to, from, next) => {
|
||||
next();
|
||||
} else {
|
||||
next();
|
||||
useUserStore().resetInfo();
|
||||
// next(`/login?redirect=${to.path}&unTourist=true`); // 否则全部重定向到登录页
|
||||
NProgress.done();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<el-input placeholder="搜索当下分类下的标签" />
|
||||
</el-form-item>
|
||||
<div class="form-right">
|
||||
<el-button>重置</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="
|
||||
@@ -102,9 +102,10 @@
|
||||
<script setup>
|
||||
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 }
|
||||
);
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-pagination {
|
||||
|
||||
Reference in New Issue
Block a user