当前位置: 首页 > news >正文

柳州公积金网站刚刚发生了一件大事

柳州公积金网站,刚刚发生了一件大事,网站后台如何添加视频,展馆展示设计公司招聘信息一、需求 1、如果第一是视频&#xff0c;不进行自动轮播 2、可以手动滑动切换 3、点击播放视频&#xff0c;也可以手动滑动切换 4、视频播放完后&#xff0c;自动轮播 5、视频可以点击暂停和全屏播放二、最终效果 三、源码 播放icon使用了TDesign组件库 1、wxml <swiper c…

一、需求

1、如果第一是视频,不进行自动轮播
2、可以手动滑动切换
3、点击播放视频,也可以手动滑动切换
4、视频播放完后,自动轮播
5、视频可以点击暂停和全屏播放

二、最终效果

在这里插入图片描述

三、源码

播放icon使用了TDesign组件库

1、wxml

<swiper class="detail-banner" wx:if="{{details.images.length > 0}}" indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" circular="{{circular}}" indicator-color="{{indicatorColor}}" indicator-active-color="{{indicatorActiveColor}}" style="background: #fff;"><swiper-item wx:for="{{bannerMsg}}" wx:for-item="item" wx:key="index"><view class='videocover' data-id="{{index}}" wx:if="{{item.type==2}}"><view class='videocoverbg'></view><t-icon name="play-circle" size="100rpx" class="playIcon" bindtap="videoPlay" wx:if="{{!controls}}" /></view><view wx:if="{{item.type==2}}"><video class='box-w block' id="video" src="{{item.url}}" show-center-play-btn="{{false}}" objectFit="cover" bindended="endPlay" controls="{{controls}}"></video></view><image class="detail-banner-img" src="{{item.url}}" data-src="{{item.url}}" wx:if="{{item.type==1}}"></image></swiper-item></swiper>

2、wxss

 .detail-banner {width: 100%;height: 500rpx;padding: 0 0 10rpx 0;
}.detail-banner-img {width: 100%;height: 100%;
}/* video */.box-w {width: 100%;height: 500rpx;
}.videocover {width: 100%;overflow: hidden;
}.videocoverbg {position: absolute;left: 0;top: 0;right: 0;bottom: 0;background: rgba(0, 0, 0, 0.3);
}.playIcon {position: absolute;top: 50%;z-index: 2;left: 50%;width: 100rpx;height: 100rpx;background-color: #fff;border-radius: 50%;transform: translate(-50%, -50%);
}.videocover .cover {width: 100%;
}

3、js

Page({data: {details: {}, // 商品详情信息indicatorDots: true, // 是否显示面板指示点autoplay: false, // 自动播放interval: 3000, // 自动切换时间间隔duration: 400, // 滑动动画时长circular: true, //是否循环 是否采用衔接滑动indicatorColor: "lightgray", //指示点颜色indicatorActiveColor: "red", //当前选中的指示点颜色controls: false, // 是否显示播放icon},// 获取商品详情getDetail(spuId) {const selectedAddr = wx.getStorageSync('addressMsg')const storeId = selectedAddr.storeIdconst selectedAddrStr = selectedAddr.streetPromise.all([fetchGood(spuId, storeId), fetchActivityList(spuId, storeId)]).then((res) => {const [details, activityData] = res;const {video,images} = details;let bannerMsg = []bannerMsg = bannerMsg.concat(images)bannerMsg = bannerMsg.map(val => {return {type: 1,url: val}})if (video) {bannerMsg = [{ type: 2, url: video }, ...bannerMsg]}// console.log('bannerMsg', bannerMsg, images[0]);this.setData({details,bannerMsg});});},//预览图片previewImage(e) {console.log('预览图片', e)const current = e.currentTarget.dataset.src;wx.previewImage({current, // 当前显示图片的http链接  urls: this.data.bannerMsg// urls: this.data.imgUrls // 需要预览的图片http链接列表  })},// 播放videoPlay() {console.log("开始播放")this.setData({autoplay: false})let videoplay = wx.createVideoContext("video");videoplay.play()this.setData({controls: true})},// 结束播放endPlay() {console.log("结束播放")this.setData({controls: false,autoplay: true})},onShow() {this.getDetail();}
});

四、其他文章

基于ElementUi或Antd再次封装基础组件文档

vue3+ts基于Element-plus再次封装基础组件文档

http://www.ritt.cn/news/12987.html

相关文章:

  • 网站空间查询友情链接地址
  • 那个网站可免费做推广百度热搜高考大数据
  • 怎样建自己的网站赚钱最新新闻热点事件及评论
  • 网站关键词密度查询seo排名赚靠谱吗
  • 天安保险公司官网湖南长沙seo教育
  • 网站建设可行性及需求分析自助建站平台
  • 网站图片左右滚动免费b2b
  • 太原市网站制作公司如何让百度搜索到自己的网站
  • 有赞微商城登录衡水网站优化推广
  • 建筑公司名称大全集最新免费北京官网seo收费
  • 兖州做网站怎么弄一个网站
  • 类似58同城的网站怎么做李飞seo
  • 网站开发维护多少钱如何发布自己的html网站
  • 日本做的中国音乐网站百度一下你就知道官网网页版
  • 微信网站建设费用杭州优化seo公司
  • 企业网站建设的重要性和必要性视频号广告推广
  • 青岛做外贸网站建设冯耀宗seo博客
  • 便宜的seo官网优化大连seo优化
  • 百度做网站的费用简单的网页设计源代码
  • 新乡网站推广公司优化网站seo
  • 上海网站建设天津百度优化
  • 虚机wordpress全站httpsseo技术培训机构
  • 企业网查询四六级网站seo优化8888
  • 做外贸那个网站好网络优化大师下载
  • wordpress头部工具栏seo案例分析及解析
  • 怎么做足球直播网站排名nba
  • 网店推广的作用是站长工具seo诊断
  • 网站建设方案 市场分析优化推广关键词
  • 音乐网站设计总结关键词排名优化软件价格
  • 建设门户网站的意义郑州网站建设哪家好