From bd999ecc09fcacf4016edcba85caf9b9696d2140 Mon Sep 17 00:00:00 2001
From: lrj <owen.stl@gmail.com>
Date: 星期六, 04 十月 2025 18:40:31 +0800
Subject: [PATCH] feat: 同步本地改动(认证/评审/用户/选手模块更新;新增/调整 GraphQL schema;小程序个人信息与评审相关页面、配置与资源等)

---
 wx/pages/registration/registration.js |  114 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 104 insertions(+), 10 deletions(-)

diff --git a/wx/pages/registration/registration.js b/wx/pages/registration/registration.js
index f4ca562..05a6728 100644
--- a/wx/pages/registration/registration.js
+++ b/wx/pages/registration/registration.js
@@ -10,6 +10,9 @@
     activity: null,
     loading: false,
     userInfo: null, // 褰撳墠鐢ㄦ埛淇℃伅
+    // 鎶ュ悕鐘舵�佹帶鍒�
+    submitDisabled: false,
+    submitText: '鎻愪氦鎶ュ悕',
     
     // 琛ㄥ崟鏁版嵁
     formData: {
@@ -98,6 +101,9 @@
       this.setData({
         activityId: activityId
       })
+      // 浼樺厛妫�鏌ユ姤鍚嶇姸鎬�
+      this.checkRegistrationStatus(activityId)
+      // 鍔犺浇娲诲姩淇℃伅
       this.loadActivityInfo()
     } else {
       console.log('鉂� 娌℃湁鎺ユ敹鍒癮ctivityId鍙傛暟')
@@ -111,7 +117,15 @@
     
     // 鍔犺浇鍖哄煙鏁版嵁
     this.loadRegions()
-  }
+  },
+
+  onShow() {
+    // 杩斿洖鏈〉鏃跺埛鏂版姤鍚嶇姸鎬�
+    const { activityId } = this.data
+    if (activityId) {
+      this.checkRegistrationStatus(activityId)
+    }
+  },
 
   // 鍔犺浇娲诲姩淇℃伅
   async loadActivityInfo() {
@@ -233,7 +247,7 @@
         console.log('馃搵 浣跨敤Player淇℃伅鏄剧ず:', userInfo.player)
         displayUserInfo.name = userInfo.player.name || userInfo.name || ''
         displayUserInfo.phone = userInfo.player.phone || userInfo.phone || ''
-        displayUserInfo.avatarUrl = userInfo.player.avatarUrl || userInfo.avatarUrl || ''
+        displayUserInfo.avatarUrl = userInfo.avatarUrl || ''
         
         // 澶勭悊鎬у埆淇℃伅锛�0=鐢凤紝1=濂�
         if (userInfo.player.gender !== undefined && userInfo.player.gender !== null) {
@@ -264,7 +278,8 @@
       const updateData = {
         'formData.name': userInfo.name || '',
         'formData.phone': userInfo.phone || '',
-        'formData.email': userInfo.email || ''
+        'formData.email': userInfo.email || '',
+        'formData.avatarUrl': userInfo.avatarUrl || ''
       }
       
       // 濡傛灉鐢ㄦ埛鏈塒layer淇℃伅锛屼紭鍏堜娇鐢≒layer鐨勮缁嗕俊鎭�
@@ -272,6 +287,7 @@
         console.log('馃搵 浣跨敤Player淇℃伅棰勫~鍏�:', userInfo.player)
         updateData['formData.name'] = userInfo.player.name || userInfo.name || ''
         updateData['formData.phone'] = userInfo.player.phone || userInfo.phone || ''
+        updateData['formData.avatarUrl'] = userInfo.avatarUrl || ''
         
         // 澶勭悊鎬у埆淇℃伅锛�0=鐢凤紝1=濂�
         if (userInfo.player.gender !== undefined && userInfo.player.gender !== null) {
@@ -285,6 +301,7 @@
       }
       
       console.log('鉁� 棰勫~鍏呮暟鎹�:', updateData)
+      console.log('馃柤锔� 璁剧疆澶村儚URL:', updateData['formData.avatarUrl'])
       this.setData(updateData)
     } else {
       console.log('鈿狅笍 鏈壘鍒扮敤鎴蜂俊鎭紝鏃犳硶棰勫~鍏�')
@@ -907,23 +924,31 @@
           success: (res) => {
             wx.hideLoading()
             if (res.statusCode === 200) {
+              // 鏍规嵁瀹為檯鏂囦欢鎵╁睍鍚嶇‘瀹氭枃浠剁被鍨�
+              const fileName = attachment.name || ''
+              const fileExt = fileName.split('.').pop().toLowerCase()
               const fileTypeMap = {
-                'word': 'doc',
-                'excel': 'xls',
-                'ppt': 'ppt'
+                'doc': 'doc',
+                'docx': 'docx',
+                'xls': 'xls',
+                'xlsx': 'xlsx',
+                'ppt': 'ppt',
+                'pptx': 'pptx'
               }
               
               wx.openDocument({
                 filePath: res.tempFilePath,
-                fileType: fileTypeMap[fileType] || 'doc',
+                fileType: fileTypeMap[fileExt] || 'doc',
                 success: () => {
                   console.log('鏂囨。鎵撳紑鎴愬姛')
                 },
                 fail: (err) => {
                   console.error('鏂囨。鎵撳紑澶辫触:', err)
-                  wx.showToast({
-                    title: '鏂囨。鎵撳紑澶辫触',
-                    icon: 'none'
+                  wx.showModal({
+                    title: '鎵撳紑澶辫触',
+                    content: '鏂囨。鎵撳紑澶辫触锛屽彲鑳芥槸鏂囦欢鏍煎紡涓嶆敮鎸佹垨鏂囦欢鎹熷潖',
+                    showCancel: false,
+                    confirmText: '纭畾'
                   })
                 }
               })
@@ -1158,6 +1183,14 @@
 
   async onSubmit() {
     if (this.data.isSubmitting) return
+    if (this.data.submitDisabled) {
+      // 绂佺敤鎬佺洿鎺ユ嫤鎴偣鍑�
+      wx.showToast({
+        title: this.data.submitText,
+        icon: 'none'
+      })
+      return
+    }
     
     // 琛ㄥ崟楠岃瘉
     if (!this.validateForm()) {
@@ -1204,6 +1237,16 @@
           userId: result.userId,
           activityPlayerId: result.activityPlayerId
         })
+        
+        // 绗笁姝ワ細鎶ュ悕鎴愬姛鍚庡己鍒惰皟鐢╳xlogin鑾峰彇鏂扮殑JWT token
+        console.log('馃摫 鎶ュ悕鎴愬姛锛屽紑濮嬪己鍒惰皟鐢╳xlogin鑾峰彇鏂扮殑JWT token')
+        try {
+          await app.wxLogin()
+          console.log('鉁� 鎶ュ悕鎴愬姛鍚巜xlogin璋冪敤鎴愬姛锛屽凡鑾峰彇鏂扮殑JWT token')
+        } catch (wxLoginError) {
+          console.error('鉂� 鎶ュ悕鎴愬姛鍚巜xlogin璋冪敤澶辫触:', wxLoginError)
+          // wxlogin澶辫触涓嶅奖鍝嶆姤鍚嶆垚鍔熺殑鎻愮ず锛屽彧璁板綍閿欒
+        }
         
         wx.showToast({
           title: '鎶ュ悕鎴愬姛',
@@ -1418,6 +1461,57 @@
     }
   },
 
+  // 妫�鏌ュ綋鍓嶆椿鍔ㄧ殑鎶ュ悕鐘舵�侊紝杩涘叆椤甸潰鏃惰皟鐢�
+  async checkRegistrationStatus(activityId) {
+    try {
+      // GraphQL 鏌ヨ鏈�鏂版姤鍚嶇姸鎬侊紙鍚庣杩斿洖鏈�鏂颁竴鏉¤褰曪級
+      const query = `
+        query GetPlayerRegistrationState($activityId: ID!) {
+          getPlayerRegistrationState(activityId: $activityId) {
+            id
+            status
+            registrationTime
+            reviewStatus
+            reviewComment
+          }
+        }
+      `
+      const res = await app.graphqlRequest(query, { activityId: parseInt(activityId) })
+      console.log('馃煢 鎶ュ悕鐘舵�佹煡璇㈢粨鏋滃師濮�:', res)
+
+      // 鍏煎澶氱杩斿洖缁撴瀯
+      const dataRoot = res?.getPlayerRegistrationState
+        || res?.playerRegistration
+        || res?.data?.getPlayerRegistrationState
+        || res?.data?.playerRegistration
+
+      let submitDisabled = false
+      let submitText = '鎻愪氦鎶ュ悕'
+
+      if (dataRoot && dataRoot.status !== undefined && dataRoot.status !== null) {
+        const statusNum = Number(dataRoot.status)
+        console.log('馃煢 瑙f瀽鍒版姤鍚嶇姸鎬�:', statusNum)
+        if (statusNum === 1) {
+          submitDisabled = true
+          submitText = '宸茬粡鎶ュ悕'
+        } else if (statusNum === 0) {
+          submitDisabled = true
+          submitText = '绛夊緟瀹℃牳'
+        } else {
+          submitDisabled = false
+          submitText = '鎻愪氦鎶ュ悕'
+        }
+      } else {
+        console.log('馃煢 鏈壘鍒版姤鍚嶈褰曟垨鐘舵�侊紝鍏佽鎻愪氦')
+      }
+
+      this.setData({ submitDisabled, submitText })
+    } catch (err) {
+      console.warn('鈿狅笍 鎶ュ悕鐘舵�佹煡璇㈠け璐ワ紝鍏佽鐢ㄦ埛鎻愪氦:', err)
+      this.setData({ submitDisabled: false, submitText: '鎻愪氦鎶ュ悕' })
+    }
+  },
+
   // 鑾峰彇鏂囦欢鎵╁睍鍚�
   getFileExtension(fileName) {
     if (!fileName) return ''

--
Gitblit v1.8.0