Merge branch 'abp' of https://gitee.com/ccnetcore/Yi into abp

This commit is contained in:
橙子
2024-01-04 20:37:02 +08:00
26 changed files with 182 additions and 49 deletions

View File

@@ -140,8 +140,10 @@ namespace Yi.Framework.Ddd.Application
public virtual async Task PostImportExcelAsync(List<TCreateInput> input) public virtual async Task PostImportExcelAsync(List<TCreateInput> input)
{ {
var entities = input.Select(x => MapToEntity(x)).ToList(); var entities = input.Select(x => MapToEntity(x)).ToList();
await Repository.DeleteManyAsync(entities.Select(x => x.Id)); //安全起见,该接口需要自己实现
await Repository.InsertManyAsync(entities); throw new NotImplementedException();
//await Repository.DeleteManyAsync(entities.Select(x => x.Id));
//await Repository.InsertManyAsync(entities);
} }
} }
} }

View File

@@ -70,7 +70,7 @@ namespace Yi.Framework.Bbs.Domain.Managers
var articleHandled = abstractArticleImport.Import(discussId, articleParentId, fileObjs); var articleHandled = abstractArticleImport.Import(discussId, articleParentId, fileObjs);
//await _articleRepository.InsertManyAsync(articleHandled); await _articleRepository.InsertManyAsync(articleHandled);
} }
} }

View File

@@ -39,7 +39,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="wwwroot\icon\" /> <Folder Include="database_backup\" />
</ItemGroup> </ItemGroup>
</Project> </Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -28,8 +28,9 @@ export function update(id, data) {
} }
export function del(ids) { export function del(ids) {
return request({ return request({
url: `/article/${ids}`, url: `/article`,
method: "delete", method: "delete",
params: { id: ids },
}); });
} }
export function all(discussId) { export function all(discussId) {
@@ -38,3 +39,16 @@ export function all(discussId) {
method: "get", method: "get",
}); });
} }
/**
* 导入文章
*/
export function importArticle(params, data) {
return request({
url: `/article/import`,
headers: { "Content-Type": "multipart/form-data" },
params: params,
data,
method: "post",
});
}

View File

@@ -19,6 +19,6 @@ export function del(id) {
return request({ return request({
url: `/comment`, url: `/comment`,
method: "delete", method: "delete",
params: {id:id}, params: { id: id },
}); });
} }

View File

@@ -42,8 +42,9 @@ export function update(id, data) {
} }
export function del(ids) { export function del(ids) {
return request({ return request({
url: `/discuss/${ids}`, url: `/discuss`,
method: "delete", method: "delete",
params: { id: ids },
}); });
} }

View File

