Commit 4f3f8970 authored by wangxuelai's avatar wangxuelai

'逻辑串联'

parent 6ef6b346
......@@ -329,11 +329,6 @@ Page({
noCommentTotal: Number(data.not_review_count || 0),
"remindTips.pushStatus": data.subject_status
});
// TODO班级信息 好像不需要
// if(this.data.id){
// this.getCircleDetail();
// }
const startD = data.calendar_set.start_time.split(" ")[0];
const endD = data.calendar_set.end_time.split(" ")[0];
if (this.numberDate(startD) == this.numberDate(endD)) {
......@@ -398,35 +393,6 @@ Page({
});
}
},
getCircleDetail() {
erpClassDetailGet({
id: this.data.id,
school_id: this.data.sid
}).then(res => {
if (res.code == 200) {
if (res.data.deleted_at) {
wx.showModal({
title: "提示",
content: "班级已被删除,点击确认返回",
showCancel: false,
confirmText: "确定",
success(r) {
if (r.confirm) {
wx.navigateBack({
delta: 1
});
}
}
});
}
this.setData({
circleInfo: res.data
});
this.getSchoolDetail(res.data.school_id);
}
});
},
onesmallsortselect(e) {
const { dataset } = e.currentTarget;
if (dataset.onesmallsort == this.data.oneSmallSort) {
......@@ -1590,7 +1556,7 @@ Page({
},
toEdit() {
wx.navigateTo({
url: `/business/pages/themeeditor/index?id=${this.data.id}&tid=${this.data.tid}&sid=${this.data.sid}&editType=2`
url: `/business/pages/themeeditor/index?tid=${this.data.tid}&sid=${this.data.sid}&editType=2`
});
}
});
......@@ -93,31 +93,14 @@ Page({
this.data.selectClass && this.data.selectClass.id
? this.data.selectClass.id
: 0;
switch (Number(createtype)) {
case 1:
url = `/business/pages/themeeditor/index?id=${selectClassId}&tid=0&sid=${
this.data.sid
}&classes=${encodeURIComponent(
this.data.selectClass && this.data.selectClass.id
? JSON.stringify([
{
id: this.data.selectClass.id,
title: this.data.selectClass.title
}
])
: "[]"
)}`;
break;
case 2:
url = `/business/pages/calendarthemeeditor/index?id=${selectClassId}&tid=0&sid=${this.data.sid}`;
break;
case 3:
url = `/business/pages/themeeditorlock/index?id=${selectClassId}&tid=0&sid=${this.data.sid}`;
break;
default:
break;
}
const classes = this.data.selectClass && this.data.selectClass.id
?
JSON.stringify([{
id: this.data.selectClass.id,
title: this.data.selectClass.title
}])
: "[]"
url = `/business/pages/themeeditor/index?tid=0&sid=${this.data.sid}&classes=${encodeURIComponent(classes)}&editType=${createtype}`;
wx.navigateTo({
url: `${url}`
});
......@@ -470,17 +453,17 @@ Page({
const {
dataset: { theme }
} = e.currentTarget;
if (theme.subject_type == 2) {
if (theme.subject_type == 2) { // 日历
wx.navigateTo({
url: `/business/pages/calendarthemeindex/index?tid=${theme.id}&sid=${this.data.sid}`
});
} else if (theme.subject_type == 1) {
} else if (theme.subject_type == 1) { // 作业
wx.navigateTo({
url: `/business/pages/themeindex/index?tid=${theme.id}&sid=${this.data.sid}`
});
} else if (theme.subject_type == 3) {
} else if (theme.subject_type == 3) { // 闯关
wx.navigateTo({
url: `/business/pages/morethemeindex/index?tid=${theme.id}&sid=${this.data.sid}&sort=1`
url: `/business/pages/themeeditor/lockthemelist?tid=${theme.id}&sid=${this.data.sid}`
});
}
},
......
......@@ -216,19 +216,7 @@ Page({
addTheme(e){
const {createtype} = e.currentTarget.dataset;
let url = '';
switch (Number(createtype)){
case 1:
url = `/business/pages/themeeditor/index?id=0&tid=0&sid=${this.data.sid}&classes=${encodeURIComponent('[]')}`;
break;
case 2:
url = `/business/pages/calendarthemeeditor/index?id=0&tid=0&sid=${this.data.sid}`;
break;
case 3:
url = `/business/pages/themeeditorlock/index?id=0&tid=0&sid=${this.data.sid}`;
break;
default:
break;
}
url = `/business/pages/themeeditor/index?tid=0&sid=${this.data.sid}&classes=${encodeURIComponent('[]')}&editType=${createtype}`;
wx.navigateTo({
url: `${url}`
})
......
......@@ -139,9 +139,8 @@ Page({
},
onLoad: function(options) { // Do some initialize when page load.
const that = this;
const {id, mid, tid,sid} = options;
const {mid, tid, sid} = options;
this.setData({
id,
tid,
sid,
mid,
......
/*
time: 2018-10-31
author: wxl
*/
import {
themeEditor
} from '../../../service/business/themeeditor.js';
import {
themeDetail
} from '../../../service/business/themeindex.js';
import {
audioorigin,
formatDate,
getDateInfo,
LocalStorage,
deepCopy
} from '../../../utilities/index.js';
import {
erpClassListGet,
} from '../../../service/business/common.js';
var app = getApp();
Page({
// mixins: [deepCopy(require('../../../mixins/myMins/audioCallback'))],
data: {
maxLength: 500,
maxImgCount: 9,
maxVideoCount: 9,
maxAudioCount: 600,
imageRoot: app.globalData.imageRoot,
imageVersion: app.globalData.imageVersion,
localImageRoot: '../../../images/',
id: 0,
tid: 0,
sid: 0,
params: {
type: 0, // 0无限制 1录音 2视频 3照片
title: '',
content: [],
is_cheat: 0,
is_encrypt: 0,
force_status: 2,
force_num:0,
push_status:2,
text_require_status:2,
text_require_num:0,
image_require_status:2,
image_require_num:0,
video_require_status:2,
video_require_num:0,
audio_require_status:2,
audio_require_num:0,
startDate: formatDate(new Date().getTime()/1000).split(' ')[0],
startTime: formatDate(new Date().getTime()/1000).split(' ')[1],
endDate: formatDate((new Date().getTime()+86400*1000*7)/1000).split(' ')[0],
endTime: formatDate((new Date().getTime()+86400*1000*7)/1000).split(' ')[1],
clock_start_time: '00:00',
clock_end_time: '23:59',
push_time:'09:00'
},
submiting: false,
audioStatus: { // 录音弹窗的交互状态
show: false,
playStatus: 'no', // no play pause resume
time: 0,
upload: false
},
videostatus: {
preSrc: '',
currentSrc: '',
videoShow: false,
videoId: '',
src: ''
},
placeholder: '请输入打卡主题的具体要求,如:演唱歌曲《小小少年》\r\n演唱歌曲《小小少年》,具体要求\r\n1.跟随伴奏唱一段副歌\r\n2.视频录下唱歌过程\r\n3.上传歌唱视频打卡成功\r\n如果有该歌曲示例视频,你可以点击上传视频,供学员参考。',
audioStorage: {
},
currentVoice: '', // 当前播放的录音
voiceInterval: null,
showWarn: false,
yearRang: [1900, 2200],
years: [],
months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
days: [],
hours: ['00点', '01点', '02点', '03点', '04点', '05点', '06点', '07点', '08点', '09点', '10点', '11点', '12点', '13点', '14点', '15点', '16点', '17点', '18点', '19点', '20点', '21点', '22点', '23点'],
minutes: ['00分', '01分', '02分', '03分', '04分', '05分', '06分', '07分', '08分', '09分', '10分', '11分', '12分', '13分', '14分', '15分', '16分', '17分', '18分', '19分', '20分', '21分', '22分', '23分', '24分', '25分', '26分', '27分', '28分', '29分', '30分', '31分', '32分', '33分', '34分', '35分', '36分', '37分', '38分', '39分', '40分', '41分', '42分', '43分', '44分', '45分', '46分', '47分', '48分', '49分', '50分', '51分', '52分', '53分', '54分', '55分', '56分', '57分', '58分', '59分', '60分'],
startDateInfoArr: [null, null, null, null, null],
endDateInfoArr: [null, null, null, null, null],
datePickerArr: [null, null, null, null, null],
scrollerStartMonth: '',
scrollerEndMonth: '',
scrollerStartYear: '',
scrollerEndYear: '',
showLimitF:false,
showReadF:false,
my: 0,
circlelistLoading: false,
circlehasmore: true,
classList: [],
circlePage: 1,
circlePerpage: 10,
modalClass: false,
modelClassAnimate: false,
selectClass: '', // 当前班级
mockTitleList: [
{type: 1,label:"课后作业",title: '请各位同学提交本次课后布置的作业'},
{type: 2,label:"周末作业",title: '请各位同学提交本周周末布置的作业'},
{type: 3,label:"演讲一段话",title: '请各位同学演讲本次作业要讲的话'},
{type: 4,label:"练习动作",title: '请各位同学练习一下动作'},
{type: 5,label:"今日练字作业",title: '请各位同学认真查看今日要练习的作业,并跟着练习'}
],
currentMockType: 0,
successDailogShow: false,
actPalyaudioValue: ''
},
onLoad: function(options) { // Do some initialize when page load.
const that = this;
const {
id,
tid,
clone,
sid,
my
} = options;
this.setData({
id,
tid,
clone: clone || '',
sid: sid || '',
my: my || 0
});
if(tid != 0){
wx.setNavigationBarTitle({
title: '编辑作业打卡'
})
}
this.loadThemeData({
id,
tid
});
this.getDatePickerData(getDateInfo(Math.floor((new Date()).getTime()/1000)));
this.getStartDatePickerArr(this.data.params.startDate, this.data.params.startTime);
this.getEndDatePickerArr(this.data.params.endDate, this.data.params.endTime);
this.getClassList('init')
},
onReady: function() { // Do something when page ready.
},
onShow: function() { // Do something when page show.
},
onHide: function() { // Do something when page hide.
this.resetAudiosPlayStatus()
clearInterval(this.data.voiceInterval);
},
onUnload: function() { // Do something when page close.
this.resetAudiosPlayStatus();
this.setData({
audioStorage: {
}
})
clearInterval(this.data.voiceInterval);
},
onShareAppMessage(option){
if (option.from == "menu"){
return {
title: '轻校通',
path: 'ucenter/index'
}
}else{
return {
title: `邀请您提交「${this.data.params.title}」作业`,
path: `/src/pages/themeindex/index?tid=${this.data.newCreateId}&id=${this.data.id}&sid=${this.data.sid}`,
imageUrl: `${this.data.imageRoot}pageshare_cover/theme_share.png?${this.data.imageRoot}`,
}
}
},
getStartDatePickerArr (date, time) {
let currentDate = Date.parse(new Date(`${date} ${time}`.replace(/-/g, '/')));
let dateInfo = getDateInfo(currentDate/1000);
this.setData({
startDateInfoArr: [dateInfo.year - this.data.yearRang[0], dateInfo.month - 1, dateInfo.day -1 ,dateInfo.hours, dateInfo.minutes]
}, () => {
this.data.scrollerStartMonth = this.data.startDateInfoArr[1] + 1 < 10 ? `0${this.data.startDateInfoArr[1] + 1}`: this.data.startDateInfoArr[1] + 1;
this.data.scrollerStartYear = this.data.startDateInfoArr[0] + this.data.yearRang[0];
})
},
getEndDatePickerArr (date, time) {
let currentDate = Date.parse(new Date(`${date} ${time}`.replace(/-/g, '/')));
let dateInfo = getDateInfo(currentDate/1000);
this.setData({
endDateInfoArr: [dateInfo.year - this.data.yearRang[0], dateInfo.month - 1, dateInfo.day - 1,dateInfo.hours, dateInfo.minutes]
}, () => {
this.data.scrollerEndMonth = this.data.endDateInfoArr[1] + 1 < 10 ? `0${this.data.endDateInfoArr[1] + 1}`: this.data.endDateInfoArr[1] + 1;
this.data.scrollerEndYear = this.data.endDateInfoArr[0] + this.data.yearRang[0];
})
},
getDatePickerData (dateInfo) {
for (let i = this.data.yearRang[0]; i <= this.data.yearRang[1]; i++) {
this.data.years.push(`${i}年`)
}
let dates = []
for (let i = 1; i <= dateInfo.monthDays; i++ ) {
let day = i;
if (i < 10) {
day = '0' + i
}
dates.push(`${day}日`);
}
this.setData({
days: dates,
years: this.data.years,
datePickerArr: [this.data.years, this.data.months, dates, this.data.hours, this.data.minutes]
})
},
startDatePickerChange (e) { // 旋转年月 的时候把日这一列的数据更改掉 如果当前选中天数超出了这一月的总天数 定位到最后一天
// let month, year;
switch (e.detail.column) {
case 0: // 修改年
this.data.scrollerStartYear = e.detail.value + this.data.yearRang[0]
this.setMonthDays(this.data.scrollerStartYear, this.data.scrollerStartMonth);
break;
case 1: // 修改月
this.data.scrollerStartMonth = e.detail.value + 1 < 10 ? `0${e.detail.value + 1}`: e.detail.value + 1;
this.setMonthDays(this.data.scrollerStartYear, this.data.scrollerStartMonth);
break;
}
},
endDatePickerChange (e) { // 旋转年月 的时候把日这一列的数据更改掉 如果当前选中天数超出了这一月的总天数 定位到最后一天
// let month, year;
switch (e.detail.column) {
case 0: // 修改年
this.data.scrollerEndYear = e.detail.value + this.data.yearRang[0]
this.setMonthDays(this.data.scrollerEndYear, this.data.scrollerEndMonth);
break;
case 1: // 修改月
this.data.scrollerEndMonth = e.detail.value + 1 < 10 ? `0${e.detail.value + 1}`: e.detail.value + 1;
this.setMonthDays(this.data.scrollerEndYear, this.data.scrollerEndMonth);
break;
}
},
setMonthDays (year, month) {
let currentDate = Date.parse(new Date(`${year}/${month}/01 00:00`.replace(/-/g, '/')));
let dateInfo = getDateInfo(currentDate/1000);
let dates = [];
for (let i = 1; i <= dateInfo.monthDays; i++ ) {
let day = i;
if (i < 10) {
day = '0' + i
}
dates.push(`${day}日`);
}
this.setData({
'datePickerArr[2]': dates
})
},
startTimeChange (e) {
const year = e.detail.value[0] + this.data.yearRang[0];
const month = e.detail.value[1] + 1 < 10 ? `0${e.detail.value[1] + 1}` : `${e.detail.value[1] + 1}`;
const day = e.detail.value[2] + 1 < 10 ? `0${e.detail.value[2] + 1}` : `${e.detail.value[2] + 1}`;
const hour = e.detail.value[3]< 10 ? `0${e.detail.value[3]}` : `${e.detail.value[3]}`;
const minute = e.detail.value[4] < 10 ? `0${e.detail.value[4]}` : `${e.detail.value[4]}`;
let currentDate = `${year}-${month}-${day} ${hour}:${minute}`;
this.data.startDateInfoArr = e.detail.value;
this.data.params.startDate = `${year}-${month}-${day}`;
this.data.params.startTime = `${hour}:${minute}`;
this.timeCompare(1);
},
endTimeChange (e) {
const year = e.detail.value[0] + this.data.yearRang[0];
const month = e.detail.value[1] + 1 < 10 ? `0${e.detail.value[1] + 1}` : `${e.detail.value[1] + 1}`;
const day = e.detail.value[2] + 1 < 10 ? `0${e.detail.value[2] + 1}` : `${e.detail.value[2] + 1}`;
const hour = e.detail.value[3]< 10 ? `0${e.detail.value[3]}` : `${e.detail.value[3]}`;
const minute = e.detail.value[4] < 10 ? `0${e.detail.value[4]}` : `${e.detail.value[4]}`;
let currentDate = `${year}-${month}-${day} ${hour}:${minute}`;
this.data.endDateInfoArr = e.detail.value;
this.data.params.endDate = `${year}-${month}-${day}`;
this.data.params.endTime = `${hour}:${minute}`;
this.timeCompare(2);
},
timeCompare (type) { // type 1 选择开始时间 2选择结束时间
let startTime = Date.parse(`${this.data.params.startDate} ${this.data.params.startTime}`.replace(/-/g, '/'));
let entTime = Date.parse(`${this.data.params.endDate} ${this.data.params.endTime}`.replace(/-/g, '/'));
if (startTime >= entTime) {
switch (type) {
case 1:
startTime = entTime - 24 * 60 * 60 * 1000;
let startTimeFormat = formatDate(Math.floor(startTime / 1000));
this.setData({
'params.startDate': startTimeFormat.split(' ')[0],
'params.startTime': startTimeFormat.split(' ')[1]
})
this.getStartDatePickerArr(this.data.params.startDate, this.data.params.startTime)
break;
case 2:
entTime = startTime + 24 * 60 * 60 * 1000;
let entTimeFormat = formatDate(Math.floor(entTime / 1000));
this.setData({
'params.endDate': entTimeFormat.split(' ')[0],
'params.endTime': entTimeFormat.split(' ')[1]
}, () => {
this.getEndDatePickerArr(this.data.params.endDate, this.data.params.endTime)
})
break;
default:
break;
}
} else {
switch (type) {
case 1:
this.setData({
startDateInfoArr: this.data.startDateInfoArr,
'params.startDate': this.data.params.startDate,
'params.startTime': this.data.params.startTime,
})
break;
case 2:
this.setData({
endDateInfoArr: this.data.endDateInfoArr,
'params.endDate': this.data.params.endDate,
'params.endTime': this.data.params.endTime,
})
break;
default:
break;
}
}
},
loadThemeData({
id,
tid
}) {
let that = this;
if (tid == 0) { // 走新建的逻辑
this.setData({
currentMockType: 2,
'params.title': that.data.mockTitleList.filter(item=>item.type==2)[0].title,
})
} else { // 走查询的逻辑
wx.showLoading({
title: '数据加载中...'
})
themeDetail({
id: this.data.tid,
school_id: this.data.sid
}).then((res) => {
wx.hideLoading();
const {
code,
data
} = res;
if (code == 200) {
let _content = [];
try {
_content = JSON.parse(data.content);
} catch (error) {
_content = []
}
let currentMockItem = this.data.mockTitleList.filter(item=>item.title == data.title)[0];
this.setData({
params: {
type: data.type,
title: data.title,
content: _content,
is_cheat: data.is_cheat,
is_encrypt: data.is_encrypt,
force_status: data.force_status,
force_num:Number(data.force_num),
push_status:data.homework_set.push_status,
text_require_status:data.text_require_status,
text_require_num:Number(data.text_require_num),
image_require_status:data.image_require_status,
image_require_num:Number(data.image_require_num),
video_require_status:data.video_require_status,
video_require_num:Number(data.video_require_num),
audio_require_status:data.audio_require_status,
audio_require_num:Number(data.audio_require_num),
startDate: data.homework_set.publish_time.split(" ")[0],
startTime: data.homework_set.publish_time.split(" ")[1],
endDate: data.homework_set.end_time.split(" ")[0],
endTime: data.homework_set.end_time.split(" ")[1],
clock_start_time: data.clock_start_time,
clock_end_time: data.clock_end_time,
push_time:data.homework_set.push_time
},
currentMockType: currentMockItem? currentMockItem.type : 0,//标题类型回显
})
}
}).catch((err) => {
wx.hideLoading()
})
}
},
titleInput(e) {
const {
value
} = e.detail;
let currentMockItem = this.data.mockTitleList.filter(item=>item.title == value)[0];
this.setData({
'params.title': value.length > 36 ? value.substr(0, 36) : value,
currentMockType: currentMockItem? currentMockItem.type: 0
})
},
selectType() {
const that = this;
wx.showActionSheet({
itemList: ['无限制', '录音打卡', '视频打卡', '照片打卡'],
success(res) {
that.setData({
'params.type': `${res.tapIndex}`
})
}
})
},
saveTheme(e) {
clearTimeout(this.timeOut)
this.timeOut = setTimeout(()=>{
this.thisSaveTheme()
},300)
},
thisSaveTheme() {
const that = this;
const _params = JSON.parse(JSON.stringify(this.data.params));
const publish_time = this.data.params.startDate+' '+this.data.params.startTime;
const end_time = this.data.params.endDate+' '+this.data.params.endTime;
if (this.data.id==0) {
wx.showModal({
title: '提示',
content: '请选择班级',
showCancel: false
})
return;
}
if (_params.title.trim() === '') {
wx.showModal({
title: '提示',
content: '请输入主题名称',
confirm: true,
showCancel: false
})
return;
}
if (_params.title.trim().length > 36) {
wx.showModal({
title: '提示',
content: '主题名称不能超过36个字',
confirm: true,
showCancel: false
})
return;
}
if(this.compareTime(end_time,publish_time)){
wx.showModal({
title: '提示',
content: '结束时间必须大于等于开始时间',
confirm: true,
showCancel: false
})
return;
}
if (this.data.submiting) {
return
}
this.data.submiting = true
wx.showLoading({
title: '数据保存中...'
})
const sjdMediaEditor = this.selectComponent('#sjd-media-editor');
let content = JSON.parse(JSON.stringify(sjdMediaEditor.data.content));
let _content = content.filter((ele) => ele.value.trim() != '');
_content.forEach((ele) => {
if (ele.type == 'video' && ele.poster) {
delete ele.poster;
}
})
_params.content = JSON.stringify(_content);
const data = Object.assign(_params, {
class_id: this.data.id,
tid: this.data.tid,
clone: this.data.clone,
school_id: this.data.sid,
subject_type:1,
publish_time:publish_time,
end_time:end_time,
})
themeEditor(data).then((res) => {
const {
code,
data
} = res;
wx.hideLoading();
if (code == 200) {
if (this.data.tid == 0) {
that.setData({
successDailogShow: true,
newCreateId: data.id
})
that.data.submiting = false
return;
}
wx.showToast({
title: '保存成功'
})
if (this.data.clone == 1) {
wx.redirectTo({
url: `/business/pages/circleindex/index?id=${this.data.id}&sid=${this.data.sid}`,
success: function () {
that.data.submiting = false
}
})
return;
}
let pages = getCurrentPages();
let currPage = null; //当前页面
let prevPage = null; //上一个页面
if (pages.length >= 2) {
currPage = pages[pages.length - 1]; //当前页面
prevPage = pages[pages.length - 2]; //上一个页面
}
prevPage.setData({
showRefresh: true
});
wx.navigateBack({
delta: 1, // 回退前 delta(默认为1) 页面
success: function () {
that.data.submiting = false
}
})
} else {
this.data.submiting = false
}
}).catch((e) => {
this.data.submiting = false
})
},
// 跟录音相关的操作
addVoice(e) {
const {
show,
src
} = e.detail
this.setData({
'audioStatus.show': show
})
},
pushVoice(e) {
const {
src,
duration
} = e.detail;
this.selectComponent('#sjd-media-editor').pushVoice({
src,
duration
}); // 页面向组件传递参数
},
// 跟录音相关的操作
// 跟录音相关的操作
// 播放录音的相关操作
// 格式是以录音名字为key value为{play: true || false, currentTime: 0}的一个对象
voiceIntervalPlay (value) { // 初始化录音的状态
let voiceInterval = setInterval(() => {
let audioStorage = this.data.audioStorage;
let currentTime = ++audioStorage[value].currentTime;
this.setData({
audioStorage
})
if (currentTime >= this.data.audioStorage[value].duration) {
audioStorage[value].play = false;
audioStorage[value].currentTime = 0;
// audioStorage[value].innerAudioContext.seek(0);
// audioStorage[value].innerAudioContext.pause();
this.setData({
audioStorage
})
clearInterval(this.data.voiceInterval);
}
}, 1000);
this.setData({
voiceInterval
})
},
playvoice (e) {
const {value, duration} = e.detail;
const that = this;
// this.innerAudioContext.src = audioorigin(value);
// this.innerAudioContext.obeyMuteSwitch = false;
wx.getNetworkType({
success: (res) => {
if (res.networkType != 'none') {
that.resetAudiosPlayStatus();
clearInterval(that.data.voiceInterval);
let audioStorage = that.data.audioStorage;
if (!audioStorage[value]) {
audioStorage[value] = {
play: true,
currentTime: 0,
duration,
isWaiting: false,
innerAudioContext: wx.createInnerAudioContext(),
}
audioStorage[value].innerAudioContext.src = audioorigin(value);
audioStorage[value].innerAudioContext.obeyMuteSwitch = false;
audioStorage[value].innerAudioContext.onWaiting((e)=>{
console.log('等待中');
const { actPalyaudioValue, audioStorage} = this.data;
// if(audioStorage[value].isWaiting){
// return
// }
clearInterval(that.data.voiceInterval);
audioStorage[value].isWaiting = true
that.setData({
audioStorage,
})
// setTimeout((e)=>{
// this.data.audioStorage[value].isWaiting = false;
// this.setData({
// audioStorage: this.data.audioStorage
// })
// },5000)
})
// audioStorage[value].innerAudioContext.onPlay((e) => {
// console.log('dasdad');
// that.voiceIntervalPlay(value);
// })
audioStorage[value].innerAudioContext.onTimeUpdate((e) => {
console.log('sss');
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[value].isWaiting) {
clearInterval(that.data.voiceInterval);
that.voiceIntervalPlay(value);
audioStorage[value].isWaiting = false
that.setData({
audioStorage,
})
}
})
audioStorage[value].innerAudioContext.onError((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
audioStorage[value].isWaiting = false;
audioStorage[value].play = false;
wx.showToast({
title: '音频播放出错啦',
icon: 'none',
duration: 2000
})
that.setData({
audioStorage,
})
});
} else {
if (audioStorage[value].currentTime == audioStorage[value].duration) {
audioStorage[value].currentTime = 0;
audioStorage[value].play = true;
} else {
audioStorage[value].play = true;
}
audioStorage[value].isWaiting = false;
}
audioStorage[value].innerAudioContext.seek(audioStorage[value].currentTime)
setTimeout(() => {
audioStorage[value].innerAudioContext.play();
}, 500)
that.voiceIntervalPlay(value);
that.setData({
audioStorage,
actPalyaudioValue:value
})
} else {
wx.showToast({
title: '暂无网络, 请检查您的网络',
icon: 'none'
})
}
}
})
},
pausevoice (e) {
const {value} = e.detail;
let audioStorage = this.data.audioStorage;
audioStorage[value].play = false;
this.setData({
audioStorage,
})
audioStorage[value].innerAudioContext.pause();
clearInterval(this.data.voiceInterval);
},
voiceslide (e) {
const {value, slide, duration} = e.detail;
let audioStorage = this.data.audioStorage;
const that = this;
wx.getNetworkType({
success: (res) => {
if (res.networkType != 'none') {
if (!audioStorage[value]) {
audioStorage[value] = {
play: false,
currentTime: slide,
duration,
isWaiting: false,
innerAudioContext: wx.createInnerAudioContext(),
}
audioStorage[value].innerAudioContext.src = audioorigin(value);
audioStorage[value].innerAudioContext.obeyMuteSwitch = false;
audioStorage[value].innerAudioContext.onWaiting((e)=>{
console.log(value, '等待1111');
if (audioStorage[value] && !audioStorage[value].play) {
const { actPalyaudioValue, audioStorage} = this.data
// if(audioStorage[value].isWaiting){
// return
// }
audioStorage[value].isWaiting = true
that.setData({
audioStorage,
})
}
// setTimeout((e)=>{
// this.data.audioStorage[value].isWaiting = false;
// this.setData({
// audioStorage: this.data.audioStorage
// })
// },5000)
})
audioStorage[value].innerAudioContext.onTimeUpdate((e) => {
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[value].isWaiting) {
console.log('22222222222222222');
clearInterval(that.data.voiceInterval);
that.voiceIntervalPlay(value);
audioStorage[value].isWaiting = false
that.setData({
audioStorage,
})
}
})
audioStorage[value].innerAudioContext.onError((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
audioStorage[value].isWaiting = false;
audioStorage[value].play = false;
wx.showToast({
title: '音频播放出错啦',
icon: 'none',
duration: 2000
})
that.setData({
audioStorage,
})
});
// audioStorage[value].innerAudioContext.seek(slide);
} else {
if (slide >= audioStorage[value].duration) {
audioStorage[value].currentTime = 0;
audioStorage[value].play = false;
audioStorage[value].innerAudioContext.pause();
clearInterval(this.data.voiceInterval);
// audioStorage[value].innerAudioContext.seek(0);
} else {
audioStorage[value].currentTime = slide;
// audioStorage[value].innerAudioContext.seek(slide);
}
audioStorage[value].isWaiting = false;
}
// if (audioStorage[value] && audioStorage[value].play) { // 如果当前是播放状态 则启用定时器 播放按钮状态不需要改
// // audioStorage[value].play = false;
// console.log(slide, '播放slide')
// audioStorage[value].innerAudioContext.seek(slide); // audioStorage[value].currentTime
// // audioStorage[value].innerAudioContext.play();
// // clearInterval(this.data.voiceInterval);
// setTimeout(() => {
// audioStorage[value].innerAudioContext.play();
// }, 500)
// this.voiceIntervalPlay(value);
// } else { // 如果当前不是播放状态 则该干嘛干嘛
// // audioStorage[value].innerAudioContext.play();
// }
this.setData({
audioStorage,
})
} else {
wx.showToast({
title: '暂无网络, 请检查您的网络',
icon: 'none'
})
}
}
})
},
// voicesliding
slidestart (e) {
const {value, slide} = e.detail;
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[value] && audioStorage[value].play) { // 如果当前是播放状态 则先暂停音乐盒计时器 播放按钮状态不需要改
audioStorage[value].innerAudioContext.pause();
audioStorage[value].play = false;
clearInterval(this.data.voiceInterval);
} else { // 如果当前不是播放状态 则该干嘛干嘛
}
this.setData({
actPalyaudioValue: value,
audioStorage,
})
},
slideend (e) {
// const {value, slide} = e.detail;
// let audioStorage = this.data.audioStorage;
// clearInterval(this.slideTimeOut);
// if (audioStorage[value] && audioStorage[value].play) { // 如果当前是播放状态 则启用定时器 播放按钮状态不需要改
// // audioStorage[value].play = false;
// console.log(audioStorage[value].currentTime, '播放')
// audioStorage[value].innerAudioContext.seek(audioStorage[value].currentTime);
// // audioStorage[value].innerAudioContext.play();
// // clearInterval(this.data.voiceInterval);
// this.voiceIntervalPlay(value);
// } else { // 如果当前不是播放状态 则该干嘛干嘛
// // audioStorage[value].innerAudioContext.play();
// }
},
resetAudiosPlayStatus () { // 点击一个录音的时候把其他的录音状态改成暂停状态
let audioStorage = this.data.audioStorage;
Object.keys(audioStorage).forEach((key) => {
audioStorage[key].play = false;
audioStorage[key].isWaiting = false;
if (audioStorage[key].innerAudioContext) {
audioStorage[key].innerAudioContext.pause();
}
});
this.setData({
audioStorage,
})
},
delvoice (e) {
const {value} = e.detail;
let audioStorage = this.data.audioStorage;
if (audioStorage[value] && audioStorage[value].play) { // 如果当前是播放状态 删除录音的操作要把录音销毁掉
audioStorage[value].innerAudioContext.pause();
// delete audioStorage[value];
clearInterval(this.data.voiceInterval);
}
this.setData({
audioStorage,
})
},
// 跟录音相关的操作
remindswitch() {
if (Number(this.data.params.push_status) == 2) {
this.setData({
'params.push_status': 1
})
} else if (Number(this.data.params.push_status) == 1) {
this.setData({
'params.push_status': 2
})
}
},
tipTimeChange(e){
const {
value
} = e.detail;
this.setData({
'params.push_time': value,
})
},
compareTime(date1, date2, type) {
// date2比date1大
if (type == 1) {
if (typeof date2 != "string") {
return new Date(date1.replace(/-/g, '/')).getTime() - Number(date2) > 0 ? false : true
}
return new Date(date1.replace(/-/g, '/')).getTime() - new Date(date2.replace(/-/g, '/')).getTime() > 0 ? false : true
}
if (type == 2) {}
return new Date(date1.replace(/-/g, '/')).getTime() - new Date(date2.replace(/-/g, '/')).getTime() > 0 ? false : true
},
// 切换选择班级 start
getClassList(type) {
let dakarole = LocalStorage.getItem('dakarole');
let that = this;
if (!this.data.circlehasmore) {
return;
}
if (this.data.circlelistLoading) {
return
}
this.setData({
circlelistLoading: true
})
erpClassListGet({
page: this.data.circlePage,
// perPage: this.data.circlePerpage,
perPage: 200,//重新选择问题,所以这里暂不分页了
school_id: this.data.sid,
my: dakarole==2? 1: this.data.my
}).then((res) => {
const {
code,
data
} = res;
wx.hideLoading();
this.setData({
circlelistLoading: false
})
if (code != 200) { // 失败的处理
} else {
if (data.total==0) {
wx.showModal({
title: '提示',
content: '您还没有班级,请先创建班级',
showCancel: false,
confirmColor: '#16B0FD',
success:function(){
wx.navigateTo({
url: `/business/pages/circleeditor/index?sid=${that.data.sid}&id=0&from=3`
})
}
})
return;
}
if (data.total) {
this.data.circleTotal = data.total;
}
switch(type){
case 'init':
data.list = data.list.map(item => {
return {
id: item.id,
title: item.title
}
})
this.setData({
classList: data.list,
selectClass: this.data.id!=0 ? data.list.find(ele => ele.id == this.data.id) : data.list[0],
id: this.data.id!=0? this.data.id: data.list[0].id
})
if (data.total > this.data.classList.length) {
this.data.circlePage = this.data.circlePage + 1;
} else { // 没有更多了
this.setData({
circlehasmore: false
})
}
break;
case 'up': // 页面上拉刷新
let list = this.data.classList;
let _listGet = data.list.map(item=>{
return {
id: item.id,
title: item.title
}
});
let _list = list.concat(_listGet);
this.setData({
classList: _list
})
if (data.total > this.data.classList.length) {
this.data.circlePage = this.data.circlePage + 1;
} else { // 没有更多了
this.setData({
circlehasmore: false
})
}
break;
default:
break;
}
}
}).catch((e) => {
this.setData({
listLoading: false
})
})
},
scrolltolowerClass(e) {
if (this.data.circlehasmore) {
this.getClassList('up')
}
},
showClassSelectModal() {
let that = this;
if(this.data.tid!=0){//编辑
return
}
if(this.data.classList.length==0){
wx.showModal({
title: '提示',
content: '您还没有班级,请先创建班级',
showCancel: false,
confirmColor: '#16B0FD',
success:function(){
wx.navigateTo({
url: `/business/pages/circleeditor/index?sid=${that.data.sid}&id=0&from=3`
})
}
})
return
}
this.setData({
modalClass: true
})
},
selectClassHandle(e) {
const { item } = e.currentTarget.dataset;
if(item.id == this.data.selectClass.id){
this.setData({
modelClassAnimate: true
})
setTimeout(() => {
this.setData({
modalClass: false,
modelClassAnimate: false
})
}, 200)
}else{
this.setData({
selectClass: item,
id: item.id,
modelClassAnimate: true,
})
setTimeout(() => {
this.setData({
modalClass: false,
modelClassAnimate: false
})
}, 200)
}
},
hideClassSelectModal(e) {
this.setData({
modelClassAnimate: true
})
setTimeout(() => {
this.setData({
modalClass: false,
modelClassAnimate: false
})
}, 200)
},
jumpToSolution(){
wx.navigateTo({
url: `/business/pages/webview/index?type='video'`
})
},
bindMockTitle(e){
let that = this;
const {type} = e.currentTarget.dataset;
if(type==that.data.currentMockType){
return
}
let optMockTitle = that.data.mockTitleList.filter(item=>item.type==type)[0];
that.setData({
'params.title': optMockTitle.title,
currentMockType: type
})
},
// 切换选择班级 end
bindMoreSetting(){
const {
is_cheat,
is_encrypt,
force_status,
force_num,
text_require_status,
text_require_num,
image_require_status,
image_require_num,
audio_require_status,
video_require_num,
video_require_status,
audio_require_num
} = this.data.params
wx.navigateTo({
url: `/business/pages/themeeditor/setting?is_cheat=${is_cheat}&is_encrypt=${is_encrypt}&force_status=${force_status}&force_num=${force_num}&text_require_status=${text_require_status}&text_require_num=${text_require_num}&image_require_status=${image_require_status}&image_require_num=${image_require_num}&audio_require_status=${audio_require_status}&video_require_num=${video_require_num}&video_require_status=${video_require_status}&audio_require_num=${audio_require_num}`
})
},
// 新建成功
bindToThemeindex(){
wx.redirectTo({
url: `/business/pages/themeindex/index?id=${this.data.id}&tid=${this.data.newCreateId}&sid=${this.data.sid}`,
})
},
true(){},
// 视频播放相关代码
playvideo(e) {
const that = this;
const {
src,
from,
mode
} = e.detail;
this.setData({
'videostatus.videoId': src,
'videostatus.videoShow': true,
'videostatus.src': src,
'videostatus.mode': mode || 'mp4',
})
setTimeout(() => {
that.videoContext = wx.createVideoContext(src);
that.videoContext.play();
that.videoContext.requestFullScreen({});
}, 500)
},
screenchange(e) {
const {
fullScreen
} = e.detail;
if (!fullScreen) { // 退出全屏时的操作
this.setData({
'videostatus.videoId': '',
'videostatus.videoShow': false,
'videostatus.src': '',
})
}
},
closeVideo() {
this.setData({
'videostatus.videoId': '',
'videostatus.videoShow': false,
'videostatus.src': '',
})
},
// 视频播放相关代码
})
\ No newline at end of file
{
"navigationBarTitleText": "新建作业打卡",
"usingComponents": {
"sjd-media-editor": "../../../components/sjdmediaeditor",
"sound-recording": "../../../components/soundrecording",
"w-switch": "/dist/w-switch/index",
"w-button": "/dist/w-button/index",
"w-cell": "/dist/w-cell/index",
"w-cell-group": "/dist/w-cell-group/index",
"w-pane": "/dist/w-pane/index",
"expiredTip": "../../components/expiredTip"
}
}
\ No newline at end of file
<wxs src="../../../filter/index.wxs" module="filter" />
<view class="container" style="display: {{videostatus.videoShow ? 'none' : 'block'}}">
<view class="theme-editor-container clearfix {{showWarn ? 'opacitybody' : ''}}">
<!-- <view class="broadcast-box clearfix mb24">
<image class="broadcast-img" src="{{imageRoot}}2b/shopeditor/voiceicon.png?{{imageVersion}}">
</image>
<text class="broadcast-text" selectable="false" space="false" decode="false">主题发布后老师带头打卡,可提高学员参与积极性至3倍。</text>
</view> -->
<view class="section-wrap">
<view class="section-item" bindtap="showClassSelectModal">
<view class="form-item">
<view class="item-l">班级:{{selectClass.title}}</view>
<view class="item-r" wx:if="{{tid==0}}">
<view class="label">去选择</view>
<image class="icon-arr" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"/>
</view>
</view>
</view>
<view class="section-tip">所选的班级,该班级学员能接收作业提醒并参与作业打卡</view>
</view>
<view class="section-wrap">
<view class="section-item section-themetitle">
<view class="form-item">
<view class="item-l">
<textarea class="title-input" bindinput="titleInput" value="{{params.title}}" placeholder="请输入此次作业标题" wx:if="{{!modalClass}}" auto-height="true"></textarea>
<view class="title-input title-input-mock" wx:else>{{params.title?params.title:'请输入此次作业标题'}}</view>
</view>
<view class="item-r">{{params.title.length}}/36</view>
</view>
</view>
<view class="mock-titlebox">
<view class="mock-item {{item.type==currentMockType? 'active': ''}}" wx:for="{{mockTitleList}}" wx:key="" data-type="{{item.type}}" bindtap="bindMockTitle">{{item.label}}</view>
</view>
</view>
<view class="section-wrap">
<view class="section-item section-content">
<view class="content-inputbox">在这里添加此次作业的描述,可点击下方内容控件进行添加</view>
<view class="sjd-component-box">
<sjd-media-editor content="{{params.content}}"
id="sjd-media-editor" sid="{{sid}}"
bind:addVoice="addVoice"
placeholder="{{placeholder}}"
bind:playvoice="playvoice"
actionsPalyvalue="{{actPalyaudioValue}}"
bind:pausevoice="pausevoice"
bind:voiceslide="voiceslide"
audioStorage="{{audioStorage}}"
bind:slidestart="slidestart"
bind:slideend="slideend"
bind:delvoice="delvoice"
bind:playvideo="playvideo"
withmask="{{showWarn}}">
</sjd-media-editor>
</view>
</view>
<view class="section-tip" style="color: #16B0FD;" bindtap="jumpToSolution">上传视频一直传不上去怎么办?点这里解决 ></view>
</view>
<view class="section-wrap">
<view class="section-item">
<view class="form-item">
<view class="item-l">打卡提醒
<text class="tip" wx:if="{{params.push_status==2}}">(开启后定时提醒学员打卡)</text>
<view class="num-box" wx:else>
<picker mode="time" value="{{params.push_time}}" bindchange="tipTimeChange">
{{params.push_time}}
<image class="icon-arr" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"/>
</picker>提醒
</view>
</view>
<view class="item-r">
<w-switch slot="content" value="{{params.push_status}}" color="#16B0FD" size="small" bind:onChange="remindswitch" />
</view>
</view>
</view>
</view>
<view class="section-wrap">
<view class="section-item">
<view class="form-item">
<view class="item-l">作业生效日期</view>
<view class="item-r">
<view class="label">
<picker mode="multiSelector" range="{{datePickerArr}}" value="{{startDateInfoArr}}" bindchange="startTimeChange" bindcolumnchange="startDatePickerChange">
{{params.startDate}} {{params.startTime}}
</picker>
</view>
<image class="icon-arr" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"/>
</view>
</view>
<view class="form-item">
<view class="item-l">作业截至日期</view>
<view class="item-r">
<view class="label">
<picker mode="multiSelector" range="{{datePickerArr}}" value="{{endDateInfoArr}}" bindchange="endTimeChange" bindcolumnchange="endDatePickerChange" style="line-height: 40rpx;">
{{params.endDate}} {{params.endTime}}
</picker>
</view>
<image class="icon-arr" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"/>
</view>
</view>
</view>
</view>
<view class="section-wrap">
<view class="section-item">
<view class="form-item">
<view class="item-l">高级设置<text class="tip">(防作弊,上传图片/视频限制)</text></view>
<view class="item-r" bindtap="bindMoreSetting">
<view class="label">去设置</view>
<image class="icon-arr" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"/>
</view>
</view>
</view>
</view>
<sound-recording sid="{{sid}}" show="{{audioStatus.show}}" bind:addVoice="addVoice" bind:pushVoice="pushVoice">
</sound-recording>
</view>
<view class="page-btnsubmit" bindtap="saveTheme">发布</view>
</view>
<view class="modal {{modelClassAnimate? 'hide': ''}}" hidden="{{!modalClass}}" catchtouchmove="true">
<view class="mask" bindtap="hideClassSelectModal"></view>
<view class="modal-content">
<scroll-view class="opt-list" scroll-y="{{true}}" lower-threhold="200" bindscrolltolower="scrolltolowerClass">
<view class="opt-item {{selectClass.id == item.id ? 'active' : ''}}" wx:for="{{classList}}" wx:key="index" data-item="{{item}}" bindtap="selectClassHandle">{{item.title}}</view>
<view class="loadmore" wx:if="{{circlehasmore}}">上拉加载更多班级</view>
<list-loading loading="{{circlelistLoading}}"></list-loading>
</scroll-view>
<view class="opt-item btn-cancel" bindtap="hideClassSelectModal">取消</view>
</view>
</view>
<view class="videodialog" wx:if="{{videostatus.videoShow}}">
<view class="videodialogmask" bindtap="closeVideo"></view>
<video class="" src="{{filter.transformOssVideofy(videostatus.src,videostatus.mode)}}" id="{{videostatus.videoId}}"
initial-time="0" autoplay="false" loop="false" bindplay="" bindpause="" bindended=""
bindtimeupdate="" bindwaiting="" binderror="" bindfullscreenchange="screenchange"></video>
</view>
<view class="modal-dialog success-dailog" wx:if="{{successDailogShow}}" catchtouchmove="true">
<view class="modal-mask"></view>
<view class="modal-box">
<image class="top-imgbg" src="{{imageRoot}}2b/themeeditor/dailog-bj.png?{{imageVersion}}"/>
<view class="modal-content">
<view class="main-title">作业创建成功</view>
<view class="sub-title">可以邀请学员打卡了</view>
</view>
<view class="modal-btngroup">
<view class="btn" bindtap="hideDailogShow" bindtap="bindToThemeindex">进入管理后台</view>
<button class="btn btn-primary" open-type="share">分享给学员</button>
</view>
</view>
</view>
<expiredTip/>
@import '../../../style/editor.wxss';
page{
height: 100%;
background: #F2F2F2;
}
.container{
padding: 30rpx 0 140rpx;
}
.theme-editor-container {
padding: 0 24rpx;
}
.theme-editor-container.opacitybody {
display: none;
}
/* 顶部提示 */
.theme-editor-container .broadcast-box {
padding: 22rpx 0 22rpx 24rpx;
background-color: #fff;
}
.theme-editor-container .broadcast-box .broadcast-img {
width: 24rpx;
height: 18rpx;
display: block;
float: left;
margin-top: 10rpx;
}
.theme-editor-container .broadcast-box .broadcast-text {
font-size: 24rpx;
color: #ef9c52;
padding-left: 21rpx;
width: 647rpx;
}
.page-btnsubmit {
display: block;
width: 100%;
height: 100rpx;
border-radius: 50rpx;
background: #16B0FD;
font-size: 38rpx;
color: #fff;
letter-spacing: 4rpx;
/* position: fixed; */
width: 600rpx;
margin: 0 auto;
bottom: 0;
left: 0%;
display: flex;
align-items: center;
justify-content: center;
/* border-radius: 0; */
z-index: 9;
}
.showorhide-icon{
width: 12rpx;
height: 20rpx;
/* transform: rotate(-90deg); */
position: absolute;
bottom:26rpx;
right: 0;
}
/* 弹框 选择班级 作业列表 */
.modal{
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
background:rgba(0,0,0,.5);
z-index: 9;
animation: modalshow 0.2s linear;
}
.modal.hide{
animation: modalhide 0.2s linear forwards;
}
.modal .mask{
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 9;
}
.modal .modal-content{
width: 100%;
position: absolute;
left: 0;
bottom: 0;
background:#fff;
border-radius: 20rpx 20rpx 0px 0px;
z-index: 10;
animation: modalmoveup 0.2s linear forwards;
}
.modal.hide .modal-content{
animation: modalmovedown 0.2s linear forwards;
}
.modal .modal-content .opt-list{
max-height: 700rpx;
border-bottom: 16rpx solid #EDEDED;
overflow: auto;
}
.modal .modal-content .opt-item{
height: 95rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
font-weight: bold;
color: #000;
position: relative;
}
.modal .modal-content .opt-item::after{
content: '';
width: 100%;
height: 1px;
background: rgba(0,0,0,.1);
position: absolute;
left: 0;
bottom: 0;
transform: scaleY(.5);
}
.modal .modal-content .opt-item:last-of-type::after{
display: none;
}
.modal .modal-content .opt-item.active{
color: #53C8FF;
}
.modal .modal-content .btn-cancel{
height: 106rpx;
}
.modal .loadmore{
text-align: center;
line-height: 65rpx;
font-size: 26rpx;
}
.section-wrap{
margin-bottom: 30rpx;
}
.section-item{
border-radius: 20rpx;
padding: 40rpx 21rpx;
background: #fff;
}
.section-tip{
font-size: 24rpx;
color: #AAAAAA;
padding: 4rpx 22rpx 7rpx;
line-height: 48rpx;
}
/* 快速选择标题 */
.mock-titlebox{
display: flex;
flex-wrap: wrap;
padding-bottom: 20rpx;
}
.mock-titlebox .mock-item{
height: 54rpx;
border-radius: 27rpx;
background: #fff;
font-size: 24rpx;
font-weight: 500;
color: #626262;
display: flex;
align-items: center;
justify-content: center;
margin: 16rpx 32rpx 0 0;
padding: 0 20rpx;
}
.mock-titlebox .mock-item.active{
color: #fff;
background: #16B0FD;
}
.section-item .form-item{
display: flex;
align-items: center;
justify-content: space-between;
line-height: 39rpx;
width: 100%;
margin-bottom: 30rpx;
}
.section-item .form-item:last-of-type{
margin-bottom: 0;
}
.form-item .item-l{
font-size: 28rpx;
color: #1F1F1F;
font-weight: bold;
display: flex;
align-items: center;
}
.form-item .item-l .tip{
font-size: 24rpx;
color: #AAAAAA;
padding-left: 20rpx;
font-weight: normal;
}
.form-item .item-l .num-box{
display: flex;
align-items: center;
font-size: 24rpx;
color: #9B9B9B;
font-weight: normal;
}
.form-item .item-l .num-box picker{
color: #686868;
font-size: 26rpx;
padding: 0 70rpx 0 60rpx;
position: relative;
}
.form-item .item-l .num-box picker .icon-arr{
width: 12rpx;
height: 20rpx;
position: absolute;
top: 50%;
right: 40rpx;
transform: translateY(-50%) rotate(90deg);
}
.form-item .item-r{
display: flex;
align-items: center;
}
.form-item .item-r .label{
font-size: 26rpx;
color: #686868;
}
.form-item .item-r .icon-arr{
width: 12rpx;
height: 20rpx;
margin-left: 20rpx;
}
.section-item.section-themetitle{
padding: 34rpx 0;
position: relative;
}
.section-item.section-themetitle .item-l{
width: calc(100% - 100rpx);
}
.section-item.section-themetitle .item-l .title-input{
line-height: 34rpx;
padding: 0 15rpx;
width: 100%;
}
.section-item.section-themetitle .item-l .title-input-mock{
padding: 5rpx 21rpx;
}
.section-item.section-themetitle .item-r{
width: 94rpx;
height: 100%;
border-radius: 0 20rpx 20rpx 0;
background: #FBFBFB;
font-size: 22rpx;
color: #9D9D9D;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 0;
right: 0;
}
.section-item.section-content{
padding: 0;
}
.section-item.section-content .content-inputbox{
padding: 40rpx 21rpx;
font-size: 24rpx;
color: #9D9D9D;
border-bottom: 1px solid rgba(0,0,0,.05);
}
.sjd-component-box{
width: 100%;
padding: 30rpx 20rpx;
}
/* 创建成功弹窗 */
.modal-dialog{
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 9;
}
.modal-dialog .modal-mask{
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
background: rgba(0,0,0,.5);
z-index: 9;
}
.modal-dialog .modal-box{
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
/* width: 550rpx;
height: 349rpx;
background: #fff;
border-radius: 20rpx;
display: flex;
flex-direction: column;
justify-content: space-between; */
z-index: 10;
}
.modal-dialog .modal-btngroup{
display: flex;
height: 105rpx;
position: relative;
border-radius: 0 0 20rpx 20rpx;
background: #fff;
border-top: 1px solid rgba(0,0,0,.05);
}
/* .modal-dialog .modal-btngroup::before{
content: '';
width: 100%;
height: 1px;
background: rgba(0,0,0,.05);
position: absolute;
top: 0;
left: 0;
transform: scaleY(.5);
} */
.modal-dialog .modal-btngroup .btn{
flex: 1;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 32rpx;
color: #434343;
position: relative;
padding: 0;
}
.modal-dialog .modal-btngroup .btn::after{
content: '';
width: 1px;
height: 100%;
background: rgba(0,0,0,.05);
position: absolute;
top: 0;
right: 0;
transform: scaleX(.5);
z-index: 2;
}
.modal-dialog .modal-btngroup .btn:last-of-type::after{
display: none;
}
.modal-dialog .modal-btngroup .btn.btn-primary{
color: #16B0FD;
background: #fff;
border-radius: 0 0 20rpx 0;
border-left: 1px solid rgba(0,0,0,0.05);
}
.success-dailog .modal-box{
width: 550rpx;
background:#fff;
position: relative;
border-radius: 20rpx;
}
.success-dailog .modal-box .top-imgbg{
width: 100%;
height: 167rpx;
position: absolute;
left: 0;
top: -90rpx;
}
.success-dailog .modal-box .modal-content{
padding: 160rpx 0 70rpx;
}
.success-dailog .modal-box .modal-content .main-title{
font-size: 30rpx;
color: #000;
line-height: 1;
text-align: center;
font-weight: bold;
}
.success-dailog .modal-box .modal-content .sub-title{
font-size: 24rpx;
color: #616161;
line-height: 1;
padding-top: 28rpx;
text-align: center;
}
// business/pages/themeeditor/setting.js
Page({
data: {
is_cheat: 0,
is_encrypt: 0,
force_status: 2,
force_num:0,
text_require_status:2,
text_require_num:0,
image_require_status:2,
image_require_num:0,
video_require_status:2,
video_require_num:0,
audio_require_status:2,
audio_require_num:0,
tipObj: [
{type: '1', title: '防作弊模式', content: ['开启后学员打卡后','才能看到其他同学的打卡作品!']},
{type: '2', title: '加密模式', content: ['开启后非本校在读人员','看不到老师的主题内容的!']},
{type: '3', title: '强制阅读', content: ['开启后,学员将先进入阅读页面','倒计时结束后才能去提交作业!']},
{type: '4', title: '文字要求', content: ['学员输入文字最少多少字']},
{type: '5', title: '图片要求', content: ['学员上传图片最少多少张']},
{type: '6', title: '录音要求', content: ['学员录音时长最少多少秒']},
{type: '7', title: '视频要求', content: ['学员上传视频最少几个视频']}
],
tipModalShow: false,
optTipObj: {},//点击获取的提示内容
},
onLoad: function (options) {
let that = this;
const {is_cheat,
is_encrypt,
force_status,
force_num,
text_require_status,
text_require_num,
image_require_status,
image_require_num,
audio_require_status,
video_require_num,
video_require_status,
audio_require_num
} = options;
that.setData({
is_cheat,
is_encrypt,
force_status,
force_num,
text_require_status,
text_require_num,
image_require_status,
image_require_num,
audio_require_status,
video_require_num,
video_require_status,
audio_require_num
})
},
cheatswitch() {
if (Number(this.data.is_cheat) == 0) {
this.setData({
is_cheat: 1
})
} else if (Number(this.data.is_cheat) == 1) {
this.setData({
is_cheat: 0
})
}
},
encryptswitch() {
if (Number(this.data.is_encrypt) == 0) {
this.setData({
is_encrypt: 1
})
} else if (Number(this.data.is_encrypt) == 1) {
this.setData({
is_encrypt: 0
})
}
},
readswitch(){
if (Number(this.data.force_status) == 2) {
this.setData({
force_status: 1
})
} else if (Number(this.data.force_status) == 1) {
this.setData({
force_status: 2
})
}
},
textswitch() {
if (Number(this.data.text_require_status) == 2) {
this.setData({
text_require_status: 1
})
} else if (Number(this.data.text_require_status) == 1) {
this.setData({
text_require_status: 2
})
}
},
imageswitch() {
if (Number(this.data.image_require_status) == 2) {
this.setData({
image_require_status: 1
})
} else if (Number(this.data.image_require_status) == 1) {
this.setData({
image_require_status: 2
})
}
},
videoswitch() {
if (Number(this.data.video_require_status) == 2) {
this.setData({
video_require_status: 1
})
} else if (Number(this.data.video_require_status) == 1) {
this.setData({
video_require_status: 2
})
}
},
audioswitch() {
if (Number(this.data.audio_require_status) == 2) {
this.setData({
audio_require_status: 1
})
} else if (Number(this.data.audio_require_status) == 1) {
this.setData({
audio_require_status: 2
})
}
},
readtimeInput(e) {
const {
value
} = e.detail;
this.setData({
force_num: Number(value),
})
},
textInput(e) {
const {
value
} = e.detail;
if (Number(value) > this.data.maxLength) {
this.setData({
text_require_num: Number(this.data.maxLength),
})
} else {
this.setData({
text_require_num: Number(value),
})
}
},
imageInput(e) {
const {
value
} = e.detail;
if (Number(value) > this.data.maxImgCount) {
this.setData({
image_require_num: Number(this.data.maxImgCount),
})
} else {
this.setData({
image_require_num: Number(value),
})
}
},
videoInput(e) {
const {
value
} = e.detail;
if (Number(value) > this.data.maxVideoCount) {
this.setData({
video_require_num: Number(this.data.maxVideoCount),
})
} else {
this.setData({
video_require_num: Number(value),
})
}
},
audioInput(e) {
const {
value
} = e.detail;
if (Number(value) > this.data.maxAudioCount) {
this.setData({
audio_require_num: Number(this.data.maxAudioCount),
})
} else {
this.setData({
audio_require_num: Number(value),
})
}
},
bindBackPrevPage(){
let pages = getCurrentPages();
const {
is_cheat,
is_encrypt,
force_status,
force_num,
text_require_status,
text_require_num,
image_require_status,
image_require_num,
audio_require_status,
video_require_num,
video_require_status,
audio_require_num
} = this.data
let currPage = null; //当前页面
let prevPage = null; //上一个页面
if (pages.length >= 2) {
currPage = pages[pages.length - 1]; //当前页面
prevPage = pages[pages.length - 2]; //上一个页面
}
prevPage.setData({
"params.is_cheat": Number(is_cheat),
"params.is_encrypt": Number(is_encrypt),
"params.force_status": Number(force_status),
"params.force_num": Number(force_num),
"params.text_require_status": Number(text_require_status),
"params.text_require_num": Number(text_require_num),
"params.image_require_status": Number(image_require_status),
"params.image_require_num": Number(image_require_num),
"params.audio_require_status": Number(audio_require_status),
"params.video_require_num": Number(video_require_num),
"params.video_require_status": Number(video_require_status),
"params.audio_require_num": Number(audio_require_num)
});
wx.navigateBack({
delta: 1
})
},
showTipModal(e){
const {type} = e.currentTarget.dataset;
let that = this;
let optTipObj = that.data.tipObj.filter(item=>item.type==type)[0]
that.setData({
optTipObj,
tipModalShow: true
})
},
hideTipModal(){
let that = this;
that.setData({
tipModalShow: false
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "高级设置",
"usingComponents": {
"w-switch": "/dist/w-switch/index"
}
}
\ No newline at end of file
<view class="container">
<view class="section">
<view class="form-item">
<view class="item-l">
<text class="title">防作弊模式</text>
<text class="tip" data-type="1" bindtap="showTipModal" wx:if="{{is_cheat==0}}">什么是防作弊?</text>
</view>
<view class="item-r">
<w-switch slot="content" isBoolean="{{1}}" value="{{ is_cheat }}" color="#16B0FD" size="small" bind:onChange="cheatswitch" />
</view>
</view>
<view class="form-item">
<view class="item-l">
<text class="title">加密模式</text>
<text class="tip" data-type="2" bindtap="showTipModal" wx:if="{{is_encrypt==0}}">什么是加密模式?</text>
</view>
<view class="item-r">
<w-switch slot="content" isBoolean="{{1}}" value="{{ is_encrypt }}" color="#16B0FD" size="small" bind:onChange="encryptswitch" />
</view>
</view>
<view class="form-item">
<view class="item-l">
<text class="title">强制阅读模式</text>
<text class="tip" data-type="3" bindtap="showTipModal" wx:if="{{force_status==2}}">什么是强制阅读模式?</text>
<view class="num-box" wx:else>
<input type="number" placeholder-class="placeholderclass" class="iteminput" maxlength="5" value="{{force_num}}" bindinput="readtimeInput" placeholder=""></input>分钟
</view>
</view>
<view class="item-r">
<w-switch slot="content" value="{{ force_status }}" color="#16B0FD" size="small" bind:onChange="readswitch" />
</view>
</view>
</view>
<view class="section">
<view class="form-item">
<view class="item-l">
<text class="title">文字字数要求</text>
<text class="tip" data-type="4" bindtap="showTipModal" wx:if="{{text_require_status==2}}">什么是文字字数要求?</text>
<view class="num-box" wx:else>
<input type="number" placeholder-class="placeholderclass" class="iteminput" maxlength="5" value="{{text_require_num}}" bindinput="textInput" placeholder=""></input>字
</view>
</view>
<view class="item-r">
<w-switch slot="content" value="{{ text_require_status }}" color="#16B0FD" size="small" bind:onChange="textswitch" />
</view>
</view>
<view class="form-item">
<view class="item-l">
<text class="title">图片个数要求</text>
<text class="tip" data-type="5" bindtap="showTipModal" wx:if="{{image_require_status==2}}">什么是图片个数要求?</text>
<view class="num-box" wx:else>
<input type="number" placeholder-class="placeholderclass" class="iteminput" maxlength="5" value="{{image_require_num}}" bindinput="imageInput" placeholder=""></input>张
</view>
</view>
<view class="item-r">
<w-switch slot="content" value="{{ image_require_status }}" color="#16B0FD" size="small" bind:onChange="imageswitch" />
</view>
</view>
<view class="form-item">
<view class="item-l">
<text class="title">录音时长要求</text>
<text class="tip" data-type="6" bindtap="showTipModal" wx:if="{{audio_require_status==2}}">什么是录音时长要求?</text>
<view class="num-box" wx:else>
<input type="number" placeholder-class="placeholderclass" class="iteminput" maxlength="5" value="{{audio_require_num}}" bindinput="audioInput" placeholder=""></input>秒
</view>
</view>
<view class="item-r">
<w-switch slot="content" value="{{ audio_require_status}}" color="#16B0FD" size="small" bind:onChange="audioswitch"/>
</view>
</view>
<view class="form-item">
<view class="item-l">
<text class="title">视频个数要求</text>
<text class="tip" data-type="7" bindtap="showTipModal" wx:if="{{video_require_status==2}}">什么是视频个数要求?</text>
<view class="num-box" wx:else>
<input type="number" placeholder-class="placeholderclass" class="iteminput" maxlength="30" value="{{video_require_num}}" bindinput="videoInput" placeholder=""></input>个
</view>
</view>
<view class="item-r">
<w-switch slot="content" value="{{ video_require_status}}" color="#16B0FD" size="small" bind:onChange="videoswitch"/>
</view>
</view>
</view>
<view class="modal-dialog" wx:if="{{tipModalShow}}">
<view class="modal-mask"></view>
<view class="modal-box">
<view class="modal-title">{{optTipObj.title}}</view>
<view class="modal-content">
<view class="item" wx:for="{{optTipObj.content}}" wx:key="">{{item}}</view>
</view>
<view class="modal-btn" bindtap="hideTipModal">我知道了</view>
</view>
</view>
<view class="page-btnsubmit" bindtap="bindBackPrevPage">返回</view>
</view>
\ No newline at end of file
page{
background: #F2F2F2;
}
.container{
padding: 0 24rpx;
}
.section{
margin-top: 31rpx;
background: #fff;
border-radius: 20rpx;
width: 100%;
background: #fff;
padding: 10rpx 0;
}
.form-item{
display: flex;
align-items: center;
justify-content: space-between;
line-height: 39rpx;
width: 100%;
padding: 20rpx;
}
.form-item .item-l{
font-size: 28rpx;
display: flex;
align-items: center;
}
.form-item .item-l .title{
color: #1F1F1F;
font-weight: bold;
width: 200rpx;
}
.form-item .item-l .tip{
font-size: 24rpx;
color: #16B0FD;
}
.form-item .item-l .num-box{
display: flex;
align-items: center;
font-size: 24rpx;
color: #9B9B9B;
}
.form-item .item-l .num-box .iteminput{
width: 69rpx;
border-bottom: 2rpx solid #E2E2E2;
margin-right: 26rpx;
font-size: 26rpx;
color: #16B0FD;
text-align: center;
}
.form-item .item-r{
display: flex;
align-items: center;
}
.form-item .item-r .label{
font-size: 26rpx;
color: #686868;
}
.page-btnsubmit {
width: 100%;
height: 100rpx;
background: #16B0FD;
font-size: 38rpx;
color: #fff;
letter-spacing: 4rpx;
position: fixed;
bottom: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
}
/* 提示框 */
.modal-dialog{
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 9;
}
.modal-dialog .modal-mask{
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
background: rgba(0,0,0,.5);
z-index: 9;
}
.modal-dialog .modal-box{
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
width: 600rpx;
height: 349rpx;
background:#fff;
border-radius: 20rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
z-index: 10;
}
.modal-dialog .modal-box .modal-title{
font-size: 28rpx;
color: #000;
font-weight: bold;
text-align: center;
padding-top: 33rpx;
line-height: 1;
}
.modal-dialog .modal-box .modal-content{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.modal-dialog .modal-box .modal-content .item{
line-height: 48rpx;
font-size: 28rpx;
color: #000;
}
.modal-dialog .modal-box .modal-btn{
width: 100%;
height: 100rpx;
display: flex;
align-items: center;
justify-content: center;
border-top: 1px solid rgba(0,0,0,.05);
font-size: 30rpx;
color: #434343;
font-weight: bold;
}
\ No newline at end of file
......@@ -245,7 +245,6 @@ Page({
onLoad: function(options) { // Do some initialize when page load.
const that = this;
const {
id,
tid,
clone,
sid,
......@@ -254,7 +253,6 @@ Page({
editType,
} = options;
this.setData({
id,
tid,
clone: clone || '',
sid: sid || '',
......@@ -290,7 +288,6 @@ Page({
title: '编辑作业打卡'
})
this.loadThemeData({
id,
tid,
extra: 'land_content,class'
});
......@@ -299,7 +296,6 @@ Page({
title: '编辑作业打卡'
})
this.loadCalendarThemeData({
id,
tid,
extra: 'land_content,class'
});
......@@ -657,7 +653,7 @@ Page({
wx.hideLoading()
})
},
loadThemeData({ id, tid, extra }) {
loadThemeData({ tid, extra }) {
wx.showLoading({
title: '数据加载中...'
})
......@@ -678,7 +674,6 @@ Page({
} catch (error) {
_content = []
}
let currentMockItem = this.data.mockTitleList.filter(item=>item.title == data.title)[0];
this.setData({
params: {
type: data.type,
......@@ -713,10 +708,10 @@ Page({
id: (data.land_content && data.land_content.id) || 0,
title: (data.land_content && data.land_content.title) || ''
},
currentMockType: currentMockItem? currentMockItem.type : 0,//标题类型回显
})
}
}).catch((err) => {
console.log('22222');
wx.hideLoading()
})
},
......
......@@ -3,7 +3,7 @@
<view class="theme-editor-container clearfix {{showWarn ? 'opacitybody' : ''}}">
<view class="themetypebox" wx:if="{{tid == 0}}">
<view class="themetab">
<view class="themetypeitem {{editType == 1 ? 'active' : ''}}" data-type="1" bindtap="editTypeChange">作业打卡{{tid}}</view>
<view class="themetypeitem {{editType == 1 ? 'active' : ''}}" data-type="1" bindtap="editTypeChange">作业打卡</view>
<view class="themetypeitem {{editType == 2 ? 'active' : ''}}" data-type="2" bindtap="editTypeChange">日历打卡</view>
<view class="themetypeitem {{editType == 3 ? 'active' : ''}}" data-type="3" bindtap="editTypeChange">闯关打卡</view>
</view>
......
......@@ -156,4 +156,9 @@ Page({
}
})
},
goMembers () {
wx.navigateTo({
url: `/business/pages/unlockclocksituation/index?tid=${this.data.tid}&sid=${this.data.sid}`
})
}
})
\ No newline at end of file
......@@ -135,9 +135,8 @@ Page({
},
onLoad: function(options) { // Do some initialize when page load.
const that = this;
const {id, tid,sid} = options;
const {tid,sid} = options;
this.setData({
id,
tid,
sid,
page: 1,
......@@ -314,8 +313,6 @@ Page({
noCommentTotal: Number(data.not_review_count || 0),
'remindTips.pushStatus': data.subject_status
})
console.log(_content, '44444444444');
this.getCircleDetail()
}
}).catch((err) => {
wx.hideLoading()
......@@ -331,34 +328,6 @@ Page({
})
}
},
getCircleDetail () {
erpClassDetailGet({
id: this.data.id,
school_id:this.data.sid
}).then((res) => {
if (res.code == 200) {
this.getSchoolDetail(res.data.school_id)
if (res.data.deleted_at) {
wx.showModal({
title: '提示',
content: '班级已被删除,点击确认返回机构首页',
showCancel:false,
confirmText:"确定",
success(r) {
if (r.confirm) {
wx.reLaunch({
url:`/business/pages/businessindex/index`
})
}
}
})
}
this.setData({
circleInfo: res.data
})
}
})
},
edittheme () {
wx.navigateTo({
url: `/business/pages/themeeditor/index?id=${this.data.id}&tid=${this.data.tid}&sid=${this.data.sid}`
......@@ -1334,7 +1303,7 @@ Page({
},
toEdit () {
wx.navigateTo({
url: `/business/pages/themeeditor/index?id=${this.data.id}&tid=${this.data.tid}&sid=${this.data.sid}&editType=1`
url: `/business/pages/themeeditor/index?tid=${this.data.tid}&sid=${this.data.sid}&editType=1`
})
}
})
\ 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