Commit e522a63c authored by 吴颖's avatar 吴颖

'教练端课表接口对接,财务对接,课程管理详情接口对接'

parent c545fb1b
import {
Base
} from './utils/base.js';
const base = new Base()
App({
onLaunch: function () {
this.isReload() // 小程序是否有新版本
this.getSessionKey() // 获取token
this.getToken()
},
// 小程序是否有新版本
isReload: function () {
......@@ -40,7 +37,15 @@ App({
})
}
},
getToken() {
var that = this
try {
var token = wx.getStorageSync('token')
if (token) {
that.globalData.token = token
}
} catch (e) {}
},
// 获取sessionkey 提交后台换取基本openid unionid
getSessionKey: function (cb) {
let that = this
......@@ -95,10 +100,18 @@ App({
method: 'POST',
success: function (res) {
if (res.data.meta.code == 200) {
wx.showToast({
title: '授权成功',
icon: 'none',
duration: 2000
})
that.globalData.hasTel = res.data.data.hasTel
that.globalData.userInfo = res.data.data;
wx.setStorageSync('userInfo', res.data.data)
if (res.data.data.userTel) {
wx.setStorageSync('userTel', res.data.data.userTel)
}
} else {
console.log(res.data.meta.message)
wx.showToast({
title: res.data.meta.message,
icon: 'none',
......
// pages/index/classManagement/classManagement.js
const app = getApp()
import {
Base
} from '../../../utils/base.js';
const base = new Base()
Page({
/**
* 页面的初始数据
*/
data: {
showView : true,
coach_id: '5',
class_id: '16',
lesson_id: '69',
classTime: '', // 上课时间
showView: true,
list: [],
locked: false,
},
......@@ -13,71 +24,71 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
// coach_id: '5',
class_id: options.class_id,
lesson_id: options.lesson_id,
classTime: options.classTime, // 上课时间
})
this.getDetail()
},
getDetail() {
let params = {
url: 'coach/manage_lesson',
data: {
coach_id: this.data.coach_id,
class_id: this.data.class_id,
lesson_id: this.data.lesson_id
},
callback:(data)=>{
this.setData({
list: data,
locked: false
})
console.log(data)
}
}
base.newRequest(params)
},
showButton: function (e) {
let index = e.currentTarget.dataset.index
let list = this.data.list
let params = {
url: '',
data: {
},
showButton : function () {
var that = this;
that.setData({
showView : (!that.data.showView)
callback:(data)=>{
base.toast('签到成功')
list[index].sign_status = 1
this.setData({
list: list
})
},
gocourseInstant:function(){
}
base.newRequest(params)
},
gocourseInstant: function () {
wx.navigateTo({
url: '../../index/courseInstant/courseInstant',
})
},
goevaluation:function(){
goevaluation: function () {
wx.navigateTo({
url: '../../index/evaluation/evaluation',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
onPullDownRefresh() {
this.setData({
list: [],
locked: false,
})
if (!this.data.locked) {
this.setData({
locked: true
})
this.getDetail()
}
wx.stopPullDownRefresh()
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "课程管理"
"navigationBarTitleText": "课程管理",
"enablePullDownRefresh": true
}
\ No newline at end of file
<view class="top flex-h flex-vc flex-hb">
<view>
<view class="time">15:00~16:00</view>
<view class="time">{{classTime}}</view>
<view class="time_text">上课时间</view>
</view>
<view>
<view class="instant" catchtap="gocourseInstant">
<view class="instant flex-h flex-vc flex-hc" catchtap="gocourseInstant">
课程瞬间
<image src="../../../images/camera.png"></image>
<image src="/images/camera.png"></image>
</view>
</view>
</view>
<view class="cont">
<block wx:for="{{list}}" wx:key='index'>
<view class="item flex-h flex-vc flex-hb">
<view class="flex-h flex-vc">
<image src="../../../images/photo.png"></image>
<image src="{{item.child.thumb !=null ? item.child.thumb: '/images/default_head.png'}}"></image>
<view>
<view class="name">西西</view>
<view class="big_name">大名:王梓西</view>
<view class="name">{{item.child.nick_name != null ? item.child.nick_name: ''}}</view>
<view class="big_name">大名:{{item.child.child_name}}</view>
</view>
</view>
<view>
<view class="sign {{showView?'show':'hide'}}" bindtap="showButton">已签到</view>
<view class="evaluation {{showView?'hide':'show'}}" catchtap="goevaluation">运动评价</view>
</view>
</view>
<view class="item flex-h flex-vc flex-hb">
<view class="flex-h flex-vc">
<image src="../../../images/photo.png"></image>
<view>
<view class="name">西西</view>
<view class="big_name">大名:王梓甜</view>
</view>
</view>
<view>
<view wx:if="{{item.is_leave == 1}}" class="leave">已请假</view>
<view wx:if="{{item.is_leave == 0}}">
<!-- 未请假状态 -->
<view wx:if="{{item.sign_status == 1}}">
<view class="sign">已签到</view>
<view class="evaluation1">已评价</view>
<view class="evaluation1" wx:if='{{item.class_comment!=""}}'>已评价</view>
<view wx:if='{{item.class_comment==""}}' catchtap="goSport">运动评价</view>
</view>
<view wx:if="{{item.sign_status == 0}}">
<view class="sign1" bindtap="showButton" data-index="{{index}}">签到</view>
</view>
<view class="item flex-h flex-vc flex-hb">
<view class="flex-h flex-vc">
<image src="../../../images/photo.png"></image>
<view>
<view class="name">西西</view>
<view class="big_name">大名:王梓甜</view>
</view>
</view>
<view>
<!-- <view class="sign1">签到</view> -->
<view class="sign1 {{showView?'show':'hide'}}" bindtap="showButton">签到</view>
<view class="evaluation {{showView?'hide':'show'}}" catchtap="goevaluation">运动评价</view>
</view>
</view>
<view class="item flex-h flex-vc flex-hb">
<view class="flex-h flex-vc">
<image src="../../../images/photo.png"></image>
<view>
<view class="name">西西</view>
<view class="big_name">大名:王梓甜</view>
</view>
</view>
<view>
<view class="leave">已请假</view>
</view>
</view>
</block>
</view>
<view class="button">
......
page {
padding-bottom: 120rpx;
}
.top{
width: 100%;
height: 220rpx;
......
const app = getApp()
import { Base } from '../../../utils/base.js';
import {
Base
} from '../../../utils/base.js';
const base = new Base()
Page({
data: {
......@@ -21,7 +23,7 @@ Page({
base.toast('授权成功')
app.globalData.userTel = data.phoneNumber
wx.setStorageSync('userTel', data.phoneNumber)
if(app.globalData.backurl) {
if (app.globalData.backurl) {
if (app.globalData.backurl.indexOf('/pages/tabbar') != -1) {
wx.switchTab({
url: app.globalData.backurl,
......
......@@ -6,29 +6,6 @@ const base = new Base()
Page({
data: {
die: false,
isBindTel: false
},
onLoad: function (options) {
// this.checkPhone()
},
checkPhone() {
let params = {
// url: 'xcx/v2.0/checkphone',
data: {},
callback: (data) => {
wx.setStorageSync('userTel', data.tel)
this.setData({
isBindTel: true
})
},
errorback: (res) => {
base.toast('')
this.setData({
isBindTel: false
})
}
}
base.newRequest(params)
},
userInfoHandler: function (e) {
if (e.detail.errMsg == 'getUserInfo:ok') {
......@@ -38,7 +15,7 @@ Page({
}
},
showUserInfo: function () {
if (this.data.isBindTel) {
if (app.globalData.hasTel) {
base.toast('登录成功')
setTimeout(() => {
if (app.globalData.backurl) {
......
// pages/financial/financial.js
const app = getApp()
import {
Base
} from '../../../utils/base.js';
const base = new Base()
Page({
/**
* 页面的初始数据
*/
data: {
activeIndex: 1,
coach_id: '5',
detail: '',
type: '1', // 1:收益 2:提现 3:预存储
profitList: [], // 上课记录
profitPage: 1,
profitMore: true,
profitLocked: false,
withdrawList: [], // 提现
withdrawPage: 1,
withdrawMore: true,
withdrawLocked: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getMoney()
this.getList(1)
this.getList(2)
},
changeTab(e) {
let index = e.currentTarget.dataset.index
......@@ -23,55 +37,153 @@ Page({
activeIndex: index
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
getList(type) {
let params = {
url: 'commission/list',
data: {
wx_user_id: this.data.coach_id,
type: type,
pageSize: '15',
page: this.data.profitPage
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
callback: (data) => {
if (type == 1) {
this.setData({
profitList: this.data.profitList.concat(data.data.data),
profitPage: data.data.current_page + 1,
profitMore: data.hasMorePage,
profitLocked: false
})
console.log(this.data.profitList)
} else if (type == 2) {
this.setData({
withdrawList: this.data.withdrawList.concat(data.data.data),
withdrawPage: data.data.current_page + 1,
withdrawMore: data.hasMorePage,
withdrawLocked: false
})
}
}
}
base.newRequest(params)
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
getMoney() {
let params = {
url: 'commission',
data: {
wx_user_id: this.data.coach_id
},
callback: (data) => {
this.setData({
detail: data
})
}
}
base.newRequest(params)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
if (this.data.currentTabIndex==1) {
this.init2()
} else if (this.data.currentTabIndex==2) {
this.init3()
}
wx.stopPullDownRefresh()
},
init2() {
this.setData({
profitList: [], // 收益列表
profitPage: 1,
profitMore: true,
profitLocked: false
})
if (!this.data.profitLocked) {
this.setData({
profitLocked: true
})
this.getList(1)
}
},
init3() {
this.setData({
withdrawList: [], // 提现
withdrawPage: 1,
withdrawMore: true,
withdrawLocked: false
})
if (!this.data.withdrawLocked) {
this.setData({
withdrawLocked: true
})
this.getList(2)
}
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if (!this.data.locked && this.data.hasMore) {
this.setData({
locked: true
})
this.getStudent()
}
if (!this.data.profitLocked && this.data.profitMore) {
this.setData({
profitLocked: true
})
this.getList(1)
}
if (!this.data.withdrawLocked && this.data.withdrawMore) {
this.setData({
withdrawLocked: true
})
this.getList(2)
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return {
title: '3-12岁儿童家门口的体育课,新人立享超级优惠!',
imageUrl: this.data.detail.course.img,
path: '/pages/index/index?parent_id=' + this.data.user_id
}
},
withdrawClick() { // 提现
console.log(this.data.detail)
console.log(this.data.detail && this.data.detail.unrealized_revenue <= 0)
if (this.data.detail == '' || this.data.detail.unrealized_revenue <= 0) {
base.toast('提现金额不能小于0')
return
}
wx.showModal({
title: '提示',
content: '您确定要提现所有金额',
success:(res)=>{
if (res.confirm) {
let params = {
url: 'take_money',
type: 'POST',
data: {
wx_user_id: this.data.coach_id,
amount: this.data.detail.unrealized_revenue
},
callback:(data)=>{
base.toast('您的提现申请已提交')
}
}
base.newRequest(params)
} else if (res.cancel) {
console.log('取消')
}
}
})
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "财务"
"usingComponents": {
"van-empty": "/components/vant/empty/index"
},
"navigationBarTitleText": "财务",
"enablePullDownRefresh": true
}
\ No newline at end of file
......@@ -4,119 +4,90 @@
<text class="{{activeIndex == 2 ? 'active': ''}}" catchtap="changeTab" data-index="2">提现记录</text>
</view>
<view class="item_detail">
<view hidden="{{activeIndex == 1}}">
<view class="detailed flex-h">
<wxs module="time">
var time = function(str){
var newstr = str.split(' ');
return newstr[0];
}
module.exports = {
time:time
}
</wxs>
<view hidden="{{activeIndex != 1}}">
<view class="detailed flex-h flex-vc flex-hc">
<view class="item-one">
<view class="num">500</view>
<view class="num">{{detail ? detail.estimated_revenue: 0}}</view>
<view class="small">预计收益</view>
</view>
<view class="line"></view>
<view class="item-two">
<view class="num">300</view>
<view class="item-one">
<view class="num">{{detail ? detail.total_revenue: 0}}</view>
<view class="small">已结算</view>
</view>
</view>
<van-icon class="question_icon" name="question-o" />
<view class="tx">全部提现</view>
<view class="tip">提示:每周二为提现日!其他日不支持提现</view>
<view class="table">
<view class="table-tr">
<view class="table-th">日期</view>
<view class="table-th">提现金额</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
<view class="content1" wx:if="{{profitList.length > 0}}">
<view class="content1_head flex-h flex-vc">
<view style="width:30%">日期</view>
<view style="width:30%">结算金额</view>
<view style="width:40%">说明</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
<view class="content1_body">
<block wx:for="{{profitList}}" wx:key='index'>
<view class="content1_body_th flex-h flex-vc">
<view style="width:30%">{{time.time(item.created_at)}}</view>
<view style="width:30%">{{item.amount}}</view>
<view class="text-line-one" style="width:40%">{{item.remark}}</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
</block>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
<view wx:else class="empty">
<van-empty
class="custom-image"
image="/images/without.png"
description="暂无上课记录"
/>
</view>
</view>
</view>
<view hidden="{{activeIndex == 2}}">
<view class="detailed flex-h">
<view hidden="{{activeIndex != 2}}">
<view class="detailed flex-h flex-hc flex-vc">
<view class="item-one">
<view class="num">2000</view>
<view class="small">预计收益</view>
<view class="num">{{detail? detail.unrealized_revenue: 0}}</view>
<view class="small">余额</view>
</view>
<view class="line"></view>
<view class="item-two">
<view class="num">1520</view>
<view class="item-one">
<view class="num">{{detail? detail.sales_revenue: 0}}</view>
<view class="small">已结算</view>
</view>
</view>
<van-icon class="question_icon" name="question-o" />
<view class="table">
<view class="table-tr">
<view class="table-th">日期</view>
<view class="table-th">结算金额</view>
<view class="table-th">说明</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
<view class="table-td">用户"西西"第一节课</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
<view class="table-td">用户"西西"第一节课</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
<view class="table-td">用户"西西"第一节课</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
<view class="table-td">用户"西西"第一节课</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
<view class="table-td">用户"西西"第一节课</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
<view class="table-td">用户"西西"第一节课</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
<view class="table-td">用户"西西"第一节课</view>
</view>
<view class="table-tr">
<view class="table-td">2020-10-28</view>
<view class="table-td">10</view>
<view class="table-td">用户"西西"第一节课</view>
<view class="share" catchtap="withdrawClick">全部提现</view>
</view>
<view class="tip">提示:每周二为提现日!其他日不支持提现</view>
<view class="content1" wx:if='{{withdrawList.length > 0}}'>
<view class="content1_head flex-h flex-vc">
<view style="width:50%">日期</view>
<view style="width:50%">提现金额</view>
</view>
<view class="content1_body">
<block wx:for="{{withdrawList}}" wx:key='index'>
<view class="content1_body_th flex-h flex-vc">
<view style="width:50%">{{time.time(item.created_at)}}</view>
<view style="width:50%">{{item.amount}}</view>
</view>
</block>
</view>
</view>
<view wx:else class="empty">
<van-empty
class="custom-image"
image="/images/without.png"
description="暂无提现记录"
/>
</view>
</view>
</view>
......
.tablist {
width: 690rpx;
height: 68rpx;
......@@ -10,15 +9,18 @@
margin: 56rpx auto 30rpx;
overflow: hidden;
}
.tablist text{
.tablist text {
width: 50%;
font-size: 26rpx;
color: #000000;
}
.tablist text.active {
background: #FFC600;
}
.number{
.number {
width: 690rpx;
height: 180rpx;
background: #FFFFFF;
......@@ -27,50 +29,59 @@
box-shadow: 0 10rpx 20rpx 10rpx rgba(239, 240, 241, 0.72);
position: relative;
}
.number .item-one{
.number .item-one {
position: absolute;
top: 32rpx;
left: 100rpx;
}
.number .item-one .num{
.number .item-one .num {
color: #000000;
font-size: 50rpx;
}
.number .item-one .small{
.number .item-one .small {
color: #B3B3B3;
font-size: 24rpx;
text-align: center;
}
.number .line{
.number .line {
width: 2rpx;
height: 80rpx;
background:#EBEBEB;
background: #EBEBEB;
position: absolute;
top: 46rpx;
left: 344rpx;
}
.number .item-two{
.number .item-two {
position: absolute;
top: 32rpx;
right: 142rpx;
}
.number .item-two .num{
.number .item-two .num {
color: #000000;
font-size: 50rpx;
}
.number .item-two .small{
.number .item-two .small {
color: #B3B3B3;
font-size: 24rpx;
text-align: center;
}
.number .question_icon{
.number .question_icon {
position: absolute;
right: 30rpx;
top: 40rpx;
font-size: 30rpx;
color: #999999;
}
.number .share{
.number .share {
width: 105rpx;
height: 40rpx;
background: linear-gradient(-62deg, #FF7800 0%, #FF9D1F 100%);
......@@ -83,61 +94,50 @@
top: 100rpx;
right: 0;
}
.detailed{
.detailed {
width: 690rpx;
height: 180rpx;
background: linear-gradient(25deg, #212121 0%, #3B3B3B 100%);
background: url('https://wdty.xueyoubangedu.com/wandou/moneybg.png') no-repeat;
background-size: 100% 100%;
border-radius: 15px;
margin: 30rpx auto;
box-shadow: 0 10rpx 20rpx 10rpx rgba(239, 240, 241, 0.72);
position: relative;
}
.detailed .item-one{
position: absolute;
top: 32rpx;
left: 100rpx;
.detailed .item-one {
text-align: center;
width: 50%;
}
.detailed .item-one .num{
.detailed .item-one .num {
color: #FFDEAA;
font-size: 50rpx;
}
.detailed .item-one .small{
.detailed .item-one .small {
color: #999999;
font-size: 24rpx;
text-align: center;
}
.detailed .line{
.detailed .line {
width: 2rpx;
height: 80rpx;
background:#EBEBEB;
background: #EBEBEB;
position: absolute;
top: 46rpx;
left: 344rpx;
}
.detailed .item-two{
position: absolute;
top: 32rpx;
right: 142rpx;
}
.detailed .item-two .num{
color: #FFDEAA;
font-size: 50rpx;
}
.detailed .item-two .small{
color: #999999;
font-size: 24rpx;
text-align: center;
}
.question_icon{
.question_icon {
position: absolute;
right: 60rpx;
top: 180rpx;
right: 30rpx;
top: 20rpx;
font-size: 30rpx;
color: #999999;
}
.tx{
width: 116rpx;
.share {
padding: 0 15rpx;
height: 40rpx;
background: linear-gradient(-62deg, #FF7800 0%, #FF9D1F 100%);
border-radius: 20px 0px 0px 20px;
......@@ -146,12 +146,11 @@
text-align: center;
line-height: 40rpx;
position: absolute;
top: 234rpx;
right: 32rpx;
padding-left: 10rpx;
padding-right: 4rpx;
top: 90rpx;
right: 0;
}
.tip{
.tip {
width: 690rpx;
height: 53rpx;
background: #FFF2DD;
......@@ -162,44 +161,39 @@
padding-left: 12rpx;
margin-left: 30rpx;
}
/* table表格 */
.table{
.content1 {
width: 690rpx;
height: 750rpx;
background: #FFFFFF;
border-radius: 15px;
box-shadow: 0 10rpx 20rpx 10rpx rgba(239, 240, 241, 0.72);
margin-bottom: 20rpx;
display: table;
border-collapse: collapse;
box-sizing: border-box;
display: table;
text-align: center;
}
.table, .table div {
margin: 30rpx auto;
}
.table-tr {
display: table-row;
height: 92rpx;
.content1_head {
height: 80rpx;
border-bottom: 1px solid #EBEBEB;
}
.table-tr:last-child{
border-bottom: none;
}
.table-tr:nth-child(2n){
background: #F7F8FA;
}
.table-th{
display: table-cell;
font-weight: bold;
text-align: center;
vertical-align: middle;
line-height: 80rpx;
font-size: 24rpx;
color: #333333;
}
.table-td{
display: table-cell;
text-align: center;
vertical-align: middle;
padding: 0 10rpx;
}
.content1_body {
padding: 0 10rpx;
}
.content1_body_th {
height: 80rpx;
line-height: 80rpx;
font-size: 24rpx;
color: #B3B3B3;
}
\ No newline at end of file
}
.content1_body_th view:nth-child(1) {
color: #666;
}
.content1_body_th:nth-child(2n) {
background: #F7F8FA;
}
\ No newline at end of file
......@@ -13,25 +13,8 @@ Page({
data: {
coach_id: '5',
isOpen: false,
daysColor: [{
month: 'current',
day: '12',
color: '#fff',
background: '#FF6E00'
},
{
month: 'current',
day: '10',
color: '#fff',
background: 'linear-gradient(#5791FE 0%, #3E63F8 100%);'
},
{
month: 'current',
day: '8',
color: '#fff',
background: 'linear-gradient(#5791FE 0%, #3E63F8 100%);'
}
],
daysColor: [],
today: '', // 今天日期
curDate: '',
list: [],
allList: []
......@@ -45,8 +28,10 @@ Page({
title: '加载中...',
})
this.setData({
today: util.formatTime(new Date()),
curDate: util.formatTime(new Date())
})
console.log(this.data.today == this.data.curDate)
this.getAllList()
this.getList()
},
......@@ -146,21 +131,23 @@ Page({
isOpen: !this.data.isOpen
})
},
goclassManagement: function () {
wx.navigateTo({
url: '../../index/classManagement/classManagement',
})
},
goclassDetail: function () {
goclassManagement: function (e) {
let item = e.currentTarget.dataset.item
let classTime = item.start_time + '' + item.end_time
wx.navigateTo({
url: '../../index/classDetail/classDetail',
url: '/pages/index/classManagement/classManagement?classTime=' + classTime + '&class_id=' + item.class_id + '&lesson_id=' + item.id,
})
},
goDetail(e) {
let item = e.currentTarget.dataset.item
console.log(item)
let classTime = item.start_time + '' + item.end_time
// console.log(item)
// wx.navigateTo({
// url: '/pages/index/classDetail/classDetail',
// })
wx.navigateTo({
url: '/pages/index/classDetail/classDetail',
url: '/pages/index/classManagement/classManagement?classTime=' + classTime + '&class_id=' + item.class_id + '&lesson_id=' + item.id,
})
},
})
\ No newline at end of file
......@@ -10,27 +10,44 @@
</view>
</view>
</view>
<wxs module="util">
var time = function() {
var hour = getDate().getHours()
var minute = getDate().getMinutes()
var time = hour + ':' + minute
console.log(hour)
console.log(minute)
return time
}
module.exports = {
time: time
}
</wxs>
<view wx:if='{{list.length > 0}}'>
<block wx:for="{{list}}" wx:key='index' >
<view class="cont flex-v flex-hb" catchtap="goclassDetail">
<view class="top">
<view class="time_title">{{item.course.name}}</view>
<view wx:if='{{today != curDate}}'>
<view class="over" wx:if="{{item.class_status_display == '已结束'}}">{{item.class_status_display}}</view>
<view class="state" wx:if="{{item.class_status_display == '即将开课'}}">{{item.class_status_display}}</view>
</view>
<view wx:else>
<view class="state">{{item.class_status_display}}</view>
<view class="inclass">上课中</view>
<view class="state" wx:if='{{util.time() < item.start_time}}'>即将开课</view>
<view class="inclass" wx:if='{{util.time() > item.start_time && util.time()< end_time}}'>开课中</view>
<view class="over" wx:if='{{util.time() > item.end_time }}'>已结束</view>
</view>
</view>
<view class="time">上课时间:{{item.class_date}} {{item.start_time}}-{{item.end_time}} </view>
<view class="place">上课地点:{{item.stadium.name}}</view>
<view>
<view class="manage1" catchtap="goDetail" wx:if="{{item.class_status_display == '已结束'}}" data-item='{{item}}'>查看详情</view>
<view wx:else class="manage" catchtap="goclassManagement">管理</view>
<view class="manage1" catchtap="goDetail" wx:if="{{item.lesson_status == 1}}" data-item='{{item}}'>查看详情</view>
<view wx:else class="manage" catchtap="goclassManagement" data-item="{{item}}">管理</view>
</view>
</view>
</block>
</view>
<view wx:else class="empty">
<van-empty
......
......@@ -42,12 +42,6 @@
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"list": []
},
"conversation": {
"list": []
},
"plugin": {
"list": []
},
......@@ -154,6 +148,18 @@
"id": -1,
"name": "pages/team/teamDetail/teamDetail",
"pathName": "pages/team/teamDetail/teamDetail",
"query": "",
"scene": null
},
{
"name": "财务",
"pathName": "pages/tabbar/financial/financial",
"query": "",
"scene": null
},
{
"name": "课程管理详情页面",
"pathName": "pages/index/classManagement/classManagement",
"scene": null
}
]
......
......@@ -12,22 +12,15 @@ class Base {
params.type = 'GET'
}
var cur_url = that.baseUrl + params.url
// if (flag) {
// params.url = params.url;
// } else {
// params.url = that.baseUrl + params.url;
// }
console.log(cur_url)
wx.request({
url: cur_url,
data: params.data,
method: params.type,
header: {
'token': wx.getStorageSync('token'),
'token': app.globalData.token,
'app': 'coach'
},
success: function (res) {
console.log(res)
params.ischeckedCallback && params.ischeckedCallback() //防止用户多次点击,请求完成后让用户可点
if (wx.showLoading()) {
wx.hideLoading() //隐藏加载动画
......@@ -35,11 +28,11 @@ class Base {
if (res.statusCode == 200) {
let rstcode = res.data.meta.code.toString() //接口返回的错误码
if (rstcode == '200') {
params.callback && params.callback(res.data.data)
params.callback && params.callback(res.data.data, res) // 请求成功
} else if (rstcode == '400') {
if (!flag) { // 400 token过期
if (!flag) {
app.getSessionKey(function () {
that.newRequest(params, true)
that.newRequest(params, true, tips)
})
}
} else if (rstcode == '404') {
......@@ -56,8 +49,12 @@ class Base {
duration: 2000
})
}
}
} else {
if (wx.showLoading()) {
wx.hideLoading() //隐藏加载动画
}
wx.showModal({
title: '错误',
content: '网络请求失败'
......@@ -66,6 +63,7 @@ class Base {
}
})
}
//富文本
richText(detail) {
if (detail != '' && detail != null && detail != undefined) {
......
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