feat: 社区新增有偿悬赏功能
This commit is contained in:
@@ -52,6 +52,7 @@ namespace Yi.Framework.Stock.Domain.Entities
|
||||
/// <summary>
|
||||
/// 新闻内容
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)]
|
||||
public string Content { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,8 +5,10 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
|
||||
/// <summary>
|
||||
/// Discuss输入创建对象
|
||||
/// </summary>
|
||||
public class DiscussCreateInputVo
|
||||
public class DiscussCreateInput
|
||||
{
|
||||
public DiscussTypeEnum DiscussType { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
public string? Types { get; set; }
|
||||
public string? Introduction { get; set; }
|
||||
@@ -41,5 +43,29 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
|
||||
/// 角色
|
||||
/// </summary>
|
||||
public List<string>? PermissionRoleCodes { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// 悬赏类型主题
|
||||
/// </summary>
|
||||
public DiscussRewardCreateInput? RewardData { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class DiscussRewardCreateInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 悬赏最小价值
|
||||
/// </summary>
|
||||
public decimal MinValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 悬赏最大价值
|
||||
/// </summary>
|
||||
public decimal? MaxValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 作者联系方式
|
||||
/// </summary>
|
||||
public string Contact { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,8 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
|
||||
//是否置顶,默认false
|
||||
public bool IsTop { get; set; }
|
||||
|
||||
public DiscussTypeEnum DiscussType { get; set; }
|
||||
|
||||
public DiscussPermissionTypeEnum PermissionType { get; set; }
|
||||
//是否禁止,默认false
|
||||
public bool IsBan { get; set; }
|
||||
|
||||
@@ -24,7 +24,10 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
|
||||
public Guid PlateId { get; set; }
|
||||
//是否置顶,默认false
|
||||
public bool IsTop { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主题类型
|
||||
/// </summary>
|
||||
public DiscussTypeEnum DiscussType { get; set; }
|
||||
/// <summary>
|
||||
/// 封面
|
||||
/// </summary>
|
||||
@@ -50,6 +53,7 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
|
||||
|
||||
public bool HasPermission { get;internal set; }
|
||||
|
||||
public DiscussRewardGetOutputDto? RewardData { get; set; }
|
||||
/// <summary>
|
||||
/// 设置权限
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss;
|
||||
|
||||
public class DiscussRewardGetOutputDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否已解决
|
||||
/// </summary>
|
||||
public bool IsResolved{ get; set; }
|
||||
/// <summary>
|
||||
/// 悬赏最小价值
|
||||
/// </summary>
|
||||
public decimal MinValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 悬赏最大价值
|
||||
/// </summary>
|
||||
public decimal? MaxValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 作者联系方式
|
||||
/// </summary>
|
||||
public string Contact { get; set; }
|
||||
}
|
||||
@@ -2,7 +2,7 @@ using Yi.Framework.Bbs.Domain.Shared.Enums;
|
||||
|
||||
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
|
||||
{
|
||||
public class DiscussUpdateInputVo
|
||||
public class DiscussUpdateInput
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string? Types { get; set; }
|
||||
@@ -6,7 +6,7 @@ namespace Yi.Framework.Bbs.Application.Contracts.IServices
|
||||
/// <summary>
|
||||
/// Discuss服务抽象
|
||||
/// </summary>
|
||||
public interface IDiscussService : IYiCrudAppService<DiscussGetOutputDto, DiscussGetListOutputDto, Guid, DiscussGetListInputVo, DiscussCreateInputVo, DiscussUpdateInputVo>
|
||||
public interface IDiscussService : IYiCrudAppService<DiscussGetOutputDto, DiscussGetListOutputDto, Guid, DiscussGetListInputVo, DiscussCreateInput, DiscussUpdateInput>
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
|
||||
/// Discuss应用服务实现,用于参数校验、领域服务业务组合、日志记录、事务处理、账户信息
|
||||
/// </summary>
|
||||
public class DiscussService : YiCrudAppService<DiscussAggregateRoot, DiscussGetOutputDto, DiscussGetListOutputDto,
|
||||
Guid, DiscussGetListInputVo, DiscussCreateInputVo, DiscussUpdateInputVo>,
|
||||
Guid, DiscussGetListInputVo, DiscussCreateInput, DiscussUpdateInput>,
|
||||
IDiscussService
|
||||
{
|
||||
private ISqlSugarRepository<DiscussTopEntity> _discussTopRepository;
|
||||
@@ -103,6 +103,17 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
|
||||
throw new UserFriendlyException("该主题不存在", "404");
|
||||
}
|
||||
|
||||
switch (output.DiscussType)
|
||||
{
|
||||
case DiscussTypeEnum.Article: break;
|
||||
//查询的是悬赏主题
|
||||
case DiscussTypeEnum.Reward:
|
||||
var reward= await _forumManager._discussRewardRepository.GetAsync(x=>x.DiscussId==output.Id);
|
||||
output.RewardData = reward.Adapt<DiscussRewardGetOutputDto>();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//组装点赞
|
||||
var agreeCreatorList =
|
||||
(await _agreeRepository._DbQueryable.Where(x => x.DiscussId == output.Id).Select(x=>x.CreatorId).ToListAsync());
|
||||
@@ -277,7 +288,7 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
|
||||
/// <returns></returns>
|
||||
[Permission("bbs:discuss:add")]
|
||||
[Authorize]
|
||||
public override async Task<DiscussGetOutputDto> CreateAsync(DiscussCreateInputVo input)
|
||||
public override async Task<DiscussGetOutputDto> CreateAsync(DiscussCreateInput input)
|
||||
{
|
||||
var plate = await _plateEntityRepository.FindAsync(x => x.Id == input.PlateId);
|
||||
if (plate is null)
|
||||
@@ -300,12 +311,31 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
|
||||
}
|
||||
}
|
||||
|
||||
var entity = await _forumManager.CreateDiscussAsync(await MapToEntityAsync(input));
|
||||
var entity = await _forumManager.CreateDiscussAsync(await MapToEntityAsync(input),input.RewardData.Adapt<DiscussRewardAggregateRoot>());
|
||||
return await MapToGetOutputDtoAsync(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置悬赏主题已解决
|
||||
/// </summary>
|
||||
/// <param name="discussId"></param>
|
||||
/// <exception cref="UserFriendlyException"></exception>
|
||||
[HttpPut("discuss/reward/resolve/{discussId}")]
|
||||
[Authorize]
|
||||
public async Task SetRewardResolvedAsync([FromRoute]Guid discussId)
|
||||
{
|
||||
var reward= await _forumManager._discussRewardRepository.GetFirstAsync(x=>x.DiscussId==discussId);
|
||||
if (reward is null)
|
||||
{
|
||||
throw new UserFriendlyException("未找到该悬赏主题","404");
|
||||
}
|
||||
|
||||
public override Task<DiscussGetOutputDto> UpdateAsync(Guid id, DiscussUpdateInputVo input)
|
||||
//设置已解决
|
||||
reward.SetResolved();
|
||||
await _forumManager._discussRewardRepository.UpdateAsync(reward);
|
||||
}
|
||||
|
||||
public override Task<DiscussGetOutputDto> UpdateAsync(Guid id, DiscussUpdateInput input)
|
||||
{
|
||||
return base.UpdateAsync(id, input);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Yi.Framework.Bbs.Domain.Shared.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// 主题类型
|
||||
/// </summary>
|
||||
public enum DiscussTypeEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 文章
|
||||
/// </summary>
|
||||
Article = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 悬赏
|
||||
/// </summary>
|
||||
Reward=1
|
||||
}
|
||||
@@ -39,6 +39,11 @@ namespace Yi.Framework.Bbs.Domain.Entities.Forum
|
||||
public string? Introduction { get; set; }
|
||||
public int AgreeNum { get; set; }
|
||||
public int SeeNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主题类型
|
||||
/// </summary>
|
||||
public DiscussTypeEnum DiscussType { get; set; }
|
||||
/// <summary>
|
||||
/// 封面
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp.Auditing;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
using Volo.Abp.Domain.Entities.Auditing;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities.Forum;
|
||||
|
||||
[SugarTable("DiscussReward")]
|
||||
[SugarIndex($"index_{nameof(DiscussId)}", nameof(DiscussId), OrderByType.Asc)]
|
||||
public class DiscussRewardAggregateRoot : FullAuditedAggregateRoot<Guid>
|
||||
{
|
||||
public Guid DiscussId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否已解决
|
||||
/// </summary>
|
||||
public bool IsResolved{ get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 悬赏最小价值
|
||||
/// </summary>
|
||||
public decimal? MinValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 悬赏最大价值
|
||||
/// </summary>
|
||||
public decimal? MaxValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 作者联系方式
|
||||
/// </summary>
|
||||
public string Contact { get; set; }
|
||||
|
||||
public void SetResolved()
|
||||
{
|
||||
IsResolved = true;
|
||||
}
|
||||
}
|
||||
@@ -21,21 +21,30 @@ namespace Yi.Framework.Bbs.Domain.Managers
|
||||
public readonly ISqlSugarRepository<PlateAggregateRoot, Guid> _plateEntityRepository;
|
||||
public readonly ISqlSugarRepository<CommentAggregateRoot, Guid> _commentRepository;
|
||||
public readonly ISqlSugarRepository<ArticleAggregateRoot, Guid> _articleRepository;
|
||||
public ForumManager(ISqlSugarRepository<DiscussAggregateRoot, Guid> discussRepository, ISqlSugarRepository<PlateAggregateRoot, Guid> plateEntityRepository, ISqlSugarRepository<CommentAggregateRoot, Guid> commentRepository, ISqlSugarRepository<ArticleAggregateRoot, Guid> articleRepository)
|
||||
public readonly ISqlSugarRepository<DiscussRewardAggregateRoot,Guid> _discussRewardRepository;
|
||||
public ForumManager(ISqlSugarRepository<DiscussAggregateRoot, Guid> discussRepository, ISqlSugarRepository<PlateAggregateRoot, Guid> plateEntityRepository, ISqlSugarRepository<CommentAggregateRoot, Guid> commentRepository, ISqlSugarRepository<ArticleAggregateRoot, Guid> articleRepository, ISqlSugarRepository<DiscussRewardAggregateRoot, Guid> discussRewardRepository)
|
||||
{
|
||||
_discussRepository = discussRepository;
|
||||
_plateEntityRepository = plateEntityRepository;
|
||||
_commentRepository = commentRepository;
|
||||
_articleRepository = articleRepository;
|
||||
_discussRewardRepository = discussRewardRepository;
|
||||
}
|
||||
|
||||
//主题是不能直接创建的,需要由领域服务统一创建
|
||||
public async Task<DiscussAggregateRoot> CreateDiscussAsync(DiscussAggregateRoot entity)
|
||||
public async Task<DiscussAggregateRoot> CreateDiscussAsync(DiscussAggregateRoot entity,DiscussRewardAggregateRoot rewardEntity=null)
|
||||
{
|
||||
entity.CreationTime = DateTime.Now;
|
||||
entity.AgreeNum = 0;
|
||||
entity.SeeNum = 0;
|
||||
return await _discussRepository.InsertReturnEntityAsync(entity);
|
||||
var discuss = await _discussRepository.InsertReturnEntityAsync(entity);
|
||||
if (discuss.DiscussType==DiscussTypeEnum.Reward)
|
||||
{
|
||||
rewardEntity.DiscussId=discuss.Id;
|
||||
Check.NotNull(rewardEntity,"悬赏类型,悬赏信息不能为空");
|
||||
await _discussRewardRepository.InsertAsync(rewardEntity);
|
||||
}
|
||||
return discuss;
|
||||
}
|
||||
|
||||
public async Task<CommentAggregateRoot> CreateCommentAsync(Guid discussId, Guid parentId, Guid rootId, string content)
|
||||
|
||||
@@ -37,10 +37,10 @@ namespace Yi.Framework.Bbs.Domain.Managers
|
||||
/// <returns></returns>
|
||||
public async Task<Dictionary<int, LevelCacheItem>> GetCacheMapAsync()
|
||||
{
|
||||
var items = _levelCache.GetOrAdd(LevelConst.LevelCacheKey, () =>
|
||||
var items =await _levelCache.GetOrAddAsync(LevelConst.LevelCacheKey,async () =>
|
||||
{
|
||||
var cacheItem = (_repository.GetListAsync().Result)
|
||||
.OrderByDescending(x => x.CurrentLevel).ToList()
|
||||
var cacheItem = ((await _repository.GetListAsync())
|
||||
.OrderByDescending(x => x.CurrentLevel))
|
||||
.Adapt<List<LevelCacheItem>>();
|
||||
return cacheItem;
|
||||
});
|
||||
|
||||
@@ -53,6 +53,10 @@ namespace Yi.Framework.ChatHub.Domain.Managers
|
||||
chatHistory: history,
|
||||
executionSettings: openSettings,
|
||||
kernel: _kernel);
|
||||
if (results is null)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
await foreach (var result in results)
|
||||
{
|
||||
yield return result.Content;
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import request from "@/config/axios/service";
|
||||
|
||||
export function setResolve(discussId) {
|
||||
return request({
|
||||
url: `/discuss/reward/resolve/${discussId}`,
|
||||
method: "put"
|
||||
});
|
||||
}
|
||||
|
||||
export function getList(data) {
|
||||
return request({
|
||||
url: "/discuss",
|
||||
|
||||
24
Yi.Bbs.Vue3/src/components/DiscussTypeLable.vue
Normal file
24
Yi.Bbs.Vue3/src/components/DiscussTypeLable.vue
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
<script setup>
|
||||
import {computed} from "vue";
|
||||
|
||||
const model = defineModel();
|
||||
const items=[
|
||||
{ type: 'primary', label: '主题',key:"Article" },
|
||||
{ type: 'primary', label: '悬赏',key:"Reward" }
|
||||
];
|
||||
const currentValue=computed(()=>{
|
||||
return items.filter(item=>item.key===model.value)[0];
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<template>
|
||||
<el-tag
|
||||
v-if="currentValue"
|
||||
:type="currentValue?.type"
|
||||
effect="light"
|
||||
>
|
||||
{{ currentValue?.label }}
|
||||
</el-tag>
|
||||
</template>
|
||||
@@ -1,7 +1,9 @@
|
||||
<template>
|
||||
<el-badge class="box-card">
|
||||
<el-card shadow="never" :style="{ 'border-color': discuss.color }"
|
||||
class="discuss-subscript"
|
||||
>
|
||||
<span class="recommend" v-if="discuss.discussType==='Reward'"> </span>
|
||||
<div class="card-header">
|
||||
<AvatarInfo :userInfo="discuss.user" />
|
||||
</div>
|
||||
@@ -42,10 +44,11 @@
|
||||
<div class="item item-bottom">
|
||||
<div class="tag-list">
|
||||
|
||||
<el-tag v-for="item in discuss.permissionRoleCodes" effect="dark" type="danger" :key="item">{{item}}</el-tag>
|
||||
<el-tag v-if="discuss.permissionRoleCodes.length>0" v-for="item in discuss.permissionRoleCodes" effect="dark" type="danger" :key="item">{{item}}</el-tag>
|
||||
|
||||
<el-tag v-if="discuss.lables.length===0">暂无标签</el-tag>
|
||||
<el-tag v-for="item in discuss.lables" :key="item.id">{{item.name}}</el-tag>
|
||||
<el-tag v-if="discuss.title!=''&& discuss.lables.length===0">暂无标签</el-tag>
|
||||
|
||||
<el-tag v-if="discuss.lables.length>0" v-for="item in discuss.lables" :key="item.id">{{item.name}}</el-tag>
|
||||
</div>
|
||||
<el-space :size="10" :spacer="spacer">
|
||||
<div class="item-description">
|
||||
@@ -86,7 +89,9 @@ const discuss = reactive({
|
||||
isAgree: false,
|
||||
cover: "",
|
||||
isBan: false,
|
||||
lables:[]
|
||||
lables:[],
|
||||
permissionRoleCodes:[],
|
||||
discussType:""
|
||||
});
|
||||
const router = useRouter();
|
||||
const spacer = h(ElDivider, { direction: "vertical" });
|
||||
@@ -132,6 +137,7 @@ onMounted(() => {
|
||||
discuss.cover = props.discuss.cover;
|
||||
discuss.lables=props.discuss.lables;
|
||||
discuss.permissionRoleCodes=props.discuss.permissionRoleCodes;
|
||||
discuss.discussType=props.discuss.discussType;
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
@@ -207,4 +213,41 @@ onMounted(() => {
|
||||
:deep(.el-card__body) {
|
||||
padding: 10px 20px;
|
||||
}
|
||||
|
||||
.discuss-subscript{
|
||||
position: relative;
|
||||
.recommend:before {
|
||||
cursor: pointer;
|
||||
content: "悬赏";
|
||||
position: absolute;
|
||||
top: -8px;
|
||||
right: -26px;
|
||||
z-index: 1;
|
||||
padding: 14px 22px 2px;
|
||||
background-color: #ff9900;
|
||||
transform: rotate(45deg);
|
||||
font-size: 12px;
|
||||
color: #ffffff;
|
||||
}
|
||||
.recommend:hover::after {
|
||||
width: 100px;
|
||||
content: "选择悬赏主题,帮助他人解决问题,赚取小费"; /* 鼠标悬浮时显示的文字 */
|
||||
position: absolute;
|
||||
top: 30px; /* 距离盒子顶部的距离 */
|
||||
left: 70%; /* 盒子中央位置 */
|
||||
transform: translateX(-50%); /* 水平居中 */
|
||||
padding: 5px 10px;
|
||||
background-color: #ff9900;
|
||||
color: #ffffff;
|
||||
font-size: 12px;
|
||||
border-radius: 5px;
|
||||
z-index: 9999;
|
||||
opacity: 0; /* 初始状态不透明 */
|
||||
transition: opacity 0.5s; /* 添加过渡效果 */
|
||||
}
|
||||
|
||||
.recommend:hover::after {
|
||||
opacity: 1; /* 鼠标悬浮时完全显示 */
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<el-menu-item index="2" @click="enterStart"
|
||||
>开始</el-menu-item>
|
||||
<el-menu-item index="3" @click="enterTemp" style="color: red;font-weight: bolder;font-size: large;"
|
||||
>Ai炒股</el-menu-item>
|
||||
>有偿悬赏</el-menu-item>
|
||||
<el-menu-item index="4" @click="enterShop"
|
||||
>商城</el-menu-item>
|
||||
<!-- <el-sub-menu index="4">-->
|
||||
@@ -234,7 +234,7 @@ const enterStart = () => {
|
||||
}
|
||||
|
||||
const enterTemp=()=>{
|
||||
router.push("/stock");
|
||||
router.push("/discuss/24cc0526-86e7-aabf-e091-3a0f83c3e604/false");
|
||||
}
|
||||
const enterShop=()=>{
|
||||
router.push("/shop");
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<el-row :gutter="20" class="top-div">
|
||||
<el-col :span="5">
|
||||
<el-row class="art-info-left">
|
||||
<el-col :span="24">
|
||||
<el-col :span="24" v-if="discuss.discussType=='Article'">
|
||||
<InfoCard header="文章信息" text="展开" hideDivider="true" :isPadding="false" style="padding: 10px">
|
||||
<template #content>
|
||||
<el-button
|
||||
@@ -35,6 +35,35 @@
|
||||
</template>
|
||||
</InfoCard>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" v-if="discuss.discussType=='Reward'">
|
||||
<InfoCard header="悬赏信息" text="有偿" hideDivider="true" :isPadding="true" style="padding: 10px">
|
||||
<template #content>
|
||||
<p>
|
||||
当前状态:
|
||||
<el-tag
|
||||
v-if="discuss.rewardData.isResolved"
|
||||
type="success"
|
||||
effect="dark"
|
||||
round
|
||||
>已解决</el-tag>
|
||||
|
||||
<el-tag
|
||||
v-else
|
||||
type="danger"
|
||||
effect="dark"
|
||||
round
|
||||
>未解决</el-tag>
|
||||
</p>
|
||||
<el-divider/>
|
||||
<p>参考价格:{{discuss.rewardData.minValue}}~{{discuss.rewardData.maxValue}}RMB</p>
|
||||
<el-divider/>
|
||||
<p style="color: #AB9AAA">联系作者:</p>
|
||||
<p>{{discuss.rewardData.contact}}</p>
|
||||
</template>
|
||||
</InfoCard>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<InfoCard :items="authorList" :isPadding="false" header="作者分享" height="410" text="更多" style="padding:0 20px">
|
||||
<template #item="temp">
|
||||
@@ -42,13 +71,6 @@
|
||||
</template>
|
||||
</InfoCard>
|
||||
</el-col>
|
||||
<!-- <el-col :span="24">-->
|
||||
<!-- <InfoCard :items="items" header="内容推荐" text="更多">-->
|
||||
<!-- <template #item="temp">-->
|
||||
<!-- <AvatarInfo />-->
|
||||
<!-- </template>-->
|
||||
<!-- </InfoCard>-->
|
||||
<!-- </el-col>-->
|
||||
</el-row>
|
||||
</el-col>
|
||||
|
||||
@@ -56,16 +78,15 @@
|
||||
<el-row class="left-div">
|
||||
<el-col :span="24">
|
||||
<Breadcrumb :breadcrumbsList="breadcrumbsList" class="breadcrumb"/>
|
||||
<!-- {{ discuss.user }} -->
|
||||
|
||||
<AvatarInfo
|
||||
:size="50"
|
||||
:showWatching="true"
|
||||
:time="discuss.creationTime"
|
||||
:userInfo="discuss.user"
|
||||
></AvatarInfo>
|
||||
<!-- :userInfo="{nick:'qwe'} -->
|
||||
|
||||
<h2>{{ discuss.title }}</h2>
|
||||
<h2> <DiscussTypeLable style="margin-right: 8px;height: 35px;" v-model="discuss.discussType" /> {{ discuss.title }}</h2>
|
||||
<h5 class="subtitle">{{ discuss.introduction }}</h5>
|
||||
<el-image
|
||||
:preview-src-list="[getUrl(discuss.cover)]"
|
||||
@@ -73,7 +94,14 @@
|
||||
:src="getUrl(discuss.cover)"
|
||||
style="width: 150px; height: 150px"
|
||||
/>
|
||||
|
||||
<div v-if="discuss.discussType=='Reward'">
|
||||
<el-divider/>
|
||||
<p style="color: red">通过”悬赏主题“发布问题,双方达成一致并解决问题后,建议有偿提供RMB给解决人员</p>
|
||||
<p style="color: red">社区只提供解决问题平台,不参与任何交易,请自行联系</p>
|
||||
</div>
|
||||
<el-divider/>
|
||||
<el-skeleton :rows="10" animated v-if="discuss.content==undefined" />
|
||||
<ArticleContentInfo
|
||||
:code="discuss.content ?? ''"
|
||||
></ArticleContentInfo>
|
||||
@@ -111,11 +139,21 @@
|
||||
<el-button
|
||||
type="primary"
|
||||
size="default"
|
||||
v-if="isEditTheme && isArticleUser"
|
||||
v-if="isEditTheme && isArticleUser&&discuss.discussType=='Article'"
|
||||
@click="updateHander(route.params.discussId)"
|
||||
>编辑
|
||||
</el-button
|
||||
>
|
||||
<el-button
|
||||
type="warning"
|
||||
size="default"
|
||||
v-if="isEditTheme && isArticleUser&&discuss.discussType=='Reward'&&discuss.rewardData.isResolved==false"
|
||||
@click="updateSolveHander(route.params.discussId)"
|
||||
>设置已解决
|
||||
</el-button
|
||||
>
|
||||
|
||||
|
||||
<el-button
|
||||
style="margin-left: 1rem"
|
||||
type="danger"
|
||||
@@ -165,19 +203,7 @@
|
||||
<ThemeData :themeData="temp"/>
|
||||
</template>
|
||||
</InfoCard>
|
||||
<!-- <InfoCard :items="items" header="其他" text="更多">-->
|
||||
<!-- <template #item="temp">-->
|
||||
<!-- <AvatarInfo />-->
|
||||
<!-- </template>-->
|
||||
<!-- </InfoCard>-->
|
||||
</el-col>
|
||||
<!-- <el-col :span="24">-->
|
||||
<!-- <InfoCard :items="items" header="其他" text="更多">-->
|
||||
<!-- <template #item="temp">-->
|
||||
<!-- <AvatarInfo />-->
|
||||
<!-- </template>-->
|
||||
<!-- </InfoCard>-->
|
||||
<!-- </el-col>-->
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -193,7 +219,8 @@ import BottomInfo from "@/components/BottomInfo.vue";
|
||||
import TreeArticleInfo from "@/components/TreeArticleInfo.vue";
|
||||
import {useRoute, useRouter} from "vue-router";
|
||||
import AgreeInfo from "@/components/AgreeInfo.vue";
|
||||
import {get as discussGet, del as discussDel} from "@/apis/discussApi.js";
|
||||
import DiscussTypeLable from "@/components/DiscussTypeLable.vue";
|
||||
import {get as discussGet, del as discussDel,setResolve} from "@/apis/discussApi.js";
|
||||
import {
|
||||
all as articleall,
|
||||
del as articleDel,
|
||||
@@ -311,6 +338,22 @@ const delHander = async (ids) => {
|
||||
});
|
||||
});
|
||||
};
|
||||
//设置已解决
|
||||
const updateSolveHander=(discussId)=>{
|
||||
ElMessageBox.confirm(`确定要将此悬赏主题设置已解决吗?`, "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
}).then(async () => {
|
||||
await setResolve(discussId);
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "设置成功",
|
||||
});
|
||||
await loadDiscuss();
|
||||
|
||||
});
|
||||
};
|
||||
//更新操作
|
||||
const updateHander = (discussId) => {
|
||||
//跳转路由
|
||||
|
||||
@@ -12,8 +12,7 @@
|
||||
<el-radio-group v-model="radio">
|
||||
<el-radio-button label="discuss" :disabled="artType !== 'discuss'"
|
||||
>主题
|
||||
</el-radio-button
|
||||
>
|
||||
</el-radio-button>
|
||||
<el-radio-button label="article" :disabled="artType !== 'article'"
|
||||
>文章
|
||||
</el-radio-button
|
||||
@@ -28,6 +27,35 @@
|
||||
>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="主题类型:" v-if="radio == 'discuss'">
|
||||
<el-radio-group v-model="editForm.discussType">
|
||||
<el-radio-button label="Article">基础</el-radio-button>
|
||||
<el-radio-button label="Reward">有偿悬赏</el-radio-button>
|
||||
<el-radio-button label="Test" :disabled="true">问答</el-radio-button>
|
||||
<el-radio-button label="Test" :disabled="true">投票</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="悬赏金额:" v-if="editForm.discussType == 'Reward'">
|
||||
<div class="reward-div">
|
||||
<p style="color: red">通过”悬赏主题“发布问题,双方达成一致并解决问题后,建议有偿提供RMB给解决人员</p>
|
||||
<p style="color: red">社区只提供解决问题平台,不参与任何交易,请自行联系</p>
|
||||
<div>
|
||||
<span>最少RMB:</span>
|
||||
<el-input-number style="margin-right: 40px;" v-model="editForm.rewardData.minValue" :min="10">
|
||||
</el-input-number>
|
||||
|
||||
<span>最多RMB:</span>
|
||||
<el-input-number v-model="editForm.rewardData.maxValue" :min="10">
|
||||
</el-input-number>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系方式:" v-if="editForm.discussType == 'Reward'">
|
||||
<el-input v-model="editForm.rewardData.contact" placeholder="输入你的联系方式(例如微信号/QQ号)" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="权限:" v-if="radio == 'discuss'">
|
||||
<el-radio-group v-model="perRadio">
|
||||
<el-radio-button label="Public">公开</el-radio-button>
|
||||
@@ -187,7 +215,6 @@ const codeStyle = "atom-one-dark";
|
||||
|
||||
// 用于禁用判断
|
||||
const artType = ref(route.query.artType);
|
||||
|
||||
//封面完整显示的url
|
||||
const fileUploadUrl = `${import.meta.env.VITE_APP_BASEAPI}/file`;
|
||||
//封面的url
|
||||
@@ -218,12 +245,19 @@ const getUrl = computed(() => {
|
||||
|
||||
//整个页面上的表单
|
||||
const editForm = reactive({
|
||||
|
||||
discussType: "Article",
|
||||
title: "",
|
||||
introduction: "",
|
||||
content: "",
|
||||
name: "",
|
||||
permissionRoleCodes: [],
|
||||
discussLableIds:[]
|
||||
discussLableIds: [],
|
||||
rewardData: {
|
||||
minValue: 10,
|
||||
maxValue: 200,
|
||||
contact:""
|
||||
}
|
||||
});
|
||||
|
||||
//组装主题内容: 需要更新主题信息
|
||||
@@ -252,6 +286,7 @@ const submit = async (formEl) => {
|
||||
if (valid) {
|
||||
//dicuss主题处理
|
||||
if (radio.value == "discuss") {
|
||||
discuss.discussType=editForm.discussType;
|
||||
discuss.discussLableIds = selectLabelList.value.map((item) => item.id);
|
||||
discuss.title = editForm.title;
|
||||
discuss.introduction = editForm.introduction;
|
||||
@@ -260,6 +295,21 @@ const submit = async (formEl) => {
|
||||
discuss.cover = dialogImageUrl.value;
|
||||
discuss.permissionType = perRadio.value;
|
||||
discuss.permissionRoleCodes = editForm.permissionRoleCodes;
|
||||
//悬赏还需要新增参数
|
||||
if (editForm.discussType == 'Reward')
|
||||
{
|
||||
discuss.rewardData= editForm.rewardData;
|
||||
if (editForm.rewardData.contact=="")
|
||||
{
|
||||
ElMessage.error("悬赏的联系方式不能为空!");
|
||||
return;
|
||||
}
|
||||
if (editForm.rewardData.maxValue<editForm.rewardData.minValue)
|
||||
{
|
||||
ElMessage.error("悬赏设置的最多金额不能小于最少金额");
|
||||
return;
|
||||
}
|
||||
}
|
||||
//主题创建
|
||||
if (route.query.operType == "create") {
|
||||
const response = await discussAdd(discuss);
|
||||
@@ -412,6 +462,11 @@ const getFile = async (e) => {
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
.reward-div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.body-div {
|
||||
position: relative;
|
||||
min-height: 1000px;
|
||||
|
||||
@@ -54,6 +54,7 @@ margin: 10px auto;">
|
||||
|
||||
<el-col :span="24" v-for="i in allDiscussList" :key="i.id">
|
||||
<img v-if="isIcp" src="@/assets/login.png" style="height: 150px;width: 100%" alt=""/>
|
||||
|
||||
<DisscussCard v-else :discuss="i"/>
|
||||
</el-col>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user