diff --git a/pages.json b/pages.json
index f95c581..2778a94 100644
--- a/pages.json
+++ b/pages.json
@@ -317,6 +317,14 @@
"navigationBarTitleText" : "课程学习页面",
"enablePullDownRefresh": true
}
+ },
+ {
+ "path" : "pages/course/myCourse",
+ "style" :
+ {
+ "navigationBarTitleText" : "我的课程",
+ "enablePullDownRefresh": true
+ }
}
],
"globalStyle": {
diff --git a/pages/course/courseDetail.vue b/pages/course/courseDetail.vue
index 5e34386..5ea9522 100644
--- a/pages/course/courseDetail.vue
+++ b/pages/course/courseDetail.vue
@@ -16,17 +16,17 @@
{{course.title}}
-
-
+
+
继续学习
-
+
{{course.title}}
-
+
-
+
@@ -45,24 +45,34 @@
-
-
-
-
-
- 当前目录还未开始学习
+
+
+
+
+
+ 当前目录还未开始学习
+
+
+ 课程观看有效期截止到:{{librayList[curIndex].endTime}}
+
-
- 课程观看有效期截止到:{{librayList[curIndex].endTime}}
+
+
+
+
+ {{item.title}}
+
+
+
+
+ 试听{{index2+1}}
+
+
-
-
- {{item.title}}
-
-
@@ -134,12 +144,12 @@
发布留言
-
+
-
-
+
+
@@ -231,7 +241,9 @@
-
+
+
+
×
@@ -243,7 +255,7 @@
-
+
@@ -319,9 +331,9 @@
totalP: 0,
status: 88,
loadFlag: false,
- fatherSay:{},
- fatherIndex:null,
- supportFlag:false,
+ fatherSay: {},
+ fatherIndex: null,
+ supportFlag: false,
};
},
//第一次加载
@@ -334,7 +346,7 @@
this.getUserInfo()
this.courseId = e.id
// this.getCateList(this.courseId)
- this.getData(e.id)
+ this.getData(e.id)
this.getSayList()
},
onPageScroll(e) {
@@ -380,127 +392,129 @@
// }
},
// 评论
- showSayModule(data){
- console.log(data,'父级收到值了');
+ showSayModule(data) {
+ console.log(data, '父级收到值了');
this.fatherSay = data.item
this.fatherIndex = data.index
- console.log(this.fatherSay,this.fatherIndex,'父级收到值了');
+ console.log(this.fatherSay, this.fatherIndex, '父级收到值了');
this.sayVisible = true
},
// 点赞
- support(data){
- console.log(data,'父级收到值了吗?');
- let _obj = {...data} // index,index1,val
-
- if(this.supportFlag){
+ support(data) {
+ console.log(data, '父级收到值了吗?');
+ let _obj = {
+ ...data
+ } // index,index1,val
+
+ if (this.supportFlag) {
uni.showToast({
- title:'操作太快了,歇一下吧~',
- icon:'non'
+ title: '操作太快了,歇一下吧~',
+ icon: 'non'
})
- return
+ return
}
this.supportFlag = true
- if(!_obj.val.support){
- $http.request({
- url: "common/courseGuestbook/addCourseGuestbookSupport",
- method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
- data: {
- "userId": this.userInfo.id,
- "guestbookId":_obj.val.id ,
- },
- header: { //默认 无 说明:请求头
- 'Content-Type': 'application/json'
- },
- })
- .then(res => {
- // console.log('sayList =>', res);
- uni.showToast({
- title:"点赞成功",
- icon:'success'
- })
- if(_obj.index1 == 'one'){ // 一级
- this.sayList[_obj.index].support = true
- this.sayList[_obj.index].supportCount++
- }
- if(_obj.index1 != undefined && _obj.index1 != null && _obj.index1 != 'one'){
- this.sayList[_obj.index1].Bchildren[_obj.index].support = true
- this.sayList[_obj.index1].Bchildren[_obj.index].supportCount++
- }
- this.supportFlag = false
- }).catch(e => {
- uni.showToast({
- title:"点赞失败",
- icon:'error'
- })
- console.log(e,'e')
- this.supportFlag = false
- })
- }else{
+ if (!_obj.val.support) {
$http.request({
- url: "common/courseGuestbook/cancelCourseGuestbookSupport",
- method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
- data: {
- "userId": this.userInfo.id,
- "guestbookId":_obj.val.id ,
+ url: "common/courseGuestbook/addCourseGuestbookSupport",
+ method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
+ data: {
+ "userId": this.userInfo.id,
+ "guestbookId": _obj.val.id,
+ },
+ header: { //默认 无 说明:请求头
+ 'Content-Type': 'application/json'
},
- header: { //默认 无 说明:请求头
- 'Content-Type': 'application/json'
- },
- })
- .then(res => {
- // console.log('sayList =>', res);
- uni.showToast({
- title:"取消成功",
- icon:'success'
})
- if(index1 == 'one'){ // 一级
- this.sayList[_obj.index].support = false
- this.sayList[_obj.index].supportCount--
- }
- if(_obj.index1 != undefined && _obj.index1 != null && _obj.index1 != 'one'){
- this.sayList[_obj.index1].Bchildren[_obj.index].support = false
- this.sayList[_obj.index1].Bchildren[_obj.index].supportCount--
- }
- this.supportFlag = false
- }).catch(e => {
- uni.showToast({
- title:"取消失败",
- icon:'error'
+ .then(res => {
+ // console.log('sayList =>', res);
+ uni.showToast({
+ title: "点赞成功",
+ icon: 'success'
+ })
+ if (_obj.index1 == 'one') { // 一级
+ this.sayList[_obj.index].support = true
+ this.sayList[_obj.index].supportCount++
+ }
+ if (_obj.index1 != undefined && _obj.index1 != null && _obj.index1 != 'one') {
+ this.sayList[_obj.index1].Bchildren[_obj.index].support = true
+ this.sayList[_obj.index1].Bchildren[_obj.index].supportCount++
+ }
+ this.supportFlag = false
+ }).catch(e => {
+ uni.showToast({
+ title: "点赞失败",
+ icon: 'error'
+ })
+ console.log(e, 'e')
+ this.supportFlag = false
+ })
+ } else {
+ $http.request({
+ url: "common/courseGuestbook/cancelCourseGuestbookSupport",
+ method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
+ data: {
+ "userId": this.userInfo.id,
+ "guestbookId": _obj.val.id,
+ },
+ header: { //默认 无 说明:请求头
+ 'Content-Type': 'application/json'
+ },
+ })
+ .then(res => {
+ // console.log('sayList =>', res);
+ uni.showToast({
+ title: "取消成功",
+ icon: 'success'
+ })
+ if (index1 == 'one') { // 一级
+ this.sayList[_obj.index].support = false
+ this.sayList[_obj.index].supportCount--
+ }
+ if (_obj.index1 != undefined && _obj.index1 != null && _obj.index1 != 'one') {
+ this.sayList[_obj.index1].Bchildren[_obj.index].support = false
+ this.sayList[_obj.index1].Bchildren[_obj.index].supportCount--
+ }
+ this.supportFlag = false
+ }).catch(e => {
+ uni.showToast({
+ title: "取消失败",
+ icon: 'error'
+ })
+ this.supportFlag = false
})
- // console.log('888888888888888');
- this.supportFlag = false
- })
}
-
+
},
// 获取内容
- getHtml(){
- return new Promise((resolve,reject) => {
- this.editorCtx.getContents({
- success:(res)=>{
- resolve(res)
- },
- fail:(error)=>{
- reject(err)
- }
- })
+ getHtml() {
+ return new Promise((resolve, reject) => {
+ this.editorCtx.getContents({
+ success: (res) => {
+ resolve(res)
+ },
+ fail: (error) => {
+ reject(err)
+ }
})
-
- },
+ })
+
+ },
// 提交
- async submitSay() {
+ async submitSay() {
// await console.log(this.getHtml())
- let data = await this.getHtml()
- this.htmlContent = data.html
- console.log(this.htmlContent,'this.htmlContent--++++');
-
- if (this.htmlContent == '' && this.uploadPicLIst.length == 0) {
+ let data = await this.getHtml()
+ this.htmlContent = data.html
+ console.log(data, this.htmlContent, 'this.htmlContent--++++');
+
+ if ((this.htmlContent == '' || this.htmlContent == '
') && this.uploadPicLIst.length == 0) {
uni.showToast({
icon: 'none',
title: '您未输入内容哦'
})
return
}
+ return false
let images = ''
if (this.uploadPicLIst.length > 0) {
let list = this.uploadPicLIst.map(item => item.url)
@@ -511,11 +525,11 @@
let forUserId = null
let pid = 0
forUserId = this.userInfo.id
- if(this.fatherSay.id != undefined){
+ if (this.fatherSay.id != undefined) {
forUserId = this.fatherSay.user.id
pid = this.fatherSay.id
}
- console.log(this.fatherIndex,'this.fatherIndex');
+ console.log(this.fatherIndex, 'this.fatherIndex');
// return false
$http.request({
url: "common/courseGuestbook/addCourseGuestbook",
@@ -543,36 +557,38 @@
title: '提交成功'
})
}
- let _obj = {...res.courseGuestbook}
+ let _obj = {
+ ...res.courseGuestbook
+ }
_obj.children = []
_obj.Bchildren = []
if (_obj.images != '') {
- _obj.imgList = _obj.images.split(',')
- }else{
- _obj.imgList = []
- }
-
- console.log(this.sayList[this.fatherIndex],'this.fatherSay.cIndex------------')
- if(this.fatherIndex != undefined && this.fatherIndex != null ){ // 二级
- this.sayList[this.fatherIndex].children.push(_obj)
- this.sayList[this.fatherIndex].Bchildren.unshift(_obj)
-
- }else{ // 一级
- this.sayList.unshift(_obj)
- console.log(_obj,'_obj返回的一级')
- }
+ _obj.imgList = _obj.images.split(',')
+ } else {
+ _obj.imgList = []
+ }
+
+ console.log(this.sayList[this.fatherIndex], 'this.fatherSay.cIndex------------')
+ if (this.fatherIndex != undefined && this.fatherIndex != null) { // 二级
+ this.sayList[this.fatherIndex].children.push(_obj)
+ this.sayList[this.fatherIndex].Bchildren.unshift(_obj)
+
+ } else { // 一级
+ this.sayList.unshift(_obj)
+ console.log(_obj, '_obj返回的一级')
+ }
this.sayVisible = false
this.fatherSay = {}
this.fatherIndex = null
// this.getSayList()
// 获得的新实例,插入到数组的前面
-
+
}).catch(e => {
uni.showToast({
icon: 'error',
title: '提交失败'
})
- console.log('提交报错',e);
+ console.log('提交报错', e);
})
},
// 查询课程的评论
@@ -604,11 +620,11 @@
this.totalP = res.page.total
myList.map((item) => {
if (item.images != '') {
- item.imgList = item.images.split(',')
+ item.imgList = item.images.split(',')
}
- if(item.children.length > 0){
- item.Bchildren = item.children.slice(0,5)
- }else{
+ if (item.children.length > 0) {
+ item.Bchildren = item.children.slice(0, 5)
+ } else {
item.Bchildren = []
}
})
@@ -679,11 +695,6 @@
console.log('insert image success')
}
})
- // if (i.emotioni == '[em_98]') {
-
- // } else {
-
- // }
},
chooseImg() {
this.showImgType = true
@@ -726,24 +737,24 @@
// #endif
},
// end
- addSay(fIndex,item) {
- this.sayVisible = true
- if(item){
+ addSay(fIndex, item) {
+ this.sayVisible = true
+ if (item) {
this.fatherSay = item
this.fatherSay.cIndex = fIndex
}
- console.log('fatherSay =>',this.fatherSay);
+ console.log('fatherSay =>', this.fatherSay);
},
sayclose() {
this.sayVisible = false
this.fatherSay = {}
this.fatherIndex = null
- },
- goToLearn(){
- uni.navigateTo({
- url: `/pages/course/myCourseLearn?id=${this.course.id}`
- })
- },
+ },
+ goToLearn() {
+ uni.navigateTo({
+ url: `/pages/course/myCourseLearn?id=${this.course.id}`
+ })
+ },
getData(id) {
$http.request({
url: "sociology/course/getCourseDetail",
@@ -764,9 +775,9 @@
this.catalogueId = this.librayList[0].id
this.curId = this.librayList[0].id
this.curIndex = 0
- if(res.data.shopProductList && res.data.shopProductList.length > 0){
+ if (res.data.shopProductList && res.data.shopProductList.length > 0) {
this.tjProList = res.data.shopProductList
- }else{
+ } else {
this.tjProList
}
this.getChapterList(this.catalogueId)
@@ -812,62 +823,26 @@
choosePrice(item) {
console.log(item, 'choosePrice')
this.curProId = item.productId
- // uni.showModal({
- // title: '提示',
- // cancelText: '再想想',
- // content: `您正在购买 ${item.productName},价格是${item.price}元,是否继续?`,
- // success: function(res) {
- // if (res.confirm) {
- // console.log('用户点击确定');
- // } else if (res.cancel) {
- // console.log('用户点击取消');
- // }
- // }
- // });
},
- chooseChapter(item, index) {
- return false
- // 检查课程是否已经购买了 是否为试听
+ async chooseChapter(item, index) {
+ console.log('获取试听内容')
if (item.isAudition == 1) {
// 未购买仅试听
- // this.getPath(item, index)
- uni.navigateTo({
- url: `/pages/course/learn?courseId=${this.course.id}&catalogueId
-=${this.curId}&chapterId=${item.id}`
- })
- } else if (this.librayList[this.curIndex].isBuy == 1) {
- uni.showModal({
- title: '提示',
- cancelText: '再看看',
- confirmText: '去学习',
- content: `当前操作即将跳转至学习页面,是否继续?`,
- success: function(res) {
- if (res.confirm) {
- console.log('用户点击确定');
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- })
- } else {
- uni.showModal({
- title: '提示',
- cancelText: '知道了',
- confirmText: '立即购买',
- content: `本章节不支持试听,购买课程后即可观看`,
+ // let data = null
+ this.courseList[index].tryListen = await this.getPath(item, index)
+ console.log(this.courseList, '1*********')
+
+ // uni.navigateTo({
+ // url: `/pages/course/learn?courseId=${this.course.id}&catalogueId
+ // =${this.curId}&chapterId=${item.id}`
+ // })
- success: function(res) {
- if (res.confirm) {
- console.log('用户点击确定');
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- })
}
+
},
- getPath(item, index) {
- $http.request({
+ async getPath(item, index) {
+ var datas
+ await $http.request({
url: "sociology/course/getCourseCatalogueChapterDetail",
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
data: {
@@ -875,19 +850,13 @@
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
- },
- }).then(res => {
- if (res.code == 0) {
-
- // if (res.page.length > 0) {
- // this.learnList = res.page
- // } else {
- // this.learnList = []
- // }
}
- // console.log(res,'-------------')
+ }).then((res) => {
+ datas = res.data.videos
+ console.log(res);
- });
+ })
+ return datas
},
clicklib(item, index) {
if (item.id == this.curId) {
@@ -917,6 +886,9 @@
.then(res => {
if (res.code == 0) {
if (res.chapterList.length > 0) {
+ res.chapterList.map(item => {
+ item.tryListen = []
+ })
this.courseList = res.chapterList
// console.log('status', res)
} else {
@@ -929,28 +901,34 @@
});
},
// 跳转
- onPageJump(url,id) {
+ onPageJump(url, id) {
uni.navigateTo({
url: `${url}?id=${id}`
});
},
-
+
},
};
\ No newline at end of file
diff --git a/pages/course/myCourseLearn.vue b/pages/course/myCourseLearn.vue
index 3f15a3f..ed8c682 100644
--- a/pages/course/myCourseLearn.vue
+++ b/pages/course/myCourseLearn.vue
@@ -1,14 +1,14 @@
-
+
-
+
-
+
VIP畅学权益生效中