From 2d410989d32380d31ae3fe6d42aa3b3ba9e09d00 Mon Sep 17 00:00:00 2001
From: lrj <owen.stl@gmail.com>
Date: 星期五, 03 十月 2025 22:13:29 +0800
Subject: [PATCH] UI优化和bug修复: 1.调整小程序消息列表图标样式 2.优化web端比赛晋级页面布局 3.修复小程序消息列表日期显示问题
---
web/src/views/next-list.vue | 14 ++-
wx/pages/message/utils.wxs | 48 +++++++++---
backend/src/main/java/com/rongyichuang/player/dto/PromotionCompetitionResponse.java | 10 ++
backend/src/main/resources/graphql/player.graphqls | 57 ++++++++++++++
web/src/api/promotion.js | 1
wx/pages/index/index.wxss | 8 ++
wx/pages/message/message.wxml | 4
backend/src/main/java/com/rongyichuang/player/service/PromotionService.java | 4
web/src/views/carousel/index.vue | 34 ++++++++
wx/pages/message/message.wxss | 11 ++
10 files changed, 164 insertions(+), 27 deletions(-)
diff --git a/backend/src/main/java/com/rongyichuang/player/dto/PromotionCompetitionResponse.java b/backend/src/main/java/com/rongyichuang/player/dto/PromotionCompetitionResponse.java
index d5521b4..bcf3ffe 100644
--- a/backend/src/main/java/com/rongyichuang/player/dto/PromotionCompetitionResponse.java
+++ b/backend/src/main/java/com/rongyichuang/player/dto/PromotionCompetitionResponse.java
@@ -10,6 +10,7 @@
public class PromotionCompetitionResponse {
private Long id;
+ private Long competitionId;
private String competitionName;
private String stageName;
private Integer maxParticipants;
@@ -26,6 +27,7 @@
public PromotionCompetitionResponse(Activity competition, Activity stage, Integer currentCount) {
this.id = stage.getId();
+ this.competitionId = competition.getId();
this.competitionName = competition.getName();
this.stageName = stage.getName();
this.maxParticipants = stage.getPlayerMax();
@@ -49,6 +51,14 @@
this.id = id;
}
+ public Long getCompetitionId() {
+ return competitionId;
+ }
+
+ public void setCompetitionId(Long competitionId) {
+ this.competitionId = competitionId;
+ }
+
public String getCompetitionName() {
return competitionName;
}
diff --git a/backend/src/main/java/com/rongyichuang/player/service/PromotionService.java b/backend/src/main/java/com/rongyichuang/player/service/PromotionService.java
index 9ab63c2..4ca32ea 100644
--- a/backend/src/main/java/com/rongyichuang/player/service/PromotionService.java
+++ b/backend/src/main/java/com/rongyichuang/player/service/PromotionService.java
@@ -246,8 +246,8 @@
return PromotionResult.failure("璇烽�夋嫨瑕佹檵绾х殑鍙傝禌鑰�");
}
- // 鏌ヨ鐩爣鏅嬬骇闃舵淇℃伅锛堢敤鎴风偣鍑荤殑闃舵灏辨槸瑕佹檵绾у埌鐨勯樁娈碉級
- Activity targetStage = activityRepository.findById(input.getCompetitionId()).orElse(null);
+ // 鏌ヨ鐩爣鏅嬬骇闃舵淇℃伅
+ Activity targetStage = activityRepository.findById(input.getTargetStageId()).orElse(null);
if (targetStage == null) {
return PromotionResult.failure("鐩爣鏅嬬骇闃舵涓嶅瓨鍦�");
}
diff --git a/backend/src/main/resources/graphql/player.graphqls b/backend/src/main/resources/graphql/player.graphqls
index 6a5f120..8ab03f6 100644
--- a/backend/src/main/resources/graphql/player.graphqls
+++ b/backend/src/main/resources/graphql/player.graphqls
@@ -19,6 +19,10 @@
activityPlayerDetail(id: ID!): ActivityPlayerDetailResponse
# 寰俊绔幏鍙栭�夋墜鎶ュ悕鐘舵��
getPlayerRegistrationState(activityId: ID!): PlayerRegistrationResponse
+ # 鑾峰彇姣旇禌鏅嬬骇鍒楄〃
+ promotionCompetitions(name: String, page: Int, size: Int): [PromotionCompetitionResponse!]!
+ # 鑾峰彇鍙檵绾у弬璧涜�呭垪琛�
+ promotableParticipants(currentStageId: ID!): PromotableParticipantsResponse
}
extend type Mutation {
@@ -29,6 +33,8 @@
submitActivityRegistration(input: ActivityRegistrationInput!): ActivityRegistrationResponse
# 淇濆瓨璇勫璇勫垎
saveActivityPlayerRating(input: ActivityPlayerRatingInput!): Boolean
+ # 鎵ц瀛﹀憳鏅嬬骇鎿嶄綔
+ promoteParticipants(input: PromotionInput!): PromotionResult
}
type ActivityPlayer {
@@ -232,4 +238,55 @@
input ActivityPlayerRatingItemInput {
itemId: ID!
score: Float!
+}
+
+# 姣旇禌鏅嬬骇鍒楄〃鍝嶅簲绫诲瀷
+type PromotionCompetitionResponse {
+ id: ID!
+ competitionId: ID!
+ competitionName: String!
+ stageName: String!
+ maxParticipants: Int
+ currentCount: Int!
+ status: Int
+ startTime: String
+ endTime: String
+ sortOrder: Int
+ state: Int
+}
+
+# 鍙檵绾у弬璧涜�呭垪琛ㄥ搷搴旂被鍨�
+type PromotableParticipantsResponse {
+ participants: [PromotableParticipantResponse!]!
+ selectableCount: Int
+ totalCount: Int
+ previousStageName: String
+ currentStageName: String
+}
+
+# 鍙檵绾у弬璧涜�呭搷搴旂被鍨�
+type PromotableParticipantResponse {
+ id: ID!
+ playerName: String
+ projectName: String
+ phone: String
+ averageScore: Float
+ ratingCount: Int
+ applyTime: String
+ state: Int
+ playerId: ID
+}
+
+# 鏅嬬骇鎿嶄綔杈撳叆绫诲瀷
+input PromotionInput {
+ competitionId: ID!
+ participantIds: [ID!]!
+ targetStageId: ID!
+}
+
+# 鏅嬬骇鎿嶄綔缁撴灉绫诲瀷
+type PromotionResult {
+ success: Boolean!
+ message: String
+ promotedCount: Int
}
\ No newline at end of file
diff --git a/web/src/api/promotion.js b/web/src/api/promotion.js
index 2878790..c2b315d 100644
--- a/web/src/api/promotion.js
+++ b/web/src/api/promotion.js
@@ -5,6 +5,7 @@
query GetPromotionCompetitions($name: String, $page: Int, $size: Int) {
promotionCompetitions(name: $name, page: $page, size: $size) {
id
+ competitionId
competitionName
stageName
maxParticipants
diff --git a/web/src/views/carousel/index.vue b/web/src/views/carousel/index.vue
index c305d0c..648baf0 100644
--- a/web/src/views/carousel/index.vue
+++ b/web/src/views/carousel/index.vue
@@ -60,8 +60,8 @@
<el-table-column prop="createTime" label="鍒涘缓鏃堕棿" width="180" />
<el-table-column label="鎿嶄綔" width="120" fixed="right">
<template #default="{ row }">
- <el-button type="primary" size="small" @click="handleEdit(row)" :icon="Edit" circle title="缂栬緫"></el-button>
- <el-button type="danger" size="small" @click="handleDelete(row)" :icon="Delete" circle title="鍒犻櫎"></el-button>
+ <el-button text size="small" @click="handleEdit(row)" :icon="Edit" class="action-btn edit-btn" title="缂栬緫"></el-button>
+ <el-button text size="small" @click="handleDelete(row)" :icon="Delete" class="action-btn delete-btn" title="鍒犻櫎"></el-button>
</template>
</el-table-column>
</el-table>
@@ -681,6 +681,36 @@
}
}
+/* 鎿嶄綔鎸夐挳鏍峰紡 */
+.action-btn {
+ padding: 8px !important;
+ margin: 0 6px;
+ border-radius: 6px;
+ transition: all 0.2s ease;
+ background: transparent !important;
+ border: none !important;
+}
+
+.edit-btn {
+ color: #409eff !important;
+}
+
+.edit-btn:hover {
+ color: #337ecc !important;
+ background: rgba(64, 158, 255, 0.1) !important;
+ transform: scale(1.2);
+}
+
+.delete-btn {
+ color: #f56c6c !important;
+}
+
+.delete-btn:hover {
+ color: #dd6161 !important;
+ background: rgba(245, 108, 108, 0.1) !important;
+ transform: scale(1.2);
+}
+
.header-actions {
display: flex;
gap: 10px;
diff --git a/web/src/views/next-list.vue b/web/src/views/next-list.vue
index addeb22..a8200db 100644
--- a/web/src/views/next-list.vue
+++ b/web/src/views/next-list.vue
@@ -27,7 +27,6 @@
<el-icon><Search /></el-icon>
鎼滅储
</el-button>
- <el-button @click="resetSearch">閲嶇疆</el-button>
</div>
</div>
@@ -222,6 +221,7 @@
import { ElMessage, ElMessageBox } from 'element-plus'
import { Search, TrophyBase, InfoFilled } from '@element-plus/icons-vue'
import PromotionApi from '@/api/promotion'
+import { getActivity } from '@/api/activity'
const router = useRouter()
@@ -393,6 +393,8 @@
selectedParticipants.value = selection
}
+
+
// 纭鏅嬬骇
const confirmPromotion = async () => {
if (selectedParticipants.value.length === 0) {
@@ -418,10 +420,10 @@
const participantIds = selectedParticipants.value.map(p => p.id)
const result = await PromotionApi.promoteParticipants(
- selectedCompetition.value.id,
- participantIds,
- null // 鐩爣闃舵ID锛岃繖閲屽彲浠ユ牴鎹渶瑕佽缃�
- )
+ selectedCompetition.value.competitionId, // 涓绘瘮璧汭D
+ participantIds,
+ selectedCompetition.value.id // 褰撳墠闃舵ID浣滀负鐩爣闃舵ID
+ )
if (result && result.success) {
ElMessage.success(result.message || `鎴愬姛鏅嬬骇 ${result.promotedCount} 鍚嶄汉鍛榒)
@@ -558,7 +560,7 @@
.search-toolbar {
display: flex;
align-items: center;
- justify-content: space-between;
+ justify-content: flex-end;
margin-bottom: 20px;
padding: 16px;
background-color: #f9fafb;
diff --git a/wx/pages/index/index.wxss b/wx/pages/index/index.wxss
index 10ba3b4..df62744 100644
--- a/wx/pages/index/index.wxss
+++ b/wx/pages/index/index.wxss
@@ -268,6 +268,14 @@
width: 140rpx;
text-align: center;
/* align-self 宸茬Щ闄わ紝鐢辩埗绾� .btn-row 鎺у埗瀵归綈 */
+ /* 绉婚櫎button榛樿鏍峰紡 */
+ margin: 0;
+ position: static;
+ display: inline-block;
+}
+
+.ghost-btn::after {
+ border: none;
}
.ghost-btn:active {
diff --git a/wx/pages/message/message.wxml b/wx/pages/message/message.wxml
index f9c22e5..1738522 100644
--- a/wx/pages/message/message.wxml
+++ b/wx/pages/message/message.wxml
@@ -19,8 +19,8 @@
<view wx:else class="message-list">
<view wx:for="{{messages}}" wx:key="id" class="message-card">
<view class="icon-wrapper">
- <!-- 鎸夎姹備娇鐢ㄧ粺涓�鍥炬爣 -->
- <icon type="info" size="22" color="#FFFFFF"></icon>
+ <!-- 浣跨敤鏇村悎閫傜殑娑堟伅鍥炬爣 -->
+ <text class="icon ic-comment"></text>
</view>
<view class="text-wrapper">
<text class="title">{{item.content}}</text>
diff --git a/wx/pages/message/message.wxss b/wx/pages/message/message.wxss
index 620b929..bb839f8 100644
--- a/wx/pages/message/message.wxss
+++ b/wx/pages/message/message.wxss
@@ -75,10 +75,10 @@
}
.icon-wrapper {
- width: 80rpx;
- height: 80rpx;
+ width: 60rpx;
+ height: 60rpx;
border-radius: 50%;
- background-color: #007aff; /* 缁熶竴浣跨敤钃濊壊 */
+ background-color: #e6f3ff; /* 娴呰摑鑹茶儗鏅� */
display: flex;
align-items: center;
justify-content: center;
@@ -86,6 +86,11 @@
flex-shrink: 0;
}
+.icon-wrapper .icon {
+ font-size: 28rpx;
+ color: #007aff; /* 娣辫摑鑹插浘鏍� */
+}
+
.text-wrapper {
display: flex;
flex-direction: column;
diff --git a/wx/pages/message/utils.wxs b/wx/pages/message/utils.wxs
index 687c244..ef6572f 100644
--- a/wx/pages/message/utils.wxs
+++ b/wx/pages/message/utils.wxs
@@ -1,19 +1,43 @@
var formatTime = function (dateStr) {
if (!dateStr) return '';
- // 鍏煎 iOS
- var date = getDate(dateStr.split('-').join('/'));
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var day = date.getDate();
- var hour = date.getHours();
- var minute = date.getMinutes();
-
- var formatNumber = function(n) {
- n = n.toString();
- return n[1] ? n : '0' + n;
+
+ var date;
+
+ // 澶勭悊鏃堕棿鎴筹紙鏁板瓧锛�
+ if (typeof dateStr === 'number') {
+ date = getDate(dateStr);
+ }
+ // 澶勭悊瀛楃涓叉牸寮忕殑鏃ユ湡
+ else if (typeof dateStr === 'string') {
+ // 灏濊瘯鐩存帴瑙f瀽
+ date = getDate(dateStr);
+ }
+ else {
+ return '';
}
+
+ // 妫�鏌ユ棩鏈熷璞℃槸鍚﹀垱寤烘垚鍔�
+ try {
+ var year = date.getFullYear();
+ var month = date.getMonth() + 1;
+ var day = date.getDate();
+ var hour = date.getHours();
+ var minute = date.getMinutes();
+
+ // 濡傛灉鑾峰彇鍒扮殑鍊兼槸NaN锛岃鏄庢棩鏈熸棤鏁�
+ if (year !== year || month !== month || day !== day) {
+ return '';
+ }
+
+ return year + '-' + formatNumber(month) + '-' + formatNumber(day) + ' ' + formatNumber(hour) + ':' + formatNumber(minute);
+ } catch (e) {
+ return '';
+ }
+}
- return year + '-' + formatNumber(month) + '-' + formatNumber(day) + ' ' + formatNumber(hour) + ':' + formatNumber(minute);
+var formatNumber = function(n) {
+ n = n.toString();
+ return n[1] ? n : '0' + n;
}
module.exports = {
--
Gitblit v1.8.0