Commit 7a7bb8e0 authored by 吴颖's avatar 吴颖

Merge branch 'wuying' into 'master'

Wuying

See merge request !49
parents 1b4985ea bab50453
......@@ -136,5 +136,6 @@ App({
token: '',
backurl: '', // 全局跳转页面路径
coach_id: '', // 教练id
classRush: false // 抢班是否成功
}
})
\ No newline at end of file
......@@ -40,18 +40,14 @@ page{
background: #fff;
border-radius: 15rpx;
}
.imgbox view{
margin-left:26rpx;
}
.bigimg {
width: 150rpx;
height: 150rpx;
width: 180rpx;
height: 180rpx;
border-radius: 50%;
margin: 0 28rpx 50rpx 28rpx;
}
.bigimg:nth-child(3n-1) {
margin: 0 64rpx 50rpx 64rpx;
margin: 0 25rpx 50rpx 25rpx;
}
/* 按钮样式 */
.button{
width: 750rpx;
......
......@@ -21,10 +21,7 @@ Page({
coach_id: app.globalData.coach_id,
class_id: options.class_id,
lesson_id: options.lesson_id,
})
console.log(options.lesson_id)
console.log(options.class_id)
this.getlessondetail()
},
......
......@@ -51,12 +51,10 @@ Page({
}
},
getDate() {
let date = util.formatTime(new Date())
let newDate = new Date()
const hour = newDate.getHours()
const minute = newDate.getMinutes()
let time = date + ' ' + hour + ':' + minute
if (time > this.data.courseTime) {
let curTime = new Date().getTime()
let str = this.data.courseTime.split(' ')[0] + ' ' + this.data.courseTime.split('')[1]
let courseTime = new Date(str).getTime()
if (curTime > courseTime) {
this.setData({
isMoment: true
})
......
......@@ -14,6 +14,8 @@ Page({
imgBox: [],
imgShow: true,
fileList: [],
show: false,
autoplay: false
},
/**
......@@ -35,7 +37,6 @@ Page({
lesson_id: this.data.lesson_id
},
callback:(data)=>{
console.log(data.class_moment)
if (data.class_moment !=null) {
let class_moment = JSON.parse(data.class_moment)
let arr1 = [], arr2 = []
......@@ -180,6 +181,14 @@ Page({
},
paly() { // 播放视频
this.setData({
autoplay: true,
show: true,
})
},
onClose() {
this.setData({
show: false
})
}
})
\ No newline at end of file
{
"usingComponents": {},
"usingComponents": {
"van-popup": "/components/vant/popup/index"
},
"navigationBarTitleText": "课程瞬间"
}
\ No newline at end of file
<view wx:if="{{type != 'check'}}">
<view wx:if="{{type == 'check'}}">
<view class="video">
<view class="head">
<text class="title">运动工程</text>
</view>
<view class="imgBox flex-h">
<view class="img videoBox" wx:for="{{videoBox}}" wx:for-item="item" wx:key="idx">
<video src="{{item.url}}" data-index="{{index}}" bindplay='paly'></video>
<video src="{{item.url}}" data-index="{{index}}" bindplay='paly' wx:if="{{!show}}"></video>
</view>
</view>
</view>
......@@ -19,6 +19,11 @@
</view>
</view>
</view>
<van-popup show="{{ show }}" bind:close="onClose">
<view class="showVideo">
<video src="{{videoBox[0].url}}"></video>
</view>
</van-popup>
</view>
<view wx:else>
<view class="video">
......@@ -29,7 +34,7 @@
<view class="imgBox flex-h">
<view class="img videoBox" wx:for="{{videoBox}}" wx:for-item="item" wx:key="idx">
<video src="{{item.url}}" data-index="{{index}}"></video>
<view class="delete-btn" data-index="{{index}}" catchtap="deleteVideo" wx:if="{{type != 'check'}}">
<view class="delete-btn" data-index="{{index}}" catchtap="deleteVideo">
<text class='iconfont iconguanbi'></text>
</view>
</view>
......@@ -46,17 +51,17 @@
<view class="imgBox flex-h flex-hw">
<view class="img" wx:for="{{imgBox}}" wx:for-item="item" wx:key="idx">
<image src="{{item.url}}" data-index="{{index}}" mode="aspectFill" bindtap="previewImg"></image>
<view class="delete-btn" data-index="{{index}}" catchtap="deleteImg" wx:if="{{type != 'check'}}">
<view class="delete-btn" data-index="{{index}}" catchtap="deleteImg">
<text class='iconfont iconguanbi'></text>
</view>
</view>
<view class='addBox flex-h flex-vc flex-hc' bindtap="chooseImg"
wx:if="{{imgBox.length < 9 && type != 'check' }}">
wx:if="{{imgBox.length < 9}}">
<text class='iconfont iconxiangji'></text>
</view>
</view>
</view>
<view class="button" wx:if="{{type != 'check'}}">
<view class="button">
<view class="submit" catchtap="save">提交</view>
</view>
......
......@@ -88,3 +88,12 @@ page {
text-align: center;
line-height: 80rpx;
}
.showVideo {
width: 6400rpx;
height: 430rpx;
}
.showVideo video {
width: 100%;
height: 100%;
}
\ No newline at end of file
......@@ -64,7 +64,6 @@ Page({
deleteBadge: function (e) {
var imgs = this.data.imgBox
var index = e.currentTarget.dataset.index
// console.log(index)
imgs.splice(index, 1)
this.setData({
imgBox: imgs
......
......@@ -17,10 +17,12 @@ Page({
lesson_id: '',
child_id: '',
class_single_id: '',
ec: null,
ec: {
lazyLoad: true // 延迟加载
},
},
onLoad: function (options) {
this.init()
this.setData({
coach_id: app.globalData.coach_id,
class_id: options.class_id,
......@@ -31,33 +33,6 @@ Page({
this.getcomment()
this.getbadges()
},
init() {
const getPixelRatio = () => {
let pixelRatio = 0
wx.getSystemInfo({
success: function (res) {
pixelRatio = res.pixelRatio
},
fail: function () {
pixelRatio = 0
}
})
return pixelRatio
}
var dpr = getPixelRatio()
this.setData({
ec: {
onInit: function (canvas, width, height) {
chartLine = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: dpr
});
canvas.setChart(chartLine);
}
}
})
},
getcomment: function () {
let params = {
url: 'coach/comment',
......@@ -84,13 +59,37 @@ Page({
arrs.push(option)
newArrs.push(this.data.scoreList[i].score)
}
this.getOption(arrs, newArrs)
this.initCharts(arrs, newArrs)
}
},
}
base.newRequest(params)
},
initCharts(arrs, newArrs) {
var that = this
const getPixelRatio = () => {
let pixelRatio = 0
wx.getSystemInfo({
success: function (res) {
pixelRatio = res.pixelRatio
},
fail: function () {
pixelRatio = 0
}
})
return pixelRatio
}
that.selectComponent('#mychart').init((canvas, width, height) => {
var chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: getPixelRatio()
});
chart.setOption(that.getOption(arrs, newArrs));
return chart;
})
},
getOption(xData, data_cur) {
var option = {
backgroundColor: "#ffffff",
......@@ -102,7 +101,7 @@ Page({
show: false
},
radar: {
radius: 90,
radius: 94,
center: ['50%', '50%'],
shape: 'circle',
splitNumber: 4, // 分割段数
......@@ -157,8 +156,7 @@ Page({
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
colorStops: [{
offset: 0,
color: '#00E24A'
},
......@@ -172,7 +170,7 @@ Page({
}]
};
chartLine.setOption(option);
return option
},
getbadges: function () {
let params = {
......
......@@ -10,7 +10,7 @@
<view class="flex-h flex-vc">
<view class="teacher_left flex-v flex-hc">
<image src="/images/default_head.png" wx:if="{{coach.thumb == null}}"></image>
<image src="{{coach.thumb}}" wx:else></image>
<image src="{{coach.thumb}}" wx:else mode="aspectFill"></image>
<text class="name">{{coach.title}}</text>
</view>
<view class="teacher_right">{{coachcomment.class_comment}}</view>
......
......@@ -51,6 +51,7 @@ page {
margin: 40rpx auto;
}
.teacher_left{
width: 80rpx;
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 500;
......
......@@ -34,7 +34,6 @@ Page({
coach_id: this.data.coach_id
},
callback: (data) => {
console.log(data)
wx.hideLoading();
this.setData({
datalList: data,
......@@ -75,12 +74,17 @@ Page({
class_id: class_id
},
callback: (data) => {
app.globalData.classRush = true
base.toast('抢班成功')
this.setData({
datalList: []
datalList: [],
classList: [],
})
this.getList()
this.getMyclasslist()
},
confirmback:()=>{
app.globalData.classRush = false
}
}
base.newRequest(params)
......@@ -102,6 +106,7 @@ Page({
initData: function () {
this.setData({
datalList: [],
classList: [],
locked: false
})
},
......@@ -111,7 +116,8 @@ Page({
this.setData({
locked: true
})
this.onLoad();
this.getList()
this.getMyclasslist();
}
wx.stopPullDownRefresh()
},
......
......@@ -11,10 +11,11 @@ Page({
*/
data: {
coach_id: '',
// isOpen: false,
daysColor: [],
today: '', // 今天日期
curDate: '',
curTime: '', // 选中日期 与curDate格式不同返回格式是毫秒级
curDate: '', // 选中日期
list: [],
allList: [],
month: '',
......@@ -43,13 +44,22 @@ Page({
let month = util.formatNumber(new Date().getMonth() + 1)
this.setData({
coach_id: app.globalData.coach_id,
today: util.formatTime(new Date()),
today: new Date(util.formatTime(new Date())).getTime(),
curTime: new Date(util.formatTime(new Date())).getTime(),
curDate: util.formatTime(new Date()),
month: year + month
})
this.getAllList()
this.getList()
},
onShow() {
if (app.globalData.classRush) { // 抢班成功之后刷新当前页面
this.initData()
this.getAllList()
this.getList()
app.globalData.classRush = false
}
},
getAllList() {
wx.showLoading({
title: '加载中...',
......@@ -82,6 +92,8 @@ Page({
list: data,
locked: false
})
console.log(this.data.list)
}
}
base.newRequest(params)
......@@ -109,14 +121,15 @@ Page({
class: 'circle_data'
})
})
// const calendar = this.selectComponent('#calendar').calendar;
calendar.setDateStyle(daysColor)
},
afterTapDate(e) {
const calendar = this.selectComponent('#calendar').calendar
calendar.cancelSelectedDates()
this.setData({
curDate: e.detail.year + '-' + util.formatNumber(e.detail.month) + '-' + util.formatNumber(e.detail.date)
curDate: e.detail.year + '-' + util.formatNumber(e.detail.month) + '-' + util.formatNumber(e.detail.date),
today: new Date(util.formatTime(new Date())).getTime(),
curTime: new Date(e.detail.year + '-' + util.formatNumber(e.detail.month) + '-' + util.formatNumber(e.detail.date)).getTime(),
})
const toSet = [
{
......@@ -130,7 +143,7 @@ Page({
if (!this.data.locked) {
this.setData({
locked: true,
courseList: [],
list: [],
})
this.getList();
}
......@@ -142,34 +155,6 @@ Page({
})
this.getAllList();
},
// prev: function (event) {
// let currentMonth = util.formatNumber(event.detail.currentMonth)
// this.setData({
// month: event.detail.currentYear + currentMonth
// })
// this.getAllList();
// },
// next: function (event) {
// let currentMonth = util.formatNumber(event.detail.currentMonth)
// this.setData({
// month: event.detail.currentYear + currentMonth
// })
// this.getAllList();
// },
// dayClick: function (event) {
// console.log(event)
// this.setData({
// curDate: event.detail.year + '-' + util.formatNumber(event.detail.month) + '-' + util.formatNumber(event.detail.day)
// })
// if (!this.data.locked) {
// this.setData({
// locked: true,
// courseList: [],
// })
// this.getList();
// }
// },
onChange(e) {
let index = e.currentTarget.dataset.index
let list = this.data.classlist
......@@ -186,12 +171,6 @@ Page({
})
}
},
// 日历展开与否
// open() {
// this.setData({
// isOpen: !this.data.isOpen
// })
// },
goclassManagement: function (e) {
let item = e.currentTarget.dataset.item
let classTime = this.data.curDate + ' ' + item.start_time + '' + item.end_time
......
......@@ -9,38 +9,21 @@
bind:whenChangeMonth="whenChangeMonth"
/>
</view>
<!-- <view class="riliShow">
<view class="flex-h flex-vc flex-hc" catchtap="open">
<text>{{isOpen ? '收起':'更多日期'}}</text>
<text class="iconfont icongengduo {{isOpen ? 'up': 'down'}}"></text>
</view>
</view> -->
</view>
<wxs module="util">
var time = function() {
var hour = getDate().getHours()
var minute = getDate().getMinutes()
var time = hour + ':' + minute
return time
}
module.exports = {
time: time
}
</wxs>
</view>
<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 flex-h flex-vc flex-hb">
<view class="time_title">{{item.course.name}}</view>
<view wx:if='{{today != curDate}}'>
<view wx:if='{{today != curTime}}'>
<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" wx:if='{{util.time() < item.start_time}}'>即将开课</view>
<view class="inclass" wx:if='{{util.time() > item.start_time && util.time()< item.end_time}}'>开课中</view>
<view class="over" wx:if='{{util.time() > item.end_time }}'>已结束</view>
<view class="state" wx:if='{{item.time_status == 1}}'>即将开课</view>
<view class="inclass" wx:elif='{{ item.time_status == 2 }}'>开课中</view>
<view class="over" wx:elif='{{item.time_status == 3}}'>已结束</view>
</view>
</view>
<view class="time">上课时间:{{item.class_date}} {{item.start_time}}-{{item.end_time}} </view>
......
......@@ -90,7 +90,7 @@
}
/* 已结束样式 */
.over{
color: #B3B3B3;
color: #B3B3B3 !important;
font-size: 24rpx;
}
.cont .time{
......
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