From bbba5d26e9e26c910ed337dcb65f462752ee6dce Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期四, 12 九月 2024 09:11:47 +0800
Subject: [PATCH] fenxiang

---
 pages/personalCenter/certificate/index.js |   64 +++++++++++++++++++++++++++++--
 1 files changed, 59 insertions(+), 5 deletions(-)

diff --git a/pages/personalCenter/certificate/index.js b/pages/personalCenter/certificate/index.js
index 46d090b..fc8bae3 100644
--- a/pages/personalCenter/certificate/index.js
+++ b/pages/personalCenter/certificate/index.js
@@ -1,4 +1,9 @@
 const app = getApp();
+import Wxml2Canvas from 'wxml2canvas';
+import moment from 'moment'
+import {
+  getPublicImage
+} from "../../../assets/js/middleGround/tool.js";
 Page({
 
   /**
@@ -34,6 +39,9 @@
     closeBtn: false,
     deleteBtn: false,
     images: [],
+    pubCertificateHide: false,
+    contentData: {},
+    rzzsImg: ''
   },
 
   /**
@@ -88,9 +96,10 @@
       .then((res) => {
         if (res.datas.length > 0) {
           res.datas.forEach((item) => {
-            item.updateDate = item.updateDate.split('T')[0]
             if (item.content) {
               item.productList = JSON.parse(item.content)
+              item.productList.updateDate = moment(item.updateDate).format('YYYY骞碝M鏈�')
+              item.productList.userPicture = getPublicImage(item.productList.userPicture, '', '')
             }
           })
           let dataList = res.datas;
@@ -119,18 +128,63 @@
   goBookDetails(e) {
     let productList = e.currentTarget.dataset.book.productList
     this.setData({
-      images: productList.certificate ? [productList.certificate] : this.data.active === 0 ? ['/static/images/certificate/kczs.jpg'] : ['/static/images/certificate/jczs.jpg'],
-      showIndex: true,
-      visible: true,
+      contentData: productList,
+      pubCertificateHide: true,
     })
-
+    this.drawImage1()
   },
+  drawImage1() {
+    let that = this;
+    let drawMyImage1 = new Wxml2Canvas({
+      width: that.data.imageWidth,
+      height: that.data.imageHeight,
+      element: 'myCanvas1',
+      progress(percent) {},
+      finish(url) {
+        wx.getFileSystemManager().readFile({
+          filePath: url,
+          encoding: 'base64',
+          success: (res) => {
+            let MyImageBase641 = 'data:image/jpg;base64,' + res.data
+            if (MyImageBase641) {
+              that.setData({
+                rzzsImg: MyImageBase641,
+              })
+            }
+            setTimeout(() => {
+              that.setData({
+                pubCertificateHide: false,
+                images: [that.data.rzzsImg],
+                showIndex: true,
+                visible: true,
+              })
+            }, 1000)
+          },
+        })
+      },
+      error(res) {
+        console.log("鐢熸垚鐨勫浘鐗囧け璐�", res)
+      }
+    }, this);
+    let data = {
+      list: [{
+        type: 'wxml',
+        class: '.my_canvas1 .my_draw_canvas1', //.my_draw_canvas姣忎釜瑕佺粯鍒跺厓绱犵殑绫诲悕
+        limit: '.my_canvas1', //my_canvas鏍瑰厓绱犵被鍚�
+        x: 0,
+        y: 0
+      }]
+    }
+    drawMyImage1.draw(data, that);
+  },
+
   onClose(e) {
     const {
       trigger
     } = e.detail;
     this.setData({
       visible: false,
+      images: [],
     });
   },
   /**

--
Gitblit v1.9.1