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

保存运动评价条件判断

parent 9decfc16
......@@ -7,10 +7,6 @@ Page({
* 页面的初始数据
*/
data: {
texts: "已输入",
min: 0,//最少字数
max: 300, //最多字数
currentWordNumber: 0,
chooseBadge: true,
imgBox: [],
scoreArr: [],
......@@ -35,28 +31,6 @@ Page({
})
},
// inputs: function (e) {
// var value = e.detail.value;
// console.log(value)
// var len = parseInt(value.length);
// // console.log(len)
// if (len <= this.data.min)
// this.setData({
// texts: "已输入",
// num: this.data.min - len
// })
// else if (len > this.data.min)
// this.setData({
// texts: " ",
// textss: " ",
// num: ''
// })
// this.setData({
// currentWordNumber: len //当前字数
// });
// if (len > this.data.max) return;
// console.log(this.data)
// },
inputs : function (e) {
this.setData({
value: e.detail.value
......@@ -65,13 +39,11 @@ Page({
},
onDrag(event) {
// console.log(event)
let index = event.currentTarget.dataset.index
this.data.scoreArr[index].score = event.detail.value
this.setData({
scoreArr: this.data.scoreArr
});
// console.log(this.data.scoreArr)
},
gobadgelist: function (e) {
var model = JSON.stringify(this.data.imgBox)
......@@ -118,9 +90,19 @@ Page({
},
// 保存
save: function () {
this.data.scoreArr.map((e) => {
obj[e.id] = e.score;
if(e.score == 0){
base.toast('运动表现分值不能为0')
return
}
});
if (this.data.value =='') {
base.toast('教练评语不能为空')
return
}
let obj = {};
this.data.scoreArr.map((e) => {
console.log(e)
obj[e.id] = e.score;
});
//如果其中存在某一条评分未评则不能保存成功 必须全部评分完毕
......
......@@ -14,9 +14,8 @@
<view class="coach">
<view class="title">教练评语</view>
<view class="text">
<textarea placeholder="请输入对学生的评价" minlength="{{min}}" maxlength="{{max}}" bindinput="inputs" value="{{value}}">
<!-- <text class="currentWordNumber">{{currentWordNumber}}/{{max}}</text>
<text class="hint">{{texts}}{{num}}</text> -->
<textarea placeholder="请输入对学生的评价" maxlength="300" bindinput="inputs" value="{{value}}">
<text class="currentWordNumber">已输入{{value.length > 0 ? value.length: 0 }}/300</text>
</textarea>
</view>
</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