Commit 885f0058 authored by 吴颖's avatar 吴颖

Merge branch 'master' of...

Merge branch 'master' of http://gitlab.xueyoubangedu.com/shipanpan/wandouchengzhang_coach into wuying
parents babbfb44 c7015f20
......@@ -12,7 +12,7 @@ Component({
},
maxProgress: {
type: Number,
value: 10
value: 100
},
canSlide: {
type: Boolean,
......@@ -52,7 +52,7 @@ Component({
attached: function() {
// 在组件实例进入页面节点树时执行
this.setData({
progressText: (this.properties.currentProgress).toFixed(1),
progressText: (this.properties.currentProgress),
buttonLeft: this.properties.currentProgress * (max - min) / this.properties.maxProgress + min,
progress: this.properties.currentProgress * (max - min) / this.properties.maxProgress
})
......@@ -89,7 +89,7 @@ Component({
// buttonTop: buttonTop,
buttonLeft: buttonLeft,
progress: buttonLeft - min,
progressText: ((buttonLeft - min) / (max - min) * this.properties.maxProgress).toFixed(1)
progressText: parseInt(((buttonLeft - min) / (max - min) * this.properties.maxProgress))
//
})
},
......
......@@ -4,9 +4,15 @@ const base = new Base()
Page({
data: {
list: [],
selectlist:[]
status: false,
num: 0,
arr:[]
},
onLoad: function (options) {
var arr1 = JSON.parse(options.listData)
this.setData({
arr : arr1
})
this.getList()
},
getList() {
......@@ -16,46 +22,62 @@ Page({
let params = {
url: 'badges/all',
callback: (data) => {
console.log(data)
wx.hideLoading()
data.map((item, index) => {
Object.assign(item, { status: false })
});
this.setData({
list: data
})
// for (let i = 0; i < this.data.list.length; i++) {
// console.log(this.data.list)
// }
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
}
}
}
this.setData({
list: this.data.list
})
}
}
base.newRequest(params)
},
chooseOne: function(e){
let index = e.currentTarget.dataset.index
console.log(index)
if(this.data.selectlist.length<=2){
// if(this.data.selectlist.length>1){
// // for( var i=0 ;i<this.data.selectlist.length;i++){
// // if(index == this.data.selectlist[i]){
// // console.log(11111,index)
// // }
// // else{
// // this.data.selectlist.push(index)
// // console.log(this.data.selectlist,22222)
// // }
// // }
// }else{
// this.data.selectlist.push(index)
// }
this.data.selectlist.push(index);
chooseOne: function (e) {
let index = e.currentTarget.dataset.index;
var list = this.data.list;
if (list[index].status) {
list[index].status = false
} else {
list[index].status = true
}
//点击图片把status==true的组成新的数组
var arr = [];
for (var i = 0; i < list.length; i++) {
if(list[i].status==true){
arr.push(list[i])
}
}
this.setData({
selectlist: this.data.selectlist
list: list,
arr: arr
})
},
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) {
base.toast('最多选择三个徽章')
} else {
prevPage.setData({
arr: this.data.arr
})
wx.navigateBack({
delta: 1
})
}
console.log(this.data.selectlist)
}
})
\ No newline at end of file
......@@ -3,14 +3,13 @@
<view class="top">
<view class="title">运动大满贯</view>
<view class="imgbox flex-h flex-vc flex-hw">
<view wx:for="{{list}}" wx:key='index' wx:for-item='item_a' data-index="{{index}}" bindtap="chooseOne" >
<!-- <view wx:for="{{selectlist}}" wx:key='index' wx:for-item='selectlistOne'></view> -->
<image wx:if="{{selectlist==item_a.id}}" class="bigimg" src="{{item_a.icon.active}}" ></image>
<view wx:for="{{list}}" wx:key='index' wx:for-item='item_a' data-index="{{index}}" bindtap="chooseOne" data-id="{{item_a.id}}">
<image wx:if="{{item_a.status}}" class="bigimg" src="{{item_a.icon_active}}"></image>
<image wx:else class="bigimg" src="{{item_a.icon}}"></image>
</view>
</view>
</view>
</view>
<view class="button">
<view class="apply" bindtap="goapplyResult">保存</view>
<view class="apply" bindtap="save">保存</view>
</view>
\ No newline at end of file
......@@ -10,6 +10,9 @@ page{
font-size: 24rpx;
line-height: 53rpx;
}
.top{
margin-bottom: 120rpx;
}
.title {
padding-left: 52rpx;
height: 100rpx;
......
// pages/index/evaluation/evaluation.js
const app = getApp()
import { Base } from '../../../utils/base.js';
const base = new Base()
Page({
/**
......@@ -9,16 +11,28 @@ Page({
min: 0,//最少字数
max: 300, //最多字数
currentWordNumber:0,
chooseBadge:true,
imgBox:[],
scoreArr : [],
idlist:[],
scorelist:[]
},
onLoad: function (options) {
this.getComment()
},
onShow: function(){
this.setData({
imgBox: this.data.arr?this.data.arr: []
})
},
inputs: function (e) {
var value = e.detail.value;
console.log(value)
var len = parseInt(value.length);
console.log(len)
// console.log(len)
if (len <= this.data.min)
this.setData({
texts: "已输入",
......@@ -36,15 +50,112 @@ Page({
if (len > this.data.max) return;
console.log(this.data)
},
onDrag(event) {
console.log(event)
let index = event.currentTarget.dataset.index
this.data.scoreArr[index].score = event.detail.value
this.setData({
currentValue: event.detail.value,
scoreArr : this.data.scoreArr
});
console.log(this.data.scoreArr)
},
gobadgelist:function(){
gobadgelist:function(e){
var model = JSON.stringify(this.data.imgBox)
wx.navigateTo({
url: '../../index/badgelist/badgelist',
url: '../../index/badgelist/badgelist?listData=' + model,
})
},
//删除徽章
deleteBadge: function (e) {
var imgs = this.data.imgBox
var index = e.currentTarget.dataset.index
// console.log(index)
imgs.splice(index, 1)
this.setData({
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": {
"bar": "/components/bar/index"
"van-slider": "/components/vant/slider/index"
},
"navigationBarTitleText": "运动评价"
}
\ No newline at end of file
<view class="cont">
<view class="performance">
<view class="title">运动表现</view>
<bar id="bar1" class="bar1" currentProgress="10" maxProgress="10" canSlide="{{true}}" progressName="运动量" slideImg="../../images/ic_slide_button_1.png" />
<bar id="bar1" class="bar1" currentProgress="10" maxProgress="10" canSlide="{{true}}" progressName="体力" slideImg="../../images/ic_slide_button_1.png" />
<bar id="bar1" class="bar1" currentProgress="10" maxProgress="10" canSlide="{{true}}" progressName="完整度" slideImg="../../images/ic_slide_button_1.png" />
<bar id="bar1" class="bar1" currentProgress="10" maxProgress="10" canSlide="{{true}}" progressName="柔韧度" slideImg="../../images/ic_slide_button_1.png" />
<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">
<view class="bar">
<view class="tit">{{item.name}}</view>
<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}}'>
<view class="custom-button" slot="button"></view>
</van-slider>
<view class="num">{{ item.score }}</view>
</view>
</view>
</view>
<view class="coach">
<view class="title">教练评语</view>
......@@ -18,9 +22,19 @@
</view>
<view class="badge">
<view class="title">颁发徽章</view>
<image src="/images/add.png" bindtap="gobadgelist"></image>
<view class="imgBox flex-h flex-hw">
<view class="img" wx:for="{{imgBox}}" wx:for-item="item" wx:key="idx">
<image src="{{item.icon_active}}" data-index="{{index}}" mode="aspectFill"></image>
<view class="delete-btn" data-index="{{index}}" catchtap="deleteBadge">
<text class='iconfont iconguanbi'></text>
</view>
</view>
<view class='addBox flex-h flex-vc flex-hc' bindtap="chooseImg" wx:if="{{imgBox.length < 3}}">
<image class="chooseBadge" wx:if="{{chooseBadge}}" src="/images/add.png" bindtap="gobadgelist"></image>
</view>
</view>
</view>
</view>
<view class="button">
<view class="apply" bindtap="goapplyResult">保存</view>
<view class="apply" bindtap="save">保存</view>
</view>
\ No newline at end of file
......@@ -60,7 +60,7 @@ page {
background: #FFFFFF;
border-radius: 15rpx;
padding: 50rpx 30rpx;
margin-bottom: 50rpx;
margin-bottom: 140rpx;
}
.badge image{
width: 130rpx;
......@@ -107,3 +107,64 @@ page {
text-align: center;
line-height: 80rpx;
}
/* 徽章 */
.img {
width: 130rpx;
height: 130rpx;
border: 1px solid #EBEBEB;
border-radius: 5rpx;
margin-right: 82rpx;
margin-bottom: 30rpx;
position: relative;
}
.img image {
width: 130rpx;
height: 130rpx;
margin-right: 54rpx;
}
.delete-btn {
position: absolute;
right: -25rpx;
top: -25rpx;
}
.delete-btn .iconguanbi {
font-size: 52rpx;
color: #B3B3B3;
}
.addBox {
width: 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;
}
......@@ -74,11 +74,14 @@ Page({
class_id : 16
},
callback : (data) => {
base.toast('抢班成功')
console.log(data)
console.log('1111111111111')
this.setData({
datalList: data
datalList: []
})
this.getList()
}
}
base.newRequest(params)
......
......@@ -12,7 +12,6 @@ page{
height: 340rpx;
background: #FFFFFF;
border-radius: 15rpx;
box-shadow: 0 10rpx 20rpx 10rpx rgba(239, 240, 241, 0.72);
padding: 35rpx 18rpx;
}
.top .course .course_top{
......
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