Skip to content

Commit

Permalink
mod: 评论和留言文案调整,根据传参展示 && 搜素结果页不用类型的结果使用不同颜色的标签标识
Browse files Browse the repository at this point in the history
  • Loading branch information
yangrunkang committed Jan 30, 2023
1 parent c7e6b6c commit dd1377e
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 55 deletions.
10 changes: 5 additions & 5 deletions upupor-web/src/main/resources/static/js/common/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ $(function () {
$.cvLoadShowImg();
});

function cancel() {
function cancel(text) {
swal({
title: '确定重置评论操作?',
text: "当前评论的所有操作将会被重置",
title: '确定重置'+text+'操作?',
text: "当前"+text+"的所有操作将会被重置",
icon: "warning",
buttons: [{
text: "确认",
Expand Down Expand Up @@ -104,11 +104,11 @@ function comment(contentId, commentSource, desc) {
/**
* 渲染回复用户的名字
*/
function renderReplayUserName(userName, userId, floorNum) {
function renderReplayUserName(userName, userId, floorNum, businessDesc) {
try {
$("#reply_to_user").val(userId);
$("#reply_to_floor").val(floorNum);
$("#reply_to_user_name").text('回复 ' + floorNum + '# · ' + userName + ' 的评论').show();
$("#reply_to_user_name").text('回复 ' + floorNum + '# · ' + userName + ' 的' + businessDesc).show();
//滚动到锚点位置
$('html,body').animate({scrollTop: $(".btn-cv-comment").offset().top - 440}, 200);
} catch (e) {
Expand Down
85 changes: 43 additions & 42 deletions upupor-web/src/main/resources/templates/content/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ <h5 class="text-wrap m-0" th:text="${contentIndexDto.contentEnhance.content.titl
${contentIndexDto.contentEnhance?.listCommentDto?.pageDtoList},
${contentIndexDto.contentEnhance?.listCommentDto?.total},
'content-detail',
${contentIndexDto.contentEnhance.content.userId})"></div>
${contentIndexDto.contentEnhance.content.userId},
'评论')"></div>
<!--评论框-->
<div class="card border-0 rounded-3 p-2 my-2" th:if="${session?.cv_user_id} and ${contentIndexDto.contentEnhance.content.status.name() == 'NORMAL'}">
<div id="comment_area">
Expand All @@ -131,6 +132,42 @@ <h5 class="text-wrap m-0" th:text="${contentIndexDto.contentEnhance.content.titl
</div>
<div class="col-lg-3">
<div th:if="${contentIndexDto.createContentDesc != null}" th:include="fragments/index::create_content_url(${contentIndexDto.createContentDesc})"></div>
<div class="card border-0 rounded-3 p-2 mb-2">
<div>
<p style="text-align: center" class="m-0 p-1" th:if="!${#strings.isEmpty(contentIndexDto.contentEnhance.memberEnhance.member.via)}">
<a th:href="'/profile/'+${contentIndexDto.contentEnhance.memberEnhance.member.userId}+'/content'">
<img class="lazyload img rounded" th:data-src="${contentIndexDto.contentEnhance.memberEnhance.member.via}" style="width: 90px;height: 90px;"/>
</a>
</p>
<p style="text-align: center" class="m-0 p-1">
<a th:inline="text" th:href="'/profile/' + ${contentIndexDto.contentEnhance.content.userId}+'/content'" class="text-black-50 cv-link" style="font-size: 14px">
[[${contentIndexDto.contentEnhance.memberEnhance.member.userName}]]
</a>
</p>
<div>
<p style="text-align: center" class="text-black-50 small m-0 p-1" th:if="!${#strings.isEmpty(contentIndexDto.contentEnhance.memberEnhance.lastLoginDate)}" th:inline="text">最近活跃: [[${contentIndexDto.contentEnhance.memberEnhance.lastLoginDate}]]</p>
</div>
<!--关注按钮-->
<button th:if="${session?.cv_user_id != contentIndexDto.contentEnhance.content.userId} and !${contentIndexDto.currUserIsAttention}" class="btn rounded-3 bg-gradient btn-warning btn-sm w-100" th:onclick="attentionAuthor([[${contentIndexDto.contentEnhance.content.userId}]])" id="attention_btn">
<span th:text="${contentIndexDto.currUserIsAttention} == false ? '关注作者':'已关注作者'" id="attention_tips"></span>
</button>
<!--关注按钮..end-->
</div>
</div>
<!--作者其他文章-->
<div class="card border-0 rounded-3 p-2 mb-2">
<div>
<div class="text-black-50 border-bottom mb-2">[[${contentIndexDto.contentEnhance.memberEnhance.member.userName}]]的其他文章<a class="cv-link text-black-50 float-end" th:href="'/profile/'+${contentIndexDto.contentEnhance.content.userId}+'/content'"><i class="bi bi-balloon"></i>全部</a></div>
<div th:if="${#lists.isEmpty(contentIndexDto.authorOtherContentEnhanceList)}" th:include="fragments/index::empty_content"></div>
<div th:if="!${#lists.isEmpty(contentIndexDto.authorOtherContentEnhanceList)}">
<div th:each="contentEnhance,ite : ${contentIndexDto.authorOtherContentEnhanceList}">
<a class="cv-link text-secondary up-text-overflow"
th:href="'/u/'+${contentEnhance.content.contentId}"
th:title="${contentEnhance.content.title}">[[${ite.count}]]. [[${contentEnhance.content.title}]]</a>
</div>
</div>
</div>
</div>
<div th:include="fragments/index::global_search"></div>
<div class="card border-0 rounded-3 p-2 mb-2">
<div class="text-black-50 border-bottom mb-2 pt-0">文章导航</div>
Expand All @@ -147,12 +184,6 @@ <h5 class="text-wrap m-0" th:text="${contentIndexDto.contentEnhance.content.titl
</ol>
</nav>
</div>
<div th:if="${session?.is_admin} and ${contentIndexDto.contentEnhance.content.status.name() == 'NORMAL'}" class="card border-0 rounded-3 p-2 mb-2">
<div class="text-black-50 small border-0 border-bottom mt-0 mb-2">管理员专有权限</div>
<div class="media-right media-middle ms-1">
<a class="ui orange button" th:href="'/user/admin/content/' + ${contentIndexDto.contentEnhance.content.contentId}">管理</a>
</div>
</div>
<div class="card border-0 rounded-3 p-2 mb-2" th:if="${session?.cv_user_id == contentIndexDto.contentEnhance.content.userId}">
<div class="text-black-50 small border-0 border-bottom mt-0 mb-2">操作</div>
<div class="media-right media-middle ms-1">
Expand Down Expand Up @@ -212,43 +243,13 @@ <h5 class="text-wrap m-0" th:text="${contentIndexDto.contentEnhance.content.titl
</div>
<!--社交模板-->
<div th:include="fragments/social::social_box('u/','文章',${contentIndexDto.contentEnhance.content.contentId},${contentIndexDto.contentEnhance.content.title})" th:if="${contentIndexDto.contentEnhance.content.status.name() == 'NORMAL'}"></div>
<div class="card border-0 rounded-3 p-2 mb-2">
<div>
<p style="text-align: center" class="m-0 p-1" th:if="!${#strings.isEmpty(contentIndexDto.contentEnhance.memberEnhance.member.via)}">
<a th:href="'/profile/'+${contentIndexDto.contentEnhance.memberEnhance.member.userId}+'/content'">
<img class="lazyload img rounded" th:data-src="${contentIndexDto.contentEnhance.memberEnhance.member.via}" style="width: 90px;height: 90px;"/>
</a>
</p>
<p style="text-align: center" class="m-0 p-1">
<a th:inline="text" th:href="'/profile/' + ${contentIndexDto.contentEnhance.content.userId}+'/content'" class="text-black-50 cv-link" style="font-size: 14px">
[[${contentIndexDto.contentEnhance.memberEnhance.member.userName}]]
</a>
</p>
<div>
<p style="text-align: center" class="text-black-50 small m-0 p-1" th:if="!${#strings.isEmpty(contentIndexDto.contentEnhance.memberEnhance.lastLoginDate)}" th:inline="text">最近活跃: [[${contentIndexDto.contentEnhance.memberEnhance.lastLoginDate}]]</p>
</div>
<!--关注按钮-->
<button th:if="${session?.cv_user_id != contentIndexDto.contentEnhance.content.userId} and !${contentIndexDto.currUserIsAttention}" class="btn rounded-3 bg-gradient btn-warning btn-sm w-100" th:onclick="attentionAuthor([[${contentIndexDto.contentEnhance.content.userId}]])" id="attention_btn">
<span th:text="${contentIndexDto.currUserIsAttention} == false ? '关注作者':'已关注作者'" id="attention_tips"></span>
</button>
<!--关注按钮..end-->
</div>
</div>
<!--作者其他文章-->
<div class="card border-0 rounded-3 p-2 mb-2">
<div>
<div class="text-black-50 border-bottom mb-2">[[${contentIndexDto.contentEnhance.memberEnhance.member.userName}]]的其他文章<a class="cv-link text-black-50 float-end" th:href="'/profile/'+${contentIndexDto.contentEnhance.content.userId}+'/content'"><i class="bi bi-balloon"></i>全部</a></div>
<div th:if="${#lists.isEmpty(contentIndexDto.authorOtherContentEnhanceList)}" th:include="fragments/index::empty_content"></div>
<div th:if="!${#lists.isEmpty(contentIndexDto.authorOtherContentEnhanceList)}">
<div th:each="contentEnhance,ite : ${contentIndexDto.authorOtherContentEnhanceList}">
<a class="cv-link text-secondary up-text-overflow"
th:href="'/u/'+${contentEnhance.content.contentId}"
th:title="${contentEnhance.content.title}">[[${ite.count}]]. [[${contentEnhance.content.title}]]</a>
</div>
</div>
<div th:replace="fragments/index::user_manage_fragment(true)"></div>
<div th:if="${session?.is_admin} and ${contentIndexDto.contentEnhance.content.status.name() == 'NORMAL'}" class="card border-0 rounded-3 p-2 mb-2">
<div class="text-black-50 small border-0 border-bottom mt-0 mb-2">管理员专有权限</div>
<div class="media-right media-middle ms-1">
<a class="ui orange button" th:href="'/user/admin/content/' + ${contentIndexDto.contentEnhance.content.contentId}">管理</a>
</div>
</div>
<div th:replace="fragments/index::user_manage_fragment(true)"></div>
<div th:include="fragments/index::google_right_ad"></div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@
<input type="hidden" id="reply_to_floor" />
<div id="comment_btn_group" style="display: none">
<button class="ui primary button btn-sm btn-cv-comment my-2" th:onclick="comment([[${targetId}]],[[${source}]],[[${text}]])">[[${text}]]</button>
<button class="ui button btn-sm my-2" th:onclick="cancel()">重置</button>
<button class="ui button btn-sm my-2" th:onclick="cancel([[${text}]])">重置</button>
<div class="btn rounded-3 bg-gradient btn-link cv-link btn-sm my-2" th:include="fragments/common::markdown"></div>
</div>
</div>
</div>


<div th:fragment="commentList(commentEnhance,pageDtoList,total,fromPage,targetUserId)">
<div th:fragment="commentList(commentEnhance,pageDtoList,total,fromPage,targetUserId,businessDesc)">
<div th:class="${fromPage == 'profile-message'}?'':'card border-0 rounded-3 p-2 my-2'">
<div th:if="${#lists.isEmpty(commentEnhance)}" th:include="fragments/index::empty_content"></div>
<div th:if="!${#lists.isEmpty(commentEnhance)}">
Expand All @@ -80,10 +80,10 @@
[[${commentEnhance.memberEnhance.member.userName}]] <span class="badge rounded-3 fw-normal" style="border: 1px solid #DAEDE4;color: #3f7b5a;background-color: #EFF7ED;" th:if="${commentEnhance.memberEnhance.member.userId == targetUserId}">楼主</span>
<span th:include="fragments/member::memberTag(${commentEnhance.memberEnhance})"></span>
</a>
<span class="badge bg-gradient bg-success" th:if="${commentEnhance.comment.beFloorNum != null}" th:text="'回复 ' + ${commentEnhance.comment.beFloorNum} + '#'+(${commentEnhance.replyMemberEnhance?.member?.userName} == null?'':' · '+${commentEnhance.replyMemberEnhance?.member?.userName})+' 的评论'"></span>
<span class="badge bg-gradient bg-success" th:if="${commentEnhance.comment.beFloorNum != null}" th:text="'回复 ' + ${commentEnhance.comment.beFloorNum} + '#'+(${commentEnhance.replyMemberEnhance?.member?.userName} == null?'':' · '+${commentEnhance.replyMemberEnhance?.member?.userName})+' 的'+${businessDesc}"></span>
<div class="float-end text-black-50 small">
<span class="d-none d-sm-block float-start text-black-50 ">[[${commentEnhance.createDateDiff}]]&nbsp;·&nbsp;</span>
<span style="cursor: pointer" th:if="${session?.cv_user_id}" th:onclick="renderReplayUserName([[${commentEnhance.memberEnhance.member.userName}]],[[${commentEnhance.memberEnhance.member.userId}]],[[${commentEnhance.comment.floorNum}]])">回复<i class="bi bi-reply-fill"></i></span>
<span style="cursor: pointer" th:if="${session?.cv_user_id}" th:onclick="renderReplayUserName([[${commentEnhance.memberEnhance.member.userName}]],[[${commentEnhance.memberEnhance.member.userId}]],[[${commentEnhance.comment.floorNum}]],[[${businessDesc}]])">回复<i class="bi bi-reply-fill"></i></span>
<span style="cursor: pointer" th:if="!${session?.cv_user_id}" th:onclick="window.location.href='/login?back=' + window.location.pathname">回复<i class="bi bi-reply-fill"></i></span>
·&nbsp;<span class="badge bg-gradient bg-light text-black-50" th:text="${commentEnhance.comment.floorNum} + '#'"></span>
</div>
Expand Down
3 changes: 2 additions & 1 deletion upupor-web/src/main/resources/templates/profile/message.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
${memberIndexDto.listCommentDto.pageDtoList},
${memberIndexDto.listCommentDto.total},
'profile-message',
${memberIndexDto.memberEnhance.member.userId})"></div>
${memberIndexDto.memberEnhance.member.userId},
'留言')"></div>
</div>
<div class="card border-0 rounded-3 p-2 my-2" th:if="${session?.cv_user_id}">
<div id="comment_area">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ <h5 class="mt-2">[[${radioIndexDto.radioEnhance.radio.radioIntro}]]</h5>
${radioIndexDto.radioEnhance.listCommentDto.pageDtoList},
${radioIndexDto.radioEnhance.listCommentDto.total},
'radio-detail',
${radioIndexDto.radioEnhance.radio.userId})"></div>
${radioIndexDto.radioEnhance.radio.userId},
'评论')"></div>
<div class="card border-0 rounded-3 p-2 my-2" th:if="${session?.cv_user_id} and ${radioIndexDto.radioEnhance.radio.status.name() == 'NORMAL'}">
<div id="comment_area">
<div th:include="fragments/comment::comment_box(${radioIndexDto.radioEnhance.radio.radioId},'RADIO','评论')"></div>
Expand Down
8 changes: 6 additions & 2 deletions upupor-web/src/main/resources/templates/search/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ <h2 style="font-weight: lighter">关键字</h2>
<div class="flex-grow-1">
<div class="mt-0">
<a th:href="${searchData.hrefUrl}" class="cv-link up-text-overflow fs-6 fst-normal" th:title="${searchData.resultTitle}" th:utext="${searchData.resultTitle}"></a>
<div class="text-black-50 small"><span class="badge bg-gradient bg-success fw-light">[[${searchData.dataType.name}]]</span></div>
<div class="text-black-50 small"> <i class="bi bi-clock"></i> [[${searchData.createDate}]]</div>
<div class="text-black-50 small">
<span class="badge bg-gradient bg-success fw-light" th:if="${searchData.dataType.name()} == 'CONTENT'">[[${searchData.dataType.name}]]</span>
<span class="badge bg-gradient bg-info fw-light" th:if="${searchData.dataType.name()} == 'RADIO'">[[${searchData.dataType.name}]]</span>
<span class="badge bg-gradient bg-primary fw-light" th:if="${searchData.dataType.name()} == 'MEMBER'">[[${searchData.dataType.name}]]</span>
</div>
<div class="text-black-50 small"><img th:data-src="${ossStatic} + @{/icons/system/content-time.png}" class="lazyload cv-icon-small"/> [[${searchData.createDate}]]</div>
</div>
</div>
<a class="flex-shrink-0 text-black-50 cv-link" th:if="${searchData.dataType.name()} == 'MEMBER'" th:href="'/profile/' + ${searchData.memberEnhance.member.userId}+'/content'" th:title="${searchData.memberEnhance.member.userName}">
Expand Down

0 comments on commit dd1377e

Please sign in to comment.