Commit 691e5ac2 authored by 石盼盼's avatar 石盼盼

Merge branch 'shipanpan' into 'master'

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

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