Commit 6a5101d9 authored by 吴颖's avatar 吴颖

'上传课程瞬间,签到'

parent c67e040b
App({
onLaunch: function () {
console.log('222222222')
this.isReload() // 小程序是否有新版本
// this.getLogin()
this.getToken()
},
// 小程序是否有新版本
......@@ -37,6 +39,24 @@ App({
})
}
},
getLogin() {
let userInfo = wx.getStorageSync('userInfo')
if (userInfo) {
this.globalData.userInfo = userInfo
}
console.log(userInfo)
if (userInfo) {
wx.switchTab({
url: '/pages/tabbar/index/index',
})
} else {
if (userInfo) { // 判断有没有申请教练
wx.redirectTo({
url: '/pages/sign/apply/apply',
})
}
}
},
getToken() {
var that = this
try {
......
{
"pages":[
"pages/tabbar/index/index",
"pages/sign/login/login",
"pages/sign/bindTel/bindTel",
"pages/sign/apply/apply",
"pages/sign/applyResult/applyResult",
"pages/tabbar/class/class",
"pages/tabbar/financial/financial",
"pages/tabbar/personal/personal",
......@@ -11,10 +16,7 @@
"pages/index/classDetail/classDetail",
"pages/index/performance/performance",
"pages/index/evaluation/evaluation",
"pages/team/teamDetail/teamDetail",
"pages/sign/login/login",
"pages/sign/bindTel/bindTel"
"pages/team/teamDetail/teamDetail"
],
"tabBar":{
"custom":false,
......
const app = getApp()
import { Base } from '../../../utils/base.js';
import {
Base
} from '../../../utils/base.js';
const base = new Base()
Page({
data: {
stuList:[],
courseData : '',
coach_id: '',
class_id: '',
lesson_id: '',
stuList: [],
courseData: '',
noticeCount: 9,
},
onLoad: function (options) {
this.setData({
class_id: options.class_id,
lesson_id: options.lesson_id
})
console.log(options.lesson_id)
this.getlessondetail()
},
getlessondetail : function (){
const {coach_id, class_id,lesson_id} = this.data
getlessondetail: function () {
let params = {
url:'coach/lessondetail',
data:{
coach_id : 5,
class_id : 16,
lesson_id : 69
url: 'coach/lessondetail',
data: {
coach_id: 5,
class_id: this.data.class_id,
lesson_id: this.data.lesson_id
},
callback : (data) => {
callback: (data) => {
console.log(data)
this.setData({
courseData : data,
stuList : data.class_single_person
courseData: data,
stuList: data.class_single_person
})
}
}
base.newRequest(params)
},
goperformance:function(e){
goperformance: function (e) {
var child_id = e.currentTarget.dataset.id
console.log(child_id)
wx.navigateTo({
......
......@@ -19,7 +19,7 @@
<image src="/images/default_head.png" wx:if="{{item.child.thumb == null}}"></image>
<image src="{{item.child.thumb}}" wx:else></image>
<view>
<view class="name">{{item.child.nick_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>
......
......@@ -10,8 +10,8 @@ Page({
*/
data: {
coach_id: '5',
class_id: '16',
lesson_id: '69',
class_id: '',
lesson_id: '',
classTime: '', // 上课时间
showView: true,
list: [],
......@@ -51,31 +51,32 @@ Page({
base.newRequest(params)
},
showButton: function (e) {
let index = e.currentTarget.dataset.index
let list = this.data.list
let child_id = e.currentTarget.dataset.id
let params = {
url: '',
url: 'coach/sign',
data: {
coach_id: this.data.coach_id,
lesson_id: this.data.lesson_id,
child_id: child_id
},
callback:(data)=>{
base.toast('签到成功')
list[index].sign_status = 1
this.setData({
list: list
list: []
})
this.getDetail()
},
}
base.newRequest(params)
},
gocourseInstant: function () {
wx.navigateTo({
url: '../../index/courseInstant/courseInstant',
url: '/pages/index/courseInstant/courseInstant',
})
},
goevaluation: function () {
wx.navigateTo({
url: '../../index/evaluation/evaluation',
url: '/pages/index/evaluation/evaluation',
})
},
onPullDownRefresh() {
......
......@@ -29,7 +29,7 @@
<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 class="sign1" bindtap="showButton" data-id='{{item.child.id}}'>签到</view>
</view>
</view>
</view>
......
// pages/index/courseInstant/courseInstant.js
const app = getApp()
import {
Base
} from '../../../utils/base.js';
const base = new Base()
var qiniuUploader = require("../../../utils/qiniuUploader");
Page({
data: {
videoBox: [],
videoShow: true,
imgBox: [],
imgShow: true,
fileList: [],
},
afterRead(event) {
const { file } = event.detail;
wx.uploadFile({
url: 'https://example.weixin.qq.com/upload',
filePath: file.path,
name: 'file',
formData: { user: 'test' },
success(res) {
const { fileList = [] } = this.data;
fileList.push({ ...file, url: res.data });
this.setData({ fileList });
},
});
},
/**
* 生命周期函数--监听页面加载
......@@ -24,53 +20,122 @@ Page({
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
// 上传视频
chooseVideo: function () {
base.initQiniu();
var that = this
var videos = this.data.videoBox
wx.chooseVideo({
sourceType: ['album', 'camera'],
camera: 'back',
compressed: false,
success(res) {
console.log(res)
var tempFilePaths = [res.tempFilePath]
if (Math.round(res.size / 1024 / 1024) < 25) {
qiniuUploader.upload(0, tempFilePaths, (res) => {
console.log(res)
let option = {
type: 'video',
url: res[0].imageURL
}
videos.push(option)
that.setData({
videoBox: videos,
videoShow: false
});
console.log(that.data.videoBox)
})
} else {
base.toast('视频大小不能超过25兆,请重新选择')
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
fail() {
base.toast('上传视频失败,请重新上传')
}
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
// 删除视频
deleteVideo: function (e) {
var videos = this.data.videoBox
var index = e.currentTarget.dataset.index
videos.splice(index, 1)
this.setData({
videoShow: true,
videoBox: videos,
})
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
// 上传图片
chooseImg: function (e) {
base.initQiniu();
var that = this
var imgs = this.data.imgBox
wx.chooseImage({
count: 9 - that.data.imgBox.length, // 默认9
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
var tempFilePaths = res.tempFilePaths
qiniuUploader.upload(0, tempFilePaths, (res) => {
for (var i = 0; i < res.length; i++) {
let option = {
type: 'img',
url: res[i].imageURL
}
imgs.push(option)
}
that.setData({
imgBox: imgs
});
console.log(that.data.imgBox)
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
fail() {
base.toast('上传失败,请重试')
}
})
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
// 删除图片
deleteImg: function (e) {
var imgs = this.data.imgBox
var index = e.currentTarget.dataset.index
imgs.splice(index, 1)
this.setData({
imgBox: imgs
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
// 预览图片
previewImg: function (e) {
var index = e.currentTarget.dataset.index
var imgs = this.data.imgBox
wx.previewImage({
current: imgs[index].url,
urls: this.data.imgBox
})
},
save() {
if (this.data.videoBox.length == 0) {
base.toast('请上传视频')
return
}
if (this.data.imgBox.length == 0) {
base.toast('请上传图片')
return
}
let arr = this.data.videoBox.concat(this.data.imgBox)
console.log(arr)
// let params = {
// url: 'coach/moment',
// data: {
// coach_id: '',
// lesson_id: this.data.lesson_id,
// class_moment: JSON.stringify(arr)
// },
// callback:(data)=>{
// base.toast('提交成功')
// }
// }
// base.newRequest(params)
}
})
\ No newline at end of file
{
"usingComponents": {
"van-uploader": "../../../components/vant/uploader/index"
},
"usingComponents": {},
"navigationBarTitleText": "课程瞬间"
}
\ No newline at end of file
......@@ -3,15 +3,35 @@
<text class="title">拍摄运动工程</text>
<text class="up">(可上传1个视频)</text>
</view>
<van-uploader file-list="{{ fileList }}" bind:after-read="afterRead" />
<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">
<text class='iconfont iconguanbi'></text>
</view>
</view>
<view class='addBox flex-h flex-vc flex-hc' bindtap="chooseVideo" wx:if="{{videoShow}}">
<text class='iconfont iconshipin'></text>
</view>
</view>
</view>
<view class="video">
<view class="head">
<text class="title">记录精彩瞬间</text>
<text class="up">(最多可上传9张照片)</text>
</view>
<van-uploader file-list="{{ fileList }}" bind:after-read="afterRead" />
<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">
<text class='iconfont iconguanbi'></text>
</view>
</view>
<view class='addBox flex-h flex-vc flex-hc' bindtap="chooseImg" wx:if="{{imgBox.length < 9}}">
<text class='iconfont iconxiangji'></text>
</view>
</view>
</view>
<view class="button">
<view class="submit">提交</view>
<view class="submit" catchtap="save">提交</view>
</view>
\ No newline at end of file
page{
page {
background: #F7F8FA;
padding-bottom: 140rpx;
}
.video{
width: 750rpx;
height: 330rpx;
.video {
width: 100%;
padding: 30rpx 0 30rpx 30rpx;
background: #FFFFFF;
margin-bottom: 24rpx;
padding:35rpx 30rpx;
margin-bottom: 24rpx;
}
.video .head{
.video .head {
margin-bottom: 30rpx;
}
.video .title{
.video .title {
color: #1A1A1A;
font-size: 26rpx;
font-weight: bold;
}
.video .up{
.video .up {
color: #B3B3B3;
font-size: 24rpx;
}
.img {
width: 210rpx;
height: 210rpx;
border: 1px solid #EBEBEB;
border-radius: 5rpx;
margin-right: 30rpx;
margin-bottom: 30rpx;
position: relative;
}
.img video {
width: 210rpx;
height: 210rpx;
border-radius: 5rpx;
}
.img image {
width: 210rpx;
height: 210rpx;
border-radius: 5rpx;
}
.delete-btn {
position: absolute;
right: -25rpx;
top: -25rpx;
.button{
}
.delete-btn .iconguanbi {
font-size: 52rpx;
color: #B3B3B3;
}
.addBox {
width: 210rpx;
height: 210rpx;
border: 1px solid #EBEBEB;
border-radius: 5rpx;
}
.iconxiangji {
color: #DFE0E6;
font-size: 60rpx;
}
.iconshipin {
color: #DFE0E6;
font-size: 64rpx;
}
.button {
width: 750rpx;
height: 118rpx;
padding: 18rpx 68rpx 20rpx;
height: 140rpx;
padding: 30rpx;
position: fixed;
bottom: 0;
}
.button .submit{
width: 620rpx;
.button .submit {
width: 690rpx;
height: 80rpx;
border:none;
border: none;
background: linear-gradient(-70deg, #FFC600 0%, #FFD400 100%);
border-radius: 40rpx;
color: #000000;
......
const app = getApp()
import {
Base
} from '../../../utils/base.js';
const base = new Base()
Page({
data: {
user_id: '',
role_type: '2',
telPhone: ''
},
onLoad: function (options) {
},
apply() {
let params = {
url: 'apply',
type: 'POST',
data: {
wx_user_id: this.data.user_id,
role_type: this.data.role_type,
mobile: this.data.telPhone
},
callback:(data)=>{
console.log(data)
}
}
base.newRequest(params)
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view>
<view class="save" catchtap="apply">申请成为教练</view>
</view>
\ No newline at end of file
.save {
position: absolute;
bottom: 33rpx;
left: 50rpx;
right: 50rpx;
width: 650rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
background: linear-gradient(-70deg, #FFC600 0%, #FFD400 100%);
border-radius: 40rpx;
font-size: 30rpx;
color: #000000;
}
\ No newline at end of file
Page({
/**
* 页面的初始数据
*/
data: {
type: '1',
curImage: 'https://wdty.xueyoubangedu.com/wandou/pic_02.png'
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
type: options.type
})
},
copy: function (e) {
wx.setClipboardData({
data: 'bu15333212792',
success: function (res) {
wx.showToast({
title: '复制成功',
icon: 'none',
duration: 3000
})
}
})
},
prevImage() {
wx.previewImage({
urls: [this.data.curImage]
})
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "申请成功"
}
\ No newline at end of file
<view class="box">
<view class="icon">
<image src="/images/pic_01.png"></image>
</view>
<view class="text">申请成功</view>
<view class="cont">
<view class="title" wx:if='{{type == 1}}'>添加审核人员,更快成为团长!</view>
<view class="title" wx:if='{{type == 2}}'>添加审核人员,更快成为教练!</view>
<view class="title" wx:if='{{type == 3}}'>添加审核人员,更快管理场馆!</view>
<view class="code" catchtap="prevImage">
<image src="{{curImage}}"></image>
</view>
<view class="save" catchtap="prevImage">长按保存相册</view>
<view class="wx">微信号: bu15333212792<text class="copy" bindtap="copy">复制</text></view>
</view>
</view>
.box {
padding-top: 50rpx;
}
.icon{
width: 201rpx;
height: 190rpx;
margin: 0 auto 30rpx;
}
.icon image{
width: 100%;
height: 100%;
}
.text{
text-align: center;
color: #1A1A1A;
font-size: 30rpx;
font-weight: bold ;
}
.cont{
width: 736rpx;
height: 487rpx;
margin: 94rpx auto;
background-image: url('https://wdty.xueyoubangedu.com/wandou/pic_03.png');
background-size: 100% 100%;
}
.cont .title{
color: #1A1A1A;
font-size: 28rpx;
text-align: center;
line-height: 80rpx;
}
.cont .code{
width: 211rpx;
height: 211rpx;
margin: 40rpx auto 18rpx;
}
.cont .code image{
width: 100%;
height: 100%;
}
.cont .save{
color: #808080;
font-size: 24rpx;
text-align: center;
}
.cont .wx{
color: #1A1A1A;
font-size: 24rpx;
text-align: center;
margin-top: 20rpx;
}
.cont .wx .copy{
color: #FF6E00;
font-size: 24rpx;
margin-left: 18rpx;
text-decoration: underline;
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ Page({
data: {
activeIndex: 1,
coach_id: '5',
role_id: '2',
detail: '',
type: '1', // 1:收益 2:提现 3:预存储
......@@ -43,6 +44,7 @@ Page({
let params = {
url: 'commission/list',
data: {
role_id: this.data.role_id,
wx_user_id: this.data.coach_id,
type: type,
pageSize: '15',
......
......@@ -27,7 +27,9 @@ Page({
wx.showLoading({
title: '加载中...',
})
console.log(app.globalData)
this.setData({
// coach_id: app.globalData.userInfo.id,
today: util.formatTime(new Date()),
curDate: util.formatTime(new Date())
})
......@@ -140,14 +142,8 @@ Page({
},
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/classManagement/classManagement?classTime=' + classTime + '&class_id=' + item.class_id + '&lesson_id=' + item.id,
url: '/pages/index/classDetail/classDetail?class_id=' + item.class_id + '&lesson_id=' + item.id,
})
},
})
\ No newline at end of file
......@@ -28,7 +28,7 @@
<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="top flex-h flex-vc flex-hb">
<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>
......
......@@ -98,23 +98,19 @@
float: left;
color: #000000;
font-size: 30rpx;
margin-bottom: 32rpx;
font-weight: bold;
}
.cont .top .state{
float: right;
color: #FF6E00;
font-size: 24rpx;
}
/* 上课中样式 */
.inclass{
float: right;
color: #B4BC4D;
font-size: 24rpx;
}
/* 已结束样式 */
.over{
float: right;
color: #B3B3B3;
font-size: 24rpx;
}
......
......@@ -160,6 +160,18 @@
{
"name": "课程管理详情页面",
"pathName": "pages/index/classManagement/classManagement",
"query": "",
"scene": null
},
{
"name": "申请成为教练",
"pathName": "pages/sign/apply/apply",
"query": "",
"scene": null
},
{
"name": "课程瞬间上传",
"pathName": "pages/index/courseInstant/courseInstant",
"scene": null
}
]
......
......@@ -139,7 +139,7 @@ class Base {
initQiniu() {
var options = {
uptokenURL: 'https://wandoutiyu.test.xueyoubangedu.com/api/get_upload_token',
domain: 'https://wandoutiyu.test.xueyoubangedu.com/',
domain: 'https://wdty.xueyoubangedu.com/',
uploadURL: 'https://up-z1.qiniup.com'
};
qiniuUploader.init(options);
......
// created by gpake
(function() {
const app = getApp()
var imgTempUrl = [] //上传图片后临时存放容器
var config = {
qiniuUploadURL: '',
......@@ -110,15 +111,25 @@
}
function getQiniuToken(callback) {
var that = this
wx.request({
url: config.qiniuUploadTokenURL,
data: {
token: app.globalData.token
},
success: function(res) {
console.log(res)
if (res.data.meta.code == 200) {
var token = res.data.data.uptoken;
config.qiniuUploadToken = token;
if (callback) {
callback();
}
} else if (res.data.meta.code == 400) {
app.getSessionKey(function () {
that.getQiniuToken(callback)
})
}
},
fail: function(error) {
console.log(error);
......
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