Commit bd518f1b authored by 和慭琛's avatar 和慭琛

培训视频页 接口对接 100%

parent 79e6ea0c
...@@ -8,6 +8,14 @@ ...@@ -8,6 +8,14 @@
{ {
"path": "pages/video/index",
"style": {
"navigationBarTitleText": "培训&考试"
}
},
{
"path": "pages/settle/index", "path": "pages/settle/index",
"style": { "style": {
"navigationBarTitleText": "充电桩安装招募" "navigationBarTitleText": "充电桩安装招募"
...@@ -82,13 +90,7 @@ ...@@ -82,13 +90,7 @@
}, },
{
"path": "pages/video/index",
"style": {
"navigationBarTitleText": "培训&考试"
}
},
...@@ -227,7 +229,7 @@ ...@@ -227,7 +229,7 @@
{ {
"path": "pages/take/web", "path": "pages/take/web",
"style": { "style": {
"navigationBarTitleText": "网页" "navigationBarTitleText": ""
} }
}, },
......
...@@ -8,13 +8,19 @@ ...@@ -8,13 +8,19 @@
export default { export default {
data() { data() {
return { return {
webUrl:'' webUrl:'',
from:'',
} }
}, },
onLoad(e) { onLoad(e) {
getApp().trackPage('内置网页') getApp().trackPage('内置网页')
if(e && e.from){
this.from = e.from
}
if(e && e.url){ if(e && e.url){
this.webUrl = e.url this.webUrl = e.url
return return
......
<template> <template>
<view class="backView"> <view class="backView">
<view class="itemView" v-for="(item,ikey) in dataList":key="ikey" <view
@click="itemClick(item,ikey)"> class="itemView"
<view class="titleView"> v-for="(item,ikey) in dataList":key="ikey">
<text class="title">{{item.title}}</text>
<image class="arrow" :src="icon_arrow_right" mode=""></image>
</view>
<text class="notice">时长:5分钟,已完成学习</text> <view class="titleView" @click="itemClick(item,ikey)">
<text class="title">{{item.name}}</text>
<image class="arrow" :src="icon_arrow_right" mode=""></image>
</view>
<text class="notice" v-if="item.isLearn">已学习</text>
<text class="notice" v-if="!item.isLearn">未学习</text>
</view> </view>
...@@ -25,6 +32,9 @@ ...@@ -25,6 +32,9 @@
return { return {
icon_arrow_right:'', icon_arrow_right:'',
dataList:[], dataList:[],
course_id:172,
section_id:0,
jumpUrl:'https://m.banshouhui.com/xue/course/section/',
} }
}, },
onLoad(e) { onLoad(e) {
...@@ -37,6 +47,9 @@ ...@@ -37,6 +47,9 @@
//获取数据 //获取数据
getData: function () { getData: function () {
this.getSections()
/*
this.dataList = [ this.dataList = [
{ {
'title':'第一章 希望的终结', 'title':'第一章 希望的终结',
...@@ -48,21 +61,174 @@ ...@@ -48,21 +61,174 @@
'title':'第三章 诸神的黄昏', 'title':'第三章 诸神的黄昏',
}, },
]; ];
*/
},
//获取章节
getSections: function () {
//getApp().globalData.domain_Name
let that = this
uni.request({
url: 'http://rest-xue.yunya.com/v1/chapter-sections'
+'?course_id=' + this.course_id,
method: 'GET',
data: {
//type:this.activeTop,
},
success: (res) => {
uni.hideLoading()
console.log('获取 章节 成功')
console.log(res)
if(res.statusCode==401){
uni.navigateTo({
url:'/pages/login/wxlogin'
})
return
}
if(res.statusCode==200){
this.dataList = res.data
//this.getFirstSectionId()
console.log('statusCode=200')
console.log('获取 章节 成功 this.dataList')
console.log(this.dataList)
}else{
uni.showToast({
icon:'none',
title:res.data.message
})
}
},
fail: (e) => {
uni.hideLoading()
uni.showToast({
icon:'none',
title:'获取章节失败'
})
// console.log('获取下单列表 失败')
// console.log(e)
}
})
},
/*
//获取 第一章 章节Id
getFirstSectionId: function () {
var item = this.dataList[0]
var sectionList = item.section
var firstSection = sectionList[0]
this.section_id = firstSection.id
//this.goToWeb()
//this.getSectionDetail()
console.log('获取 第一章 章节Id:')
console.log(this.section_id)
},
//跳转到 视频网页
goToWeb: function () {
uni.navigateTo({
url:'/pages/take/web'
+'?url=' + 'https://m.banshouhui.com/xue/course/section/4227',
})
}, },
*/
itemClick: function (item , ikey) { itemClick: function (item , ikey) {
var sectionList = item.section
var firstSection = sectionList[0]
this.section_id = firstSection.id
item.isLearn = true
uni.navigateTo({ uni.navigateTo({
url:'/pages/take/web' url:'/pages/take/web'
+'?url=' + 'https://www.baidu.com', +'?url='
+ this.jumpUrl + this.section_id,
}) })
}, },
//参加考试 //参加考试
examClick: function () { examClick: function () {
uni.navigateTo({ uni.navigateTo({
url:'/pages/exam/index' url:'/pages/exam/index'
}) })
} },
//获取 章节详情
getSectionDetail: function () {
//getApp().globalData.domain_Name
let that = this
uni.request({
url: 'http://rest-xue.yunya.com/v1/section-details'
+ '?section_id=' + this.section_id,
method: 'GET',
data: {
//type:this.activeTop,
},
success: (res) => {
uni.hideLoading()
console.log('获取 章节详情 成功')
console.log(res)
if(res.statusCode==401){
uni.navigateTo({
url:'/pages/login/wxlogin'
})
return
}
if(res.statusCode==200){
}else{
uni.showToast({
icon:'none',
title:res.data.message
})
}
},
fail: (e) => {
console.log('获取 章节详情 失败')
console.log(e)
uni.hideLoading()
uni.showToast({
icon:'none',
title:'获取章节详情失败'
})
// console.log('获取下单列表 失败')
// console.log(e)
}
})
},
...@@ -90,6 +256,16 @@ ...@@ -90,6 +256,16 @@
border-bottom: 2rpx solid #999999; border-bottom: 2rpx solid #999999;
} }
.sectionView{
background-color: #FFFFFF;
width: 100%;
height: 80rpx;
display: flex;
flex-direction: row;
align-items: center;
border-bottom: 2rpx solid #999999;
}
.titleView{ .titleView{
background-color: #FFFFFF; background-color: #FFFFFF;
width: 100%; width: 100%;
......
<template>
<view class="backView">
<view class="itemView" v-for="(item,ikey) in dataList":key="ikey"
@click="itemClick(item,ikey)">
<view class="titleView">
<text class="title">{{item.name}}</text>
<image class="arrow" :src="icon_arrow_right" mode=""></image>
</view>
<text class="notice">时长:5分钟,已完成学习</text>
</view>
<view class="bottomView">
<view class="bottomBtn" @click="examClick()">
<text class="bottomTitle">完成学习后,可参加考试</text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
protocolContent:''
}
},
onLoad(e) {
if(e && e.activeService && e.activeService.length>0){
//console.log(e.activeService)
this.activeService = e.activeService
}
},
methods: {
//拨打客服 点击
phoneCallClick: function (phone) {
uni.makePhoneCall({
phoneNumber: phone
});
},
}
}
</script>
<style>
.backView{
background-color: #FFFFFF;
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
flex-direction: column;
}
.itemView{
background-color: #FAFAFA;
width: 100%;
display: flex;
flex-direction: column;
border-bottom: 2rpx solid #999999;
}
.titleView{
background-color: #FFFFFF;
width: 100%;
height: 80rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
border-bottom: 2rpx solid #999999;
}
.title{
font-size: 28rpx;
margin-left: 40rpx;
}
.arrow{
width: 16rpx;
height: 28rpx;
margin-right: 40rpx;
}
.notice{
padding-left: 40rpx;
padding-top: 20rpx;
padding-bottom: 20rpx;
font-size: 28rpx;
color: #999999;
}
.bottomView{
background-color: #FFFFFF;
width: 100%;
height: 140rpx;
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 0;
}
.bottomBtn{
background-color: #007AFF;
width: 60%;
height: 80rpx;
border-radius: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.bottomTitle{
font-size: 32rpx;
color: #FFFFFF;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment