Commit f6534210 authored by 石盼盼's avatar 石盼盼

运动评价页面,获取课程评价维度接口对接

parent 4def512e
...@@ -12,7 +12,7 @@ Component({ ...@@ -12,7 +12,7 @@ Component({
}, },
maxProgress: { maxProgress: {
type: Number, type: Number,
value: 10 value: 100
}, },
canSlide: { canSlide: {
type: Boolean, type: Boolean,
...@@ -52,7 +52,7 @@ Component({ ...@@ -52,7 +52,7 @@ Component({
attached: function() { attached: function() {
// 在组件实例进入页面节点树时执行 // 在组件实例进入页面节点树时执行
this.setData({ this.setData({
progressText: (this.properties.currentProgress).toFixed(1), progressText: (this.properties.currentProgress),
buttonLeft: this.properties.currentProgress * (max - min) / this.properties.maxProgress + min, buttonLeft: this.properties.currentProgress * (max - min) / this.properties.maxProgress + min,
progress: this.properties.currentProgress * (max - min) / this.properties.maxProgress progress: this.properties.currentProgress * (max - min) / this.properties.maxProgress
}) })
...@@ -89,7 +89,7 @@ Component({ ...@@ -89,7 +89,7 @@ Component({
// buttonTop: buttonTop, // buttonTop: buttonTop,
buttonLeft: buttonLeft, buttonLeft: buttonLeft,
progress: buttonLeft - min, progress: buttonLeft - min,
progressText: ((buttonLeft - min) / (max - min) * this.properties.maxProgress).toFixed(1) progressText: parseInt(((buttonLeft - min) / (max - min) * this.properties.maxProgress))
// //
}) })
}, },
......
...@@ -13,10 +13,13 @@ Page({ ...@@ -13,10 +13,13 @@ Page({
currentWordNumber:0, currentWordNumber:0,
chooseBadge:true, chooseBadge:true,
imgBox:[], imgBox:[],
scoreArr : [],
idlist:[],
scorelist:[]
}, },
onLoad: function (options) { onLoad: function (options) {
this.getComment()
}, },
onShow: function(){ onShow: function(){
...@@ -27,8 +30,9 @@ Page({ ...@@ -27,8 +30,9 @@ Page({
inputs: function (e) { inputs: function (e) {
var value = e.detail.value; var value = e.detail.value;
console.log(value)
var len = parseInt(value.length); var len = parseInt(value.length);
console.log(len) // console.log(len)
if (len <= this.data.min) if (len <= this.data.min)
this.setData({ this.setData({
texts: "已输入", texts: "已输入",
...@@ -46,10 +50,15 @@ Page({ ...@@ -46,10 +50,15 @@ Page({
if (len > this.data.max) return; if (len > this.data.max) return;
console.log(this.data) console.log(this.data)
}, },
onDrag(event) { onDrag(event) {
console.log(event)
let index = event.currentTarget.dataset.index
this.data.scoreArr[index].score = event.detail.value
this.setData({ this.setData({
currentValue: event.detail.value, scoreArr : this.data.scoreArr
}); });
console.log(this.data.scoreArr)
}, },
gobadgelist:function(e){ gobadgelist:function(e){
var model = JSON.stringify(this.data.imgBox) var model = JSON.stringify(this.data.imgBox)
...@@ -61,11 +70,92 @@ Page({ ...@@ -61,11 +70,92 @@ Page({
deleteBadge: function (e) { deleteBadge: function (e) {
var imgs = this.data.imgBox var imgs = this.data.imgBox
var index = e.currentTarget.dataset.index var index = e.currentTarget.dataset.index
console.log(index) // console.log(index)
imgs.splice(index, 1) imgs.splice(index, 1)
this.setData({ this.setData({
imgBox: imgs imgBox: imgs
}) })
}, },
// 教练对孩子运动评价,获取课程评价维度
getComment : function (){
let params = {
url:'coach/comment_norm',
data : {
course_id : 1001,
},
callback : (data) => {
console.log(data)
var arr = []
for( var i = 0; i<data.length;i++){
let options = {
id : data[i].id,
name: data[i].name,
score : 0
}
arr.push(options)
}
console.log(arr)
this.setData({
scoreArr : arr,
})
//把scoreArr数组中的id跟score拿出来组成新的数组{id:1,score:0}------{"1":90,"2":80}
// let newarr = []
// this.data.scoreArr.forEach(item => {
// let newdata = {}
// newdata.id = item.id;
// newdata.score = item.score;
// newarr.push(newdata)
// })
// this.setData({
// newarr :this.data.scoreArr
// })
// console.log(newarr)
}
}
base.newRequest(params)
},
// 保存
save : function () {
// let params = {
// url:'badges/add',
// data:{
// },
// type:'POST',
// callback: (data) => {
// }
// }
// base.newRequest(params)
let params = {
url:'coach/comment_save',
data:{
coach_id : 5,
lesson_id : 73,
child_id : 303,
comment_score : this.data.newarr
},
type:'POST',
callback: (data) => {
console.log(data)
//把scoreArr数组中的id跟score拿出来组成新的数组{id:1,score:0}------{"1":90,"2":80}
// let newarr = []
// this.data.scoreArr.forEach(item => {
// let newdata = {}
// newdata.id = item.id;
// newdata.score = item.score;
// newarr.push(newdata)
// })
// this.setData({
// newarr :this.data.scoreArr
// })
// console.log(newarr)
// this.getComment()
}
}
base.newRequest(params)
}
}) })
\ No newline at end of file
{ {
"usingComponents": { "usingComponents": {
"bar": "/components/bar/index" "van-slider": "/components/vant/slider/index"
}, },
"navigationBarTitleText": "运动评价" "navigationBarTitleText": "运动评价"
} }
\ No newline at end of file
<view class="cont"> <view class="cont">
<view class="performance"> <view class="performance">
<view class="title">运动表现</view> <view class="title">运动表现</view>
<bar id="bar1" class="bar1" currentProgress="10" maxProgress="10" canSlide="{{true}}" progressName="运动量" slideImg="../../images/ic_slide_button_1.png" /> <view class="one" wx:for="{{scoreArr}}" wx:key="index">
<bar id="bar1" class="bar1" currentProgress="10" maxProgress="10" canSlide="{{true}}" progressName="体力" slideImg="../../images/ic_slide_button_1.png" /> <view class="bar">
<bar id="bar1" class="bar1" currentProgress="10" maxProgress="10" canSlide="{{true}}" progressName="完整度" slideImg="../../images/ic_slide_button_1.png" /> <view class="tit">{{item.name}}</view>
<bar id="bar1" class="bar1" currentProgress="10" maxProgress="10" canSlide="{{true}}" progressName="柔韧度" slideImg="../../images/ic_slide_button_1.png" /> <van-slider class="custom-class" value="{{ item.score }}" max='100' bar-height="4px" active-color="#FFC600" use-button-slot bind:drag="onDrag" data-index='{{index}}'>
<bar id="bar1" class="bar1" currentProgress="10" maxProgress="10" canSlide="{{true}}" progressName="耐力" slideImg="../../images/ic_slide_button_1.png" /> <view class="custom-button" slot="button"></view>
</van-slider>
<view class="num">{{ item.score }}</view>
</view>
</view>
</view> </view>
<view class="coach"> <view class="coach">
<view class="title">教练评语</view> <view class="title">教练评语</view>
...@@ -32,5 +36,5 @@ ...@@ -32,5 +36,5 @@
</view> </view>
</view> </view>
<view class="button"> <view class="button">
<view class="apply" bindtap="goapplyResult">保存</view> <view class="apply" bindtap="save">保存</view>
</view> </view>
\ No newline at end of file
...@@ -60,7 +60,7 @@ page { ...@@ -60,7 +60,7 @@ page {
background: #FFFFFF; background: #FFFFFF;
border-radius: 15rpx; border-radius: 15rpx;
padding: 50rpx 30rpx; padding: 50rpx 30rpx;
margin-bottom: 50rpx; margin-bottom: 140rpx;
} }
.badge image{ .badge image{
width: 130rpx; width: 130rpx;
...@@ -114,7 +114,7 @@ page { ...@@ -114,7 +114,7 @@ page {
height: 130rpx; height: 130rpx;
border: 1px solid #EBEBEB; border: 1px solid #EBEBEB;
border-radius: 5rpx; border-radius: 5rpx;
margin-right: 30rpx; margin-right: 82rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
position: relative; position: relative;
} }
...@@ -136,3 +136,35 @@ page { ...@@ -136,3 +136,35 @@ page {
width: 130rpx; width: 130rpx;
height: 130rpx; height: 130rpx;
} }
.custom-button {
width: 40rpx;
height: 30rpx;
background: url('https://wdty.xueyoubangedu.com/wandou/ic_slide_button_1.png');
background-size: 100% 100%;
}
.one{
height: 30rpx;
}
.bar{
position: relative;
margin-bottom: 30rpx;
}
.tit{
position: absolute;
left: 0rpx;
top: 0;
color: #1A1A1A;
font-size: 24rpx;
}
.custom-class{
width: 80%;
position: absolute;
left: 145rpx;
top: 13rpx;
}
.num{
color: #1A1A1A;
font-size: 24rpx;
position: absolute;
right: -128rpx;
}
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