From c4938f6f4e839890b032c75c7a57333a6a9157a9 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期四, 06 十一月 2025 17:06:10 +0800
Subject: [PATCH] 添加新闻功能

---
 wx/pages/profile/profile.js |   78 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 76 insertions(+), 2 deletions(-)

diff --git a/wx/pages/profile/profile.js b/wx/pages/profile/profile.js
index 15cedc9..d55cf34 100644
--- a/wx/pages/profile/profile.js
+++ b/wx/pages/profile/profile.js
@@ -27,6 +27,14 @@
     isJudge: false,
     isOrganizer: false,
     hasPlayer: false,
+    isEmployee: false,
+    
+    // 鍛樺伐瀹℃牳缁熻
+    employeeReviewStats: {
+      pendingCount: 0,
+      approvedCount: 0,
+      rejectedCount: 0
+    },
     
     // 璇勫鐩稿叧鏁版嵁
     judgeStats: {
@@ -197,7 +205,15 @@
             major
             grade
             roles
+            gender
+            birthday
             createdAt
+            employee {
+              id
+              name
+              roleId
+              description
+            }
             player {
               id
               name
@@ -218,6 +234,7 @@
         const isJudge = userRoles.includes('JUDGE')
         const isOrganizer = userRoles.includes('ORGANIZER')
         const hasPlayer = userInfo.player && userInfo.player.id
+        const isEmployee = !!(userInfo.employee && userInfo.employee.id)
         
         // 澶勭悊澶村儚鏂囧瓧
         const avatarText = (userInfo.name || '鐢ㄦ埛').substring(0, 1)
@@ -228,7 +245,8 @@
           userRoles,
           isJudge,
           isOrganizer,
-          hasPlayer
+          hasPlayer,
+          isEmployee
         })
         
         // 鏇存柊鍏ㄥ眬鐢ㄦ埛淇℃伅
@@ -241,6 +259,18 @@
         
         if (isOrganizer) {
           this.loadOrganizerStats()
+        }
+
+        if (isEmployee) {
+          this.loadEmployeeReviewStats()
+        } else {
+          this.setData({
+            employeeReviewStats: {
+              pendingCount: 0,
+              approvedCount: 0,
+              rejectedCount: 0
+            }
+          })
         }
       }
     } catch (error) {
@@ -358,6 +388,39 @@
     }
   },
 
+  // 鍔犺浇鍛樺伐瀹℃牳缁熻
+  async loadEmployeeReviewStats(keyword = null) {
+    if (!this.data.isEmployee) {
+      return
+    }
+
+    try {
+      const query = `
+        query EmployeeReviewStats($keyword: String) {
+          employeeReviewStats(keyword: $keyword) {
+            pendingCount
+            approvedCount
+            rejectedCount
+          }
+        }
+      `
+
+      const variables = {}
+      if (keyword && typeof keyword === 'string' && keyword.trim()) {
+        variables.keyword = keyword.trim()
+      }
+
+      const result = await graphqlRequest(query, variables)
+
+      if (result && result.employeeReviewStats) {
+        this.setData({
+          employeeReviewStats: result.employeeReviewStats
+        })
+      }
+    } catch (error) {
+      console.error('鍔犺浇鍛樺伐瀹℃牳缁熻澶辫触:', error)
+    }
+  },
   // 鍔犺浇璇勫缁熻鏁版嵁
   async loadJudgeStats() {
     try {
@@ -462,6 +525,17 @@
   goToReviewPage() {
     wx.navigateTo({
       url: '/pages/review/index'
+    })
+  },
+
+  // 璺宠浆鍒板憳宸ュ鏍搁〉闈�
+  goToEmployeeReviewPage() {
+    if (!this.data.isEmployee) {
+      return
+    }
+
+    wx.navigateTo({
+      url: '/pages/profile/employee-review'
     })
   },
 
@@ -616,7 +690,7 @@
   // 鍒嗕韩椤甸潰
   onShareAppMessage() {
     return {
-      title: '钃夋槗鍒� - 鎴戠殑涓汉涓績',
+      title: '钃塭鍒� - 鎴戠殑涓汉涓績',
       path: '/pages/index/index'
     }
   }

--
Gitblit v1.8.0