update:教练&课程库

This commit is contained in:
ltx 2025-06-09 17:19:11 +08:00
parent 1831dfc8fb
commit 574d1477f0
22 changed files with 275 additions and 175 deletions

View File

@ -192,6 +192,7 @@ Page({
}).then(res => {
wx.hideLoading();
if (res.success) {
wx.setStorageSync('roleId', res.data.role_Id)
that.handleLoginSuccess(res.data.token);
//
} else {

View File

@ -4,7 +4,7 @@ page{
.page-content{
background-color: rgb(247, 247, 247);
background: linear-gradient(190deg, #6bb6fc 0%, #f7f7f7 45%, #f7f7f7 100%);
background: linear-gradient(190deg, #49a5fc 0%, #f7f7f7 800rpx, #f7f7f7 100%);
padding: 0 30rpx;
box-sizing: border-box;
padding-bottom: 300rpx;

View File

@ -111,22 +111,23 @@ Page({
const account = await getUserAccount()
console.log(account)
account.data.forEach(item => {
if (item.roleId == 2) {
wx.login({
success: async (loginData) => {
const opid = await getOpenId(loginData.code)
const canLogin = await postOpenId(opid.data, item.userId)
if (canLogin.data) { //当前登录教师,需要退出
const logout = await deleteOpenId(item.userId)
that.sure()
} else {
that.sure()
}
},
})
}
})
let da = account.data.find(item => item.roleId == 2)
if(da){
wx.login({
success: async (loginData) => {
const opid = await getOpenId(loginData.code)
const canLogin = await postOpenId(opid.data, da.userId)
if (canLogin.data) { //当前登录教师,需要退出
const logout = await deleteOpenId(da.userId)
that.sure()
} else {
that.sure()
}
},
})
}else{
that.sure()
}
}
}

View File

@ -8,7 +8,7 @@ Page({
* 页面的初始数据
*/
data: {
length:2
isTrainer:false,
},
/**
@ -17,7 +17,7 @@ Page({
async onLoad(options) {
const res = await getResourceType()
this.setData({
length:res.data.length
isTrainer: wx.getStorageSync('roleId') && wx.getStorageSync('roleId') == 4
})
},

View File

@ -4,6 +4,6 @@
<view class="card password" id="1" bind:tap="goList"/>
<view class="card music" id="2" bind:tap="goList"/>
<view class="card pdf" id="3" bind:tap="goList" wx:if="{{length > 2}}" />
<view class="card video" id="4" bind:tap="goList" wx:if="{{length > 2}}"/>
<view class="card pdf" id="3" bind:tap="goList" wx:if="{{isTrainer}}" />
<!-- <view class="card video" id="4" bind:tap="goList" wx:if="{{length > 2}}"/> -->
</view>

View File

@ -1,7 +1,7 @@
// pages/teacher/vedio/vedio.js
const { getSpecialLevelList } = require("../../../utils/serve/teacher");
const { getSpecialLevelList, getResourceDetail } = require("../../../utils/serve/teacher");
const tabService = require("../../../utils/tab-serve");
const app = getApp()
Page({
/**
@ -14,19 +14,31 @@ Page({
showSelectId:0,
forList:[],
showVideo:{},
showSelectTabId:0
showSelectTabId:0,
topTab:1,
venueList:[],//场馆类别列表
venueIndex:0,
venueDetailIndex:0,
isTrainer:false // 是否教练
},
/**
* 生命周期函数--监听页面加载
*/
async onLoad(options) {
wx.showLoading({
title: '',
})
const res = await getSpecialLevelList()
const venue = await getResourceDetail({id:4})
this.setData({
list:res.data,
detail:res.data[0],
showVideo:res.data[0].levelList[0]['基本技能'][0]['actionList'][0] || {}
showVideo:res.data[0].levelList[0]['基本技能'][0]['actionList'][0] || {},
venueList:venue.data,
isTrainer: wx.getStorageSync('roleId') && wx.getStorageSync('roleId') == 4
})
wx.hideLoading()
},
showSelect(e){
@ -46,6 +58,14 @@ Page({
})
},
changeTopTab(e){
if(e.currentTarget.dataset.id == this.data[e.currentTarget.dataset.key]) return
this.setData({
[e.currentTarget.dataset.key]:e.currentTarget.dataset.id,
})
},
changeVideo(e){
console.log(e.currentTarget.dataset.video)
this.setData({

View File

@ -1,8 +1,12 @@
<!--pages/teacher/vedio/vedio.wxml-->
<view class="page-content">
<mp-bar background="linear-gradient(190deg, #49a5fc 0%, #f7f7f7 800rpx, #f7f7f7 100%)" title="视频库" color="#fff" back="{{false}}"></mp-bar>
<mp-bar background="linear-gradient(190deg, #49a5fc 0%, #f7f7f7 800rpx, #f7f7f7 100%)" title="课程库" color="#fff" back="{{false}}"></mp-bar>
<view class="card">
<view class="card-top" wx:if="{{isTrainer}}">
<view class="card-top-item {{topTab == 1?'card-top-click':''}}" data-id="1" data-key="topTab" bind:tap="changeTopTab">学校课程</view>
<view class="card-top-item {{topTab == 2?'card-top-click':''}}" data-id="2" data-key="topTab" bind:tap="changeTopTab">场馆课程</view>
</view>
<view class="card {{isTrainer?'have-top':''}}" wx:if="{{topTab == 1}}">
<scroll-view scroll-x="{{true}}">
<view class="tab-list">
<view class="title" wx:for="{{list}}" wx:key="index" bind:tap="changeTab" data-item="{{item}}">
@ -14,17 +18,18 @@
<view class="jineng {{showSelect ? 'show' :''}}">
<view class="jineng-item {{showSelectTabId == 0 ? 'aacctive':''}}" bind:tap="showSelect" data-id="0">
基本技能 <image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/{{showSelectId == 0 && showSelect ?'upp':'downn'}}-{{showSelectTabId == 0 ? 'f':'7'}}.png" mode=""/>
基本技能
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/{{showSelectId == 0 && showSelect ?'upp':'downn'}}-{{showSelectTabId == 0 ? 'f':'7'}}.png" mode="" />
</view>
<view class="jineng-item {{showSelectTabId == 1 ? 'aacctive':''}}" bind:tap="showSelect" data-id="1">
专项技能
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/{{showSelectId == 1 && showSelect ?'upp':'downn'}}-{{showSelectTabId == 1 ? 'f':'7'}}.png" mode=""/>
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/{{showSelectId == 1 && showSelect ?'upp':'downn'}}-{{showSelectTabId == 1 ? 'f':'7'}}.png" mode="" />
</view>
<view class="select {{showSelect ? 'visible' :''}}" >
<view class="select {{showSelect ? 'visible' :''}}">
<view class="box" wx:for="{{forList}}" wx:key="index">
<view class="title2">
{{item.name}}
{{item.name}}
</view>
<view class="select-box">
<view class="select-item {{showVideo.id == video.id ?'now' :''}}" wx:for="{{item.actionList}}" wx:for-item="video" wx:key="id" data-video="{{video}}" bind:tap="changeVideo">
@ -38,22 +43,54 @@
<view class="title3" wx:if="{{showVideo.actionVideoPath}}">
<view class="title3-before"></view>动作示范
</view>
<video wx:if="{{showVideo.actionVideoPath}}" class="video" src="{{showVideo.actionVideoPath}}"/>
<video wx:if="{{showVideo.actionVideoPath}}" class="video" src="{{showVideo.actionVideoPath}}" />
<view class="title3" wx:if="{{showVideo.explainVideoPath}}">
<view class="title3-before"></view>要领讲解
</view>
<video wx:if="{{showVideo.explainVideoPath}}" class="video" src="{{showVideo.explainVideoPath}}"/>
<video wx:if="{{showVideo.explainVideoPath}}" class="video" src="{{showVideo.explainVideoPath}}" />
<view class="title3" wx:if="{{showVideo.exerciseVideoPath}}">
<view class="title3-before"></view>练习方法
</view>
<video wx:if="{{showVideo.exerciseVideoPath}}" class="video" src="{{showVideo.exerciseVideoPath}}"/>
<video wx:if="{{showVideo.exerciseVideoPath}}" class="video" src="{{showVideo.exerciseVideoPath}}" />
</view>
<view class="card have-top" wx:else="">
<scroll-view scroll-x="{{true}}">
<view class="tab-list">
<view class="title" wx:for="{{venueList}}" wx:key="index" data-id="{{index}}" data-key="venueIndex" bind:tap="changeTopTab" data-item="{{item}}">
<view>{{item.typeName}}</view>
<view class="title-b" wx:if="{{venueIndex == index}}"></view>
</view>
</view>
</scroll-view>
<scroll-view scroll-x="{{true}}" class="bb">
<view class="tab">
<view class="tab-item {{venueDetailIndex == index ? 'active':''}}" wx:key="index" data-key="venueDetailIndex" wx:for="{{venueList[venueIndex]['children']}}" data-id="{{index}}" bind:tap="changeTopTab">
{{item.typeName}}
</view>
</view>
</scroll-view>
<view class="nothing" wx:if="{{venueList[venueIndex]['children'][venueDetailIndex]['resourceDetails'].length <= 0}}" class="nothing">
暂无数据~
</view>
<view class="type">
<view class="card1" wx:for="{{venueList[venueIndex]['children'][venueDetailIndex]['resourceDetails']}}" wx:key="id">
<view class="title3" style="margin-top: 0;">
<view class="title3-before"></view>{{item.resourceName}}
</view>
<video wx:if="{{item.resourceUrl}}" class="vid" src="{{item.resourceUrl}}" />
</view>
</view>
</view>
</view>

View File

@ -1,5 +1,32 @@
/* pages/teacher/vedio/vedio.wxss */
.card-top{
margin-left: 30rpx;
background-color: #fff;
display: flex;
box-sizing: border-box;
width: 390rpx;
height: 74rpx;
border-radius: 20rpx 20rpx 0 0 ;
background-color: rgba(255, 255, 255, 0.2);
color: #fff;
font-size: 30rpx;
overflow: hidden;
margin-top: 44rpx;
}
.card-top-item{
width: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.card-top-click{
background-color: #FFC20E;
font-weight: bold;
}
.card{
margin: 44rpx 30rpx;
background-color: #fff;
@ -10,6 +37,13 @@
min-height: 70vh;
}
.have-top{
margin-top: 0rpx;
border-radius: 0 20rpx 20rpx;
/* box-shadow: 0 0 0rpx rgb(223, 222, 222); */
box-shadow: 1px 1px 4px 0px rgba(0, 0, 0, 0.04);
}
.title{
/* font-weight: bold; */
font-size: 26rpx;
@ -155,4 +189,84 @@
margin-top: 20rpx;
height: 356rpx;
border-radius: 20rpx;
}
.bb{
padding: 10rpx;
background-color: #F4F6F8;
border-radius: 20rpx;
/* margin-top: 20rpx; */
font-size: 24rpx;
color: #777777;
margin-top: 30rpx;
}
.tab-item{
padding: 14rpx 30rpx;
box-sizing: border-box;
border-radius: 20rpx;
white-space: nowrap;
/* min-width: 300rpx; */
}
.active{
font-weight: bold;
color: #fff;
background-color: #28A6F6;
}
.tab{
display: flex;
align-items: center;
/* justify-content: center; */
/* padding: 10rpx;
background-color: #F4F6F8;
border-radius: 20rpx;
margin-top: 20rpx;
font-size: 24rpx;
color: #777777; */
}
.card1{
border-radius: 20rpx;
height: 280rpx;
width: 310rpx;
background-size: cover;
margin-top: 20rpx;
padding: 20rpx 20rpx;
box-sizing: border-box;
background-color: #fff;
box-shadow: 0 0 10rpx rgb(223, 222, 222)
}
.type1{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 0 30rpx;
box-sizing: border-box;
/* margin-top: 40rpx; */
}
.vid{
height: 170rpx;
width: 270rpx;
margin-top: 18rpx;
border-radius: 20rpx;
}
.nothing{
margin-top: 30rpx;
text-align: center;
}
.type{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
/* padding: 0 30rpx; */
box-sizing: border-box;
margin-top: 30rpx;
/* margin-top: 40rpx; */
}

View File

@ -21,129 +21,5 @@
"useIsolateContext": true
},
"libVersion": "3.7.12",
"condition": {
"miniprogram": {
"list": [
{
"name": "subpackage/train/result/result",
"pathName": "subpackage/train/result/result",
"query": "type=time&count=100&time=180&theme=homeWork&homeWorkId=13&isAi=true&sportType=跳绳",
"scene": null,
"launchMode": "default"
},
{
"name": "subpackage/train/result/result",
"pathName": "subpackage/train/result/result",
"query": "sportKey=Jumping-Jack&time=10&count=500&type=num&theme=fit&timeout=5&music=https%3A%2F%2Fyuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com%2FUpload%2FBackgroundMusic%2FCarly%2520Rae%2520Jepsen-Turn%2520Me%2520Up.mp3",
"launchMode": "default",
"scene": null
},
{
"name": "pages/parent/train/train",
"pathName": "pages/parent/train/train",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pages/login/login",
"pathName": "pages/login/login",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pages/login/login",
"pathName": "pages/login/login",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "module-sport/pages/sport-full-screen",
"pathName": "module-sport/pages/sport-full-screen",
"query": "sportKey=Jumping-Jack&time=0&number=5&type=num&theme=small&groupNumber=3&timeout=5&music=https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/Upload/BackgroundMusic/Carly%20Rae%20Jepsen-Turn%20Me%20Up.mp3",
"launchMode": "default",
"scene": null
},
{
"name": "subpackage/train/bluetooth/train",
"pathName": "subpackage/train/bluetooth/train",
"query": "sportKey=Jumping-Jack&time=0&number=5&type=num&theme=homeWork&groupNumber=3&timeout=5&music=https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/Upload/BackgroundMusic/Carly%20Rae%20Jepsen-Turn%20Me%20Up.mp3",
"launchMode": "default",
"scene": null
},
{
"name": "subpackage/train/result/result",
"pathName": "subpackage/train/result/result",
"query": "type=time&count=10&time=120&theme=homeWork&isAi=true&sportType=高抬腿&homeWorkId=44",
"launchMode": "default",
"scene": null
},
{
"name": "module-sport/pages/sport-full-screen",
"pathName": "module-sport/pages/sport-full-screen",
"query": "sportKey=High-Knee&time=10&number=40&type=time&theme=homeWork&homeWorkId=44&groupNumber=2&timeout=3&music=https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/Upload/BackgroundMusic/Carly%20Rae%20Jepsen-Turn%20Me%20Up.mp3",
"launchMode": "default",
"scene": null
},
{
"name": "subpackage/team/rank-team/rank-team",
"pathName": "subpackage/team/rank-team/rank-team",
"query": "taskId=98",
"launchMode": "default",
"scene": null
},
{
"name": "subpackage/teacher/check-student/check-student",
"pathName": "subpackage/teacher/check-student/check-student",
"query": "class={\"classId\":6,\"gradeId\":1,\"name\":\"一年级-一班\"}",
"launchMode": "default",
"scene": null
},
{
"name": "subpackage/teacher/new-work/new-work",
"pathName": "subpackage/teacher/new-work/new-work",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "subpackage/teacher/resource/resource",
"pathName": "subpackage/teacher/resource/resource",
"query": "id=2",
"launchMode": "default",
"scene": null
},
{
"name": "subpackage/train/bluetooth/train",
"pathName": "subpackage/train/bluetooth/train",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "subpackage/train/train/train",
"pathName": "subpackage/train/train/train",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "subpackage/teacher/prepare-success/prepare-success",
"pathName": "subpackage/teacher/prepare-success/prepare-success",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pages/teacher/resource/resource",
"pathName": "pages/teacher/resource/resource",
"query": "",
"launchMode": "default",
"scene": null
}
]
}
}
"condition": {}
}

View File

@ -9,7 +9,7 @@ page{
.page-content{
background-color: rgb(247, 247, 247);
background: linear-gradient(190deg, #6bb6fc 0%, #f7f7f7 65%, #f7f7f7 100%);
/* background: linear-gradient(190deg, #6bb6fc 0%, #f7f7f7 800rpx, #f7f7f7 100%); */
padding: 0 30rpx;
box-sizing: border-box;
padding-bottom: 300rpx;

View File

@ -17,7 +17,9 @@ Page({
parmas: '',
islink: false,
name: '',
sportKey: 'Rope-Skipping'
sportKey: 'Rope-Skipping',
isShowExampleVideo:true,
showDialog:false
},
/**
@ -54,7 +56,8 @@ Page({
addP += '&music='+set.data.resourceUrl
}
this.setData({
parmas : this.data.parmas + addP
parmas : this.data.parmas + addP,
isShowExampleVideo:set.data.isShowExampleVideo
})
},
@ -71,9 +74,15 @@ Page({
},
goai() {
wx.navigateTo({
url: '/module-sport/pages/sport-full-screen?' + this.data.parmas,
})
if((this.data.isShowExampleVideo && this.data.sportKey != 'High-Knee' && this.data.sportKey != 'Rope-Skipping' && this.data.sportKey != "Squat") && !this.data.showDialog){
this.setData({
showDialog:true
})
}else{
wx.navigateTo({
url: '/module-sport/pages/sport-full-screen?' + this.data.parmas,
})
}
},
//初始蓝牙模块
startBluetooth() {

View File

@ -1,7 +1,7 @@
{
"usingComponents": {
"mp-icon": "weui-miniprogram/icon/icon"
"mp-icon": "weui-miniprogram/icon/icon",
"mp-dialog": "weui-miniprogram/dialog/dialog"
},
"navigationBarTitleText": "选择模式",
"backgroundColor": "#f7f7f7",

View File

@ -38,4 +38,15 @@
</view>
</view>
<mp-dialog show="{{showDialog}}" title="动作示例">
<view>
<video class="shili {{sportKey=='Jumping-Jack' || sportKey == 'Squat-Horse'?'heightt':''}}" src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/train/video/{{sportKey}}.mp4"/>
<view class="toast">*可以在运动偏好中设置关闭示例视频哦~</view>
<view class="goBtn" bind:tap="goai">
去运动
</view>
</view>
</mp-dialog>
</view>

View File

@ -59,4 +59,33 @@ page{
border-radius: 50%;
background-color: #EDF1FF;
text-align: center;
}
.shili{
width: 427rpx;
height: 241rpx;
}
.heightt{
width: 244rpx;
height: 427rpx;
}
.toast{
font-size: 20rpx;
margin-top: 40rpx;
}
.goBtn{
width: 80%;
background-color: #0082FF;
height: 80rpx;
border-radius: 20rpx;
margin: auto;
margin-top: 40rpx;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-weight: bold;
}

View File

@ -4,7 +4,7 @@ page{
}
.page-content{
background-color: rgb(247, 247, 247);
background: linear-gradient(190deg, #359cfd 0%, #f7f7f7 800rpx, #f7f7f7 100%);
/* background: linear-gradient(190deg, #359cfd 0%, #f7f7f7 800rpx, #f7f7f7 100%); */
padding: 0 30rpx;
box-sizing: border-box;
padding-bottom: 300rpx;

View File

@ -4,7 +4,7 @@ page{
.page-content{
background-color: rgb(247, 247, 247);
background: linear-gradient(190deg, #6bb6fc 0%, #f7f7f7 45%, #f7f7f7 100%);
background: linear-gradient(190deg, #49a5fc 0%, #f7f7f7 800rpx, #f7f7f7 100%);
padding: 0 30rpx;
box-sizing: border-box;
min-height: 100vh;

View File

@ -127,7 +127,7 @@ Page({
"amount": count,
"homeWorkId":0,
"dataSourceType": isAi == 'true' ? 2 : 1,
"calorie":count*0.1,
"calorie":(count*0.1).toFixed(1),
"startTime":this.getCurrentDateTime(),
"endTime":this.getCurrentDateTime(),
"groupNumber":1
@ -144,6 +144,7 @@ Page({
console.log(sportObj)
let isTime = options.type == 'time'
let calorie = isTime ? options.count * sportObj[0].kcalIndex : amount * sportObj[0].kcalIndex * groupNumber
calorie = calorie.toFixed(1)
this.setData({
calorie,
group:groupNumber,

View File

@ -4,7 +4,7 @@ page{
.page-content{
background-color: rgb(247, 247, 247);
background: linear-gradient(190deg, #6bb6fc 0%, #f7f7f7 45%, #f7f7f7 100%);
background: linear-gradient(190deg, #49a5fc 0%, #f7f7f7 800rpx, #f7f7f7 100%);
padding: 0 30rpx;
box-sizing: border-box;
min-height: 100vh;

View File

@ -4,7 +4,7 @@ page{
.page-content{
background-color: rgb(247, 247, 247);
background: linear-gradient(190deg, #6bb6fc 0%, #f7f7f7 45%, #f7f7f7 100%);
background: linear-gradient(190deg, #49a5fc 0%, #f7f7f7 800rpx, #f7f7f7 100%);
padding: 0 30rpx;
box-sizing: border-box;
padding-bottom: 300rpx;

View File

@ -1,7 +1,7 @@
/* subpackage/train/user-report/user-report.wxss */
.page-content{
background-color: rgb(247, 247, 247);
background: linear-gradient(190deg, #6bb6fc 0%, #f7f7f7 800rpx, #f7f7f7 100%);
background: linear-gradient(190deg, #49a5fc 0%, #f7f7f7 800rpx, #f7f7f7 100%);
padding: 0 30rpx;
box-sizing: border-box;
padding-bottom: 300rpx;

View File

@ -107,7 +107,7 @@ const updateRole = (that, type) => {
"pagePath": "pages/teacher/vedio/vedio",
"iconPath": "/static/teacher/vedio.png",
"selectedIconPath": "/static/teacher/vedio-s.png",
"text": "视频库",
"text": "课程库",
},
{
"pagePath": "pages/student/my/my",

View File

@ -31,6 +31,7 @@ async function refreshToken() {
const res = await refreshMyToken(token)
if(res.data.token){
wx.setStorageSync('token', res.data.token)
wx.setStorageSync('roleId', res.data.role_Id)
}
}