Commit 2a293961 authored by wangxuelai's avatar wangxuelai

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

parent c0e14121
......@@ -240,7 +240,7 @@ Page({
radioList: [
],
radioname: '',
confirmId: 0
},
onLoad: function(options) { // Do some initialize when page load.
const that = this;
......@@ -770,14 +770,6 @@ Page({
for (let i = 0; i < _selectRestDays.length; i++) {
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() === '') {
wx.showModal({
title: '提示',
......@@ -822,7 +814,6 @@ Page({
title: '数据保存中...'
})
// const sjdMediaEditor = this.selectComponent('#sjd-media-editor');
console.log(_params, '_params');
let content = JSON.parse(JSON.stringify(_params.content));
let _content = content.filter((ele) => ele.value.trim() != '');
_content.forEach((ele) => {
......@@ -832,7 +823,6 @@ Page({
})
_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,
......@@ -849,44 +839,61 @@ Page({
} = res;
if (code == 200) {
wx.hideLoading();
wx.showToast({
title: '保存成功'
})
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;
}
if (this.data.tid == 0 || this.data.clone == 1) { // 生成新闯关打卡
this.setData({
confirmId: data.id,
successDailogShow: true
}, () => {
this.data.publishing = 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 {
const pages = getCurrentPages();
let curPage = null;
let prePage = null;
if (pages.length >= 2) {
prePage = pages[pages.length - 2];
prePage.setData({
showRefresh: true,
needRefresh: true,
})
}
})
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 {
wx.hideLoading();
this.data.submiting = false;
......@@ -970,43 +977,26 @@ Page({
} = 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
}
if (this.data.tid == 0 || this.data.clone == 1) { // 生成新闯关打卡
this.setData({
confirmId: data.id,
successDailogShow: true
}, () => {
this.data.publishing = 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 {
const pages = getCurrentPages();
let curPage = null;
let prePage = null;
if (pages.length >= 2) {
prePage = pages[pages.length - 2];
prePage.setData({
showRefresh: true,
needRefresh: true,
})
}
})
wx.navigateBack();
}
} else {
this.data.submiting = false
}
......@@ -2162,14 +2152,6 @@ Page({
// 保存闯管打卡
saveLock() {
const that = this;
// if (this.data.params.class_id == 0) {
// wx.showModal({
// title: '提示',
// content: '请选择班级',
// showCancel: false
// })
// return;
// }
if (this.data.lockparams.title.trim() == '') {
wx.showToast({
title: '请输入闯关活动标题',
......@@ -2186,13 +2168,6 @@ Page({
})
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) {
wx.showToast({
title: '每天可闯关数必须大于1',
......@@ -2291,12 +2266,25 @@ Page({
}).then((res) => {
const { code, data } = res;
if (res.code == 200) {
this.setData({
confirmId: data.id,
showConfirmDialog: true
}, () => {
this.data.publishing = false;
})
if (this.data.tid == 0 || this.data.clone == 1) { // 生成新闯关打卡
this.setData({
confirmId: data.id,
successDailogShow: true
}, () => {
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();
} else {
this.data.publishing = false;
......@@ -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 @@
</view>
</view>
<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">
<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>
<image class="iconclose" src="{{imageRoot}}common/icon_close.png" bindtap="gothemeindex"></image>
<image class="successicon" src="{{imageRoot}}2b/themeeditor/successicon.png"></image>
<view class="successtext">创建成功</view>
<view class="successguidetext">打卡可以方便记录和统计作业情况,</view>
<view class="successguidetext"> 督促孩子在家学习。</view>
<button class="btn btn-primary sharebtn" open-type="share">
<image class="wechaticon" src="{{imageRoot}}2b/themeeditor/wechat.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
分享给学员
</button>
<view class="shareguidetext"> 分享到微信群,邀请学生参与打卡!</view>
</view>
</view>
<expiredTip/>
......@@ -434,6 +434,57 @@ page{
left: 0;
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{
padding: 160rpx 0 70rpx;
}
......
......@@ -30,7 +30,8 @@ Page({
}
},
lockSubjects: [],
settingModalShow: false
settingModalShow: false,
needRefresh: false,
},
onLoad: function(options) { // Do some initialize when page load.
const { sid, tid } = options;
......@@ -44,6 +45,10 @@ Page({
},
onShow: function() { // Do something when page show.
if (this.data.needRefresh) {
this.unlockSubjectShow();
this.data.needRefresh = false;
}
},
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