Commit a10263d8 authored by wangxuelai's avatar wangxuelai

'闯关打卡颗粒度5'

parent 3322b648
......@@ -293,7 +293,7 @@ Page({
title: '新建闯关打卡'
})
this.setData({
lockSubjectLists: this.data.lockSubjects.slice(that.data.currentSortIndex * 10, that.data.currentSortIndex * 10 + 10),
lockSubjectLists: this.data.lockSubjects.slice(that.data.currentSortIndex * 5, that.data.currentSortIndex * 5 + 5),
})
this.setData({
classes: currentclasses,
......@@ -358,7 +358,7 @@ Page({
let smallArr = [];
let subject_count = this.data.lockparams.subject_count;
for (let i = 1; i < subject_count + 1; i ++) {
if (i%10 == 0) {
if (i%5 == 0) {
smallArr.push(i);
bigArr.push(smallArr);
smallArr = [];
......@@ -1823,7 +1823,7 @@ Page({
title: '新建闯关打卡'
})
this.setData({
lockSubjectLists: this.data.lockSubjects.slice(this.data.currentSortIndex * 10, this.data.currentSortIndex * 10 + 10),
lockSubjectLists: this.data.lockSubjects.slice(this.data.currentSortIndex * 5, this.data.currentSortIndex * 5 + 5),
})
this.getSubjectSort();
}
......@@ -2063,7 +2063,7 @@ Page({
'lockparams.subject_count': this.data.copySubjectCount,
copySubjectCount: 0,
lockSubjects: lockSubjects,
lockSubjectLists: lockSubjects.slice(this.data.currentSortIndex * 10, this.data.currentSortIndex * 10 + 10),
lockSubjectLists: lockSubjects.slice(this.data.currentSortIndex * 5, this.data.currentSortIndex * 5 + 5),
})
this.getSubjectSort();
} else {
......@@ -2073,13 +2073,17 @@ Page({
content: `您当前设置的关卡数${that.data.copySubjectCount}关小于设置前的关卡数${that.data.lockparams.subject_count}关,会丢失最后${that.data.lockparams.subject_count - that.data.copySubjectCount}关,您确定吗?`,
success: (res) => {
if (res.confirm) {
if (this.data.currentSortIndex > Math.floor(that.data.copySubjectCount / 5)) {
that.data.currentSortIndex = Math.floor(that.data.copySubjectCount / 5)
}
lockSubjects.splice(that.data.copySubjectCount);
that.setData({
changesubjectCountInputShow: false,
'lockparams.subject_count': that.data.copySubjectCount,
copySubjectCount: 0,
lockSubjects,
lockSubjectLists: lockSubjects.slice(that.data.currentSortIndex * 10, that.data.currentSortIndex * 10 + 10),
currentSortIndex: that.data.currentSortIndex,
lockSubjectLists: lockSubjects.slice(that.data.currentSortIndex * 5, that.data.currentSortIndex * 5 + 5),
})
that.getSubjectSort();
}
......@@ -2091,13 +2095,13 @@ Page({
const { index, item } = e.currentTarget.dataset;
this.setData({
currentSortIndex: index,
lockSubjectLists: this.data.lockSubjects.slice(index * 10, index * 10 + 10),
lockSubjectLists: this.data.lockSubjects.slice(index * 5, index * 5 + 5),
})
},
// 去编辑关卡内容
goModifyClockSubject (e) {
const { item, index, } = e.currentTarget.dataset;
const sort = this.data.currentSortIndex * 10 + index + 1;
const sort = this.data.currentSortIndex * 5 + index + 1;
let addSort = 0; // 是否是新增的主题
let lockSubjectLists = this.data.lockSubjects;
if (sort >= 2) {
......@@ -2446,7 +2450,7 @@ Page({
id: (data.land_content && data.land_content.id) || 0,
title: (data.land_content && data.land_content.title) || ''
},
lockSubjectLists: lockSubjects.slice(this.data.currentSortIndex * 10, this.data.currentSortIndex * 10 + 10)
lockSubjectLists: lockSubjects.slice(this.data.currentSortIndex * 5, this.data.currentSortIndex * 5 + 5)
})
this.getSubjectSort();
......
......@@ -312,7 +312,7 @@
<view class="locksubjectlist">
<view class="locksubjectitem" wx:for="{{lockSubjectLists}}" wx:key="index" data-item="{{item}}" data-index="{{index}}" bindtap="goModifyClockSubject">
<view class="topbox">
<view class="sorttitle">第{{currentSortIndex * 10 + index + 1}}关</view>
<view class="sorttitle">第{{currentSortIndex * 5 + index + 1}}关</view>
<view class="editbtn">编辑</view>
</view>
<view class="subjecttitle">{{item.title || '未设置'}}</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