Commit 7c75730c authored by lvtz's avatar lvtz

add 小程序c端提醒落地页

parent f104b88d
......@@ -80,7 +80,8 @@
"root": "src/pages/myschedule",
"name": "myschedule",
"pages": [
"index"
"index",
"landpage"
]
},
{
......
......@@ -108,6 +108,7 @@ button::after{
flex-direction: column;
z-index: 100;
position: relative;
color: #7F7F7F;
}
.gohome-b{
background: #35BAFD;
......
......@@ -154,6 +154,8 @@ const apis = {
courseMgt: {
courserecord: `${api}student/erp/course_record`,//我的上课记录
myschedule: `${api}student/erp/time_table`,//我的课表
scheduleDetail: `${api}student/erp/time_detail`,//课表详情
scheduleRemindConfirm: `${api}student/erp/schedule_remind_confirm`,//课表详情落地页标记及确认上课
mycourses: `${api}student/erp/my_course`,//我的课程
},
leavesMgt: {
......
export default {
imageRoot: 'https://cdn.img.shangjiadao.cn/qingxiao/daka/images/',
host: 'https://qxapi.qingxiao.online/daka',
host2: 'https://wx.m.shangjiadao.cn',
// host: 'https://qxapi.qingxiao.online/daka',
// host2: 'https://wx.m.shangjiadao.cn',
storageVersion: '4.0',
imageVersion: '20191104',
// host: 'https://clock.wp53.cn',
// host2: 'https://test.wp53.cn',
host: 'https://clock.wp53.cn',
host2: 'https://test.wp53.cn',
appId: 'wxc1246ea029394785',
miniProgram: {
clock: 'wxdeee20e52a1fd7ee'
......
......@@ -427,7 +427,6 @@ function matchTime(time,type){
var monthMatch = time.match(reg)[1];
return monthMatch.split('-')[0]+'月'+monthMatch.split('-')[1]+'日'
}
}
function monthIsShow(month){
if(months.indexOf(month)>-1){
......
......@@ -18,6 +18,24 @@ function myschedule(data){//我的课表
errorresolve: 2,
})
}
//课表详情
function scheduleDetail(data){
return wxRequest({
url: apis.customer.courseMgt.scheduleDetail,
data,
method: 'GET',
errorresolve: 1,
})
}
//课表详情落地页标记及确认上课
function scheduleRemindConfirm(data){
return wxRequest({
url: apis.customer.courseMgt.scheduleRemindConfirm,
data,
method: 'POST',
errorresolve: 1,
})
}
function mycourses(data){//我的课程
return wxRequest({
url: apis.customer.courseMgt.mycourses,
......@@ -30,5 +48,7 @@ function mycourses(data){//我的课程
export {
myclassrecord,
myschedule,
mycourses
mycourses,
scheduleDetail,
scheduleRemindConfirm
}
\ No newline at end of file
import {
scheduleDetail,
scheduleRemindConfirm
} from '../../../service/customer/coursemgt.js';
import {
erpLeaveAddOrEdit,
erpLeavesList,
erpLeaveDetail,
erpLeaveTimes
} from '../../../service/customer/leave.js';
import {
formIdCreate,
} from '../../../service/common.js';
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
imageRoot: app.globalData.imageRoot,
imageVersion: app.globalData.imageVersion,
localImageRoot: '../../../images/',
sid: 0,
courseDetail: {},//课程详情
modalLeaveShow: false,//请假弹框
modalLeaveRecordShow: false,//请假记录弹框
leaves: [],
leavesPage: 1,
perPage: 10,
leavesTotal: 0,
leavesHasmore: true,
LeavesEmptyPage: false,
optScheid: 0,//操作的课表id
leaveContent: '',//请假理由
leaveTimes: 0,//请假次数
//1.申请中 2.已撤销 3.已通过 4.已驳回
modalBackLeaveShow: false,//撤销请假 确定弹框
arriveStatus: 1,//到课状态 1.待确认 2.已确认
},
onLoad: function (options) { // Do some initialize when page load.
const {sid,id} = options;
this.setData({
sid,
optScheid: id || 15045
})
app.getCurrentSchoolStudentId({
source_id: this.data.sid,
source_type: 10,
}).then((res) => {
// this.setData({
// studentInfo: res.student.formal_school_student
// })
this.getCourseDetail();
this.getErpLeaveTimes();
this.getErpLeavesList('init');
})
if(this.data.optScheid){
this.scheduleRemindConfirm(2)
}
},
onReady: function () {
},
onShow: function () {
},
scheduleRemindConfirm(action){
let that = this;
scheduleRemindConfirm({
schedule_id: that.data.optScheid,
action: action
}).then(res=>{
if(res.code==200){
switch(action){
case 1:
wx.showLoading({
title: '已确认',
duration: 200,
success(){
that.setData({
'coueseDetail.schedule_remind': {
confirm_status: 2
}
})
}
})
break;
case 2:
break;
}
}
})
},
getCourseDetail() {
wx.showLoading({
title: '加载中...'
})
scheduleDetail({
// school_id: this.data.sid,
schedule_id: this.data.optScheid
}).then((res) => {
const { code, data } = res;
wx.hideLoading();
if (code != 200) { // 失败的处理
} else {
const {start_time} = data;
const startDate = start_time.split(' ')[0];
const week = ['日', '一', '二', '三', '四', '五', '六'];
data.showTime = {
year: Number(startDate.split('-')[0]),
month: Number(startDate.split('-')[1]),
day: Number(startDate.split('-')[2]),
week: week[new Date(startDate).getDay()],
// starttime: starttime.slice(0, 5),
// endtime: starttime.slice(0, 5),
}
this.setData({
courseDetail: res.data,
nowDate: res.datetime
})
}
}).catch((e) => {
wx.hideLoading();
})
},
caculateArrLength(array) {
let _length = 0;
array.forEach(ele => {
_length = _length + ele.length;
})
return _length;
},
formIdCreate(e) {
const { formId } = e.detail;
formIdCreate({
formId
})
},
// 请假次数
getErpLeaveTimes(){
let that = this;
erpLeaveTimes({
school_id: this.data.sid
}).then(res=>{
const {data,code} = res;
if(code == 40000){
return
}
if(code!=200){
}else{
that.setData({
leaveTimes: data,
nowDate: res.datetime
})
}
})
},
// 请假列表
getErpLeavesList(type) {
if (!this.data.leavesHasmore) {
return;
}
if (this.data.LeavesListLoading) {
return
}
this.setData({
LeavesListLoading: true
})
erpLeavesList({
page: this.data.leavesPage,
perPage: 10,
school_id: this.data.sid,
status: '3,4'
}).then((res) => {
const { code, data } = res;
wx.hideLoading();
this.setData({
LeavesListLoading: false
})
if(code == 40000){
this.setData({
LeavesEmptyPage: true
})
return
}
if (code != 200) { // 失败的处理
} else {
if (data.total) {
this.setData({
leavesTotal: data.total
})
}
switch (type) {
case 'init': //页面进来第一次加载
this.setData({
leaves: [data.list]
})
if (this.data.leavesTotal > this.caculateArrLength(this.data.leaves)) {
let leavesPage = this.data.leavesPage + 1;
this.setData({
leavesPage,
})
} else { // 没有更多了
this.setData({
leavesHasmore: false
})
}
break;
case 'down': // 页面下拉刷新
this.setData({
leaves: [data.list]
})
if (this.data.leavesTotal > this.caculateArrLength(this.data.leaves)) {
let leavesPage = this.data.leavesPage + 1;
this.setData({
leavesPage,
})
} else { // 没有更多了
this.setData({
leavesHasmore: false
})
}
wx.stopPullDownRefresh();
break;
case 'up': // 页面上拉刷新
this.setData({
[`leaves[${this.data.leavesPage - 1}]`]: data.list
})
if (this.data.leavesTotal > this.caculateArrLength(this.data.leaves)) {
let leavesPage = this.data.leavesPage + 1;
this.setData({
leavesPage,
})
} else { // 没有更多了
this.setData({
leavesHasmore: false
})
}
break;
default:
break;
}
if (this.caculateArrLength(this.data.leaves) == 0) {
this.setData({
LeavesEmptyPage: true
})
} else {
this.setData({
LeavesEmptyPage: false,
})
}
}
}).catch((e) => {
this.setData({
LeavesListLoading: false
})
})
},
scrolltolowerLeaves(e) {
if (this.data.leavesHasmore) {
this.getErpLeavesList('up')
}
},
// 请假弹框
bindShowModalLeave(e){
let that = this;
that.setData({
modalLeaveShow: true
})
},
contentInput(e) {
const {
value
} = e.detail;
this.setData({
leaveContent: value
})
},
bindSubmitLeave(){
let that = this;
if(!that.data.leaveContent){
wx.showModal({
title: '提示',
content: '请输入请假原因',
showCancel: false,
confirmColor: '#65B8F4'
})
return
}
wx.showLoading({
title: '正在提交..'
})
erpLeaveAddOrEdit({
schedule_id: that.data.optScheid,
content: that.data.leaveContent
}).then(res=>{
wx.hideLoading();
const {data,code} = res;
if(code!=200){
}else{
wx.showToast({
title: '请假申请成功',
icon: 'success',
duration: 500,
success: function(){
that.setData({
'courseDetail.my_leave': {
status: res.data.status,
id: data.id
},
leaveContent: '',
modalLeaveShow: false
})
}
})
}
})
wx.hideLoading()
},
bindHideModalLeave(e){
let that = this;
that.setData({
modalLeaveShow: false
})
},
bindShowModalRecords(){
let that = this;
this.setData({
leavesPage: 1,
leavesHasmore : true
})
that.getErpLeavesList('init')
that.setData({
modalLeaveRecordShow: true
})
},
bindHideModalRecords(){
let that = this;
that.setData({
modalLeaveRecordShow: false
})
},
// 撤销请假
bindBackLeave(e){
let that = this;
that.setData({
modalBackLeaveShow: true
})
},
bindBackLeaveSubmit(){
let that = this;
erpLeaveAddOrEdit({
id: that.data.courseDetail.my_leave.id,
status: 2,//2撤销
}).then(res=>{
if(res.code!=200){
wx.showToast({
title: '操作失败',
icon: 'none',
})
}else{
wx.showToast({
title: '撤销成功',
icon: 'success',
duration: 500,
success: function(){
that.setData({
'courseDetail.my_leave':{
status: 2,
},
modalBackLeaveShow: false,
})
}
})
}
})
},
bindHideModalBackLeave(){
let that = this;
that.setData({
modalBackLeaveShow: false
})
},
true(){},
// 确认到课操作
bindArriveStatus(e){
let that = this;
that.scheduleRemindConfirm(1);
},
goindex() {
wx.reLaunch({
url: '/ucenter/index'
})
},
})
\ No newline at end of file
{
"usingComponents": {
"guidecollection": "../../../components/guidecollection",
"btn-drag":"../../../components/btndrag"
},
"navigationBarTitleText": "上课提醒",
"disableScroll": true
}
\ No newline at end of file
<wxs src="./../../../filter/index.wxs" module="filter" />
<view class="container">
<view class="schedule-detail">
<view class="time-box">
<view class="label">上课时间</view>
<view class="time"><text>周{{courseDetail.showTime.week}}</text> {{courseDetail.showTime.year}}年{{courseDetail.showTime.month}}月{{courseDetail.showTime.day}}日</view>
</view>
<view class="item-box">
<view class="line-item">
<image class="icon" src="{{localImageRoot}}2c/myschedule/icon_address.png?{{imageVersion}}"></image>
<view class="label">
<text class="text">上</text>
<text class="text">课</text>
<text class="text">地</text>
<text class="text">点</text>
</view>
<view class="content">{{courseDetail.class_room.title}}</view>
</view>
<view class="line-item">
<image class="icon" src="{{localImageRoot}}2c/myschedule/icon_course.png?{{imageVersion}}"></image>
<view class="label">
<text class="text">课</text>
<text class="text">程</text>
</view>
<view class="content">{{courseDetail.course.title}}</view>
</view>
<view class="line-item">
<image class="icon" src="{{localImageRoot}}2c/myschedule/icon_class.png?{{imageVersion}}"></image>
<view class="label">
<text class="text">班</text>
<text class="text">级</text>
</view>
<view class="content">{{courseDetail.class.title}}</view>
</view>
<view class="line-item">
<image class="icon" src="{{localImageRoot}}2c/myschedule/icon_teacher.png?{{imageVersion}}"></image>
<view class="label">
<text class="text">上</text>
<text class="text">课</text>
<text class="text">老</text>
<text class="text">师</text>
</view>
<view class="content">{{courseDetail.school_teacher.nickname}}</view>
</view>
</view>
</view>
<view class="bottom-box">
<view class="btn-group">
<!-- 请假中 + 已审核通过 + 已点名 不能点到课-->
<view class="btn btn-primary {{(courseDetail.my_leave && (courseDetail.my_leave.status==1 || courseDetail.my_leave.status==3)) || courseDetail.call_time?'btn-disabled':''}}" bindtap="bindArriveStatus">{{coueseDetail.schedule_remind && coueseDetail.schedule_remind.confirm_status==2?'已确认':'我会准时到课'}}</view>
<view class="btn" bindtap="bindShowModalLeave" wx:if="{{!courseDetail.my_leave || (courseDetail.my_leave.status!=1 && courseDetail.my_leave.status!=3)}}">我要请假</view>
<view class="btn" bindtap="bindBackLeave" wx:if="{{courseDetail.my_leave.status && courseDetail.my_leave.status==1}}">撤销请假</view>
<view class="btn" wx:if="{{courseDetail.my_leave && courseDetail.my_leave.status==3}}">请假已通过</view>
</view>
<view class="page-tip">
<view class="tipline">提交请假后,老师会第一时间审批</view>
<view class="tipline">审批结果第一时间会通过模板消息通知您</view>
</view>
</view>
<view class="modal-dialog modal-leaveopt" hidden="{{!modalLeaveShow}}" style="z-index: 100;" catchtouchmove='true'>
<view class="modal-mask"></view>
<view class="modal-box" style="z-index: 101;">
<view class="modal-title">请假</view>
<view class="modal-content">
<view class="textarea-box">
<textarea placeholder="输入请假原因..." fixed="true" bindinput="contentInput" value="{{leaveContent}}" wx:if="{{!modalLeaveRecordShow}}"></textarea>
</view>
<view class="record-box">
<view class="num-box">历史请假次数:{{leaveTimes}}次</view>
<view class="record" bindtap="bindShowModalRecords" wx:if="{{leavesTotal>0}}">查看请假记录
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
</view>
</view>
</view>
<view class="modal-bottom">
<view class="modal-btn" bindtap="bindHideModalLeave">取消
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
</view>
<view class="modal-btn btn-confirm" bindtap="bindSubmitLeave">提交
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
</view>
</view>
</view>
</view>
<view class="modal-dialog modal-record" hidden="{{!modalLeaveRecordShow}}" style="z-index: 102;" catchtouchmove='true'>
<view class="modal-mask"></view>
<view class="modal-box" style="z-index: 103;">
<view class="modal-title">请假记录</view>
<view class="modal-content">
<scroll-view class="record-list" scroll-y="{{true}}" lower-threhold="200" bindscrolltolower="scrolltolowerLeaves" wx:if="{{leavesTotal>0}}">
<block wx:for="{{leaves}}" wx:for-item="bigitem" wx:key="bigindex" wx:for-index="bigindex">
<view class="record-item" wx:for="{{bigitem}}" wx:for-item="item" data-leave="{{item}}" wx:key="{{index}}">
<view class="item-status status-wait" wx:if="{{item.status==1}}">待审批</view>
<view class="item-status status-back" wx:if="{{item.status==2}}">已撤销</view>
<view class="item-status status-pass" wx:if="{{item.status==3}}">已通过</view>
<view class="item-status status-refuse" wx:if="{{item.status==4}}">已驳回</view>
<view class="line-item line0">
<view class="class-title">{{item.schedule.class.title}}</view>
<view class="sche-time">{{filter.matchTime(item.schedule.start_time,'month')}} {{filter.matchTime(item.schedule.start_time,'hour')}}-{{filter.matchTime(item.schedule.end_time,'hour')}}</view>
</view>
<view class="line-item line1">请假原因:{{item.content}}</view>
<view class="line-item line2">申请日期:{{item.created_at}}</view>
<view class="line-item line3" wx:if="{{item.handled_at}}">
<view>审批人:<text class="name">{{item.operator.nickname}}</text></view>
<view>审批时间:{{item.handled_at}}</view>
</view>
</view>
</block>
<view class="more" wx:if="{{leavesHasmore}}">滑动查看更多</view>
</scroll-view>
</view>
<view class="modal-bottom">
<view class="modal-btn" bindtap="bindHideModalRecords">知道了
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
</view>
</view>
</view>
</view>
<view class="modal-dialog modal-backLeave" hidden="{{!modalBackLeaveShow}}" catchtouchmove='true'>
<view class="modal-mask"></view>
<view class="modal-box">
<view class="modal-content">
<view class="tip-content">确定要撤销请假操作吗?</view>
</view>
<view class="modal-bottom">
<view class="modal-btn" bindtap="bindHideModalBackLeave">取消
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
</view>
<view class="modal-btn btn-confirm" bindtap="bindBackLeaveSubmit">确定
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
</view>
</view>
</view>
</view>
</view>
<guidecollection/>
<btn-drag bind:btnDragEvent='goindex' tobottomDis='88' width='45' height="45" catchtouchmove="ture">
<view class="gohome" bindtap="goindex" slot="dragcontent">
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<image class="icon" src="{{localImageRoot}}ctabbar/ucenter.png?{{imageVersion}}"></image>
<view class="home-text" >我的</view>
</view>
</btn-drag>
\ No newline at end of file
This diff is collapsed.
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