Commit 43add255 by tangjinlin

0517

parent 692941d9
...@@ -8,6 +8,7 @@ Page({ ...@@ -8,6 +8,7 @@ Page({
*/ */
data: { data: {
mediaId: 0, mediaId: 0,
courseId: '',
courseTitle: '', courseTitle: '',
teacherName: '', teacherName: '',
teacherProfile: '', teacherProfile: '',
...@@ -20,7 +21,8 @@ Page({ ...@@ -20,7 +21,8 @@ Page({
fufeiPage: 0, fufeiPage: 0,
playUrl: '', playUrl: '',
detailComment: '', detailComment: '',
money: 0, price: 0,//购买价格,合集则为合集价格,单个视频则为单个视频的价格
haveBuy:false,//是否已经购买
subTab1: true, subTab1: true,
subTab2: false subTab2: false
}, },
...@@ -90,7 +92,8 @@ Page({ ...@@ -90,7 +92,8 @@ Page({
} }
}, },
cliLearn(e) { //点击观看处理
learn(e) {
var that = this; var that = this;
let id = e.currentTarget.dataset['id']; let id = e.currentTarget.dataset['id'];
wx.getStorage({ wx.getStorage({
...@@ -100,6 +103,7 @@ Page({ ...@@ -100,6 +103,7 @@ Page({
wx.request({ wx.request({
url: app.url + 'ajax_get_play_media_detail.php', url: app.url + 'ajax_get_play_media_detail.php',
data: { data: {
courseId: that.data.courseId,
mediaId: id, mediaId: id,
unionId: res.data.unionId unionId: res.data.unionId
}, },
...@@ -116,7 +120,7 @@ Page({ ...@@ -116,7 +120,7 @@ Page({
that.setData({ that.setData({
playUrl: resp.data.result.courseMediaDat.media, playUrl: resp.data.result.courseMediaDat.media,
fufeiPage: 1, fufeiPage: 1,
money: resp.data.result.courseMediaDat.price price: resp.data.result.courseMediaDat.price
}) })
} }
} }
...@@ -134,6 +138,7 @@ Page({ ...@@ -134,6 +138,7 @@ Page({
// play:1 // play:1
// }) // })
}, },
// 查询课程详细 // 查询课程详细
classDetails() { classDetails() {
var that = this; var that = this;
...@@ -153,6 +158,7 @@ Page({ ...@@ -153,6 +158,7 @@ Page({
console.log(res) console.log(res)
if (res.statusCode == 200) { if (res.statusCode == 200) {
that.setData({ that.setData({
courseId: res.data.result.courseId,
courseTitle: res.data.result.courseTitle, courseTitle: res.data.result.courseTitle,
teacherName: res.data.result.teacherName, teacherName: res.data.result.teacherName,
teacherProfile: res.data.result.teacherProfile, teacherProfile: res.data.result.teacherProfile,
...@@ -162,14 +168,22 @@ Page({ ...@@ -162,14 +168,22 @@ Page({
updateTime: res.data.result.updateTime, updateTime: res.data.result.updateTime,
viewCount: res.data.result.viewCount, viewCount: res.data.result.viewCount,
mediaList: res.data.result.mediaList, mediaList: res.data.result.mediaList,
money: res.data.result.price price: res.data.result.price
}) })
//判断为单个还是合集
if (res.data.result.courseId==0) {
that.setData({
price: res.data.result.mediaList[0].price
})
}
} }
}, },
fail: function (res) {}, fail: function (res) {},
complete: function (res) {}, complete: function (res) {},
}) })
}, },
//合集点击明细处理
videoplay() { videoplay() {
if (this.data.show1) { if (this.data.show1) {
this.setData({ this.setData({
...@@ -196,6 +210,7 @@ Page({ ...@@ -196,6 +210,7 @@ Page({
play: 0 play: 0
}) })
}, },
// 付费观看 // 付费观看
fufeilook() { fufeilook() {
var config = wx.getStorageSync('config'); var config = wx.getStorageSync('config');
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<view>课程介绍</view> <view>课程介绍</view>
<view>{{courseComment}}</view> <view>{{courseComment}}</view>
</view> </view>
<view class="content1" wx:if="{{mediaList.length > 1}}"> <view class="content1" wx:if="{{courseId > 0}}">
<view class="sub_title"> <view class="sub_title">
<view class="sub" bindtap='subTab' data-index="1"> <view class="sub" bindtap='subTab' data-index="1">
<text>相关详情</text> <text>相关详情</text>
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
<block wx:for="{{mediaList}}"> <block wx:for="{{mediaList}}">
<view class="catalog"> <view class="catalog">
<text bindtap='videoplay'>{{item.title}}</text> <text bindtap='videoplay'>{{item.title}}</text>
<image src='/img/suo1.png' class='suo' wx:if="{{!item.haveBuy&&!item.is_free}}"></image> <image src='/img/suo1.png' class='suo' wx:if="{{!haveBuy&&price>0}}" bindtap=""></image>
<image src='/img/sanjiao.png' class='suo' wx:if="{{haveBuy||price==0}}" bindtap="playCourse"></image>
</view> </view>
</block> </block>
</view> </view>
...@@ -59,9 +60,13 @@ ...@@ -59,9 +60,13 @@
<image src="/img/share.png"></image> <image src="/img/share.png"></image>
课程分享 课程分享
</view> </view>
<!-- <view class="buyBtn" wx:if="{{mediaList.length > 1 && !check}}">课程金额:{{money}}</view> --> <!-- 单个课程 -->
<view class="buyBtn" wx:if="{{mediaList.length > 1}}" bindtap="cliLearn" data-id="{{mediaId}}">课程金额:{{money}}</view> <view class="buyBtn" wx:if="{{courseId==0 && haveBuy==false && price > 0}}" bindtap="learn" data-id="{{mediaId}}">课程金额:{{price}}</view>
<view class="buyBtn" wx:if="{{mediaList.length==1}}" bindtap="cliLearn" data-id="{{mediaList[0].id}}">课程金额:{{mediaList[0].price}}</view> <view class="buyBtn" wx:elif="{{courseId==0}}" bindtap="learn" data-id="{{mediaId}}">学习</view>
<!-- 合集课程 -->
<view class="buyBtn" wx:if="{{courseId>0 && haveBuy==false && price > 0}}" bindtap="learn" data-id="{{mediaId}}">课程金额:{{price}}</view>
<view class="buyBtn" wx:elif="{{courseId>0}}" bindtap="learn" data-id="{{mediaId}}">学习</view>
</view> </view>
</view> </view>
<view class='play' wx:if="{{play==1}}"> <view class='play' wx:if="{{play==1}}">
...@@ -85,7 +90,7 @@ ...@@ -85,7 +90,7 @@
<view style="margin-top:70px;"> <view style="margin-top:70px;">
付费金额 付费金额
</view> </view>
<view style="margin: 10px 0 50px;font-size: 18px;"><text style="color:red;">¥{{money}}</text></view> <view style="margin: 10px 0 50px;font-size: 18px;"><text style="color:red;">¥{{price}}</text></view>
<view style="color: #898989;font-size: 12px">费用用途:所收金额全部用于公益用途</view> <view style="color: #898989;font-size: 12px">费用用途:所收金额全部用于公益用途</view>
<view class='fufeiBtn'> <view class='fufeiBtn'>
<view style="background: linear-gradient(to right, #e85c6d, #fb689b);color:#fff" bindtap='surefufei'>确认</view> <view style="background: linear-gradient(to right, #e85c6d, #fb689b);color:#fff" bindtap='surefufei'>确认</view>
......
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