Browse Source

演练回顾, 视频结算获取勋章, 视频点击暂停

h5_css
蟑螂恶霸 3 years ago
committed by yanyan
parent
commit
7ee4a6b37e
  1. 38
      components/s-video/s-video.vue
  2. BIN
      static/images/start.png
  3. 64
      subpkg/complete/complete.vue
  4. 6
      subpkg/practice/practice.vue
  5. 2
      subpkg/role/role.vue

38
components/s-video/s-video.vue

@ -1,7 +1,10 @@
<template> <template>
<view class="video-wrapper" id="video-container"> <view class="video-wrapper" id="video-container">
<view class="marsk" @click="playVideo" v-if="showLayer">
<image class="animg" src="/static/images/start.png"></image>
</view>
<view style="position:relative;width:100%;" :style="{'height':videoHeight+'px'}"> <view style="position:relative;width:100%;" :style="{'height':videoHeight+'px'}">
<video id="video_play" @click="stopPlay" :controls="true" :src="videoObj.videoUrl" @ended="videoEnded()" <video id="video_play" @click="stopPlay" :controls="false" :src="videoObj.videoUrl" @ended="videoEnded()"
:autoplay="auto" :show-fullscreen-btn="false" :loop="isLoop" style="width: 100%;height: 90%;"></video> :autoplay="auto" :show-fullscreen-btn="false" :loop="isLoop" style="width: 100%;height: 90%;"></video>
<video id="video_play" :src="videoObj.videoUrl" @ended="videoEnded()" :autoplay="auto" :show-fullscreen-btn="false" :loop="isLoop" style="width: 100%;height: 100%;" object-fit="cover"></video> <video id="video_play" :src="videoObj.videoUrl" @ended="videoEnded()" :autoplay="auto" :show-fullscreen-btn="false" :loop="isLoop" style="width: 100%;height: 100%;" object-fit="cover"></video>
@ -68,6 +71,7 @@
isOk: false, isOk: false,
isError: false, isError: false,
resCheck: false, resCheck: false,
showLayer: false,
}; };
}, },
computed: { computed: {
@ -84,6 +88,10 @@
jsonId: { jsonId: {
type: String, type: String,
default: "", default: "",
},
sceneId: {
type: String,
default: "",
} }
}, },
created() { created() {
@ -118,10 +126,12 @@
}, },
methods: { methods: {
playVideo() { playVideo() {
// this.videoContext.play(); this.showLayer = false;
this.videoContext.play();
}, },
stopPlay() { stopPlay() {
// this.videoContext.pause(); this.showLayer = true;
this.videoContext.pause();
}, },
videoEnded() { videoEnded() {
this.auto = false; this.auto = false;
@ -140,7 +150,7 @@
this.question = false; this.question = false;
uni.navigateTo({ uni.navigateTo({
url: '/subpkg/complete/complete?questionFreId=' + this.questionFreId + '&roleId=' + url: '/subpkg/complete/complete?questionFreId=' + this.questionFreId + '&roleId=' +
this.jsonId this.jsonId + '&sceneId=' + this.sceneId
}) })
} else { } else {
// 不为空表示答题错误展示返回重新选择 // 不为空表示答题错误展示返回重新选择
@ -277,7 +287,7 @@
this.question = false; this.question = false;
uni.navigateTo({ uni.navigateTo({
url: '/subpkg/complete/complete?questionFreId=' + this.questionFreId + '&roleId=' + this url: '/subpkg/complete/complete?questionFreId=' + this.questionFreId + '&roleId=' + this
.jsonId .jsonId + '&sceneId=' + this.sceneId
}) })
} }
} }
@ -286,6 +296,22 @@
</script> </script>
<style> <style>
/* 设置弹出层 */
.marsk {
position: absolute;
z-index: 999;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .35);
}
.animg {
position:absolute;
top:0;left:0;right:0;bottom:0;
margin:auto;
width: 100px;
height: 100px;
}
/* 首先设置背景层 */ /* 首先设置背景层 */
.popup-layer-back { .popup-layer-back {
position: absolute; position: absolute;
@ -324,7 +350,7 @@
.popup-layer .anitem .antxt { .popup-layer .anitem .antxt {
position: absolute; position: absolute;
top: 60%; top: 30%;
width: 100%; width: 100%;
font-size: 1.2rem; font-size: 1.2rem;
} }

BIN
static/images/start.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

64
subpkg/complete/complete.vue

@ -79,6 +79,7 @@
"questionFreId":"59088ceb55644b03b8d0c7d48d2f7d39", "questionFreId":"59088ceb55644b03b8d0c7d48d2f7d39",
"roleId":"5f96b1baae1a47fbb17215a5dc46f5ce", "roleId":"5f96b1baae1a47fbb17215a5dc46f5ce",
"userId":"", "userId":"",
"sceneId": "",
questionList: [], questionList: [],
recordList: [], recordList: [],
"ask":"", "ask":"",
@ -89,9 +90,6 @@
"showShare":false, "showShare":false,
}; };
}, },
computed: {
...mapState('m_user', ['userId'])
},
//分享到好友 //分享到好友
onShareAppMessage(res) { onShareAppMessage(res) {
if (res.from === 'button') {// 来自页面内分享按钮 if (res.from === 'button') {// 来自页面内分享按钮
@ -118,8 +116,13 @@
}, 5000) }, 5000)
//this.roleId = options.roleId //this.roleId = options.roleId
//this.questionFreId = options.questionFreId //this.questionFreId = options.questionFreId
this.sceneId = options.sceneId;
this.getQuestionList() this.getQuestionList()
this.getRecordList() this.getRecordList()
this.editUserMedal();
},
computed: {
...mapState('m_user', ['userId'])
}, },
methods: { methods: {
async share() { async share() {
@ -135,7 +138,9 @@
async getQuestionList() { async getQuestionList() {
const { const {
data: res data: res
} = await uni.$http.post('/small/questionAnswer/listAll',{questionFreId:this.questionFreId}) } = await uni.$http.post('/small/questionAnswer/listAll', {
questionFreId: this.questionFreId
})
if (!res.success) return uni.$showMsg() if (!res.success) return uni.$showMsg()
this.questionList = res.data this.questionList = res.data
if (this.questionList.length != 0) { if (this.questionList.length != 0) {
@ -154,6 +159,21 @@
//uni.$showMsg('数据请求成功!') //uni.$showMsg('数据请求成功!')
}, },
async editUserMedal() {
const {
data: res
} = await uni.$http.post('/small/wechat/editUserMedal', {
medal: this.sceneId,
guid: "2752c89b6ca843558991f888f8949da2",
// guid: this.userId,
})
if (!res.success) return uni.$showMsg()
// this.recordList = res.data
this.recordList = res.data
//uni.$showMsg('数据请求成功!')
},
backIndex() { backIndex() {
uni.switchTab({ uni.switchTab({
url: '/pages/index/index' url: '/pages/index/index'
@ -200,7 +220,9 @@
height: 100%; height: 100%;
background-color: rgba(0, 0, 0, .5); background-color: rgba(0, 0, 0, .5);
} }
.popup-layer, .popup-share {
.popup-layer,
.popup-share {
//display: none; //display: none;
position: absolute; position: absolute;
top: 45%; top: 45%;
@ -222,6 +244,7 @@
height: 500rpx; height: 500rpx;
background-color: #e4eafe; background-color: #e4eafe;
border-radius: 30rpx; border-radius: 30rpx;
.medimg { .medimg {
position: absolute; position: absolute;
top: -15%; top: -15%;
@ -229,23 +252,31 @@
transform: translate(-50%, -10%); transform: translate(-50%, -10%);
width: 300rpx; width: 300rpx;
height: 230rpx; height: 230rpx;
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
.congrat { .congrat {
margin: 25% auto 10%; margin: 25% auto 10%;
color: #ff6b08; color: #ff6b08;
font-size: 40rpx; font-size: 40rpx;
text-align: center; text-align: center;
} }
.myitem { .myitem {
margin: 0; margin: 0;
width: 33%; width: 33%;
} }
} }
.mainwrap3 {
top: 56rpx;
overflow-y: auto;
}
.title { .title {
margin: 50rpx 0; margin: 50rpx 0;
color: #333; color: #333;
@ -258,6 +289,7 @@
position: relative; position: relative;
width: 100%; width: 100%;
} }
.question-list { .question-list {
/*display: flex; /*display: flex;
justify-content: space-around;*/ justify-content: space-around;*/
@ -277,18 +309,20 @@
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
} }
.erritem { .erritem {
background-color: #fb3737; background-color: #fb3737;
} }
} }
.answer-content { .answer-content {
//display: none; //display: none;
position: absolute; position: relative;
z-index: 100; z-index: 100;
margin: 2% 3%; margin: 2% 3%;
padding: 2%; padding: 2%;
width: 90%; width: 90%;
height: 400rpx; min-height: 400rpx;
background: #fff; background: #fff;
border: 1px solid #18c569; border: 1px solid #18c569;
border-radius: 10px; border-radius: 10px;
@ -304,6 +338,7 @@
.corans { .corans {
color: #18c569; color: #18c569;
font-weight: bold; font-weight: bold;
label { label {
font-size: 36rpx; font-size: 36rpx;
} }
@ -321,36 +356,42 @@
font-size: 36rpx; font-size: 36rpx;
font-weight: bold; font-weight: bold;
} }
view { view {
color: #666; color: #666;
line-height: 1.75; line-height: 1.5;
} }
} }
.question-record { .question-record {
margin: 6% 3% 10%; margin: 3% 3% 5%;
width: 94%; width: 94%;
height: 45%; height: 25%;
overflow: hidden; overflow: hidden;
label { label {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
line-height: 2; line-height: 2;
} }
.list { .list {
width: 100%; width: 100%;
height: calc(100% - 80rpx); height: calc(100% - 80rpx);
line-height: 1.75; line-height: 1.75;
overflow-y: auto; overflow-y: auto;
.item { .item {
margin: 2% 0; margin: 2% 0;
border-bottom: 1px dotted #ddd; border-bottom: 1px dotted #ddd;
} }
} }
} }
.backIndex { .backIndex {
margin: 2% auto; margin: 2% auto;
width: 86%; width: 86%;
button { button {
background-color: #1367fe !important; background-color: #1367fe !important;
border-radius: 50rpx !important; border-radius: 50rpx !important;
@ -379,11 +420,10 @@
margin: 20rpx auto; margin: 20rpx auto;
width: 100rpx; width: 100rpx;
height: 100rpx; height: 100rpx;
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
</style> </style>

6
subpkg/practice/practice.vue

@ -4,7 +4,7 @@
<view class="stabar"></view>--> <view class="stabar"></view>-->
<view class="secbar"> <label class="back" @click="back()"></label></view> <view class="secbar"> <label class="back" @click="back()"></label></view>
<view class="mainwrap3"> <view class="mainwrap3">
<view class="role_wrap"><sVideo :jsonId="jsonId"></sVideo></view> <view class="role_wrap"><sVideo :jsonId="jsonId" :sceneId="sceneId"></sVideo></view>
</view> </view>
</view> </view>
</template> </template>
@ -18,10 +18,12 @@
page: "", page: "",
jsonId: "", jsonId: "",
roleId:"", roleId:"",
sceneId:"",
}; };
}, },
onLoad(options) { onLoad(options) {
this.jsonId = options.roleId this.jsonId = options.roleId;
this.sceneId = options.sceneId;
}, },
onReady() { onReady() {
this.QR(); this.QR();

2
subpkg/role/role.vue

@ -110,7 +110,7 @@
return uni.$showMsg('请先选择一个角色') return uni.$showMsg('请先选择一个角色')
} }
uni.navigateTo({ uni.navigateTo({
url: '/subpkg/practice/practice?roleId='+this.roleId url: '/subpkg/practice/practice?roleId='+this.roleId+'&sceneId='+this.sceneId
//url: '/subpkg/practice/respractice?roleId='+this.roleId //url: '/subpkg/practice/respractice?roleId='+this.roleId
}) })
}, },

Loading…
Cancel
Save