日常相册处理,细节至上,初级版

日常相册处理,细节至上,初级版

2021-03-13
¥ 0 终身VIP免费 升级终身VIP
下载不了?请联系网站客服提交链接错误!
增值服务: 安装指导 环境配置 二次开发 网站建设 模板修改 源码安装 LOGO设计 图片设计
日常相册处理,细节至上,初级版
最近更新 2021年03月13日
资源编号 15047

日常相册处理,细节至上,初级版

郑重承诺丨总裁主题提供安全交易、信息保真!
增值服务:
安装指导
环境配置
二次开发
网站建设
模板修改
源码安装
¥ 0 (终身VIP免费 升级终身VIP开通VIP尊享优惠特权
立即下载 升级会员 最新活动
详情介绍

日常相册处理,细节至上,初级版

具体的截图,今天由于时间关系,不做详细描述若需要具体数据信息,或者了解更多小小艺人平台信息
可在网上搜索“艺人邦”,或者访问“http://www.300hu.com/”官网,下载APP,或者注册,即可获得相关接口,已经相应数据内容和用法
1.相册进入界面
列表样式显示图片
2.点击图片
进入高级画册
3.高级画册
可点选对应的图片,查看高品质图片,由于网络影响,速度可能会比较慢
大图,可以通过点击它显示左右切换功能,也可以手动滑动(一般会受网络影响)
同时,图片在3秒后可以点击close关闭

日常相册处理,细节至上,初级版

  1. var util = require(‘../../utils/util.js’)
  2. var cfg = require(‘../../utils/cfg.js’)
  3. Page({
  4.   data: {
  5.     album: {},
  6.     show: true,
  7.     pid: 0,
  8.     cid: 0,
  9.     savatar: ”,
  10.     showGallery: true,
  11.     showBtn: true,
  12.     height: cfg.height,
  13.     width: cfg.width,
  14.     scale: cfg.height / cfg.width,
  15.     img: cfg.img,
  16.     imageWidth: cfg.width,
  17.     imageHeight: cfg.height,
  18.     time: 0,
  19.     params: {
  20.       client_ver: ‘0.4.4’,
  21.       from_client: ‘cc’,
  22.       openid: ”,
  23.       page: 1,
  24.       pagesize: 10,
  25.       title: ”,
  26.       uid: 1140518
  27.     }
  28.   },
  29.   formSubmit: function (e) {
  30.     var val = e.detail.value
  31.     console.log(‘form发生了submit事件,携带数据为:’, val.input)
  32.     var that = this
  33.     var obj = that.data.params
  34.     obj.title = val.input
  35.     that.setData({ params: obj })
  36.     setTimeout(function () {
  37.       that.getConImages()
  38.     }, 1000)
  39.   },
  40.   getConImages: function () {
  41.     var that = this
  42.     var obj = that.data.params
  43.     console.log(‘album—params–name:’ + obj.username)
  44.     util.get(cfg.host + ‘api/cc/act?mod=user3&act=photos’, obj,
  45.       function (res) {
  46.         obj = res.data
  47.         obj = obj.data.list
  48.         that.setData({
  49.           album: obj,
  50.           time: 0
  51.         })
  52.       })
  53.   },
  54.   showMadel(e) {
  55.     console.log(‘showMadel:’ + e.currentTarget.id)
  56.     var that = this
  57.     that.setData({
  58.       showGallery: false,
  59.       cid: e.currentTarget.id
  60.     })
  61.   },
  62.   showView(e) {
  63.     var that = this
  64.     var savatar = that.data.album[e.currentTarget.id].photo
  65.     savatar = savatar.split(‘.jpg’)
  66.     savatar = savatar[0] + ‘.jpg’
  67.     var imageSize = util.imgUtil(savatar)
  68.     that.setData({
  69.       show: false,
  70.       pid: e.currentTarget.id,
  71.       savatar: savatar,
  72.       imageWidth: imageSize.imageWidth,
  73.       imageHeight: imageSize.imageHeight
  74.     })
  75.   },
  76.   showBtns(e) {
  77.     var that = this
  78.     that.setData({showBtn: false})
  79.     setTimeout(
  80.       function() {
  81.         if (!that.data.showBtn) {
  82.           that.setData({showBtn: true})
  83.         }
  84.       }, 3000)
  85.   },
  86.   closeImg(e) {
  87.     console.log(‘e:’ + e)
  88.     console.log(‘closeImg:’ + e.currentTarget.id)
  89.     var that = this
  90. //    var pid = that.data.pid
  91.     var show = that.data.show
  92.     if (show) {
  93.       // 当处于浏览状态时,点击关闭,隐藏浏览界面
  94.       that.setData({showGallery: true})
  95.     } else {
  96.       // 当处于浏览状态时,点击关闭,隐藏浏览界面
  97.       that.setData({show: true})
  98.     }
  99.   },
  100.   nextImg(e) {
  101.     // 点击时,获取当前图片ID,或者pid
  102.     var that = this
  103.     var id = that.data.cid
  104.     var length = that.data.length
  105.     var time = that.data.time
  106.     if (id === (length – 2)) {
  107.       if (time !== 1) {
  108.         time = 1
  109.         setTimeout(function () {
  110.           that.getMoreImg()
  111.         }, 1000)
  112.       } else {
  113.         return
  114.       }
  115.       wx.showToast({
  116.         title: ‘更多,请等待加载’,
  117.         icon: ‘successs’,
  118.         duration: 2000
  119.       })
  120.     } else {
  121.       that.setData({cid: id + 1, pid: id + 1})
  122.     }
  123.   },
  124.   prevImg(e) {
  125.   // 点击时,获取当前图片ID,或者pid
  126.     var that = this
  127.     var id = that.data.pid
  128.     //    var length = that.data.album.length
  129.     if (id === 0) {
  130.       wx.showToast({
  131.         title: ‘这是第一张图片’,
  132.         icon: ‘successs’,
  133.         duration: 2000
  134.       })
  135.       return
  136.     }
  137.     that.setData({cid: id – 1, pid: id – 1})
  138.   },
  139.   changeId(e) {
  140.     console.log(‘changeId:’ + e.detail.current)
  141.     var that = this
  142.     var id = e.detail.current
  143.     var time = that.data.time
  144.     if (id >= that.data.album.length – 2) {
  145.       wx.showToast({
  146.         title: ‘更多,请等待加载’,
  147.         icon: ‘successs’,
  148.         duration: 2000
  149.       })
  150.       if (time !== 1) {
  151.         time = 1
  152.         setTimeout(function () {
  153.           that.getMoreImg()
  154.         }, 1000)
  155.       } else {
  156.         id = id – 1
  157.       }
  158.     }
  159.     var show = that.data.show
  160.     var savatar = that.data.album[id].photo
  161.     if (!show) {
  162.       savatar = savatar.split(‘.jpg’)
  163.       savatar = savatar[0] + ‘.jpg’
  164.     }
  165.     that.setData({
  166.       cid: id,
  167.       pid: id,
  168.       savatar: savatar
  169.     })
  170.   },
  171.   bindCid(e) {
  172.     console.log(‘closeView:’ + e.currentTarget.id)
  173.     var that = this
  174.     that.setData({cid: e.currentTarget.id})
  175.   },
  176.   scrollEvent: function (e) {
  177.     var that = this
  178.     setTimeout(function () {
  179.       that.getMoreImg()
  180.     }, 1000)
  181.   },
  182.   getMoreImg: function () {
  183.     var that = this
  184.     var obj = that.data.params
  185.     var album = that.data.album
  186.     if (album.length === obj.pagesize) {
  187.       obj.pagesize += 10
  188.       that.setData({
  189.         params: obj
  190.       })
  191.     }
  192.     setTimeout(function () {
  193.       that.getConImages()
  194.     }, 1000)
  195.   },
  196.   onLoad: function () {
  197.     var that = this
  198.     var width = cfg.width
  199.     var height = cfg.height
  200.     console.log(‘width:’ + width + ‘height:’ + height)
  201.     var scale = height / width
  202.     that.setData({
  203.       width: width,
  204.       height: height,
  205.       scale: scale
  206.     })
  207.     setTimeout(function () {
  208.       that.getConImages()
  209.     }, 1000)
  210.   }
  211. })
  212. // # sourceMappingURL=album.js.map

复制代码

  1. <scroll-view scroll-y=”true” hidden=”{{!showGallery}}”style=”height:{{(album.length)*100}}rpx;background-color:lightcyan;position:relative;top:125rpx;”
  2. >
  3. <form bindsubmit=”formSubmit” class = “firstbox”>
  4. <view class = “srft”>
  5. <input name=”input” style=”background-color:gray;margin-top:-21rpx;margin-left:80rpx;width:330rpx;border:2rpx solid yellow;border-radius:8%”  />
  6. <button formType=”submit” style=”color:blue;margin-top:-21rpx;font-size:21rpx;height:60rpx;margin-left:100rpx;text-align:top;”>搜索</button>
  7. </view>
  8. </form>
  9.   <view class=”params” wx:for=”{{album}}”
  10. wx:key=”photo”
  11. wx:if=”{{(index%3==0)}}”>
  12.         <view
  13.         style=”margin-left:40rpx;”
  14.         bindtap=”showMadel” id=”{{index}}”>
  15.     <image
  16.         class=”userinfo-avatar”
  17.         src=”{{img+album[index].photo}}”
  18.         ></image> </view>
  19.         <view
  20.         style=”margin-left:10rpx;margin-right:10rpx;”
  21.         bindtap=”showMadel”
  22.         id=”{{index+1}}”>
  23.         <image
  24.         class=”userinfo-avatar”
  25.         src=”{{img+album[index+1].photo}}”
  26.         ></image>
  27.         </view>
  28.         <view
  29.         style=”margin-right:40rpx;”
  30.         bindtap=”showMadel”
  31.         id=”{{index+2}}”>
  32.         <image
  33.         class=”userinfo-avatar”
  34.         src=”{{img+album[index+2].photo}}”
  35.         ></image>
  36.         </view>
  37.   </view>
  38. </scroll-view>
  39. <view hidden=”{{showGallery}}”style=”position:absolute;top:0rpx;left:0rpx;width:100%;height:100%;z-index:1;background:linear-gradient(to bottom, lightblue , lightgray);opacity:0.6;”>
  40. </view>
  41. <view hidden=”{{showGallery}}” style=”position:absolute;top:0rpx;left:0rpx;width:100%;height:100%;z-index:2;”>
  42. <swiper indicator-dots=”true” current=”{{cid}}” bindchange=”changeId”
  43.   autoplay=”false” interval=”60000″ duration=”400″ circular=”false” style=”width:{{(show)?70:90}}%;height:{{(show)?50:90}}%;position:absolute;top:5%;left:{{(show)?15:5}}%;border-top: 3rpx solid lightgray;border-bottom: 4rpx solid gray;border-right:3rpx solid gray;border-left:2rpx solid lightgray;border-radius:2%;opacity:{{(show)?0.9:0}};background-color:aliceblue;z-index:{{(show)?3:5}}” >
  44.   <block wx:for=”{{album}}” wx:key=”photo”>
  45.     <swiper-item id=”{{index}}” bindtap=”{{(show)?’showView’:’showBtns’}}” >
  46.       <image
  47.       src=”{{img+album[index].photo}}” style =”width:{{(show)?80:100}}%;height:{{(show)?80:100}}%;position:relative;top:{{(show)?10:0}}%;left:{{(show)?10:0}}%;”/>
  48.     </swiper-item>
  49.   </block>
  50. </swiper>
  51. <scroll-view   scroll-x=”true” bindscrolltolower=”scrollEvent” style=”position:absolute;top:60%;left:0rpx;width:100%;height:30%;”  lower-threshold =”10rpx” scroll-left=”{{(cid>2)?(cid*130):0}}” >
  52. <view  class=”box3″ style = “width:{{(album.length)*240}}rpx;” >
  53. <view  wx:for=”{{album}}” wx:key=”photo” >
  54. <view bindtap=”bindCid”  id=”{{index}}”
  55. style =”display:flex;flex-direction:row;align-items:center;margin-left:40rpx;border-radius:8%;border:{{(index == cid)?’6rpx solid pink’:’3rpx solid gray’}}”
  56. >
  57.      <image class=”userinfo-avatar” src=”{{img+album[index].photo}}”></image>
  58. </view >
  59. </view >
  60. </view >
  61. </scroll-view >
  62. <view bindtap=”showBtns”  hidden=”{{show}}” style=”position:absolute;top:0%;left:0%;width:100%;height:100%;z-index:3;background-color:black;opacity:0.6;”>
  63. </view>
  64.       <!–<image bindtap=”showBtns”  hidden=”{{show}}” id =”{{pid}}” src=”{{img+savatar}}” style =”width:{{imageWidth}}px;height:{{imageHeight}}px;position:absolute;left:{{(imageWidth==width)?0:(width-imageWidth)/2}}px;top:{{(imageHeight==height)?0:(height-imageHeight)/2}}px;z-index:4;”/>–>
  65. <image bindtap=”showBtns”  hidden=”{{show}}” id =”{{pid}}” src=”{{img+savatar}}” style =”width:90%;height:80%;position:absolute;left:5%;top:10%;z-index:4;”/>
  66. <view hidden=”{{showBtn}}”>
  67. <button bindtap=”prevImg” style=”position:absolute;top:40%;left:4%;width:10%;height:7%;background-color:white;z-index:6;opacity:0.8;border-radius:40%;color:black;border:1rpx solid lightgray;font-weight:bold;” >
  68. <--
  69. </button>
  70. <button bindtap=”nextImg” style=”position:absolute;top:40%;right:4%;width:10%;height:7%;background-color:white;z-index:6;opacity:0.8;border-radius:40%;color:black;border:1rpx solid  lightgray;font-weight:bold;” >
  71. >--
  72. </button>
  73. </view>
  74. <button bindtap=”closeImg” hidden=”{{!showBtn}}” style=”position:absolute;top:90%;left:39.9%;width:20%;height:7%;background-color:white;z-index:6;opacity:0.8;border-radius:30%;color:black;border:1rpx solid lightgray;font-weight:600;” >
  75. close
  76. </button>
  77. </view>

复制代码

免责声明:本站所有文章和图片均来自用户分享和网络收集,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服处理。

资源下载此资源仅限注册用户下载,请先
客服QQ:3482249445
收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

所有文章为演示数据,不提供下载地址,版权归原作者所有,仅提供演示效果!

小程序网 小程序 日常相册处理,细节至上,初级版 https://www.10000ii.com/15047.html

上一篇: 乐享连江
下一篇: 旅行:界面设计
常见问题
  • 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。
查看详情
  • 最常见的情况是下载不完整: 可对比下载完压缩包的与网盘上的容量,若小于网盘提示的容量则是这个原因。这是浏览器下载的bug,建议用
查看详情

相关文章

日常相册处理,细节至上,初级版-海报

分享本文封面