Commit 0aaa07d7 authored by 石盼盼's avatar 石盼盼

改coach_id,点击课程完结接口对接

parent efef03e6
......@@ -6,13 +6,13 @@ Page({
list: [],
status: false,
num: 0,
arr:[],
badge_ids:[]
arr: [],
badge_ids: []
},
onLoad: function (options) {
var arr1 = JSON.parse(options.listData)
this.setData({
arr : arr1
arr: arr1
})
this.getList()
},
......@@ -25,13 +25,13 @@ Page({
callback: (data) => {
wx.hideLoading()
data.map((item, index) => {
Object.assign(item, { status: false })
Object.assign(item, { status: false })
});
this.setData({
list: data
})
for(var i =0; i< this.data.list.length;i++){
for(var j =0; j< this.data.arr.length;j++) {
for (var i = 0; i < this.data.list.length; i++) {
for (var j = 0; j < this.data.arr.length; j++) {
if (this.data.arr[j].id == this.data.list[i].id) {
this.data.list[i].status = this.data.arr[j].status
}
......@@ -56,7 +56,7 @@ Page({
var arr = [];
var badge_ids = [];
for (var i = 0; i < list.length; i++) {
if(list[i].status==true){
if (list[i].status == true) {
arr.push(list[i])
badge_ids.push(list[i].id)
}
......@@ -66,14 +66,28 @@ Page({
arr: arr,
badge_ids: badge_ids
})
console.log(badge_ids)
var s = badge_ids.toString()
console.log(s)
},
save: function (e) {
var pages = getCurrentPages();
var prevPage = pages[pages.length - 2]; //上一个页面
if (this.data.arr.length == 0) {
base.toast('请至少选择一个徽章')
} else if (this.data.arr.length > 3) {
// if (this.data.arr.length == 0) {
// base.toast('请至少选择一个徽章')
// } else if (this.data.arr.length > 3) {
// base.toast('最多选择三个徽章')
// } else {
// prevPage.setData({
// arr: this.data.arr,
// badge_ids: this.data.badge_ids
// })
// wx.navigateBack({
// delta: 1
// })
// }
if (this.data.arr.length > 3) {
base.toast('最多选择三个徽章')
} else {
prevPage.setData({
......
......@@ -11,7 +11,8 @@ Page({
* 页面的初始数据
*/
data: {
coach_id: '5',
// coach_id: '5',
coach_id: '',
class_id: '',
lesson_id: '',
classTime: '', // 上课时间
......@@ -30,6 +31,7 @@ Page({
this.getDate()
this.setData({
// coach_id: '5',
coach_id : app.globalData.coach_id,
class_id: options.class_id,
lesson_id: options.lesson_id,
courseTime: options.classTime,
......@@ -117,6 +119,18 @@ Page({
url: '/pages/index/evaluation/evaluation?child_id=' + child_id + '&class_id=' + class_id + '&class_single_id=' + class_single_id + '&course_id=' + course_id,
})
},
courseEnd : function (){
let params = {
url : 'coach/end_lesson',
data : {
coach_id : app.globalData.coach_id,
lesson_id : this.data.lesson_id
},
callback : (data) => {
}
}
base.newRequest(params)
},
onPullDownRefresh() {
this.setData({
list: [],
......
......@@ -37,5 +37,5 @@
</view>
<view class="button">
<view class="course">课程完结</view>
<view class="course" bindtap="courseEnd">课程完结</view>
</view>
\ No newline at end of file
......@@ -165,7 +165,8 @@ Page({
url: 'coach/moment',
type: 'POST',
data: {
coach_id: '5',
// coach_id: '5',
coach_id : app.globalData.coach_id,
lesson_id: this.data.lesson_id,
class_moment: JSON.stringify(arr)
},
......
......@@ -91,7 +91,6 @@ Page({
// 保存
save: function () {
this.data.scoreArr.map((e) => {
obj[e.id] = e.score;
if(e.score == 0){
base.toast('运动表现分值不能为0')
return
......@@ -105,22 +104,23 @@ Page({
this.data.scoreArr.map((e) => {
obj[e.id] = e.score;
});
//如果其中存在某一条评分未评则不能保存成功 必须全部评分完毕
let params = {
url: 'badges/add',
data: {
user_child_id: this.data.child_id,
badge_id: 1,//this.data.badge_ids,
badge_ids: this.data.badge_ids.toString(),
class_id: this.data.class_id,
class_single_id: this.data.class_single_id,
coach_id: 5,
// coach_id : 5,
coach_id: app.globalData.coach_id,
},
type: 'POST',
callback: (data) => {
let params = {
url: 'coach/comment_save',
data: {
coach_id: 5,
// coach_id : 5,
coach_id: app.globalData.coach_id,
lesson_id: this.data.class_single_id,
child_id: this.data.child_id,
comment_score: JSON.stringify(obj),
......@@ -128,7 +128,7 @@ Page({
},
type: 'POST',
callback: (data) => {
// base.toast('保存成功')
base.toast('保存成功')
}
}
base.newRequest(params)
......
......@@ -7,10 +7,10 @@
<view class="one">
<view class="title">教练评语</view>
<view class="teacher">
<view class="flex-h flex-vc flex-hb">
<view class="flex-h flex-vc">
<view class="teacher_left flex-v flex-hc">
<image src="/images/default_head.png" wx:if="{{coach.coach.thumb == null}}"></image>
<image src="{{coach.coach.thumb}}" wx:else></image>
<image src="/images/default_head.png" wx:if="{{coach.thumb == null}}"></image>
<image src="{{coach.thumb}}" wx:else></image>
<text class="name">{{coach.title}}</text>
</view>
<view class="teacher_right">{{coachcomment.class_comment}}</view>
......
......@@ -24,7 +24,8 @@ Page({
let params = {
url: 'coach/reply',
data: {
coach_id: 4
// coach_id : 4,
coach_id: app.globalData.coach_id
},
callback: (data) => {
wx.hideLoading()
......
......@@ -153,7 +153,8 @@ Page({
let params = {
url : 'coach/save_area',
data : {
coach_id: 5,
// coach_id : 5,
coach_id: app.globalData.coach_id,
city_id,
first_area,
second_area,
......
......@@ -14,28 +14,6 @@ Page({
show: false,
subjectShow: false,
subjectList:[],
// subjectList:[
// {
// name: '跳绳'
// },
// {
// name: '篮球'
// },
// {
// name: '足球'
// },
// {
// name: '轮滑'
// },
// {
// name: '平衡车'
// },
// {
// name: '跆拳道'
// },
// ]
},
......@@ -125,7 +103,8 @@ Page({
let params = {
url: 'coach/save_course',
data: {
coach_id: 4,
// coach_id : 4,
coach_id: app.globalData.coach_id,
course_ids: JSON.stringify(newArr)
},
type : 'POST',
......
......@@ -20,7 +20,8 @@ Page({
let params = {
url : 'coach/classdetail',
data : {
coach_id : 5,
// coach_id : 5,
coach_id : app.globalData.coach_id,
class_id : this.data.class_id
},
callback : (data) => {
......@@ -41,16 +42,4 @@ Page({
url: '../../index/classDetail/classDetail?lesson_id=' + lesson_id + '&class_id=' + this.data.class_id
})
},
onShow: function () {
},
onPullDownRefresh: function () {
},
})
\ No newline at end of file
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