@@ -38,8 +38,9 @@ export function updateUser(id, data) {
// 删除用户 // 删除用户
export function delUser(userId) { export function delUser(userId) {
return request({ return request({
url: `/user/${userId}`, url: `/user`,
method: "delete", method: "delete",
params: { id: userId },
}); });
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -63,14 +63,14 @@ const userInfo = reactive({
level: "", level: "",
userLimit: "", userLimit: "",
}); });
const iconUrl = ref("/favicon.ico"); const iconUrl = ref("/acquiesce.png");
const iconUrlHandler = (icon) => { const iconUrlHandler = (icon) => {
if ( if (
userInfo.icon == null || userInfo.icon == null ||
userInfo.icon == undefined || userInfo.icon == undefined ||
userInfo.icon == "" userInfo.icon == ""
) { ) {
return "/favicon.ico"; return "/acquiesce.png";
} else { } else {
return import.meta.env.VITE_APP_BASEAPI + "/file/" + icon; return import.meta.env.VITE_APP_BASEAPI + "/file/" + icon;
} }

View File

@@ -11,7 +11,15 @@
> >
<template #default="{ node, data }"> <template #default="{ node, data }">
<span class="custom-tree-node"> <span class="custom-tree-node">
<span>{{ data.name }}</span> <el-tooltip
class="box-item"
effect="dark"
:content="data.name"
placement="top-start"
>
<span class="title-name">{{ data.name }}</span>
</el-tooltip>
<span> <span>
<a <a
style="color: #409eff; margin-left: 8px" style="color: #409eff; margin-left: 8px"
@@ -76,5 +84,11 @@ const { isHasPermission: isRemoveArticle } = getPermission("bbs:article:del");
justify-content: space-between; justify-content: space-between;
font-size: 14px; font-size: 14px;
padding-right: 8px; padding-right: 8px;
.title-name {
width: 100px; /* 定义容器宽度 */
white-space: nowrap; /* 不换行 */
overflow: hidden; /* 溢出部分隐藏 */
text-overflow: ellipsis; /* 显示省略号 */
}
} }
</style> </style>

View File

@@ -63,11 +63,16 @@
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
<div class="author" @click="handleGitClick"> <div class="gitee" @click="handleGitClick">
<el-tooltip effect="dark" content="在gitee找到我们" placement="bottom"> <el-tooltip effect="dark" content="在gitee找到我们" placement="bottom">
<img src="@/assets/common/icons/gitee.png" alt="" /> <img src="@/assets/common/icons/gitee.png" alt="" />
</el-tooltip> </el-tooltip>
</div> </div>
<div class="github" @click="handleGithubClick">
<el-tooltip effect="dark" content="在github找到我们" placement="bottom">
<img src="@/assets/common/icons/github.png" alt="" />
</el-tooltip>
</div>
</div> </div>
</div> </div>
</template> </template>
@@ -128,6 +133,9 @@ const isLogin = getToken("AccessToken") ? true : false;
const handleGitClick = () => { const handleGitClick = () => {
window.open("https://gitee.com/ccnetcore/Yi"); window.open("https://gitee.com/ccnetcore/Yi");
}; };
const handleGithubClick = () => {
window.open("https://github.com/ccnetcore/Yi.Abp.Admin");
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@@ -141,22 +149,25 @@ const handleGitClick = () => {
.user { .user {
display: flex; display: flex;
align-items: center; align-items: center;
.author {
cursor: pointer;
width: 25px;
height: 25px;
margin-left: 20px;
img {
width: 100%;
height: 100%;
}
}
.el-dropdown-link { .el-dropdown-link {
cursor: pointer; cursor: pointer;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.gitee,
.github {
cursor: pointer;
width: 25px;
height: 25px;
margin-left: 15px;
img {
width: 100%;
height: 100%;
}
}
} }
.logo { .logo {
cursor: pointer; cursor: pointer;
display: flex; display: flex;

View File

@@ -47,7 +47,7 @@ const useUserStore = defineStore("user", {
const user = res.user; const user = res.user;
const avatar = const avatar =
user.icon == "" || user.icon == null user.icon == "" || user.icon == null
? "/favicon.ico" ? "/acquiesce.png"
: import.meta.env.VITE_APP_BASEAPI + "/file/" + user.icon; : import.meta.env.VITE_APP_BASEAPI + "/file/" + user.icon;
if (res.roleCodes && res.roleCodes.length > 0) { if (res.roleCodes && res.roleCodes.length > 0) {
// 验证返回的roles是否是一个非空数组 // 验证返回的roles是否是一个非空数组

View File

@@ -17,7 +17,7 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="权限:" v-if="route.query.artType == 'discuss'"> <el-form-item label="权限:" v-if="radio == 'discuss'">
<el-radio-group v-model="perRadio"> <el-radio-group v-model="perRadio">
<el-radio-button label="Public">公开</el-radio-button> <el-radio-button label="Public">公开</el-radio-button>
<el-radio-button label="Oneself">仅自己可见</el-radio-button> <el-radio-button label="Oneself">仅自己可见</el-radio-button>
@@ -26,13 +26,13 @@
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="可见用户:" label="可见用户:"
v-if="route.query.artType == 'discuss' && perRadio == 'User'" v-if="radio == 'discuss' && perRadio == 'User'"
> >
<UserSelectInfo v-model="editForm.permissionUserIds" /> <UserSelectInfo v-model="editForm.permissionUserIds" />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="route.query.artType == 'article'" v-if="radio == 'article'"
label="子文章名称:" label="子文章名称:"
prop="name" prop="name"
> >
@@ -51,7 +51,7 @@
:codeStyle="codeStyle" :codeStyle="codeStyle"
/> />
</el-form-item> </el-form-item>
<el-form-item label="封面:" v-if="route.query.artType == 'discuss'"> <el-form-item label="封面:" v-if="radio == 'discuss'">
<!-- 主题封面选择 --> <!-- 主题封面选择 -->
<el-upload <el-upload
@@ -81,6 +81,33 @@
></el-form-item ></el-form-item
> >
</el-form> </el-form>
<div class="import-content" v-show="radio == 'article'">
<div class="text">上传类型</div>
<el-select
v-model="currentType"
placeholder="请选择"
style="width: 120px"
>
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-button
type="primary"
:icon="Download"
:loading="importLoading"
@click="handleImport"
class="import-btn"
>导入文章</el-button
>
</div>
</div>
<!-- 文件弹框 -->
<div>
<input v-show="false" ref="fileRef" type="file" @change="getFile" />
</div> </div>
</div> </div>
</template> </template>
@@ -89,6 +116,7 @@ import MavonEdit from "@/components/MavonEdit.vue";
import UserSelectInfo from "@/components/UserSelectInfo.vue"; import UserSelectInfo from "@/components/UserSelectInfo.vue";
import { ref, reactive, onMounted } from "vue"; import { ref, reactive, onMounted } from "vue";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { Plus, Download } from "@element-plus/icons-vue";
import { import {
add as discussAdd, add as discussAdd,
@@ -100,6 +128,7 @@ import {
add as articleAdd, add as articleAdd,
update as articleUpdate, update as articleUpdate,
get as articleGet, get as articleGet,
importArticle,
} from "@/apis/articleApi.js"; } from "@/apis/articleApi.js";
//数据定义 //数据定义
@@ -158,7 +187,7 @@ const submit = async (formEl) => {
await formEl.validate(async (valid, fields) => { await formEl.validate(async (valid, fields) => {
if (valid) { if (valid) {
//dicuss主题处理 //dicuss主题处理
if (route.query.artType == "discuss") { if (radio.value == "discuss") {
discuss.title = editForm.title; discuss.title = editForm.title;
discuss.types = editForm.types; discuss.types = editForm.types;
discuss.introduction = editForm.introduction; discuss.introduction = editForm.introduction;
@@ -193,7 +222,7 @@ const submit = async (formEl) => {
} }
//artcle文章处理 //artcle文章处理
else if (route.query.artType == "article") { else if (radio.value == "article") {
//组装文章内容:需要添加的文章信息 //组装文章内容:需要添加的文章信息
article.content = editForm.content; article.content = editForm.content;
article.name = editForm.name; article.name = editForm.name;
@@ -237,11 +266,11 @@ onMounted(async () => {
//如果是更新操作,需要先查询 //如果是更新操作,需要先查询
if (route.query.operType == "update") { if (route.query.operType == "update") {
//更新主题 //更新主题
if (route.query.artType == "discuss") { if (radio.value == "discuss") {
await loadDiscuss(); await loadDiscuss();
//更新文章 //更新文章
} else if (route.query.artType == "article") { } else if (radio.value == "article") {
await loadArticle(); await loadArticle();
} }
} }
@@ -267,6 +296,51 @@ const loadArticle = async () => {
editForm.name = res.name; editForm.name = res.name;
editForm.discussId = res.discussId; editForm.discussId = res.discussId;
}; };
// 导入
let importLoading = ref(false);
const fileRef = ref(null);
const handleImport = async () => {
fileRef.value.click();
};
const currentType = ref("Defalut");
const typeOptions = [
{
value: "Defalut",
label: "默认",
},
{
value: "Vuepress",
label: "Vuepress",
},
];
const getFile = async (e) => {
importLoading.value = true;
try {
let formDate = new FormData();
formDate.append("file", e.target.files[0]);
await importArticle(
{
discussId: route.query.discussId,
articleParentId: route.query.parentArticleId,
importType: currentType.value,
},
formDate
);
ElMessage({
message: `导入成功!`,
type: "success",
});
importLoading.value = false;
const routerPer = { path: `/article/${route.query.discussId}` };
router.push(routerPer);
} catch (error) {
console.log(error, "error");
const { data } = error.response.data;
ElMessage.error(data.message);
importLoading.value = false;
}
};
</script> </script>
<style scoped> <style scoped>
.submit-btn { .submit-btn {
@@ -274,10 +348,24 @@ const loadArticle = async () => {
} }
.body-div { .body-div {
position: relative;
min-height: 1000px; min-height: 1000px;
background-color: #fff; background-color: #fff;
margin: 1.5rem; margin: 1.5rem;
padding: 1.5rem; padding: 1.5rem;
.import-content {
display: flex;
align-items: center;
position: absolute;
top: 1.5rem;
right: 1.5rem;
.text {
margin-right: 10px;
}
}
.import-btn {
margin-left: 10px;
}
} }
.avatar-uploader >>> .el-upload { .avatar-uploader >>> .el-upload {

View File

@@ -71,7 +71,7 @@ const userImageSrc = computed(() => {
if (props.pointsData.icon) { if (props.pointsData.icon) {
return import.meta.env.VITE_APP_BASEAPI + "/file/" + props.pointsData.icon; return import.meta.env.VITE_APP_BASEAPI + "/file/" + props.pointsData.icon;
} else { } else {
return "favicon.ico"; return "acquiesce.png";
} }
}); });
</script> </script>

View File

@@ -69,7 +69,7 @@ const userImageSrc = computed(() => {
if (props.friendData.icon) { if (props.friendData.icon) {
return import.meta.env.VITE_APP_BASEAPI + "/file/" + props.friendData.icon; return import.meta.env.VITE_APP_BASEAPI + "/file/" + props.friendData.icon;
} else { } else {
return "favicon.ico"; return "acquiesce.png";
} }
}); });
</script> </script>

View File

@@ -1,6 +1,12 @@
import request from '@/utils/request.js' import request,{download} from '@/utils/request.js'
import { parseStrEmpty } from "@/utils/ruoyi"; import { parseStrEmpty } from "@/utils/ruoyi";
// 导出角色
export function getExportExcel(query) {
return download('/user/export-excel',query,'导出数据.xlsx')
}
// 查询用户列表 // 查询用户列表
export function listUser(query) { export function listUser(query) {
return request({ return request({
@@ -141,3 +147,4 @@ export function updateAuthRole(data) {
// method: 'get' // method: 'get'
// }) // })
// } // }

View File

@@ -23,7 +23,7 @@ const service = axios.create({
//处理批零参数 //处理批零参数
paramsSerializer:params => { paramsSerializer:params => {
// return qs.stringify(params,{indices:false}) // return qs.stringify(params,{indices:false})
console.log(params,"params") // console.log(params,"params")
// if(params.id!=undefined) // if(params.id!=undefined)
// { // {
// if(Array.isArray(params.id) ) // if(Array.isArray(params.id) )
@@ -134,23 +134,18 @@ service.interceptors.response.use(res => {
) )
// 通用下载方法 // 通用下载方法
export function download(url, params, filename) { export function download(url, query, filename) {
downloadLoadingInstance = ElLoading.service({ text: "正在下载数据,请稍候", background: "rgba(0, 0, 0, 0.7)", }) downloadLoadingInstance = ElLoading.service({ text: "正在下载数据,请稍候", background: "rgba(0, 0, 0, 0.7)", })
return service.post(url, params, { return service({
transformRequest: [(params) => { return tansParams(params) }], url: url,
method: 'get',
params: query,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob' responseType: 'blob'
}).then(async (data) => { }).then(async (data) => {
const isLogin = await blobValidate(data); debugger;
if (isLogin) { const blob = new Blob([data.data])
const blob = new Blob([data])
saveAs(blob, filename) saveAs(blob, filename)
} else {
const resText = await data.text();
const rspObj = JSON.parse(resText);
const errMsg = errorCode[rspObj.code] || rspObj.message || errorCode['default']
ElMessage.error(errMsg);
}
downloadLoadingInstance.close(); downloadLoadingInstance.close();
}).catch((r) => { }).catch((r) => {
console.error(r) console.error(r)

View File

@@ -236,7 +236,7 @@
<script setup name="User"> <script setup name="User">
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser } from "@/api/system/user"; import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser,getExportExcel } from "@/api/system/user";
import { roleOptionselect } from "@/api/system/role"; import { roleOptionselect } from "@/api/system/role";
import { postOptionselect } from "@/api/system/post"; import { postOptionselect } from "@/api/system/post";
import { listDept } from "@/api/system/dept"; import { listDept } from "@/api/system/dept";
@@ -371,7 +371,7 @@ function handleDelete(row) {
}; };
/** 导出按钮操作 */ /** 导出按钮操作 */
function handleExport() { function handleExport() {
proxy.download("user/export"); getExportExcel(proxy.addDateRange(queryParams.value, dateRange.value));
}; };
/** 用户状态修改 */ /** 用户状态修改 */
function handleStatusChange(row) { function handleStatusChange(row) {