忻州推广型网站建设,前端开发常用框架,高密微网站建设,进入公众号即弹出图文可到我的github账号上去copy文件
先展示一下我实现了的功能吧 提示#xff0c;如果有出现无法加载域名之类问题的的#xff0c;可以在“设置”-“项目设置”-打钩“不校验合法域名……”#xff1b; 或者直接登录自己的微信小程序后台设置域名信息 首页部分#xff1a;
1…可到我的github账号上去copy文件
先展示一下我实现了的功能吧 提示如果有出现无法加载域名之类问题的的可以在“设置”-“项目设置”-打钩“不校验合法域名……” 或者直接登录自己的微信小程序后台设置域名信息 首页部分
1、首页的资源都是通过免费开放接口API获取的选择的是 var API_URL https://api.apiopen.top/videoCategoryDetails?id14;
//发送请求获得数据
wx.request({url: API_URL,data:{},header:{Content-Type:application/json},success:function(res){wx.hideToast();var dataAres.data;that.setData({title:今日社区精选,movies:dataA.result})console.log(res.data);// console.log(dataA[1].data.content.data.cover.detail)}});
可以爬取到的数据有10组保存到movie[]数组中 然后在wxml中排版这些获取到的资源 navigator wx:for{{movies}} url../movie/movie?id{{item.data.content.data.id}}
//注意上面url中“”后面的id当你在首页点击某个视频时他会发送“”后面的id给新打开的movie页面即
//id会保存在新页面onloadfunctionparams的params中用于区分你点加开的是哪个视频view classitemimage src{{item.data.content.data.cover.feed}} classcover/imageview classmetaview classbottomview classClassify{{item.data.header.description}} | {{item.data.content.data.duration}}s/viewtext classintro{{item.data.content.data.title}}/text/view/view/view/navigator 视频详情部分
使用的API为
var API_URL http://baobab.kaiyanapp.com/api/v1/video/;
onLoad: function (params) {this.videoCtx wx.createVideoContext(myVideo);this.videoCtx.requestFullScreen({direction:90});var thatthis;//console.log(params);wx.request({url: API_URLparams.id,data:{},header:{Content-Type:application/json},success:function(res){console.log(res.data);that.setData({movie:res.data,src: res.data.playUrl}),console.log(Url res.data.playUrl);},});},
爬取到的资源如下 排版这些资源
scroll-view classpage-body scroll-ytrueview!--如果视频src播放不了,请在“ 设置 ”中找到“ 项目设置 ”在“ 调试基础库 ”上设成“ 2.3.2 ”即可。不要问我为什么…… --video idmyVideo src{{src}} controlstrue duration{{movie.duration}} binderrorlistenerVideo classvideo poster{{movie.coverForDetail}} objectFitfill page-gesturetrue direction0/videotext classinfro{{movie.title}}/texttext————/texttext{{movie.category}} / {{movie.duration}}s/texttext classdetail{{movie.description}}/text/view
/scroll-view 先到这里啦如果有什么意见可以在评论区留言哦我会耐心改正的
好的接下来要介绍搜索部分了……可以到微信小程序模仿开眼视频app二哦