Commit 2a293961 authored by wangxuelai's avatar wangxuelai

'创建打卡之后页面的串联'

parent c0e14121
...@@ -240,7 +240,7 @@ Page({ ...@@ -240,7 +240,7 @@ Page({
radioList: [ radioList: [
], ],
radioname: '', radioname: '',
confirmId: 0
}, },
onLoad: function(options) { // Do some initialize when page load. onLoad: function(options) { // Do some initialize when page load.
const that = this; const that = this;
...@@ -770,14 +770,6 @@ Page({ ...@@ -770,14 +770,6 @@ Page({
for (let i = 0; i < _selectRestDays.length; i++) { for (let i = 0; i < _selectRestDays.length; i++) {
restdates.push(_selectRestDays[i].data.year + '-' + _selectRestDays[i].data.month + '-' + _selectRestDays[i].data.day) restdates.push(_selectRestDays[i].data.year + '-' + _selectRestDays[i].data.month + '-' + _selectRestDays[i].data.day)
} }
// if (this.data.id==0) {
// wx.showModal({
// title: '提示',
// content: '请选择班级',
// showCancel: false
// })
// return;
// }
if (_params.title.trim() === '') { if (_params.title.trim() === '') {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
...@@ -822,7 +814,6 @@ Page({ ...@@ -822,7 +814,6 @@ Page({
title: '数据保存中...' title: '数据保存中...'
}) })
// const sjdMediaEditor = this.selectComponent('#sjd-media-editor'); // const sjdMediaEditor = this.selectComponent('#sjd-media-editor');
console.log(_params, '_params');
let content = JSON.parse(JSON.stringify(_params.content)); let content = JSON.parse(JSON.stringify(_params.content));
let _content = content.filter((ele) => ele.value.trim() != ''); let _content = content.filter((ele) => ele.value.trim() != '');
_content.forEach((ele) => { _content.forEach((ele) => {
...@@ -832,7 +823,6 @@ Page({ ...@@ -832,7 +823,6 @@ Page({
}) })
_params.content = JSON.stringify(_content); _params.content = JSON.stringify(_content);
const data = Object.assign(_params, { const data = Object.assign(_params, {
// class_id: this.data.id,
tid: this.data.tid, tid: this.data.tid,
clone: this.data.clone, clone: this.data.clone,
school_id: this.data.sid, school_id: this.data.sid,
...@@ -849,44 +839,61 @@ Page({ ...@@ -849,44 +839,61 @@ Page({
} = res; } = res;
if (code == 200) { if (code == 200) {
wx.hideLoading(); wx.hideLoading();
wx.showToast({ if (this.data.tid == 0 || this.data.clone == 1) { // 生成新闯关打卡
title: '保存成功' this.setData({
}) confirmId: data.id,
if (this.data.tid == 0) { successDailogShow: true
wx.redirectTo({ }, () => {
url: `/business/pages/calendarthemeindex/index?id=${this.data.id}&tid=${data.id}&sid=${this.data.sid}`, this.data.publishing = false;
success: function () {
that.data.submiting = false;
}
})
return;
}
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; } else {
} const pages = getCurrentPages();
let pages = getCurrentPages(); let curPage = null;
let currPage = null; //当前页面 let prePage = null;
let prevPage = null; //上一个页面 if (pages.length >= 2) {
if (pages.length >= 2) { prePage = pages[pages.length - 2];
currPage = pages[pages.length - 1]; //当前页面 prePage.setData({
prevPage = pages[pages.length - 2]; //上一个页面 showRefresh: true,
} needRefresh: true,
prevPage.setData({ })
showRefresh: true,
needRefresh: true,
});
wx.navigateBack({
delta: 1, // 回退前 delta(默认为1) 页面
success: function () {
that.data.submiting = false;
} }
}) wx.navigateBack();
}
// if (this.data.tid == 0) {
// wx.redirectTo({
// url: `/business/pages/calendarthemeindex/index?id=${this.data.id}&tid=${data.id}&sid=${this.data.sid}`,
// success: function () {
// that.data.submiting = false;
// }
// })
// return;
// }
// 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,
// needRefresh: true,
// });
// wx.navigateBack({
// delta: 1, // 回退前 delta(默认为1) 页面
// success: function () {
// that.data.submiting = false;
// }
// })
} else { } else {
wx.hideLoading(); wx.hideLoading();
this.data.submiting = false; this.data.submiting = false;
...@@ -970,43 +977,26 @@ Page({ ...@@ -970,43 +977,26 @@ Page({
} = res; } = res;
wx.hideLoading(); wx.hideLoading();
if (code == 200) { if (code == 200) {
if (this.data.tid == 0 || this.data.clone == 1) { // 生成新闯关打卡
if (this.data.tid == 0) { this.setData({
that.setData({ confirmId: data.id,
successDailogShow: true, successDailogShow: true
newCreateId: data.id }, () => {
}) this.data.publishing = false;
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; } else {
} const pages = getCurrentPages();
let pages = getCurrentPages(); let curPage = null;
let currPage = null; //当前页面 let prePage = null;
let prevPage = null; //上一个页面 if (pages.length >= 2) {
if (pages.length >= 2) { prePage = pages[pages.length - 2];
currPage = pages[pages.length - 1]; //当前页面 prePage.setData({
prevPage = pages[pages.length - 2]; //上一个页面 showRefresh: true,
} needRefresh: true,
prevPage.setData({ })
showRefresh: true
});
wx.navigateBack({
delta: 1, // 回退前 delta(默认为1) 页面
success: function () {
that.data.submiting = false
} }
}) wx.navigateBack();
}
} else { } else {
this.data.submiting = false this.data.submiting = false
} }
...@@ -2162,14 +2152,6 @@ Page({ ...@@ -2162,14 +2152,6 @@ Page({
// 保存闯管打卡 // 保存闯管打卡
saveLock() { saveLock() {
const that = this; const that = this;
// if (this.data.params.class_id == 0) {
// wx.showModal({
// title: '提示',
// content: '请选择班级',
// showCancel: false
// })
// return;
// }
if (this.data.lockparams.title.trim() == '') { if (this.data.lockparams.title.trim() == '') {
wx.showToast({ wx.showToast({
title: '请输入闯关活动标题', title: '请输入闯关活动标题',
...@@ -2186,13 +2168,6 @@ Page({ ...@@ -2186,13 +2168,6 @@ Page({
}) })
return; return;
} }
// if (Number(this.data.lockparams.subject_count) < Number(this.data.copySubjectCount)) {
// wx.showToast({
// icon: 'none',
// title: `关卡数量只能增加不能减少,原关卡${this.data.copySubjectCount}关卡`
// })
// return;
// }
if (this.data.lockparams.unlock_limit < 1) { if (this.data.lockparams.unlock_limit < 1) {
wx.showToast({ wx.showToast({
title: '每天可闯关数必须大于1', title: '每天可闯关数必须大于1',
...@@ -2291,12 +2266,25 @@ Page({ ...@@ -2291,12 +2266,25 @@ Page({
}).then((res) => { }).then((res) => {
const { code, data } = res; const { code, data } = res;
if (res.code == 200) { if (res.code == 200) {
this.setData({ if (this.data.tid == 0 || this.data.clone == 1) { // 生成新闯关打卡
confirmId: data.id, this.setData({
showConfirmDialog: true confirmId: data.id,
}, () => { successDailogShow: true
this.data.publishing = false; }, () => {
}) this.data.publishing = false;
})
} else {
const pages = getCurrentPages();
let curPage = null;
let prePage = null;
if (pages.length >= 2) {
prePage = pages[pages.length - 2];
prePage.setData({
needRefresh: true
})
}
wx.navigateBack();
}
wx.hideLoading(); wx.hideLoading();
} else { } else {
this.data.publishing = false; this.data.publishing = false;
...@@ -2381,4 +2369,23 @@ Page({ ...@@ -2381,4 +2369,23 @@ Page({
}) })
}, },
// 闯关打卡的相关代码 // 闯关打卡的相关代码
// 新建打卡成功跳转到不同的主题详情页
gothemeindex() {
if (this.data.editType == 1) { // 跳转到作业打卡
wx.redirectTo({
url: `/business/pages/themeindex/index?tid=${this.data.confirmId}&sid=${this.data.sid}`,
})
} else if (this.data.editType == 2) { // 跳转到日历打卡
wx.redirectTo({
url: `/business/pages/calendarthemeindex/index?tid=${this.data.confirmId}&sid=${this.data.sid}`,
})
} else if (this.data.editType == 3) { // 跳转到闯关打卡
wx.redirectTo({
url: `/business/pages/themeeditor/lockthemelist?tid=${this.data.confirmId}&sid=${this.data.sid}`,
})
}
this.setData({
successDailogShow: false
})
}
}) })
\ No newline at end of file
...@@ -369,17 +369,18 @@ ...@@ -369,17 +369,18 @@
</view> </view>
</view> </view>
<view class="modal-dialog success-dailog" wx:if="{{successDailogShow}}" catchtouchmove="true"> <view class="modal-dialog success-dailog" wx:if="{{successDailogShow}}" catchtouchmove="true">
<view class="modal-mask"></view> <view class="modal-mask" bindtap="gothemeindex"></view>
<view class="modal-box"> <view class="modal-box">
<image class="top-imgbg" src="{{imageRoot}}2b/themeeditor/dailog-bj.png?{{imageVersion}}"/> <image class="iconclose" src="{{imageRoot}}common/icon_close.png" bindtap="gothemeindex"></image>
<view class="modal-content"> <image class="successicon" src="{{imageRoot}}2b/themeeditor/successicon.png"></image>
<view class="main-title">作业创建成功</view> <view class="successtext">创建成功</view>
<view class="sub-title">可以邀请学员打卡了</view> <view class="successguidetext">打卡可以方便记录和统计作业情况,</view>
</view> <view class="successguidetext"> 督促孩子在家学习。</view>
<view class="modal-btngroup"> <button class="btn btn-primary sharebtn" open-type="share">
<view class="btn" bindtap="hideDailogShow" bindtap="bindToThemeindex">进入管理后台</view> <image class="wechaticon" src="{{imageRoot}}2b/themeeditor/wechat.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
<button class="btn btn-primary" open-type="share">分享给学员</button> 分享给学员
</view> </button>
<view class="shareguidetext"> 分享到微信群,邀请学生参与打卡!</view>
</view> </view>
</view> </view>
<expiredTip/> <expiredTip/>
...@@ -434,6 +434,57 @@ page{ ...@@ -434,6 +434,57 @@ page{
left: 0; left: 0;
top: -90rpx; top: -90rpx;
} }
.modal-dialog.success-dailog .modal-box{
height: initial;
}
.success-dailog .modal-box .iconclose {
width: 24rpx;
height: 24rpx;
position: absolute;
right: 20rpx;
top: 20rpx;
}
.success-dailog .modal-box .successtext {
color: #222222;
font-size: 34rpx;
text-align: center;
line-height: 1;
margin-bottom: 22rpx;
}
.success-dailog .modal-box .successguidetext {
color: #555555;
font-size: 26rpx;
text-align: center;
}
.success-dailog .modal-box .sharebtn{
display: flex;
align-items: center;
justify-content: center;
background-color: #02AE5F;
width: 478rpx;
height: 100rpx;
border-radius: 50rpx;
color: #fff;
margin: 56rpx auto 16rpx;
}
.success-dailog .modal-box .shareguidetext {
color: #999999;
font-size: 22rpx;
text-align: center;
padding-bottom: 22rpx;
}
.success-dailog .modal-box .sharebtn .wechaticon {
width: 52rpx;
height: 44rpx;
display: block;
margin-right: 20rpx;
}
.success-dailog .modal-box .successicon {
width: 166rpx;
height: 166rpx;
display: block;
margin: 74rpx auto 44rpx;
}
.success-dailog .modal-box .modal-content{ .success-dailog .modal-box .modal-content{
padding: 160rpx 0 70rpx; padding: 160rpx 0 70rpx;
} }
......
...@@ -30,7 +30,8 @@ Page({ ...@@ -30,7 +30,8 @@ Page({
} }
}, },
lockSubjects: [], lockSubjects: [],
settingModalShow: false settingModalShow: false,
needRefresh: false,
}, },
onLoad: function(options) { // Do some initialize when page load. onLoad: function(options) { // Do some initialize when page load.
const { sid, tid } = options; const { sid, tid } = options;
...@@ -44,6 +45,10 @@ Page({ ...@@ -44,6 +45,10 @@ Page({
}, },
onShow: function() { // Do something when page show. onShow: function() { // Do something when page show.
if (this.data.needRefresh) {
this.unlockSubjectShow();
this.data.needRefresh = false;
}
}, },
onHide: function() { // Do something when page hide. onHide: function() { // Do something when page hide.
......
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