liyongli 1 year ago
parent
commit
71e71d51b8

+ 2 - 1
pages/application/index.js

@@ -17,7 +17,8 @@ Page({
     multiIndex: [0, 0, 0],
     multiArray: [],
     uploadheight: 0,
-    local_image_url: ''
+    local_image_url: '',
+    fileList: []
   },
   area: [],
   changeSelectArea: [0, 0, 0],

+ 2 - 1
pages/application/index.json

@@ -3,6 +3,7 @@
   "usingComponents": {
     "Container": "../../component/container/index",
     "van-radio": "@vant/weapp/radio/index",
-    "van-radio-group": "@vant/weapp/radio-group/index"
+    "van-radio-group": "@vant/weapp/radio-group/index",
+    "van-uploader": "@vant/weapp/uploader/index"
   }
 }

+ 3 - 0
pages/application/index.wxml

@@ -43,6 +43,9 @@
           <image src="{{local_image_url}}" style="width: 100px; height: 100px;" />
           <image class="del" src="../../images/del.png" style="width: 30px;height: 30px" />
         </view>
+
+        <van-uploader file-list="{{ fileList }}" deletable="{{ true }}"  max-count="1" />
+        
       </view>
     </Container>
   </view>

+ 46 - 29
pages/downZS/index.js

