From 438abf6cea95d63e1c5a46f0e6ebce1679cccd9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com>
Date: Sun, 19 Jan 2025 03:31:48 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=A0=87=E7=AD=BE?=
=?UTF-8?q?=E6=A8=A1=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Dtos/Discuss/DiscussCreateInputVo.cs | 5 +
...nputVo.cs => DiscussLableCreateInputVo.cs} | 2 +-
.../Dtos/MyType/DiscussLableGetListInputVo.cs | 9 +
...Dto.cs => DiscussLableGetListOutputDto.cs} | 3 +-
...eOutputDto.cs => DiscussLableOutputDto.cs} | 2 +-
...nputVo.cs => DiscussLableUpdateInputVo.cs} | 3 +-
.../Dtos/MyType/MyTypeGetListInputVo.cs | 12 --
...TypeService.cs => IDiscussLableService.cs} | 2 +-
.../Services/Forum/CommentService.cs | 15 +-
.../Services/Forum/DiscussLableService.cs | 53 +++++
.../Services/Forum/MyTypeService.cs | 54 -----
.../Entities/Forum/DiscussAggregateRoot.cs | 3 +
...Entity.cs => DiscussLableAggregateRoot.cs} | 8 +-
.../Entities/Forum/DiscussMyTypeEntity.cs | 16 --
Yi.Bbs.Vue3/src/apis/discussLableApi.js | 9 +
Yi.Bbs.Vue3/src/views/EditArticle.vue | 196 +++++++++++-------
16 files changed, 211 insertions(+), 181 deletions(-)
rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/{MyTypeCreateInputVo.cs => DiscussLableCreateInputVo.cs} (86%)
create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableGetListInputVo.cs
rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/{MyTypeGetListOutputDto.cs => DiscussLableGetListOutputDto.cs} (71%)
rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/{MyTypeOutputDto.cs => DiscussLableOutputDto.cs} (83%)
rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/{MyTypeUpdateInputVo.cs => DiscussLableUpdateInputVo.cs} (73%)
delete mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeGetListInputVo.cs
rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/{IMyTypeService.cs => IDiscussLableService.cs} (54%)
create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/DiscussLableService.cs
delete mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/MyTypeService.cs
rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/{MyTypeEntity.cs => DiscussLableAggregateRoot.cs} (56%)
delete mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussMyTypeEntity.cs
create mode 100644 Yi.Bbs.Vue3/src/apis/discussLableApi.js
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussCreateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussCreateInputVo.cs
index 6e5d8b4c..4c45a63a 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussCreateInputVo.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussCreateInputVo.cs
@@ -31,5 +31,10 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
/// 是否禁止评论创建功能
///
public bool IsDisableCreateComment { get; set; }
+
+ ///
+ /// 标签
+ ///
+ public HashSet? DiscussLables { get; set; }
}
}
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeCreateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableCreateInputVo.cs
similarity index 86%
rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeCreateInputVo.cs
rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableCreateInputVo.cs
index 9e7a04d6..872bbd34 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeCreateInputVo.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableCreateInputVo.cs
@@ -3,7 +3,7 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType
///
/// Label输入创建对象
///
- public class MyTypeCreateInputVo
+ public class DiscussLableCreateInputVo
{
public string Name { get; set; }
public string? Color { get; set; }
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableGetListInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableGetListInputVo.cs
new file mode 100644
index 00000000..ef8ba68a
--- /dev/null
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableGetListInputVo.cs
@@ -0,0 +1,9 @@
+using Volo.Abp.Application.Dtos;
+
+namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType
+{
+ public class DiscussLableGetListInputVo : PagedAndSortedResultRequestDto
+ {
+ public string? Name { get; set; }
+ }
+}
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableGetListOutputDto.cs
similarity index 71%
rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeGetListOutputDto.cs
rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableGetListOutputDto.cs
index cbd7125e..2f15e1e1 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeGetListOutputDto.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableGetListOutputDto.cs
@@ -2,11 +2,10 @@ using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType
{
- public class MyTypeGetListOutputDto : EntityDto
+ public class DiscussLableGetListOutputDto : EntityDto
{
public string Name { get; set; }
public string? Color { get; set; }
public string? BackgroundColor { get; set; }
- public Guid UserId { get; set; }
}
}
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableOutputDto.cs
similarity index 83%
rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeOutputDto.cs
rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableOutputDto.cs
index d020c4e8..fe34703e 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeOutputDto.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableOutputDto.cs
@@ -2,7 +2,7 @@ using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType
{
- public class MyTypeOutputDto : EntityDto
+ public class DiscussLableOutputDto : EntityDto
{
public string Name { get; set; }
public string? Color { get; set; }
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeUpdateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableUpdateInputVo.cs
similarity index 73%
rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeUpdateInputVo.cs
rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableUpdateInputVo.cs
index 29c9f921..b91b6d41 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeUpdateInputVo.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableUpdateInputVo.cs
@@ -1,10 +1,9 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType
{
- public class MyTypeUpdateInputVo
+ public class DiscussLableUpdateInputVo
{
public string Name { get; set; }
public string? Color { get; set; }
public string? BackgroundColor { get; set; }
- public Guid UserId { get; set; }
}
}
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeGetListInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeGetListInputVo.cs
deleted file mode 100644
index 7643e6a8..00000000
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/MyTypeGetListInputVo.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using Volo.Abp.Application.Dtos;
-
-namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType
-{
- public class MyTypeGetListInputVo : PagedAndSortedResultRequestDto
- {
- public string? Name { get; set; }
- public string? Color { get; set; }
- public string? BackgroundColor { get; set; }
- public Guid? UserId { get; set; }
- }
-}
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IMyTypeService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IDiscussLableService.cs
similarity index 54%
rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IMyTypeService.cs
rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IDiscussLableService.cs
index 12554e69..14c0e3f7 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IMyTypeService.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IDiscussLableService.cs
@@ -5,7 +5,7 @@ namespace Yi.Framework.Bbs.Application.Contracts.IServices
///
/// Label服务抽象
///
- public interface IMyTypeService : IYiCrudAppService
+ public interface IDiscussLableService : IYiCrudAppService
{
}
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/CommentService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/CommentService.cs
index f18cc446..681e9288 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/CommentService.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/CommentService.cs
@@ -44,7 +44,6 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
private IDiscussService _discussService { get; set; }
///
/// 获取改主题下的评论,结构为二维列表,该查询无分页
- /// Todo: 可放入领域层
///
///
///
@@ -64,15 +63,7 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
List userIds = entities.Where(x => x.CreatorId != null).Select(x => x.CreatorId ?? Guid.Empty).ToList();
var bbsUserInfoDic = (await _bbsUserManager.GetBbsUserInfoAsync(userIds)).ToDictionary(x => x.Id);
-
-
-
-
- //------数据查询完成------
-
-
-
-
+ //------数据查询完成------,以下只是dto的简单组装
//从根目录开始组装
//结果初始值,第一层等于全部根节点
@@ -117,11 +108,7 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
rootOutoutDto?.ForEach(x =>
{
x.Children = x.Children.OrderByDescending(x => x.CreationTime).ToList();
-
});
-
-
-
return new PagedResultDto(entities.Count(), rootOutoutDto);
}
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/DiscussLableService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/DiscussLableService.cs
new file mode 100644
index 00000000..7994bada
--- /dev/null
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/DiscussLableService.cs
@@ -0,0 +1,53 @@
+using Microsoft.AspNetCore.Mvc;
+using SqlSugar;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.Data;
+using Yi.Framework.Bbs.Application.Contracts.Dtos.MyType;
+using Yi.Framework.Bbs.Application.Contracts.IServices;
+using Yi.Framework.Bbs.Domain.Entities.Forum;
+using Yi.Framework.Ddd.Application;
+using Yi.Framework.SqlSugarCore.Abstractions;
+
+namespace Yi.Framework.Bbs.Application.Services.Forum
+{
+ ///
+ /// DiscussLable服务实现
+ ///
+ public class DiscussLableService : YiCrudAppService,
+ IDiscussLableService
+ {
+ private ISqlSugarRepository _repository;
+
+ public DiscussLableService(ISqlSugarRepository repository) : base(repository)
+ {
+ _repository = repository;
+ }
+
+ [HttpGet("discuss-lable/all")]
+ public async Task> GetAllListAsync(DiscussLableGetListInputVo input)
+ {
+ var order = input.Sorting ?? nameof(DiscussLableAggregateRoot.Name);
+ var output = await _repository._DbQueryable
+ .WhereIF(input.Name is not null, x => x.Name.Contains(input.Name))
+ .OrderBy(order)
+ .Select(x => new DiscussLableGetListOutputDto(), true)
+ .ToListAsync();
+ return new ListResultDto(output);
+ }
+
+ public override async Task> GetListAsync(
+ DiscussLableGetListInputVo input)
+ {
+ RefAsync total = 0;
+ var order = input.Sorting ?? nameof(DiscussLableAggregateRoot.Name);
+ var output = await _repository._DbQueryable
+ .WhereIF(input.Name is not null, x => x.Name.Contains(input.Name))
+ .OrderBy(order)
+ .Select(x => new DiscussLableGetListOutputDto(), true)
+ .ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
+ return new PagedResultDto(total, output);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/MyTypeService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/MyTypeService.cs
deleted file mode 100644
index af273095..00000000
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/MyTypeService.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using Volo.Abp.Application.Dtos;
-using Volo.Abp.Data;
-using Yi.Framework.Bbs.Application.Contracts.Dtos.MyType;
-using Yi.Framework.Bbs.Application.Contracts.IServices;
-using Yi.Framework.Bbs.Domain.Entities.Forum;
-using Yi.Framework.Ddd.Application;
-using Yi.Framework.SqlSugarCore.Abstractions;
-
-namespace Yi.Framework.Bbs.Application.Services.Forum
-{
- ///
- /// Label服务实现
- ///
- public class MyTypeService : YiCrudAppService,
- IMyTypeService
- {
- private ISqlSugarRepository _repository;
- public MyTypeService(ISqlSugarRepository repository, IDataFilter dataFilter) : base(repository)
- {
- _repository = repository;
- _dataFilter = dataFilter;
- }
-
- private IDataFilter _dataFilter { get; set; }
-
- ///
- /// 获取当前用户的主题类型
- ///
- ///
- ///
- public Task> GetListCurrentAsync(MyTypeGetListInputVo input)
- {
- //过滤器需要更换
- //_dataFilter.Enable(x => x.UserId == CurrentUser.Id);
-
- //_dataFilter.AddFilter(x => x.UserId == CurrentUser.Id);
- return base.GetListAsync(input);
- }
-
- ///
- /// 创建
- ///
- ///
- ///
- public override async Task CreateAsync(MyTypeCreateInputVo input)
- {
- var entity = await MapToEntityAsync(input);
- entity.UserId = CurrentUser.Id ?? Guid.Empty;
- entity.IsDeleted = false;
- var outputEntity = await _repository.InsertReturnEntityAsync(entity);
- return await MapToGetOutputDtoAsync(outputEntity);
- }
- }
-}
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussAggregateRoot.cs
index c1e7b8a6..5009e905 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussAggregateRoot.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussAggregateRoot.cs
@@ -67,6 +67,9 @@ namespace Yi.Framework.Bbs.Domain.Entities.Forum
[SugarColumn(IsJson = true)]//使用json处理
public List? PermissionUserIds { get; set; }
+ [SugarColumn(IsJson = true)]//使用json处理
+ public HashSet? DiscussLables{ get; set; }
+
///
/// 是否禁止评论创建功能
///
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/MyTypeEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussLableAggregateRoot.cs
similarity index 56%
rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/MyTypeEntity.cs
rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussLableAggregateRoot.cs
index 2a6f6734..7fd6362a 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/MyTypeEntity.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussLableAggregateRoot.cs
@@ -4,17 +4,13 @@ using Volo.Abp.Domain.Entities;
namespace Yi.Framework.Bbs.Domain.Entities.Forum
{
- [SugarTable("MyType")]
- public class MyTypeEntity : Entity, ISoftDelete
+ [SugarTable("DiscussLable")]
+ public class DiscussLableAggregateRoot : AggregateRoot, ISoftDelete
{
- [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
- public override Guid Id { get; protected set; }
public bool IsDeleted { get; set; }
public string Name { get; set; }
public string? Color { get; set; }
public string? BackgroundColor { get; set; }
-
- public Guid UserId { get; set; }
}
}
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussMyTypeEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussMyTypeEntity.cs
deleted file mode 100644
index 0e7a1ede..00000000
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussMyTypeEntity.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using SqlSugar;
-using Volo.Abp.Domain.Entities;
-
-namespace Yi.Framework.Bbs.Domain.Entities.Forum
-{
- [SugarTable("DiscussMyType")]
- public class DiscussMyTypeEntity : Entity
- {
- [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
- public override Guid Id { get; protected set; }
-
- public Guid DiscussId { get; set; }
-
- public Guid MyTypeId { get; set; }
- }
-}
diff --git a/Yi.Bbs.Vue3/src/apis/discussLableApi.js b/Yi.Bbs.Vue3/src/apis/discussLableApi.js
new file mode 100644
index 00000000..aa889ef8
--- /dev/null
+++ b/Yi.Bbs.Vue3/src/apis/discussLableApi.js
@@ -0,0 +1,9 @@
+import request from "@/config/axios/service";
+
+export function getAllList(data) {
+ return request({
+ url: "/discuss-lable/all",
+ method: "get",
+ params: data,
+ });
+}
\ No newline at end of file
diff --git a/Yi.Bbs.Vue3/src/views/EditArticle.vue b/Yi.Bbs.Vue3/src/views/EditArticle.vue
index ffe60fb8..e5bb8b7e 100644
--- a/Yi.Bbs.Vue3/src/views/EditArticle.vue
+++ b/Yi.Bbs.Vue3/src/views/EditArticle.vue
@@ -2,25 +2,29 @@
@@ -130,8 +157,8 @@
import MavonEdit from "@/components/MavonEdit.vue";
import UserSelectInfo from "@/components/UserSelectInfo.vue";
import {ref, reactive, onMounted, computed} from "vue";
-import { useRoute, useRouter } from "vue-router";
-import { Plus, Download } from "@element-plus/icons-vue";
+import {useRoute, useRouter} from "vue-router";
+import {Plus, Download} from "@element-plus/icons-vue";
import {
add as discussAdd,
@@ -139,6 +166,10 @@ import {
get as discussGet,
} from "@/apis/discussApi.js";
+import {
+ getAllList as getLableAllList
+} from "@/apis/discussLableApi"
+
import {
add as articleAdd,
update as articleUpdate,
@@ -161,13 +192,30 @@ const fileUploadUrl = `${import.meta.env.VITE_APP_BASEAPI}/file`;
//封面的url
const dialogImageUrl = ref("");
+//远程文章标签
+const labelListData = ref([]);
+const labelLoading = ref(false);
+const selectLabelList = ref([]);
+//远程下拉框查询文章标签
+const remoteMethod = async (query) => {
+ labelLoading.value = true
+ const {data} = await getLableAllList({name:query});
+ labelLoading.value = false
+ labelListData.value = data.items.map((item) => {
+ return {
+ value: item,
+ label: item.name
+ }
+ })
+}
+
//文件上传成功后
const onSuccess = (response) => {
dialogImageUrl.value = response[0].id;
};
//封面url
-const getUrl=computed(()=>{
+const getUrl = computed(() => {
return `${import.meta.env.VITE_APP_BASEAPI}/file/${dialogImageUrl.value}`;
})
@@ -175,11 +223,11 @@ const getUrl=computed(()=>{
//整个页面上的表单
const editForm = reactive({
title: "",
- types: "",
introduction: "",
content: "",
name: "",
permissionUserIds: [],
+ discussLables:[]
});
//组装主题内容: 需要更新主题信息
@@ -192,13 +240,13 @@ const article = {};
const ruleFormRef = ref(null);
const rules = reactive({
title: [
- { required: true, message: "请输入标题", trigger: "blur" },
- { min: 3, max: 40, message: "长度 3 到 20", trigger: "blur" },
+ {required: true, message: "请输入标题", trigger: "blur"},
+ {min: 3, max: 40, message: "长度 3 到 20", trigger: "blur"},
],
- name: [{ required: true, message: "请输入子文章名称", trigger: "blur" }],
+ name: [{required: true, message: "请输入子文章名称", trigger: "blur"}],
content: [
- { required: true, message: "请输入内容", trigger: "blur" },
- { min: 10, message: "长度 大于 10", trigger: "blur" },
+ {required: true, message: "请输入内容", trigger: "blur"},
+ {min: 10, message: "长度 大于 10", trigger: "blur"},
],
});
//提交按钮,需要区分操作类型
@@ -206,10 +254,11 @@ const submit = async (formEl) => {
if (!formEl) return;
await formEl.validate(async (valid, fields) => {
if (valid) {
+ discuss.discussLables=selectLabelList.value.map((item) =>item.id);
+ console.log(discuss,"discuss")
//dicuss主题处理
if (radio.value == "discuss") {
discuss.title = editForm.title;
- discuss.types = editForm.types;
discuss.introduction = editForm.introduction;
discuss.content = editForm.content;
discuss.plateId = discuss.plateId ?? route.query.plateId;
@@ -225,7 +274,7 @@ const submit = async (formEl) => {
message: `[${discuss.title}]主题创建成功!`,
type: "success",
});
- var routerPer = { path: `/article/${response.data.id}` };
+ var routerPer = {path: `/article/${response.data.id}`};
router.push(routerPer);
}
//主题更新
@@ -236,7 +285,7 @@ const submit = async (formEl) => {
message: `[${discuss.title}]主题更新成功!`,
type: "success",
});
- var routerPer = { path: `/article/${route.query.discussId}` };
+ var routerPer = {path: `/article/${route.query.discussId}`};
router.push(routerPer);
}
}
@@ -301,7 +350,6 @@ const loadDiscuss = async () => {
const res = response.data;
editForm.content = res.content;
editForm.title = res.title;
- editForm.types = res.types;
editForm.introduction = res.introduction;
discuss.plateId = res.plateId;
dialogImageUrl.value = res.cover;
@@ -342,19 +390,19 @@ const getFile = async (e) => {
formData.append("file", e.target.files[i]);
}
await importArticle(
- {
- discussId: route.query.discussId,
- articleParentId: route.query.parentArticleId,
- importType: currentType.value,
- },
- formData
+ {
+ discussId: route.query.discussId,
+ articleParentId: route.query.parentArticleId,
+ importType: currentType.value,
+ },
+ formData
);
ElMessage({
message: `导入成功!`,
type: "success",
});
importLoading.value = false;
- const routerPer = { path: `/article/${route.query.discussId}` };
+ const routerPer = {path: `/article/${route.query.discussId}`};
router.push(routerPer);
} catch (error) {
ElMessage.error(error.message);
@@ -373,16 +421,19 @@ const getFile = async (e) => {
background-color: #fff;
margin: 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;
}
@@ -408,6 +459,7 @@ const getFile = async (e) => {
height: 178px;
text-align: center;
}
+
.el-upload {
}