Browse Source

大图预览组件

bobo 3 years ago
parent
commit
d2f62dcecc

+ 11 - 5
pages/luckDraw/detail.js

@@ -30,7 +30,8 @@ Page({
         isLogin: false,
         isLogin: false,
         hitResult: null,
         hitResult: null,
         noHitResult: null,
         noHitResult: null,
-        hitRecordList: []
+        hitRecordList: [],
+        showCustomPreview: false,
     },
     },
 
 
     /**
     /**
@@ -486,9 +487,14 @@ Page({
     },
     },
 
 
     toLookHitPhoto() {
     toLookHitPhoto() {
-        wx.previewImage({
-              current: this.data.hitResult.goodsBigImage, // 当前显示图片的http链接
-              urls: [this.data.hitResult.goodsBigImage] // 需要预览的图片http链接列表
+        this.setData({
+            showCustomPreview: true,
+            previewImgSrc: this.data.hitResult.goodsBigImage,
+        })
+    },
+    closePreviewImage() {
+        this.setData({
+            showCustomPreview: false
         })
         })
-    } 
+    }
 })
 })

+ 2 - 1
pages/luckDraw/detail.json

@@ -1,6 +1,7 @@
 {
 {
   "navigationBarTitleText": "活动抽奖",
   "navigationBarTitleText": "活动抽奖",
   "usingComponents": {
   "usingComponents": {
-    "jumpmallapp": "../../components/jumpmallapp"
+    "jumpmallapp": "../../components/jumpmallapp",
+    "custom-preview-image": "../../components/customPreviewImage/customPreviewImage"
   }
   }
 }
 }

+ 1 - 0
pages/luckDraw/detail.wxml

@@ -159,3 +159,4 @@
 
 
 </view>
 </view>
 
 
+<custom-preview-image wx:if="{{showCustomPreview}}"  src="{{previewImgSrc}}" bind:closeCallback="closePreviewImage"/>

+ 19 - 5
pages/luckDraw/profile.js

@@ -23,8 +23,8 @@ Page({
         productNum: 0,
         productNum: 0,
         thirdPrizeNum: 0,
         thirdPrizeNum: 0,
         goodsType: 1,
         goodsType: 1,
-        goodsItemList: []
-
+        goodsItemList: [],
+        showCustomPreview: false
     },
     },
 
 
     /**
     /**
@@ -228,9 +228,23 @@ Page({
     toLookHitPhoto(e) {
     toLookHitPhoto(e) {
         console.log(e)
         console.log(e)
         let url = e.currentTarget.dataset.src;
         let url = e.currentTarget.dataset.src;
-        wx.previewImage({
-              current: url, // 当前显示图片的http链接
-              urls: [url] // 需要预览的图片http链接列表
+
+        this.setData({
+            showCustomPreview: true,
+            previewImgSrc: url,
         })
         })
+
+    //     url = 'https://ks3-cn-shanghai.ksyun.com/pb001/web/hsay/publicPath/a2623624-caf1-4877-99d0-c9355984e964.jpg';
+    //    // url = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2Ftp05%2F19100120461512E-0-lp.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1642243223&t=d67f73c97f32e30932e5ee49bbce6dbd'
+
+    //     wx.previewImage({
+    //           current: url, // 当前显示图片的http链接
+    //           urls: [url] // 需要预览的图片http链接列表
+    //     })
     },
     },
+    closePreviewImage() {
+        this.setData({
+            showCustomPreview: false
+        })
+    }
 })
 })

+ 2 - 1
pages/luckDraw/profile.json

@@ -2,7 +2,8 @@
   "navigationBarTitleText": "个人中心",
   "navigationBarTitleText": "个人中心",
   "usingComponents": {
   "usingComponents": {
     "tab-bar": "./components/tabbar",
     "tab-bar": "./components/tabbar",
-    "topbar": "../../components/topbar"
+    "topbar": "../../components/topbar",
+    "custom-preview-image": "../../components/customPreviewImage/customPreviewImage"
   },
   },
   "navigationStyle":"custom"
   "navigationStyle":"custom"
 }
 }

+ 3 - 1
pages/luckDraw/profile.wxml

@@ -85,4 +85,6 @@
   module.exports.toHide = toHide;
   module.exports.toHide = toHide;
 </wxs>
 </wxs>
 <!-- 底部导航 -->
 <!-- 底部导航 -->
-<!-- <tab-bar /> -->
+<!-- <tab-bar /> -->
+
+<custom-preview-image wx:if="{{showCustomPreview}}"  src="{{previewImgSrc}}" bind:closeCallback="closePreviewImage"/>

+ 6 - 0
project.private.config.json

@@ -107,6 +107,12 @@
                     "pathName": "pages/signIn/activity/activity",
                     "pathName": "pages/signIn/activity/activity",
                     "query": "",
                     "query": "",
                     "scene": null
                     "scene": null
+                },
+                {
+                    "name": "",
+                    "pathName": "pages/signIn/activity/activity",
+                    "query": "",
+                    "scene": null
                 }
                 }
             ]
             ]
         }
         }