From 3714621173c606c4c58439ed8941100ce9ddea14 Mon Sep 17 00:00:00 2001
From: Codex Assistant <codex@example.com>
Date: 星期三, 05 十一月 2025 15:10:49 +0800
Subject: [PATCH] bug
---
wx/pages/judge/review.js | 124 ++++++++++++++++++++++++++++++----------
1 files changed, 92 insertions(+), 32 deletions(-)
diff --git a/wx/pages/judge/review.js b/wx/pages/judge/review.js
index c8d16d2..112e080 100644
--- a/wx/pages/judge/review.js
+++ b/wx/pages/judge/review.js
@@ -149,9 +149,27 @@
videos: detail.submissionFiles ? detail.submissionFiles
.filter(file => file.mediaType === 2)
.map(file => file.fullUrl || file.url) : [],
+ mediaList: (detail.submissionFiles || []).map(file => {
+ const mt = file.mediaType
+ let typeStr = ''
+ if (mt === 1 || mt === 'image' || (typeof mt === 'string' && mt.startsWith('image'))) typeStr = 'image'
+ else if (mt === 2 || mt === 'video' || (typeof mt === 'string' && mt.startsWith('video'))) typeStr = 'video'
+ else if ((file.fileExt || '').toLowerCase().includes('pdf')) typeStr = 'pdf'
+ else if ((file.fileExt || '').toLowerCase().includes('doc')) typeStr = 'word'
+ else typeStr = 'file'
+ return {
+ id: file.id,
+ name: file.name,
+ size: file.fileSize,
+ mediaType: typeStr,
+ thumbUrl: file.fullThumbUrl || file.thumbUrl || file.fullUrl || file.url,
+ url: file.fullUrl || file.url
+ }
+ }),
participant: {
id: detail.playerInfo.id,
name: detail.playerInfo.name,
+ phone: detail.playerInfo.phone || '',
gender: this.getGenderText(detail.playerInfo.gender),
birthday: detail.playerInfo.birthday || '',
region: detail.regionInfo ? detail.regionInfo.name : '',
@@ -293,20 +311,39 @@
})
},
- // 濯掍綋鐐瑰嚮
+ // 濯掍綋鐐瑰嚮锛堥�氳繃 index 瀹氫綅 mediaList 椤癸級
onMediaTap(e) {
- const { url, type } = e.currentTarget.dataset
-
- if (type === 'image') {
+ const { index } = e.currentTarget.dataset
+ const item = this.data.submission?.mediaList?.[index]
+ if (!item) return
+ if (item.mediaType === 'image') {
+ const imgs = (this.data.submission.mediaList || [])
+ .filter(it => it.mediaType === 'image')
+ .map(it => it.url)
wx.previewImage({
- current: url,
- urls: this.data.submission.images || []
+ current: item.url,
+ urls: imgs.length ? imgs : [item.url]
})
- } else if (type === 'video') {
+ } else if (item.mediaType === 'video') {
this.setData({
showMediaPreview: true,
- currentMedia: url,
+ currentMedia: item.url,
mediaType: 'video'
+ })
+ } else {
+ wx.downloadFile({
+ url: item.url,
+ success: (res) => {
+ if (res.statusCode === 200) {
+ wx.openDocument({
+ filePath: res.tempFilePath,
+ showMenu: true
+ })
+ } else {
+ wx.showToast({ title: '棰勮澶辫触', icon: 'none' })
+ }
+ },
+ fail: () => wx.showToast({ title: '涓嬭浇澶辫触', icon: 'none' })
})
}
},
@@ -317,6 +354,44 @@
showMediaPreview: false,
currentMedia: null
})
+ },
+
+ // 鐐瑰嚮棰勮鎸夐挳锛氬浘鐗�/瑙嗛鐢� wx.previewMedia锛屾枃妗g敤 openDocument
+ onPreviewTap(e) {
+ const { index } = e.currentTarget.dataset
+ const list = this.data.submission?.mediaList || []
+ const item = list[index]
+ if (!item) return
+
+ if (item.mediaType === 'image' || item.mediaType === 'video') {
+ const mediaList = list
+ .filter(m => m.mediaType === 'image' || m.mediaType === 'video')
+ .map(m => ({
+ url: m.url,
+ type: m.mediaType === 'video' ? 'video' : 'image',
+ poster: m.thumbUrl || m.url
+ }))
+ const current = Math.max(0, mediaList.findIndex(m => m.url === item.url))
+ wx.previewMedia({
+ sources: mediaList,
+ current
+ })
+ } else {
+ wx.downloadFile({
+ url: item.url,
+ success: (res) => {
+ if (res.statusCode === 200) {
+ wx.openDocument({
+ filePath: res.tempFilePath,
+ showMenu: true
+ })
+ } else {
+ wx.showToast({ title: '棰勮澶辫触', icon: 'none' })
+ }
+ },
+ fail: () => wx.showToast({ title: '涓嬭浇澶辫触', icon: 'none' })
+ })
+ }
},
// 涓嬭浇鏂囦欢
@@ -560,30 +635,15 @@
},
*/
- // 鑱旂郴鍙傝禌鑰�
+ // 鑱旂郴鍙傝禌鑰咃細鐩存帴鎷ㄦ墦鐢佃瘽
onContactParticipant() {
- const { submission } = this.data
-
- if (submission.participant) {
- wx.showActionSheet({
- itemList: ['鍙戦�佹秷鎭�', '鏌ョ湅璇︽儏'],
- success: (res) => {
- switch (res.tapIndex) {
- case 0:
- // 鍙戦�佹秷鎭姛鑳�
- wx.navigateTo({
- url: `/pages/chat/chat?userId=${submission.participant.id}`
- })
- break
- case 1:
- // 鏌ョ湅鐢ㄦ埛璇︽儏
- wx.navigateTo({
- url: `/pages/user/profile?userId=${submission.participant.id}`
- })
- break
- }
- }
- })
+ const phone =
+ this.data.submission?.participant?.phone ||
+ this.data.submission?.participant?.userInfo?.phone
+ if (phone) {
+ wx.makePhoneCall({ phoneNumber: String(phone) })
+ } else {
+ wx.showToast({ title: '鏃犺仈绯荤數璇�', icon: 'none' })
}
},
@@ -619,7 +679,7 @@
// 鍒嗕韩椤甸潰
onShareAppMessage() {
return {
- title: '钃夋槗鍒� - 璇勫浣滃搧',
+ title: '钃塭鍒� - 璇勫浣滃搧',
path: '/pages/index/index'
}
}
--
Gitblit v1.8.0