Commit 9e9c162f authored by lvtz's avatar lvtz

Merge branch 'wxl-user-optimize' of git.server:wangxuelai/wechatapp.shangjiadao.com into lvtz_clock

parents 2240c89a 47367233
......@@ -240,7 +240,8 @@ Page({
radioList: [
],
radioname: '',
confirmId: 0,
// has_subjects_count: 0
},
onLoad: function(options) { // Do some initialize when page load.
const that = this;
......@@ -355,7 +356,6 @@ Page({
this.setData({
subjecSort: bigArr,
})
console.log(bigArr, 'bigArr');
},
onReady: function() { // Do something when page ready.
......@@ -376,17 +376,31 @@ Page({
},
onShareAppMessage(option){
if (option.from == "menu"){
if (this.data.confirmId == 0){
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}`,
}
if (this.data.editType == 1) {
return {
title: `邀请您提交「${this.data.params.title}」作业`,
path: `/src/pages/themeindex/index?tid=${this.data.confirmId}&sid=${this.data.sid}`,
imageUrl: `${this.data.imageRoot}pageshare_cover/theme_share.png?${this.data.imageRoot}`,
}
} else if (this.data.editType == 2) {
return {
title: `邀请您提交「${this.data.params.title}」作业`,
path: `/src/pages/calendarthemeindex/index?tid=${this.data.confirmId}&sid=${this.data.sid}`,
imageUrl: `${this.data.imageRoot}pageshare_cover/theme_share.png?${this.data.imageRoot}`,
}
} else if (this.data.editType == 3) {
return {
title: `邀请您提交「${this.data.params.title}」作业`,
path: `/src/pages/morethemeindex/index?tid=${this.data.confirmId}&sid=${this.data.sid}`,
imageUrl: `${this.data.imageRoot}pageshare_cover/theme_share.png?${this.data.imageRoot}`,
}
}
}
},
getStartDatePickerArr (date, time) {
......@@ -770,14 +784,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 +828,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 +837,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 +853,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 +991,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
}
......@@ -1962,6 +1966,9 @@ Page({
if (value > 199) {
value = 199;
}
if (value == 0) {
value = 1;
}
this.setData({
copySubjectCount: Number(value)
})
......@@ -1980,6 +1987,13 @@ Page({
},
sureChangePsd () {
const lockSubjects = this.data.lockSubjects;
if (this.data.copySubjectCount == 0) {
wx.showToast({
title: '关卡数不能为0',
icon: 'none'
})
return;
}
if (this.data.copySubjectCount >= this.data.lockparams.subject_count) {
for (let i = 0; i < this.data.copySubjectCount - this.data.lockparams.subject_count; i++) {
lockSubjects.push({
......@@ -2040,7 +2054,9 @@ Page({
const { item, index, } = e.currentTarget.dataset;
const sort = this.data.currentSortIndex * 10 + index + 1;
let addSort = 0; // 是否是新增的主题
if (this.id > 0 && sort > this.lockparams.subject_count) {
console.log(this.data.lockparams.has_subjects_count, 'this.data.lastSubjectCount');
console.log(sort, 'sort');
if (this.data.tid > 0 && sort > this.data.lockparams.has_subjects_count) {
addSort = 1;
}
wx.navigateTo({
......@@ -2162,14 +2178,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 +2194,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 +2292,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;
......@@ -2359,7 +2373,9 @@ Page({
push_status: data.push_status,
push_time: data.push_time,
sign_up_status: data.sign_up_status,
has_subjects_count: data.has_subjects_count,
},
lastSubjectCount: Number(data.subject_count),
radioname: data.sign_up_content ? data.sign_up_content.radioname : '',
radioList: data.sign_up_content ? data.sign_up_content.radioList : '',
lockSubjects: lockSubjects,
......@@ -2381,4 +2397,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
......@@ -321,7 +321,6 @@
</view>
</view>
<view class="locksubjectlist">
<!-- <view class="locksubjectitem" wx:for="{{lockSubjects.slice(currentSortIndex * 10,currentSortIndex * 10 + 10)}}" wx:key="index"> -->
<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>
......@@ -340,8 +339,8 @@
<view class="modal-dialog" wx:if="{{changesubjectCountInputShow}}">
<view class="modal-mask"></view>
<view class="modal-box">
<input type="number" placeholder="请输入闯关打卡关卡总数" value="{{copySubjectCount}}" bindinput="subjectCountInput" />
<view>
<input type="number" placeholder="请输入闯关打卡关卡总数" class="inputPsd" value="{{copySubjectCount}}" bindinput="subjectCountInput" />
<view class="modal-btn-box">
<view class="modal-btn" bindtap="hideChangePsd">关闭</view>
<view class="modal-btn" bindtap="sureChangePsd">确定</view>
</view>
......@@ -369,17 +368,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;
}
......@@ -910,4 +961,39 @@ page{
justify-content: center;
margin: 0 auto;
margin-top: 46rpx;
}
.modal-btn-box {
display: flex;
align-items: center;
}
.modal-dialog .modal-box .modal-btn{
width: 100%;
height: 100rpx;
display: flex;
flex: 1;
align-items: center;
justify-content: center;
border-top: 1px solid rgba(0,0,0,.05);
font-size: 30rpx;
color: #434343;
font-weight: bold;
}
.modal-dialog .modal-box .inputPsd {
width: 420rpx;
height: 78rpx;
border-radius: 38rpx;
background:rgba(238,238,237,1);
display: block;
margin: 80rpx auto;
text-align: center;
padding: 0 30rpx;
}
.modal-dialog .modal-box .modal-btn:first-child {
border-right: 1px solid rgba(0,0,0,.05);
}
.modal-dialog .modal-box .modal-btn:last-child {
color: #65B8F4;
}
.borderbottom1px {
border-bottom: 1px solid #F1F2F3;
}
\ No newline at end of file
......@@ -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