From 48145f787eda81815f653ad21161a60e89b6a303 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 13 十一月 2024 16:41:32 +0800
Subject: [PATCH] 2024.11.13

---
 pages/mExtra/pSupervisionchange/pSupervisionchange.js |  127 ++++++++++++++++++++++--------------------
 1 files changed, 66 insertions(+), 61 deletions(-)

diff --git a/pages/mExtra/pSupervisionchange/pSupervisionchange.js b/pages/mExtra/pSupervisionchange/pSupervisionchange.js
index 35b755b..9eb19bc 100644
--- a/pages/mExtra/pSupervisionchange/pSupervisionchange.js
+++ b/pages/mExtra/pSupervisionchange/pSupervisionchange.js
@@ -1,8 +1,8 @@
 // pages/mExtra/pSupervisionchange/pSupervisionchange.js
-import moment from '../../../utils/moment.min'
-import bLoadingStatus from '../../../base/behaviors/bLoadingStatus'
-import bLoadingToast from '../../../base/behaviors/bLoadingToast'
-const taskservice = require('../../../service/taskservice')
+import moment from '../../../utils/moment.min';
+import bLoadingStatus from '../../../base/behaviors/bLoadingStatus';
+import bLoadingToast from '../../../base/behaviors/bLoadingToast';
+const taskservice = require('../../../service/taskservice');
 
 Page({
   behaviors: [bLoadingStatus, bLoadingToast],
@@ -16,7 +16,7 @@
     subTask: {},
     problemList: [],
 
-    previewImageUrls:[],
+    previewImageUrls: [],
     previewCurrent: 0,
     showPreview: false,
   },
@@ -27,130 +27,135 @@
   onLoad(options) {
     console.log(options);
     if (options.time) {
-      let now = new Date()
-      now = now.getTime()
-      if (now - options.time <= (1000 * 60 * 60 * 24 * 2)) {
+      let now = new Date();
+      now = now.getTime();
+      if (now - options.time <= 1000 * 60 * 60 * 24 * 2) {
         this.setData({
           enable: true,
-        })
+        });
         if (options.subTaskId) {
-          this.sId = options.subTaskId
-          this.getSubtask()
-          this.getProblems()
+          this.sId = options.subTaskId;
+          this.getSubtask();
+          this.getProblems();
         } else {
           this.setData({
             enable: false,
             reason: '璇ュ贰鏌ヤ换鍔″凡澶辨晥',
-          })
+          });
         }
       }
+    } else {
+      this.setData({
+        enable: true,
+      });
+      this.sId = '6tsjAYdt0EUGxsdU';
+      this.getSubtask();
+      this.getProblems();
     }
-    // this.sId = 'TUIk7Jf3UKmaZM90'
-    // this.getSubtask()
-    // this.getProblems()
   },
 
   onShow() {
     wx.hideHomeButton({
-      success: (res) => {},
-      fail: (res) => {},
-      complete: (res) => {},
-    })
+      success: res => {},
+      fail: res => {},
+      complete: res => {},
+    });
   },
 
   getSubtask() {
-    var that = this
+    var that = this;
     taskservice.getSubtask(this.sId, {
       success(data) {
-        data.planstarttime = moment(data.planstarttime).format('YYYY骞碝M鏈圖D鏃�')
+        data.planstarttime = moment(data.planstarttime).format(
+          'YYYY骞碝M鏈圖D鏃�',
+        );
         that.setData({
-          subTask: data
-        })
+          subTask: data,
+        });
       },
-      fail(err) {
-      },
-      complete() {
-      }
-    })
+      fail(err) {},
+      complete() {},
+    });
   },
 
   getProblems() {
-    var that = this
-    this.setData({loading: true})
+    var that = this;
+    this.setData({ loading: true });
     taskservice.getProblem(this.sId, {
       success(data) {
         data.forEach(d => {
-          d.proPics = []
-          d.changePics = []
+          d.proPics = [];
+          d.changePics = [];
           if (d.mediafileList) {
             d.mediafileList.forEach(m => {
-              const pic = taskservice.imgUrl + m.extension1 + m.guid + '.jpg'
+              const pic = taskservice.imgUrl + m.extension1 + m.guid + '.jpg';
               if (m.ischanged) {
-                d.changePics.push(pic)
+                d.changePics.push(pic);
               } else {
-                d.proPics.push(pic)
+                d.proPics.push(pic);
               }
-            }); 
+            });
           }
         });
         that.setData({
-          problemList: data
-        })
+          problemList: data,
+        });
       },
       fail(err) {
         that.setData({
-          problemList: []
-        })
+          problemList: [],
+        });
       },
       complete() {
         that.setData({
-          loading: false
-        })
-      }
-    })
+          loading: false,
+        });
+      },
+    });
   },
 
   changeProblem(e) {
     const index = e.currentTarget.dataset.index;
-    const pro = this.data.problemList[index]
+    const pro = this.data.problemList[index];
     wx.navigateTo({
       url: '/pages/mExtra/pSupervisionchangeDetail/pSupervisionchangeDetail',
       events: {
-        uploadOver: (data) => {
+        uploadOver: data => {
           console.log(data);
           setTimeout(() => {
-            this.getProblems()            
+            this.getProblems();
           }, 1000);
-        }
+          this.getOpenerEventChannel().emit('uploadDone')
+        },
       },
-      success: (res) => {
+      success: res => {
         res.eventChannel.emit('acceptDataFromOpenerPage', {
           data: [pro],
-          index: index
-        })
+          index: index,
+        });
       },
-    })
+    });
   },
 
   //鍥剧墖鏀惧ぇ棰勮
   previewImage(e) {
-    const {index, type} = e.currentTarget.dataset;
-    const previewImageUrls = []
-    const pro = this.data.problemList[index[0]]
+    const { index, type } = e.currentTarget.dataset;
+    const previewImageUrls = [];
+    const pro = this.data.problemList[index[0]];
     if (type == 'pro') {
       pro.proPics.forEach(p => {
-        previewImageUrls.push(p)
-      }); 
+        previewImageUrls.push(p);
+      });
     } else {
       pro.changePics.forEach(p => {
-        previewImageUrls.push(p)
+        previewImageUrls.push(p);
       });
     }
     this.setData({
       previewImageUrls,
       previewCurrent: index[1],
       showPreview: true,
-      title: pro.problemname
+      title: pro.problemname,
     });
   },
-})
\ No newline at end of file
+});

--
Gitblit v1.9.3