上传文件
This commit is contained in:
parent
41c9ffd096
commit
939ff2e7f4
|
@ -0,0 +1,81 @@
|
||||||
|
// 如果没有通过拦截器配置域名的话,可以在这里写上完整的URL(加上域名部分)
|
||||||
|
let hotSearchUrl = '/ebapi/store_api/hot_search';
|
||||||
|
let indexUrl = '/ebapi/public_api/index';
|
||||||
|
|
||||||
|
// 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作,更多内容详见uView对拦截器的介绍部分:
|
||||||
|
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
|
||||||
|
const install = (Vue, vm) => {
|
||||||
|
// 此处没有使用传入的params参数
|
||||||
|
let getSearch = (params = {}) => vm.$u.get(hotSearchUrl, {
|
||||||
|
id: 2
|
||||||
|
});
|
||||||
|
// 此处使用了传入的params参数,一切自定义即可
|
||||||
|
let getUserInfo = (params = {}) => vm.$u.get('/system/user/info/', params);//获取用户信息
|
||||||
|
|
||||||
|
let getCode = (params = {}) => vm.$u.post('/system/sendmsg/', params); //获取邮箱验证码
|
||||||
|
|
||||||
|
let codeLogin = (params = {}) => vm.$u.post('/token2/', params); //邮箱验证码登录
|
||||||
|
|
||||||
|
let login = (params = {}) => vm.$u.post('/token/', params); //账户密码登录
|
||||||
|
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
||||||
|
|
||||||
|
let wxmplogin = (params = {}) => vm.$u.post('/wxmplogin/', params); //微信登录
|
||||||
|
|
||||||
|
let bindmp = (params = {}) => vm.$u.post('/system/user/bindwxmp/', params); //微信绑定
|
||||||
|
|
||||||
|
let unbindmp = (params = {}) => vm.$u.post('/system/user/unbindwxmp/', params); //微信绑定
|
||||||
|
|
||||||
|
let getMyInspectTaskList = (params = {}) => vm.$u.get('/quality/subinspecttask/self/', params);
|
||||||
|
|
||||||
|
let getSubinspectTask = (id, params)=> vm.$u.get(`/quality/subinspecttask/${id}/`, params);
|
||||||
|
|
||||||
|
//获取子任务涉及的单位
|
||||||
|
let getSubtaskDepts = (id, params)=> vm.$u.get(`/quality/subinspecttask/${id}/depts/`, params);
|
||||||
|
|
||||||
|
//获取子任务单位的详细信息
|
||||||
|
let getSubtaskDept = (id, params)=> vm.$u.get(`/quality/inspectdept/${id}/`, params);
|
||||||
|
let getInspectRecords = (params)=> vm.$u.get('/quality/inspectrecord/', params);
|
||||||
|
let getInspectRecord = (id, params)=> vm.$u.get(`/quality/inspectrecord/${id}/`, params);
|
||||||
|
let checkInspectRecord = (id, params)=> vm.$u.put(`/quality/inspectrecord/${id}/check/`, params);
|
||||||
|
let startInspectDept = (id, params)=>vm.$u.put(`/quality/inspectdept/${id}/start/`, params);//开始检查
|
||||||
|
let upInspectDept = (id, params)=>vm.$u.put(`/quality/inspectdept/${id}/up/`, params);//提交记录
|
||||||
|
let appointChecker = (params) => vm.$u.post('/quality/inspectrecord/appoint/', params);//检查指派
|
||||||
|
let getDocument = (params={})=>vm.$u.get('/quality/document/', params);//文档
|
||||||
|
let getVideos = (params={})=>vm.$u.get('/vod/video/', params);//点播视频
|
||||||
|
let getThisVideo = (id,params)=>vm.$u.get(`/vod/video/${id}/`, params);//点播视频
|
||||||
|
let getDickey = (params={})=>vm.$u.get('/system/dict/', params);//查询字典
|
||||||
|
|
||||||
|
let putMyVideoView =(id,params)=>vm.$u.put(`/vod/video/${id}/myview/`,params);//更新本人观看信息
|
||||||
|
|
||||||
|
let getMyVideoRecord =(id)=>vm.$u.get(`/vod/video/myview/`);//获取本人观看记录
|
||||||
|
let getVideoRecord =(id)=>vm.$u.get(`/vod/video/${id}/myview/`);//获取本人观看记录
|
||||||
|
vm.$u.api = {getUserInfo,
|
||||||
|
getCode,
|
||||||
|
codeLogin,
|
||||||
|
login,
|
||||||
|
wxmplogin,
|
||||||
|
bindmp,
|
||||||
|
unbindmp,
|
||||||
|
getMyInspectTaskList,
|
||||||
|
getSubinspectTask,
|
||||||
|
getSubtaskDepts,
|
||||||
|
getInspectRecords,
|
||||||
|
getSubtaskDept,
|
||||||
|
getInspectRecord,
|
||||||
|
checkInspectRecord,
|
||||||
|
upInspectDept,
|
||||||
|
appointChecker,
|
||||||
|
startInspectDept,
|
||||||
|
getDocument,
|
||||||
|
getVideos,
|
||||||
|
getDickey,
|
||||||
|
putMyVideoView,
|
||||||
|
getMyVideoRecord,
|
||||||
|
getVideoRecord,
|
||||||
|
getThisVideo
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
install
|
||||||
|
}
|
|
@ -0,0 +1,117 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<!-- <u-navbar :is-back="false" title=" " :border-bottom="false">
|
||||||
|
<view class="u-flex u-row-right" style="width: 100%;">
|
||||||
|
<view class="camera u-flex u-row-center">
|
||||||
|
<u-icon name="camera-fill" color="#000000" size="48"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-navbar> -->
|
||||||
|
<view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30">
|
||||||
|
<view class="u-m-r-10">
|
||||||
|
<u-avatar :src="vuex_user.avatar" size="140"></u-avatar>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex-1">
|
||||||
|
<view class="u-font-18 u-p-b-20">{{vuex_user.name}}</view>
|
||||||
|
<view class="u-font-14 u-type-info">{{vuex_user.username}}-{{vuex_user.dept_name}}</view>
|
||||||
|
<view class="u-font-14 u-tips-color" v-if="vuex_user.wxmp_openid">已绑定微信</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="u-m-l-10 u-p-10">
|
||||||
|
<u-icon name="scan" color="#969799" size="28"></u-icon>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-l-10 u-p-10">
|
||||||
|
<u-icon name="arrow-right" color="#969799" size="28"></u-icon>
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- <view class="u-m-t-20">
|
||||||
|
<u-cell-group>
|
||||||
|
<u-cell-item icon="rmb-circle" title="支付"></u-cell-item>
|
||||||
|
</u-cell-group>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="u-m-t-20">
|
||||||
|
<u-cell-group>
|
||||||
|
<u-cell-item icon="star" title="收藏"></u-cell-item>
|
||||||
|
<u-cell-item icon="photo" title="相册"></u-cell-item>
|
||||||
|
<u-cell-item icon="coupon" title="卡券"></u-cell-item>
|
||||||
|
<u-cell-item icon="heart" title="关注"></u-cell-item>
|
||||||
|
</u-cell-group>
|
||||||
|
</view> -->
|
||||||
|
|
||||||
|
<view class="u-m-t-20">
|
||||||
|
<u-cell-group>
|
||||||
|
<u-cell-item icon="weixin-fill" title="绑定微信" :arrow="false" @click="bindMP" v-if="!vuex_user.wxmp_openid"></u-cell-item>
|
||||||
|
<u-cell-item icon="close" title="退出" @click="Logout"></u-cell-item>
|
||||||
|
<u-cell-item icon="info" title="观看记录" @click="ViewRecord">
|
||||||
|
<!-- <image slot="icon" src="../../static/common/records.png"></image> -->
|
||||||
|
<icon type="waiting" size="20" style="position: absolute;left: 10px;top:16px"/>
|
||||||
|
</u-cell-item>
|
||||||
|
</u-cell-group>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
pic:'https://uviewui.com/common/logo.png',
|
||||||
|
show:true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
Logout(){
|
||||||
|
this.$u.api.unbindmp().then(res=>{
|
||||||
|
this.$u.vuex('vuex_token', '')
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
},
|
||||||
|
bindMP(){
|
||||||
|
uni.login({
|
||||||
|
provider: 'weixin',
|
||||||
|
success: (loginRes)=>{
|
||||||
|
this.$u.api.bindmp({code:loginRes.code}).then(res=>{
|
||||||
|
this.$u.toast('绑定成功');
|
||||||
|
this.$u.vuex('vuex_user.wxmp_openid', res.data.wxmp_openid)
|
||||||
|
uni.reLaunch({
|
||||||
|
url:'/pages/my/my'
|
||||||
|
})
|
||||||
|
}).catch(e=>{})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ViewRecord(){
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/my/videoWatchRecords'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page{
|
||||||
|
background-color: #ededed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.camera{
|
||||||
|
width: 54px;
|
||||||
|
height: 44px;
|
||||||
|
|
||||||
|
&:active{
|
||||||
|
background-color: #ededed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.user-box{
|
||||||
|
background-color: #fff;
|
||||||
|
padding-top:24rpx;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,184 @@
|
||||||
|
{
|
||||||
|
"easycom": {
|
||||||
|
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
|
||||||
|
},
|
||||||
|
// "condition": { //模式配置,仅开发期间生效
|
||||||
|
// "current": 0, //当前激活的模式(list 的索引项)
|
||||||
|
// "list": [{
|
||||||
|
// "name": "test", //模式名称
|
||||||
|
// "path": "pages/componentsC/test/index", //启动页面,必选
|
||||||
|
// "query": "uuid=c4bba940-f69e-11ea-a419-6bafda9d095e&__id__=1" //启动参数,在页面的onLoad函数里面得到
|
||||||
|
// }]
|
||||||
|
// },
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"path" : "pages/login/login",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "验证码登录",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/home/home",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/my/my",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "个人中心",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/login/login_password",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "密码登录",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/subtask/my",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "我的巡查任务",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/subtask/subtaskdetail",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "任务详情",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/inspectrecord/index",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "检查项目",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/inspectrecord/recorddo",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "检查确认",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/inspectrecord/recorddetail",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "条款详情",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/inspectrecord/deptreport",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "检查任务",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/document/index",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "手册资料",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/vod/index",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "云点播",
|
||||||
|
"enablePullDownRefresh": true,
|
||||||
|
"onReachBottomDistance":100
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/vod/video",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "云点播",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
},{
|
||||||
|
"path":"pages/my/videoWatchRecords",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "观看记录",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path":"pages/vod/watchPage",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "云视频",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"globalStyle": {
|
||||||
|
"navigationBarTextStyle": "white",
|
||||||
|
"navigationBarTitleText": "uView",
|
||||||
|
"navigationBarBackgroundColor": "#2581e4",
|
||||||
|
"backgroundColor": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"tabBar": {
|
||||||
|
"color": "#909399",
|
||||||
|
"selectedColor": "#303133",
|
||||||
|
"backgroundColor": "#FFFFFF",
|
||||||
|
"borderStyle": "black",
|
||||||
|
"list": [{
|
||||||
|
"pagePath": "pages/home/home",
|
||||||
|
"iconPath": "static/common/home.png",
|
||||||
|
"selectedIconPath": "static/common/homec.png",
|
||||||
|
"text": "主页"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/vod/video",
|
||||||
|
"iconPath": "static/common/play.png",
|
||||||
|
"selectedIconPath": "static/common/playc.png",
|
||||||
|
"text": "点播"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/my/my",
|
||||||
|
"iconPath": "static/common/me.png",
|
||||||
|
"selectedIconPath": "static/common/mec.png",
|
||||||
|
"text": "个人中心"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"plugins": {
|
||||||
|
"tencentvideo": {
|
||||||
|
"version": "1.4.9",
|
||||||
|
"provider": "wxa75efa648b60994b"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,411 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<!-- <view style="height: 80upx;">
|
||||||
|
<uni-search-bar @confirm="startSearch" v-model="search"></uni-search-bar>
|
||||||
|
</view> -->
|
||||||
|
<scroll-view class="nav-scroll" :enable-flex="true" scroll-with-animation :throttle="false"
|
||||||
|
:scroll-left="scrollToLeft" scroll-x @scroll="handleScroll">
|
||||||
|
<view class="nav uni-nav">
|
||||||
|
<view class="nav-item" :class="swiperIndex == index ? 'nav-item-act' : ''" :key="item.title"
|
||||||
|
v-for="(item, index) in list" @click="taggleNav(index)">
|
||||||
|
{{ item.title }}
|
||||||
|
</view>
|
||||||
|
<view class="nav-line" :style="style"></view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view class="swiper">
|
||||||
|
<swiper :current="swiperIndex" :duration="300" class="swiper-1" easing-function="linear"
|
||||||
|
@change="swiperChange">
|
||||||
|
<swiper-item v-for="(item, index) in list" :key="item.title">
|
||||||
|
<scroll-view :lower-threshold="80" :refresher-triggered="refreStatus"
|
||||||
|
@refresherrefresh="handleRefre" :refresher-enabled="true" class="swiper-scroll" scroll-y="true"
|
||||||
|
@scrolltolower="swiperScrollLower">
|
||||||
|
<view>
|
||||||
|
<view class="swiper-item-list" v-for="video in item.content" :key="video.id">
|
||||||
|
<!-- <video class="video" :src="video.mediaurl" controls object-fit="cover"
|
||||||
|
:id="'video'+video.id" :poster="video.coverurl" @play="doPlay($event, index)"
|
||||||
|
@pause="doPlay($event, index)" @ended="doPlay($event, index)">
|
||||||
|
<view class='video-slot' v-if="video.showTitle" :title="video.name">
|
||||||
|
<span style="margin-left:6px">{{video.name}}</span>
|
||||||
|
</view>
|
||||||
|
</video> -->
|
||||||
|
|
||||||
|
<u-icon size="80" name="play-right-fill" color="rgb(245,245,245)" @click="videoOpen(video)" class="playIcon"></u-icon>
|
||||||
|
<view class='video-slot' v-if="video.showTitle" :title="video.name">
|
||||||
|
<span style="margin-left:6px">{{video.name}}</span>
|
||||||
|
</view>
|
||||||
|
<image :src="video.coverurl" class="video"></image>
|
||||||
|
<view style="color:darkblue;margin-left:4upx">
|
||||||
|
<text>{{video.name}}</text>
|
||||||
|
<text style="float:right;color:gray;margin-right: 8upx;">{{video.viewsp}}人观看</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view style="color:gray;text-align: center;margin-top:20upx;">{{loadingText}}</view>
|
||||||
|
</scroll-view>
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
</view>
|
||||||
|
<!-- <view v-if="videoDialog" id="videoDialog">
|
||||||
|
<view class="closeIconWrap">
|
||||||
|
<u-icon size="60" name="close-circle" color="rgb(255,255,255)" @click="closeVideo" class="closeIcon"></u-icon>
|
||||||
|
</view>
|
||||||
|
<video class="video" :src="videoUrl" controls object-fit="cover"
|
||||||
|
:id="videoId" :poster="videoCoverurl" @play="doPlay($event)"
|
||||||
|
:initial-time="current"
|
||||||
|
@pause="doPlay($event)" @ended="doPlay($event)">
|
||||||
|
</video>
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
playingVideoStr: null,
|
||||||
|
swiperIndex: 0, //当前的swiperindex
|
||||||
|
navItemWidth: '', //选中下划线的宽度
|
||||||
|
navItemLeft: 0, //选中下划线的显示位置
|
||||||
|
scrollToLeft: 0, //scrollview需要滚动的距离
|
||||||
|
navInfos: [], //所有navitem的节点信息
|
||||||
|
parentLeft: 0, //nav盒子的节点信息
|
||||||
|
componentWidth: 0, //nav盒子的宽度
|
||||||
|
list: [{
|
||||||
|
id: 0,
|
||||||
|
title: '全部',
|
||||||
|
page: 1,
|
||||||
|
content: []
|
||||||
|
}],
|
||||||
|
refreStatus: false,
|
||||||
|
videoDialog:false,
|
||||||
|
loadingText: "加载中",
|
||||||
|
search:"",
|
||||||
|
videoCoverurl:'',
|
||||||
|
videoUrl:'',
|
||||||
|
videoId:0,
|
||||||
|
current:0,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
style() {
|
||||||
|
return `width:${this.navItemWidth}px; left:${this.navItemLeft}px`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
// this.init();
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.$u.api.getDickey({
|
||||||
|
pageoff: true,
|
||||||
|
type__code: 'data_video'
|
||||||
|
}).then(res => {
|
||||||
|
let list = [{
|
||||||
|
id: 0,
|
||||||
|
title: '全部',
|
||||||
|
page: 1,
|
||||||
|
content: []
|
||||||
|
}]
|
||||||
|
for (var i = 0; i < res.data.length; i++) {
|
||||||
|
let data = res.data[i]
|
||||||
|
list.push({
|
||||||
|
id: data.id,
|
||||||
|
title: data.name,
|
||||||
|
page: 1,
|
||||||
|
content: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.list = list
|
||||||
|
this.$nextTick(function() {
|
||||||
|
this.init()
|
||||||
|
this.getVideos()
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
videoOpen(video){
|
||||||
|
// debugger;
|
||||||
|
// console.log(video)
|
||||||
|
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/vod/watchPage?id='+video.id
|
||||||
|
});
|
||||||
|
},
|
||||||
|
closeVideo(){
|
||||||
|
this.videoDialog = false;
|
||||||
|
},
|
||||||
|
doPlay(e, index) {
|
||||||
|
if (e.type == 'play') {
|
||||||
|
var playingVideoStr = e.target.id
|
||||||
|
// this.list[this.swiperIndex].content[index].showTitle = false
|
||||||
|
// this.$u.api.putMyVideoView(this.list[this.swiperIndex].content[index].id).then(res=>{})
|
||||||
|
this.$u.api.putMyVideoView(this.videoId).then(res=>{})
|
||||||
|
//暂停其他视频播放
|
||||||
|
if(this.playingVideoStr==null){
|
||||||
|
this.playingVideoStr = playingVideoStr
|
||||||
|
}
|
||||||
|
else if (playingVideoStr != this.playingVideoStr) {
|
||||||
|
var videoContextPrev = uni.createVideoContext(this.playingVideoStr)
|
||||||
|
videoContextPrev.pause()
|
||||||
|
this.playingVideoStr = playingVideoStr
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// this.list[this.swiperIndex].content[index].showTitle = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取dom信息
|
||||||
|
init() {
|
||||||
|
const query = uni.createSelectorQuery().in(this);
|
||||||
|
query.select('.uni-nav').fields({
|
||||||
|
rect: true,
|
||||||
|
size: true
|
||||||
|
}, res => {
|
||||||
|
this.parentLeft = res.left;
|
||||||
|
this.componentWidth = res.width;
|
||||||
|
console.log('res==>', res);
|
||||||
|
});
|
||||||
|
query.selectAll('.nav-item').fields({
|
||||||
|
rect: true,
|
||||||
|
size: true
|
||||||
|
}, data => {
|
||||||
|
data.forEach((item, index) => {
|
||||||
|
if (index == 0) {
|
||||||
|
this.navItemWidth = item.width;
|
||||||
|
this.navItemLeft = item.left;
|
||||||
|
}
|
||||||
|
this.navInfos.push({
|
||||||
|
width: item.width,
|
||||||
|
left: item.left
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
query.exec();
|
||||||
|
},
|
||||||
|
// 点击导航切换swiper
|
||||||
|
taggleNav(val) {
|
||||||
|
this.swiperIndex = val;
|
||||||
|
},
|
||||||
|
// 滚动tabs以及移动下划线
|
||||||
|
scrollDom() {
|
||||||
|
let info = this.navInfos[this.swiperIndex];
|
||||||
|
let offsetLeft = info.left - this.parentLeft;
|
||||||
|
let scrollLeft = offsetLeft - (this.componentWidth - info.width) / 2;
|
||||||
|
this.scrollToLeft = scrollLeft < 0 ? 0 : scrollLeft;
|
||||||
|
this.navItemLeft = this.navInfos[this.swiperIndex].left;
|
||||||
|
setTimeout(() => {
|
||||||
|
this.navItemWidth = info.width;
|
||||||
|
}, 50);
|
||||||
|
},
|
||||||
|
// swiper的index变动
|
||||||
|
swiperChange(e) {
|
||||||
|
this.swiperIndex = e.detail.current;
|
||||||
|
this.scrollDom();
|
||||||
|
this.$emit('currentIndex', this.swiperIndex);
|
||||||
|
if (this.list[e.detail.current].content.length == 0) {
|
||||||
|
this.getVideos()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// tabs-scrollview触底
|
||||||
|
handleScroll(e) {
|
||||||
|
this.scrollDom();
|
||||||
|
},
|
||||||
|
// swiper-ScrollLower触底
|
||||||
|
swiperScrollLower() {
|
||||||
|
// uni.showToast({
|
||||||
|
// icon: 'none',
|
||||||
|
// title: `此时为${this.list[this.swiperIndex].title}触底`
|
||||||
|
// });
|
||||||
|
// setTimeout(() => {
|
||||||
|
// this.getData();
|
||||||
|
// }, 500);
|
||||||
|
this.list[this.swiperIndex].page = this.list[this.swiperIndex].page + 1
|
||||||
|
this.getVideos()
|
||||||
|
},
|
||||||
|
getVideos() {
|
||||||
|
let swiperIndex = this.swiperIndex
|
||||||
|
let currentData = this.list[swiperIndex]
|
||||||
|
var params = {
|
||||||
|
page: currentData.page
|
||||||
|
}
|
||||||
|
if (currentData.id == 0) {} else {
|
||||||
|
params.category = currentData.id
|
||||||
|
}
|
||||||
|
this.$u.api.getVideos(params).then(res => {
|
||||||
|
this.refreStatus = false
|
||||||
|
let results = res.data.results
|
||||||
|
for (var i = 0; i < results.length; i++) {
|
||||||
|
results[i].showTitle = true
|
||||||
|
}
|
||||||
|
if (currentData.page == 1) {
|
||||||
|
if (results == 0) {
|
||||||
|
this.loadingText = '暂无视频'
|
||||||
|
} else {
|
||||||
|
this.loadingText = ''
|
||||||
|
this.list[swiperIndex].content = results
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.loadingText = ''
|
||||||
|
this.list[swiperIndex].content.concat(results)
|
||||||
|
}
|
||||||
|
|
||||||
|
}).catch(res => {
|
||||||
|
this.refreStatus = false
|
||||||
|
if (res.code == 404) {
|
||||||
|
this.loadingText = '到底了'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
// 生成列表数据
|
||||||
|
getData() {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
for (let index = 0; index < 10; index++) {
|
||||||
|
let arr = this.list[this.swiperIndex].content;
|
||||||
|
this.$set(arr, arr.length, Math.random() + '-' + index + this.list[this.swiperIndex]
|
||||||
|
.title);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}, 1000);
|
||||||
|
console.log(this.list[this.swiperIndex]);
|
||||||
|
},
|
||||||
|
// 下拉事件
|
||||||
|
handleRefre() {
|
||||||
|
this.refreStatus = true;
|
||||||
|
// uni.showLoading({
|
||||||
|
// title: '下拉加载中'
|
||||||
|
// });
|
||||||
|
this.list[this.swiperIndex].page = 1
|
||||||
|
this.getVideos()
|
||||||
|
// setTimeout(() => {
|
||||||
|
// this.list[this.swiperIndex].content = [];
|
||||||
|
// for (var i = 0; i < 5; i++) {
|
||||||
|
// this.list[this.swiperIndex].content.push([this.list[this.swiperIndex].title + '下拉-' + i]);
|
||||||
|
// }
|
||||||
|
// uni.hideLoading();
|
||||||
|
// }, 1000);
|
||||||
|
// setTimeout(() => {
|
||||||
|
// this.refreStatus = false;
|
||||||
|
// }, 1000);
|
||||||
|
},
|
||||||
|
startSearch(e){
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.nav-item {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 16upx;
|
||||||
|
text-align: center;
|
||||||
|
transition: color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav {
|
||||||
|
white-space: nowrap;
|
||||||
|
position: relative;
|
||||||
|
height: 80upx;
|
||||||
|
padding: 20upx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #endif */
|
||||||
|
|
||||||
|
/* #ifdef H5 */
|
||||||
|
// 通过样式穿透,隐藏H5下,scroll-view下的滚动条
|
||||||
|
scroll-view ::v-deep ::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #endif */
|
||||||
|
|
||||||
|
.nav-item-act {
|
||||||
|
color: pink;
|
||||||
|
font-weight: bolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-line {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
height: 10upx;
|
||||||
|
border-radius: 10upx;
|
||||||
|
background-color: pink;
|
||||||
|
transition: left 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper {
|
||||||
|
height: calc(100vh - 80upx);
|
||||||
|
}
|
||||||
|
|
||||||
|
// swiper-item {
|
||||||
|
// text-align: center;
|
||||||
|
// color: #000;
|
||||||
|
// position: relative;
|
||||||
|
// background-color: skyblue;
|
||||||
|
// color: #fff;
|
||||||
|
// }
|
||||||
|
|
||||||
|
.swiper-item {
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swiper-item-list {
|
||||||
|
margin-top:4upx;
|
||||||
|
// height: 400upx;
|
||||||
|
border-bottom: 4upx solid pink;
|
||||||
|
// line-height: 400upx;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swiper-scroll {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video {
|
||||||
|
width: 100%;
|
||||||
|
height: 380rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-slot {
|
||||||
|
width: 100%;
|
||||||
|
height: 40px;
|
||||||
|
line-height: 40px;
|
||||||
|
font-size: 16px;
|
||||||
|
color: white;
|
||||||
|
background-color: black;
|
||||||
|
opacity: 0.6;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
.playIcon{
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
z-index: 100;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
#videoDialog{
|
||||||
|
position: fixed;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
.closeIconWrap{
|
||||||
|
position: relative;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.closeIcon{
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,89 @@
|
||||||
|
<template>
|
||||||
|
<scroll-view :lower-threshold="80" :refresher-triggered="refreStatus"
|
||||||
|
@refresherrefresh="handleRefre" :refresher-enabled="true" class="swiper-scroll" scroll-y="true"
|
||||||
|
@scrolltolower="swiperScrollLower">
|
||||||
|
<uni-list>
|
||||||
|
<uni-list-item :title="item.video_.name" :note="'上次观看时间:'+item.update_time" thumb-size="lg"
|
||||||
|
rightText="继续观看" v-for="item in dataList" :key="item.id" @click="plauVideo(item)" link></uni-list-item>
|
||||||
|
<view style="color:gray;text-align: center;margin-top:20upx;">{{loadingText}}</view>
|
||||||
|
</uni-list>
|
||||||
|
<!-- <view v-for="item in dataList" style="display: flex ; padding: 24rpx 30rpx;font-size: 28rpx;color: #3b4144;border-bottom: 1px solid #dcdcdc;">
|
||||||
|
<view class="leftAction" style="flex: 3;">
|
||||||
|
<view>{{item.video_.name}}</view>
|
||||||
|
<view style="margin-top: 6rpx; color: #999; font-size: 24rpx;">上次观看进度:</view>
|
||||||
|
<view style="margin-top: 6rpx; color: #999; font-size: 24rpx;">上次观看时间:{{item.update_time}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="rightAction" style="flex: 1; display: flex; flex-direction: column;justify-content: space-around;">
|
||||||
|
<a class="mui-navigate-right" style=" color: #999; font-size: 24rpx;">继续观看</a><image src="../../static/common/right_err.png"></image>
|
||||||
|
</view>
|
||||||
|
</view> -->
|
||||||
|
</scroll-view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
page:1,
|
||||||
|
dataList: [],
|
||||||
|
refreStatus: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow(){
|
||||||
|
this.$u.api.getMyVideoRecord({}).then(res => {
|
||||||
|
this.dataList = res.data.results;
|
||||||
|
console.log(res.data.results)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
plauVideo(item){
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/vod/watchPage?id='+item.video_.id+'¤t='+item.current
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 下拉事件
|
||||||
|
handleRefre() {
|
||||||
|
this.refreStatus = true;
|
||||||
|
this.page = 1
|
||||||
|
this.getLists()
|
||||||
|
},
|
||||||
|
swiperScrollLower() {
|
||||||
|
|
||||||
|
this.page = this.page + 1;
|
||||||
|
this.getLists()
|
||||||
|
},
|
||||||
|
getLists(){
|
||||||
|
var params = {
|
||||||
|
page: this.page
|
||||||
|
}
|
||||||
|
this.$u.api.getVideos(params).then(res => {
|
||||||
|
this.refreStatus = false
|
||||||
|
let results = res.data.results
|
||||||
|
|
||||||
|
if (currentData.page == 1) {
|
||||||
|
if (results == 0) {
|
||||||
|
this.loadingText = '暂无观看记录'
|
||||||
|
} else {
|
||||||
|
this.loadingText = ''
|
||||||
|
this.dataList = results
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.loadingText = ''
|
||||||
|
this.dataList.concat(results)
|
||||||
|
}
|
||||||
|
|
||||||
|
}).catch(res => {
|
||||||
|
this.refreStatus = false
|
||||||
|
if (res.code == 404) {
|
||||||
|
this.loadingText = '到底了'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
|
@ -0,0 +1,61 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<video class="video" :src="item.mediaurl" controls object-fit="cover"
|
||||||
|
id="videoPlayer" :poster="item.coverurl" @play="doPlay($event)"
|
||||||
|
:initial-time="current" style="width: 100%;" @timeupdate="timeupdate($event)"
|
||||||
|
@pause="doPlay($event)" @ended="doPlay($event)">
|
||||||
|
</video>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
item: {},
|
||||||
|
videoId:0,
|
||||||
|
current:0,
|
||||||
|
currentTime:0,
|
||||||
|
alreadyPlay:false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
// debugger;
|
||||||
|
this.videoId = options.id;
|
||||||
|
if(options.current){
|
||||||
|
this.current = options.current;
|
||||||
|
}else{
|
||||||
|
this.$u.api.getVideoRecord(options.id).then(res => {
|
||||||
|
this.current = res.data.current;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.$u.api.getThisVideo(options.id).then(res => {
|
||||||
|
this.item = res.data;
|
||||||
|
// console.log(res.data)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
doPlay(e) {
|
||||||
|
if(this.alreadyPlay){}else{
|
||||||
|
debugger;
|
||||||
|
this.alreadyPlay =true;
|
||||||
|
this.$u.api.putMyVideoView(this.videoId).then(res=>{})
|
||||||
|
}
|
||||||
|
// videoContextPrev.pause();
|
||||||
|
},
|
||||||
|
timeupdate(e){
|
||||||
|
let currentTime = Math.floor(e.detail.currentTime);
|
||||||
|
this.currentTime =currentTime;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
beforeDestroy(){
|
||||||
|
debugger;
|
||||||
|
let params = {'current':this.currentTime};
|
||||||
|
this.$u.api.putMyVideoView(this.item.id,params).then(res => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
Loading…
Reference in New Issue