[更新]短视频轮播

This commit is contained in:
唐明明
2020-12-25 17:00:20 +08:00
parent 81b3dbdc59
commit 286f8111bd
10 changed files with 30 additions and 12 deletions

View File

@@ -3,7 +3,8 @@ import {errInfo} from './err'
import {updToken} from './updateToken' import {updToken} from './updateToken'
// 请求方式配置 // 请求方式配置
const api = "https://mi-org.cnskl.com/api/" // const api = "https://mi-org.cnskl.com/api/"
const api = "https://new-web-test.cnskl.com/api/"
const header = { const header = {
"Accept": "application/json" "Accept": "application/json"
} }

View File

@@ -1,7 +1,7 @@
{ {
"pages": [ "pages": [
"pages/businessCard/index",
"pages/shortVideo/shortVideo", "pages/shortVideo/shortVideo",
"pages/businessCard/index",
"pages/login/login", "pages/login/login",
"pages/businessCard/cards/cards" "pages/businessCard/cards/cards"
], ],

View File

@@ -43,6 +43,9 @@ Component({
methods: { methods: {
// 视频滚动了 // 视频滚动了
changeVideo(e){ changeVideo(e){
console.log(e)
let videoLists = this.data.videoList, let videoLists = this.data.videoList,
current = e.detail.current, current = e.detail.current,
currentId = this.data.playId, currentId = this.data.playId,

View File

@@ -13,7 +13,7 @@
bindpause="vipdeBindPlay" bindpause="vipdeBindPlay"
loop loop
> >
<cover-image class="videoLayer-play {{!isPlay ? 'show': ''}}" src="/static/icon/play_icon.png"></cover-image>
</video> </video>
<image src=""></image>
</swiper-item> </swiper-item>
</swiper> </swiper>

View File

@@ -1,4 +1,10 @@
// pages/businessCard/index.js
/**
* Web唐明明
* 匆匆数载恍如梦,岁月迢迢华发增。
* 碌碌无为枉半生,一朝惊醒万事空。
*/
Page({ Page({
/** /**

View File

@@ -1,4 +0,0 @@
<view>名片</view>
<navigator url="./cards/cards">名片夹</navigator>

View File

@@ -16,6 +16,7 @@ Page({
*/ */
onLoad(options) { onLoad(options) {
wx.$api.video.videos().then(res=>{ wx.$api.video.videos().then(res=>{
console.log(res)
this.setData({ this.setData({
videoList: res, videoList: res,
videoId : res[0].video_id videoId : res[0].video_id
@@ -43,6 +44,9 @@ Page({
* 获取视频下标 * 获取视频下标
*/ */
swiperIndex(e){ swiperIndex(e){
console.log(e.detail.current)
this.setData({ this.setData({
videoIndex: e.detail.current videoIndex: e.detail.current
}) })

View File

@@ -9,6 +9,8 @@
bind:swiperindex="swiperIndex" bind:swiperindex="swiperIndex"
> >
</swiperViode> </swiperViode>
<!-- 视频播放按钮 -->
<view class="videoLayer-play {{!isPlay ? 'show': ''}}" src="/static/icon/play_icon.png"></view>
<!-- 视频信息 --> <!-- 视频信息 -->
<view class="video-info"> <view class="video-info">
<view class="video-user">@ {{videoList[videoIndex].company.name || "-"}}</view> <view class="video-user">@ {{videoList[videoIndex].company.name || "-"}}</view>
@@ -23,10 +25,10 @@
<image class="video-tool-icon" src="/static/icon/video_tool_00.png" mode="widthFix"></image> <image class="video-tool-icon" src="/static/icon/video_tool_00.png" mode="widthFix"></image>
<view class="video-tool-number">{{videoList[videoIndex].likes || "0"}}</view> <view class="video-tool-number">{{videoList[videoIndex].likes || "0"}}</view>
</view> </view>
<!-- <view class="video-tool-item"> <view class="video-tool-item">
<image class="video-tool-icon" src="/static/icon/video_tool_01.png" mode="widthFix"></image> <image class="video-tool-icon" src="/static/icon/video_tool_01.png" mode="widthFix"></image>
<view class="video-tool-number">1000</view> <view class="video-tool-number">1000</view>
</view> --> </view>
<view class="video-tool-item"> <view class="video-tool-item">
<image class="video-tool-icon" src="/static/icon/video_tool_02.png" mode="widthFix"></image> <image class="video-tool-icon" src="/static/icon/video_tool_02.png" mode="widthFix"></image>
<view class="video-tool-number">{{videoList[videoIndex].shares || "0"}}</view> <view class="video-tool-number">{{videoList[videoIndex].shares || "0"}}</view>

View File

@@ -5,7 +5,13 @@
*/ */
page{ page{
background: #0e0c1a; /* background: #0e0c1a; */
}
.videoSwiper{
width: 100%;
height: 80%;
background: #eee;
} }
.videos-content{ .videos-content{

View File

@@ -4,7 +4,7 @@
"ignore": [] "ignore": []
}, },
"setting": { "setting": {
"urlCheck": true, "urlCheck": false,
"es6": true, "es6": true,
"enhance": false, "enhance": false,
"postcss": true, "postcss": true,