From f64693c0da5483d8670220bf3a5bf89a32e94a20 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期五, 07 十一月 2025 10:34:21 +0800
Subject: [PATCH] 解决线上打包问题
---
wx/pages/activity/detail.js | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 112 insertions(+), 1 deletions(-)
diff --git a/wx/pages/activity/detail.js b/wx/pages/activity/detail.js
index 83989e1..38c6a70 100644
--- a/wx/pages/activity/detail.js
+++ b/wx/pages/activity/detail.js
@@ -9,6 +9,10 @@
myApplication: null,
buttonDisabled: false,
buttonText: '鎴戣鎶ュ悕',
+ // 瀵煎嚭鐩稿叧
+ isEmployee: false,
+ exportingActivity: false,
+ exportingStageId: null,
loading: true,
error: null
},
@@ -88,12 +92,16 @@
}
}
+ // 瑙掕壊锛氭槸鍚﹀憳宸ワ紙涓诲姙鏂�/绠$悊鍛橈級
+ const isEmployee = !!(app.globalData?.userInfo?.employee && app.globalData.userInfo.employee.id)
+
this.setData({
activity: res.activity,
myApplication: myApplication,
loading: false,
buttonDisabled: buttonDisabled,
- buttonText: buttonText
+ buttonText: buttonText,
+ isEmployee: isEmployee
});
} else {
throw new Error('鏈壘鍒版瘮璧涗俊鎭�');
@@ -135,5 +143,108 @@
return `${startDate} - ${endDate}`;
}
return startDate || endDate;
+ },
+
+ // 澶嶅埗閾炬帴鍒板壀璐存澘
+ copyLink(e) {
+ const url = e.currentTarget.dataset.url
+ if (!url) {
+ wx.showToast({ title: '鏆傛棤閾炬帴', icon: 'none' })
+ return
+ }
+ wx.setClipboardData({
+ data: url,
+ success: () => {
+ wx.showToast({ title: '宸插鍒朵笅杞介摼鎺�', icon: 'success' })
+ }
+ })
+ },
+
+ // 鍦╓ebView鍐呮墦寮�閾炬帴锛堢敤浜庨瑙�/涓嬭浇锛�
+ openWebView(e) {
+ const url = e.currentTarget.dataset.url
+ if (!url) {
+ wx.showToast({ title: '鏆傛棤閾炬帴', icon: 'none' })
+ return
+ }
+ wx.navigateTo({
+ url: `/pages/webview/webview?url=${encodeURIComponent(url)}&title=${encodeURIComponent('璇勫瀵煎嚭ZIP')}`
+ })
+ },
+
+ // 瑙﹀彂瀵煎嚭锛堜富娲诲姩锛�
+ async handleExportActivity() {
+ if (!this.data.isEmployee) {
+ wx.showToast({ title: '鏃犳潈闄愭墽琛屽鍑�', icon: 'none' })
+ return
+ }
+ if (!this.data.activityId) {
+ wx.showToast({ title: '鏃犳晥鐨勬椿鍔↖D', icon: 'none' })
+ return
+ }
+ this.setData({ exportingActivity: true })
+ const mutation = `
+ mutation ExportReviewZip($activityId: ID!, $stageIds: [ID]) {
+ exportReviewZip(activityId: $activityId, stageIds: $stageIds) {
+ success
+ url
+ message
+ }
+ }
+ `
+ try {
+ const res = await app.graphqlRequest(mutation, { activityId: this.data.activityId, stageIds: null })
+ const result = res && res.exportReviewZip
+ if (result && result.success) {
+ wx.showToast({ title: '瀵煎嚭鎴愬姛', icon: 'success' })
+ // 鍒锋柊浠ユ樉绀烘渶鏂伴摼鎺�
+ await this.loadActivityDetail(this.data.activityId)
+ } else {
+ wx.showToast({ title: result?.message || '瀵煎嚭澶辫触', icon: 'none' })
+ }
+ } catch (err) {
+ console.error('瀵煎嚭澶辫触:', err)
+ wx.showToast({ title: '瀵煎嚭澶辫触', icon: 'none' })
+ } finally {
+ this.setData({ exportingActivity: false })
+ }
+ },
+
+ // 瑙﹀彂瀵煎嚭锛堥樁娈碉級
+ async handleExportStage(e) {
+ if (!this.data.isEmployee) {
+ wx.showToast({ title: '鏃犳潈闄愭墽琛屽鍑�', icon: 'none' })
+ return
+ }
+ const stageId = e.currentTarget.dataset.stageId
+ if (!stageId) {
+ wx.showToast({ title: '鏃犳晥鐨勯樁娈礗D', icon: 'none' })
+ return
+ }
+ this.setData({ exportingStageId: stageId })
+ const mutation = `
+ mutation ExportReviewZip($activityId: ID!, $stageIds: [ID]) {
+ exportReviewZip(activityId: $activityId, stageIds: $stageIds) {
+ success
+ url
+ message
+ }
+ }
+ `
+ try {
+ const res = await app.graphqlRequest(mutation, { activityId: this.data.activityId, stageIds: [stageId] })
+ const result = res && res.exportReviewZip
+ if (result && result.success) {
+ wx.showToast({ title: '瀵煎嚭鎴愬姛', icon: 'success' })
+ await this.loadActivityDetail(this.data.activityId)
+ } else {
+ wx.showToast({ title: result?.message || '瀵煎嚭澶辫触', icon: 'none' })
+ }
+ } catch (err) {
+ console.error('瀵煎嚭闃舵澶辫触:', err)
+ wx.showToast({ title: '瀵煎嚭澶辫触', icon: 'none' })
+ } finally {
+ this.setData({ exportingStageId: null })
+ }
}
});
--
Gitblit v1.8.0