@@ -5,7 +5,15 @@ Page({
    * 页面的初始数据
    */
   data: {
-    ls_url: ""
+    ls_url: "",
+    selectIndex: 0,
+    users: [{
+        name: "李勇利"
+      },
+      {
+        name: "张云翔"
+      },
+    ]
   },
   systemInfo: wx.getSystemInfoSync(),
   /**
@@ -25,6 +33,7 @@ Page({
         height,
         path
       } = res;
+      const users = JSON.parse(JSON.stringify(this.data.users));
       const canvas = wx.createOffscreenCanvas({
         type: '2d',
         width,
@@ -33,42 +42,50 @@ Page({
       const ctx = canvas.getContext('2d');
       const img = canvas.createImage();
       img.onload = () => {
-        ctx.drawImage(img, 0, 0, width, height);
-        ctx.fillStyle = "#91725D";
-        ctx.font = (width / 20) + 'px 微软雅黑';
-        ctx.fillText("李勇利", width * 0.33, height * 0.4);
-        wx.canvasToTempFilePath({
-          x: 0,
-          y: 0,
-          width,
-          height,
-          destWidth: width,
-          destHeight: height,
-          canvas,
-          fileType: 'jpg',
-          success: res => {
-            this.setData({
-              ls_url: res.tempFilePath,
-              width,
-              height
-            });
-          },
-          complete: () => {
-            wx.hideLoading();
-          }
-        })
+        for (let i = 0; i < users.length; i++) {
+          const v = users[i];
+          ctx.drawImage(img, 0, 0, width, height);
+          ctx.fillStyle = "#91725D";
+          ctx.font = (width / 20) + 'px 微软雅黑';
+          ctx.fillText(v.name, width * 0.33, height * 0.4);
+          wx.canvasToTempFilePath({
+            x: 0,
+            y: 0,
+            width,
+            height,
+            destWidth: width,
+            destHeight: height,
+            canvas,
+            fileType: 'jpg',
+            success: res => {
+              v.url = res.tempFilePath
+              if (i === users.length - 1) {
+                this.setData({
+                  ls_url: users,
+                });
+              }
+            },
+            complete: () => {
+              wx.hideLoading();
+            }
+          })
+        }
       }
       img.onerror = () => wx.hideLoading();
       img.src = path // 要加载的图片 url
-    }).catch(err=>{
+    }).catch(err => {
       wx.hideLoading();
     });
   },
-
+  change(e) {
+    this.setData({
+      selectIndex: e.detail.current
+    })
+  },
   download() {
-    if (!this.data.ls_url) return
+    if (!this.data.ls_url[this.data.selectIndex] || !this.data.ls_url[this.data.selectIndex].url) return
     wx.saveImageToPhotosAlbum({
-      filePath: this.data.ls_url, // 使用下载得到的临时文件路径  
+      filePath: this.data.ls_url[this.data.selectIndex].url, // 使用下载得到的临时文件路径  
       success: function (saveRes) {
         wx.showToast({
           title: '已保存至相册',

+ 2 - 0
pages/downZS/index.json

@@ -1,6 +1,8 @@
 {
   "navigationBarTitleText": "证书下载",
   "usingComponents": {
+    "Container": "../../component/container/index",
+    "van-icon": "@vant/weapp/icon/index",
     "van-button": "@vant/weapp/button/index"
   }
 }

+ 11 - 4
pages/downZS/index.wxml

@@ -1,7 +1,14 @@
 <!--pages/downZS/index.wxml-->
 <view class="downZS">
-  <image class="downZS" src="{{ls_url}}" mode="aspectFit"></image>
-  <van-button class="btn" color="linear-gradient(to right, rgb(255, 96, 52), rgb(238, 10, 36))" size="normal" bind:tap="download">
-    下载
-  </van-button>
+  <Container>
+    <swiper style="height:545rpx" 	bindchange="change">
+      <swiper-item wx:for="{{ls_url}}" wx:key="index">
+        <image class="imge" src="{{item.url}}" mode="aspectFit"></image>
+      </swiper-item>
+    </swiper>
+    <van-button block round class="btn" color="#91725d" size="normal" bind:tap="download">
+      <van-icon name="down" />
+      保存图片
+    </van-button>
+  </Container>
 </view>

+ 15 - 7
pages/downZS/index.wxss

@@ -3,17 +3,25 @@
   width: 750rpx;
   height: 100vh;
   position: relative;
+  background-image: url("https://cxzx.smcic.net/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/banner-2.png");
+  background-repeat: no-repeat;
+  background-size: 100%;
+  padding-top: 530rpx;
+  padding-bottom: 45rpx;
+  box-sizing: border-box;
+  color: #A57044;
+  overflow: auto;
 }
 
-.downZS-item {
-  width: 100%;
-  height: 100%;
+.imge {
+  width: 380rpx;
+  height: 545rpx;
+  display: block;
+  margin: 0 auto;
 }
 
 .btn {
-  position: absolute;
   bottom: 10vh;
-  z-index: 1;
-  left: 50%;
-  transform: translateX(-50%);
+  display: block;
+  margin: 15rpx 50rpx 0 50rpx;
 }

+ 4 - 4
pages/us/index.wxml

@@ -6,25 +6,25 @@
     </button>
     <image class="user" wx:else src="{{ userUrl }}" />
     <Container wx:if="{{phone}}">
-      <van-cell is-link url="/pages/userData/index">
+      <van-cell is-link url="/pages/userData/index"  border="{{ false }}" >
         <view slot="title" class="title">
           <image src="../../images/application.png" class="icon" />
           报名信息
         </view>
       </van-cell>
-      <van-cell is-link url="/pages/downZS/index">
+      <van-cell is-link url="/pages/downZS/index" border="{{ false }}" >
         <view slot="title" class="title">
           <image src="../../images/certificate.png" class="icon" />
           证书下载
         </view>
       </van-cell>
-      <van-cell is-link url="/pages/expert/index">
+      <van-cell is-link url="/pages/expert/index" border="{{ false }}" >
         <view slot="title" class="title">
           <image src="../../images/expert.png" class="icon" />
           专家评审
         </view>
       </van-cell>
-      <van-cell is-link url="/pages/admin/index">
+      <van-cell is-link url="/pages/admin/index" border="{{ false }}" >
         <view slot="title" class="title">
           <image src="../../images/shgl.png" class="icon" />
           管理员审核

+ 13 - 1
project.private.config.json

@@ -5,5 +5,17 @@
     "compileHotReLoad": true,
     "urlCheck": true
   },
-  "condition": {}
+  "condition": {
+    "miniprogram": {
+      "list": [
+        {
+          "name": "pages/downZS/index",
+          "pathName": "pages/downZS/index",
+          "query": "",
+          "launchMode": "default",
+          "scene": null
+        }
+      ]
+    }
+  }
 }