Commit 756bca13 by tangjiale

更新代码

parent 0ddeb16d
...@@ -16,9 +16,16 @@ ...@@ -16,9 +16,16 @@
"name": "sport", "name": "sport",
"pages": [ "pages": [
"detail/detail", "detail/detail",
"ai-sport/ai-sport",
"ai-ywqz-sport/ai-ywqz-sport", "ai-ywqz-sport/ai-ywqz-sport",
"ai-fwc-sport/ai-fwc-sport" "ai-fwc-sport/ai-fwc-sport",
"ai-ts-sport/ai-ts-sport",
"ai-tjz-sport/ai-tjz-sport",
"ai-kht-sport/ai-kht-sport",
"ai-sd-sport/ai-sd-sport",
"ai-gtt-sport/ai-gtt-sport",
"ai-ydtt-sport/ai-ydtt-sport",
"ai-ydp-sport/ai-ydp-sport",
"share/share"
] ]
}, },
{ {
......
...@@ -397,3 +397,37 @@ page{ ...@@ -397,3 +397,37 @@ page{
font-weight: bold; font-weight: bold;
margin-bottom: 14px; margin-bottom: 14px;
} }
.ywqz-help-img{
position:absolute;
bottom: 40px;
left: 50%;
transform: translateX(-50%);
width: 490px;
height: 252px;
z-index: 98;
}
.ywqz-help{
position: absolute;
top: 50%;
left: 20px;
transform: translateY(-50%);
width: 192px;
height: 140px;
background: #000000;
opacity: 0.74;
border-radius: 12px;
color: #FFFFFF;
text-align: center;
font-size: 14px;
z-index: 99;
}
.side-help-img{
position:absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 596rpx;
height: 988rpx;
z-index: 98;
}
\ No newline at end of file
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
width: 690rpx; width: 690rpx;
overflow: hidden; overflow: hidden;
margin: 0 auto; margin: 0 auto;
min-height: 100vh;
padding-bottom: 80rpx;
} }
.list .li:nth-child(2n-1){ .list .li:nth-child(2n-1){
......
...@@ -30,6 +30,20 @@ ...@@ -30,6 +30,20 @@
"name": "ai运动", "name": "ai运动",
"pathName": "subPages/sport/ai-sport/ai-sport", "pathName": "subPages/sport/ai-sport/ai-sport",
"query": "id=11", "query": "id=11",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "subPages/sport/ai-ywqz-sport/ai-ywqz-sport",
"query": "sportTime=60",
"launchMode": "default",
"scene": null
},
{
"name": "ai运动分享",
"pathName": "subPages/sport/share/share",
"query": "id=10774553&share=0&showMedal=1&user=1&sportTime=00:02:00",
"scene": null, "scene": null,
"launchMode": "default" "launchMode": "default"
} }
......
...@@ -6,7 +6,7 @@ var time = 0; ...@@ -6,7 +6,7 @@ var time = 0;
var iosNum = 0;//ios不能重复播放同一地址音频,后加一位数,加时间戳不行 var iosNum = 0;//ios不能重复播放同一地址音频,后加一位数,加时间戳不行
Page({ Page({
mixins: [require('../ai-mixins/ai-fwc-mixins.js')], behaviors: [require('../ai-mixins/ai-fwc-mixins.js')],
data: { data: {
fps:20,//控制频率 fps:20,//控制频率
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<canvas type="2d" id="myCanvas" class="canvas"></canvas> <canvas type="2d" id="myCanvas" class="canvas"></canvas>
</camera> </camera>
<view wx:if="{{aiState == 1 || aiState == 6}}"> <view wx:if="{{aiState == 1 || aiState == 6}}">
<image class="help-img" src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/jumping-jacks.png"></image> <image class="ywqz-help-img" src="{{showImageUrl}}"></image>
<view class="help"> <view class="ywqz-help">
<view class="title">互动小提示</view> <view class="title">互动小提示</view>
<view class="content">手机竖屏固定放置,调整屏幕角度,训练者全身及双脚出现至屏幕内,识别更精准。</view> <view class="content">手机竖屏固定放置,调整屏幕角度,训练者全身及双脚出现至屏幕内,识别更精准。</view>
</view> </view>
......
...@@ -7,35 +7,10 @@ var flagTimer = null; ...@@ -7,35 +7,10 @@ var flagTimer = null;
var time = 0; var time = 0;
var iosNum = 0;//ios不能重复播放同一地址音频,后加一位数,加时间戳不行 var iosNum = 0;//ios不能重复播放同一地址音频,后加一位数,加时间戳不行
const aiSportType = app._aiSportType || '1'
var ts = require('../ai-mixins/ai-ts-mixins.js') //跳绳
var ywqz = require('../ai-mixins/ai-ywqz-mixins.js') //仰卧起坐
var tjz = require('../ai-mixins/ai-tjz-mixins.js') //踢毽子
var kht = require('../ai-mixins/ai-kht-mixins.js') //开合跳
var sd = require('../ai-mixins/ai-sd-mixins.js') //深蹲
var fwc = require('../ai-mixins/ai-fwc-mixins.js') //俯卧撑
var gtt = require('../ai-mixins/ai-gtt-mixins.js') //高抬腿
var ydtt = require('../ai-mixins/ai-ydtt-mixins.js') //原地踢腿
var ydp = require('../ai-mixins/ai-ydp-mixins.js') //原地跑
var gtjz = require('../ai-mixins/ai-ts-mixins.js') //拐踢毽子
const sportObj = {
1:ts, //跳绳
2:ywqz, //仰卧起坐
3:tjz, //踢毽子
11:kht, //开合跳
13:sd, //深蹲
14:fwc, //俯卧撑
15:gtt, //高抬腿
16:ydtt, //原地踢腿
17:ydp, //原地跑
}
console.log('aiSportType',aiSportType)
Page({ Page({
// mixins: [sportObj[aiSportType]], // mixins: [sportObj[aiSportType]],
behaviors: [sportObj[aiSportType]], behaviors: [require('../ai-mixins/ai-gtt-mixins.js')],
name:'ai-sport',
data: { data: {
fps:20,//控制频率 fps:20,//控制频率
......
<camera device-position="{{!cameraFront?'back':'front'}}" flash="off" binderror="error" frame-size="medium" class="camera" id="camera">
<canvas type="2d" id="myCanvas" class="canvas"></canvas>
</camera>
<view wx:if="{{aiState == 1 || aiState == 6}}">
<image class="side-help-img" wx:if="{{showImageUrl}}" src="{{showImageUrl}}"></image>
<view class="help">
<view class="title">互动小提示</view>
<view class="content">手机竖屏固定放置,调整屏幕角度,训练者全身及双脚出现至屏幕内,识别更精准。</view>
</view>
</view>
<!-- 识别成功,读秒 -->
<view class="countdown" wx:if="{{aiState == 2}}">
<view class="second">{{downTime}}</view>
</view>
<!-- 进行中 -->
<view wx:if="{{aiState == 3}}">
<view class="time">{{downTimeStg}}</view>
<view class="number" style="{{levelfontsize}}">{{aiCount}}</view>
</view>
<!-- 成绩提交失败 -->
<view class="tips" wx:if="{{aiState == 4}}">
<view class="tips-type error-type">
抱歉,由于角度、光线等客观环境影响,AI识别失败!结束训练/重新开始训练
</view>
<view class="handle">
<!-- <view class="no-tips">不再提示</view> -->
<view class="know" bindtap="errknow">知道了</view>
</view>
</view>
<!-- 识别中 -->
<view class="switch" bindtap="switch" wx:if="{{aiState == 1}}">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-flip.png"></image>
<view class="text">{{cameraFront?'切换家长拍模式':'切换自拍模式'}}</view>
</view>
<view class="exit" bindtap="exit">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-exit.png"></image>
<view class="text">退出</view>
</view>
<audio src="{{src}}" id="myAudio" ></audio>
@import "../../../css/ai-common.wxss";
\ No newline at end of file
{
"usingComponents": {},
"disableScroll": true
}
\ No newline at end of file
@import "../../../css/ai-common.wxss";
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @eMail: 932055106@qq.com * @eMail: 932055106@qq.com
* @Date: 2022-05-11 09:53:47 * @Date: 2022-05-11 09:53:47
* @LastEditors: tangjiale * @LastEditors: tangjiale
* @LastEditTime: 2022-06-08 11:01:27 * @LastEditTime: 2022-06-08 14:56:37
*/ */
var API = require("../../../utils/request"); var API = require("../../../utils/request");
...@@ -132,9 +132,9 @@ module.exports = Behavior({ ...@@ -132,9 +132,9 @@ module.exports = Behavior({
clearTimeout(that.data.waitTimer); clearTimeout(that.data.waitTimer);
var uid = res.data.id; var uid = res.data.id;
if(res.code == 200){ if(res.code == 200){
// wx.redirectTo({ wx.redirectTo({
// url: '../../../packageA/pushUp/share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime), url: '../share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime),
// }) })
}else{ }else{
that.setData({ that.setData({
aiState:4 aiState:4
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @eMail: 932055106@qq.com * @eMail: 932055106@qq.com
* @Date: 2022-05-11 09:53:47 * @Date: 2022-05-11 09:53:47
* @LastEditors: tangjiale * @LastEditors: tangjiale
* @LastEditTime: 2022-06-08 11:01:55 * @LastEditTime: 2022-06-08 14:57:10
*/ */
// 拐踢毽子计算配置 // 拐踢毽子计算配置
...@@ -176,7 +176,7 @@ module.exports = Behavior({ ...@@ -176,7 +176,7 @@ module.exports = Behavior({
var uid = res.data.id; var uid = res.data.id;
if(res.code == 200){ if(res.code == 200){
wx.redirectTo({ wx.redirectTo({
// url: '../../packageA/sitUp/share/share?share=0' + '&id=' + uid + '&showMedal=1', url: '../share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime),
}) })
}else{ }else{
that.setData({ that.setData({
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @eMail: 932055106@qq.com * @eMail: 932055106@qq.com
* @Date: 2022-05-11 09:53:47 * @Date: 2022-05-11 09:53:47
* @LastEditors: tangjiale * @LastEditors: tangjiale
* @LastEditTime: 2022-06-08 11:03:40 * @LastEditTime: 2022-06-08 14:57:19
*/ */
var API = require("../../../utils/request"); var API = require("../../../utils/request");
...@@ -161,9 +161,9 @@ module.exports = Behavior({ ...@@ -161,9 +161,9 @@ module.exports = Behavior({
clearTimeout(that.data.waitTimer); clearTimeout(that.data.waitTimer);
var uid = res.data.id; var uid = res.data.id;
if(res.code == 200){ if(res.code == 200){
// wx.redirectTo({ wx.redirectTo({
// url:'../../../packageA/highLegLifts/share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime), url: '../share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime),
// }) })
}else{ }else{
that.setData({ that.setData({
aiState:4 aiState:4
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @eMail: 932055106@qq.com * @eMail: 932055106@qq.com
* @Date: 2022-05-11 09:53:47 * @Date: 2022-05-11 09:53:47
* @LastEditors: tangjiale * @LastEditors: tangjiale
* @LastEditTime: 2022-06-08 11:13:58 * @LastEditTime: 2022-06-08 15:07:12
*/ */
var API = require("../../../utils/request"); var API = require("../../../utils/request");
...@@ -25,7 +25,6 @@ module.exports = Behavior({ ...@@ -25,7 +25,6 @@ module.exports = Behavior({
}, },
methods:{ methods:{
actionSend(object,app){ // 识别点 actionSend(object,app){ // 识别点
console.log('什么鬼啊------------')
var that = this; var that = this;
//console.log('app.globalData.movenet',app.globalData.movenet) //console.log('app.globalData.movenet',app.globalData.movenet)
app.globalData.movenet.estimatePoses(object).then(function (res) { app.globalData.movenet.estimatePoses(object).then(function (res) {
...@@ -69,7 +68,6 @@ module.exports = Behavior({ ...@@ -69,7 +68,6 @@ module.exports = Behavior({
} }
//通过角度判断个数 //通过角度判断个数
if(that.data.aiState == 3){ if(that.data.aiState == 3){
console.log('当前参数帧数',that.data.showTime,angle_foot)
if(angle_foot >= 20 && angle_hand > 120){ if(angle_foot >= 20 && angle_hand > 120){
if(dir == 0){ if(dir == 0){
count = count + 0.5; count = count + 0.5;
...@@ -132,9 +130,9 @@ module.exports = Behavior({ ...@@ -132,9 +130,9 @@ module.exports = Behavior({
clearTimeout(that.data.waitTimer); clearTimeout(that.data.waitTimer);
var uid = res.data.id; var uid = res.data.id;
if(res.code == 200){ if(res.code == 200){
// wx.redirectTo({ wx.redirectTo({
// url: '../../../packageA/sitUp/share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime), url: '../share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime),
// }) })
}else{ }else{
that.setData({ that.setData({
aiState:4 aiState:4
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @eMail: 932055106@qq.com * @eMail: 932055106@qq.com
* @Date: 2022-05-11 09:53:47 * @Date: 2022-05-11 09:53:47
* @LastEditors: tangjiale * @LastEditors: tangjiale
* @LastEditTime: 2022-06-08 11:03:58 * @LastEditTime: 2022-06-08 14:57:38
*/ */
var API = require("../../../utils/request"); var API = require("../../../utils/request");
...@@ -131,9 +131,9 @@ module.exports = Behavior({ ...@@ -131,9 +131,9 @@ module.exports = Behavior({
clearTimeout(that.data.waitTimer); clearTimeout(that.data.waitTimer);
var uid = res.data.id; var uid = res.data.id;
if(res.code == 200){ if(res.code == 200){
// wx.redirectTo({ wx.redirectTo({
// url: '../../../packageA/deepSquat/share/sahre?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime), url: '../share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime),
// }) })
}else{ }else{
that.setData({ that.setData({
aiState:4 aiState:4
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @eMail: 932055106@qq.com * @eMail: 932055106@qq.com
* @Date: 2022-05-11 09:53:47 * @Date: 2022-05-11 09:53:47
* @LastEditors: tangjiale * @LastEditors: tangjiale
* @LastEditTime: 2022-06-08 11:04:17 * @LastEditTime: 2022-06-08 14:57:46
*/ */
var API = require("../../../utils/request"); var API = require("../../../utils/request");
...@@ -164,9 +164,9 @@ module.exports = Behavior({ ...@@ -164,9 +164,9 @@ module.exports = Behavior({
clearTimeout(that.data.waitTimer); clearTimeout(that.data.waitTimer);
var uid = res.data.id; var uid = res.data.id;
if(res.code == 200){ if(res.code == 200){
// wx.redirectTo({ wx.redirectTo({
// url:'../../../packageA/shuttlecock/share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime), url: '../share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime),
// }) })
}else{ }else{
that.setData({ that.setData({
aiState:4 aiState:4
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @eMail: 932055106@qq.com * @eMail: 932055106@qq.com
* @Date: 2022-05-11 09:53:47 * @Date: 2022-05-11 09:53:47
* @LastEditors: tangjiale * @LastEditors: tangjiale
* @LastEditTime: 2022-06-08 11:04:30 * @LastEditTime: 2022-06-08 14:57:52
*/ */
var API = require("../../../utils/request"); var API = require("../../../utils/request");
// 拐踢毽子计算配置 // 拐踢毽子计算配置
...@@ -185,7 +185,7 @@ module.exports = Behavior({ ...@@ -185,7 +185,7 @@ module.exports = Behavior({
var uid = res.data.id; var uid = res.data.id;
if(res.code == 200){ if(res.code == 200){
wx.redirectTo({ wx.redirectTo({
// url: '../../../packageA/aiSkip/share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime), url: '../share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime),
}) })
}else{ }else{
wx.showModal({ wx.showModal({
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @eMail: 932055106@qq.com * @eMail: 932055106@qq.com
* @Date: 2022-05-11 09:53:47 * @Date: 2022-05-11 09:53:47
* @LastEditors: tangjiale * @LastEditors: tangjiale
* @LastEditTime: 2022-06-08 11:04:44 * @LastEditTime: 2022-06-08 14:58:10
*/ */
var API = require("../../../utils/request"); var API = require("../../../utils/request");
...@@ -165,9 +165,9 @@ module.exports = Behavior({ ...@@ -165,9 +165,9 @@ module.exports = Behavior({
clearTimeout(that.data.waitTimer); clearTimeout(that.data.waitTimer);
var uid = res.data.id; var uid = res.data.id;
if(res.code == 200){ if(res.code == 200){
// wx.redirectTo({ wx.redirectTo({
// url: '../../packageA/sitUp/share/share?share=0' + '&id=' + uid + '&showMedal=1', url: '../share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime),
// }) })
}else{ }else{
that.setData({ that.setData({
aiState:4 aiState:4
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @eMail: 932055106@qq.com * @eMail: 932055106@qq.com
* @Date: 2022-05-11 09:53:47 * @Date: 2022-05-11 09:53:47
* @LastEditors: tangjiale * @LastEditors: tangjiale
* @LastEditTime: 2022-06-08 11:04:59 * @LastEditTime: 2022-06-08 14:58:23
*/ */
var API = require("../../../utils/request"); var API = require("../../../utils/request");
...@@ -164,9 +164,9 @@ module.exports = Behavior({ ...@@ -164,9 +164,9 @@ module.exports = Behavior({
clearTimeout(that.data.waitTimer); clearTimeout(that.data.waitTimer);
var uid = res.data.id; var uid = res.data.id;
if(res.code == 200){ if(res.code == 200){
// wx.redirectTo({ wx.redirectTo({
// url:'../../../packageA/hipKicked/share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime), url: '../share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime),
// }) })
}else{ }else{
that.setData({ that.setData({
aiState:4 aiState:4
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @eMail: 932055106@qq.com * @eMail: 932055106@qq.com
* @Date: 2022-05-11 09:53:47 * @Date: 2022-05-11 09:53:47
* @LastEditors: tangjiale * @LastEditors: tangjiale
* @LastEditTime: 2022-06-08 11:05:18 * @LastEditTime: 2022-06-08 14:58:32
*/ */
var API = require("../../../utils/request"); var API = require("../../../utils/request");
...@@ -71,9 +71,9 @@ module.exports = Behavior({ ...@@ -71,9 +71,9 @@ module.exports = Behavior({
clearTimeout(that.data.waitTimer); clearTimeout(that.data.waitTimer);
var uid = res.data.id; var uid = res.data.id;
if(res.code == 200){ if(res.code == 200){
// wx.redirectTo({ wx.redirectTo({
// url: '../../../packageA/sitUp/share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime), url: '../share/share?share=0' + '&id=' + uid + '&showMedal=1&sportTime='+that.formatSeconds(that.data.sportTime),
// }) })
}else{ }else{
that.setData({ that.setData({
aiState:4 aiState:4
......
{
"usingComponents": {},
"disableScroll": true
}
\ No newline at end of file
<camera device-position="{{!cameraFront?'back':'front'}}" flash="off" binderror="error" frame-size="medium" class="camera" id="camera">
<canvas type="2d" id="myCanvas" class="canvas"></canvas>
</camera>
<view wx:if="{{aiState == 1 || aiState == 6}}">
<image class="side-help-img" wx:if="{{showImageUrl}}" src="{{showImageUrl}}"></image>
<view class="help">
<view class="title">互动小提示</view>
<view class="content">手机竖屏固定放置,调整屏幕角度,训练者全身及双脚出现至屏幕内,识别更精准。</view>
</view>
</view>
<!-- 识别成功,读秒 -->
<view class="countdown" wx:if="{{aiState == 2}}">
<view class="second">{{downTime}}</view>
</view>
<!-- 进行中 -->
<view wx:if="{{aiState == 3}}">
<view class="time">{{downTimeStg}}</view>
<view class="number" style="{{levelfontsize}}">{{aiCount}}</view>
</view>
<!-- 成绩提交失败 -->
<view class="tips" wx:if="{{aiState == 4}}">
<view class="tips-type error-type">
抱歉,由于角度、光线等客观环境影响,AI识别失败!结束训练/重新开始训练
</view>
<view class="handle">
<!-- <view class="no-tips">不再提示</view> -->
<view class="know" bindtap="errknow">知道了</view>
</view>
</view>
<!-- 识别中 -->
<view class="switch" bindtap="switch" wx:if="{{aiState == 1}}">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-flip.png"></image>
<view class="text">{{cameraFront?'切换家长拍模式':'切换自拍模式'}}</view>
</view>
<view class="exit" bindtap="exit">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-exit.png"></image>
<view class="text">退出</view>
</view>
<audio src="{{src}}" id="myAudio" ></audio>
@import "../../../css/ai-common.wxss";
\ No newline at end of file
{
"usingComponents": {},
"disableScroll": true
}
\ No newline at end of file
<camera device-position="{{!cameraFront?'back':'front'}}" flash="off" binderror="error" frame-size="medium" class="camera" id="camera">
<canvas type="2d" id="myCanvas" class="canvas"></canvas>
</camera>
<view wx:if="{{aiState == 1 || aiState == 6}}">
<image class="help-img" wx:if="{{showImageUrl}}" src="{{showImageUrl}}"></image>
<view class="help">
<view class="title">互动小提示</view>
<view class="content">手机竖屏固定放置,调整屏幕角度,训练者全身及双脚出现至屏幕内,识别更精准。</view>
</view>
</view>
<!-- 识别成功,读秒 -->
<view class="countdown" wx:if="{{aiState == 2}}">
<view class="second">{{downTime}}</view>
</view>
<!-- 进行中 -->
<view wx:if="{{aiState == 3}}">
<view class="time">{{downTimeStg}}</view>
<view class="number" style="{{levelfontsize}}">{{aiCount}}</view>
</view>
<!-- 成绩提交失败 -->
<view class="tips" wx:if="{{aiState == 4}}">
<view class="tips-type error-type">
抱歉,由于角度、光线等客观环境影响,AI识别失败!结束训练/重新开始训练
</view>
<view class="handle">
<!-- <view class="no-tips">不再提示</view> -->
<view class="know" bindtap="errknow">知道了</view>
</view>
</view>
<!-- 识别中 -->
<view class="switch" bindtap="switch" wx:if="{{aiState == 1}}">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-flip.png"></image>
<view class="text">{{cameraFront?'切换家长拍模式':'切换自拍模式'}}</view>
</view>
<view class="exit" bindtap="exit">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-exit.png"></image>
<view class="text">退出</view>
</view>
<audio src="{{src}}" id="myAudio" ></audio>
@import "../../../css/ai-common.wxss";
\ No newline at end of file
{
"usingComponents": {},
"disableScroll": true
}
\ No newline at end of file
<camera device-position="{{!cameraFront?'back':'front'}}" flash="off" binderror="error" frame-size="medium" class="camera" id="camera">
<canvas type="2d" id="myCanvas" class="canvas"></canvas>
</camera>
<view wx:if="{{aiState == 1 || aiState == 6}}">
<image class="help-img" wx:if="{{showImageUrl}}" src="{{showImageUrl}}"></image>
<view class="help">
<view class="title">互动小提示</view>
<view class="content">手机竖屏固定放置,调整屏幕角度,训练者全身及双脚出现至屏幕内,识别更精准。</view>
</view>
</view>
<!-- 识别成功,读秒 -->
<view class="countdown" wx:if="{{aiState == 2}}">
<view class="second">{{downTime}}</view>
</view>
<!-- 进行中 -->
<view wx:if="{{aiState == 3}}">
<view class="time">{{downTimeStg}}</view>
<view class="number" style="{{levelfontsize}}">{{aiCount}}</view>
</view>
<!-- 成绩提交失败 -->
<view class="tips" wx:if="{{aiState == 4}}">
<view class="tips-type error-type">
抱歉,由于角度、光线等客观环境影响,AI识别失败!结束训练/重新开始训练
</view>
<view class="handle">
<!-- <view class="no-tips">不再提示</view> -->
<view class="know" bindtap="errknow">知道了</view>
</view>
</view>
<!-- 识别中 -->
<view class="switch" bindtap="switch" wx:if="{{aiState == 1}}">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-flip.png"></image>
<view class="text">{{cameraFront?'切换家长拍模式':'切换自拍模式'}}</view>
</view>
<view class="exit" bindtap="exit">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-exit.png"></image>
<view class="text">退出</view>
</view>
<audio src="{{src}}" id="myAudio" ></audio>
@import "../../../css/ai-common.wxss";
\ No newline at end of file
{
"usingComponents": {},
"disableScroll": true
}
\ No newline at end of file
<camera device-position="{{!cameraFront?'back':'front'}}" flash="off" binderror="error" frame-size="medium" class="camera" id="camera">
<canvas type="2d" id="myCanvas" class="canvas"></canvas>
</camera>
<view wx:if="{{aiState == 1 || aiState == 6}}">
<image class="side-help-img" wx:if="{{showImageUrl}}" src="{{showImageUrl}}"></image>
<view class="help">
<view class="title">互动小提示</view>
<view class="content">手机竖屏固定放置,调整屏幕角度,训练者全身及双脚出现至屏幕内,识别更精准。</view>
</view>
</view>
<!-- 识别成功,读秒 -->
<view class="countdown" wx:if="{{aiState == 2}}">
<view class="second">{{downTime}}</view>
</view>
<!-- 进行中 -->
<view wx:if="{{aiState == 3}}">
<view class="time">{{downTimeStg}}</view>
<view class="number" style="{{levelfontsize}}">{{aiCount}}</view>
</view>
<!-- 成绩提交失败 -->
<view class="tips" wx:if="{{aiState == 4}}">
<view class="tips-type error-type">
抱歉,由于角度、光线等客观环境影响,AI识别失败!结束训练/重新开始训练
</view>
<view class="handle">
<!-- <view class="no-tips">不再提示</view> -->
<view class="know" bindtap="errknow">知道了</view>
</view>
</view>
<!-- 识别中 -->
<view class="switch" bindtap="switch" wx:if="{{aiState == 1}}">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-flip.png"></image>
<view class="text">{{cameraFront?'切换家长拍模式':'切换自拍模式'}}</view>
</view>
<view class="exit" bindtap="exit">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-exit.png"></image>
<view class="text">退出</view>
</view>
<audio src="{{src}}" id="myAudio" ></audio>
@import "../../../css/ai-common.wxss";
\ No newline at end of file
{
"usingComponents": {},
"disableScroll": true
}
\ No newline at end of file
<camera device-position="{{!cameraFront?'back':'front'}}" flash="off" binderror="error" frame-size="medium" class="camera" id="camera">
<canvas type="2d" id="myCanvas" class="canvas"></canvas>
</camera>
<view wx:if="{{aiState == 1 || aiState == 6}}">
<image class="side-help-img" wx:if="{{showImageUrl}}" src="{{showImageUrl}}"></image>
<view class="help">
<view class="title">互动小提示</view>
<view class="content">手机竖屏固定放置,调整屏幕角度,训练者全身及双脚出现至屏幕内,识别更精准。</view>
</view>
</view>
<!-- 识别成功,读秒 -->
<view class="countdown" wx:if="{{aiState == 2}}">
<view class="second">{{downTime}}</view>
</view>
<!-- 进行中 -->
<view wx:if="{{aiState == 3}}">
<view class="time">{{downTimeStg}}</view>
<view class="number" style="{{levelfontsize}}">{{aiCount}}</view>
</view>
<!-- 成绩提交失败 -->
<view class="tips" wx:if="{{aiState == 4}}">
<view class="tips-type error-type">
抱歉,由于角度、光线等客观环境影响,AI识别失败!结束训练/重新开始训练
</view>
<view class="handle">
<!-- <view class="no-tips">不再提示</view> -->
<view class="know" bindtap="errknow">知道了</view>
</view>
</view>
<!-- 识别中 -->
<view class="switch" bindtap="switch" wx:if="{{aiState == 1}}">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-flip.png"></image>
<view class="text">{{cameraFront?'切换家长拍模式':'切换自拍模式'}}</view>
</view>
<view class="exit" bindtap="exit">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-exit.png"></image>
<view class="text">退出</view>
</view>
<audio src="{{src}}" id="myAudio" ></audio>
@import "../../../css/ai-common.wxss";
\ No newline at end of file
...@@ -6,7 +6,7 @@ var time = 0; ...@@ -6,7 +6,7 @@ var time = 0;
var iosNum = 0;//ios不能重复播放同一地址音频,后加一位数,加时间戳不行 var iosNum = 0;//ios不能重复播放同一地址音频,后加一位数,加时间戳不行
Page({ Page({
mixins: [require('../ai-mixins/ai-ywqz-mixins.js')], behaviors: [require('../ai-mixins/ai-ywqz-mixins.js')],
data: { data: {
fps:20,//控制频率 fps:20,//控制频率
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<canvas type="2d" id="myCanvas" class="canvas"></canvas> <canvas type="2d" id="myCanvas" class="canvas"></canvas>
</camera> </camera>
<view wx:if="{{aiState == 1 || aiState == 6}}"> <view wx:if="{{aiState == 1 || aiState == 6}}">
<image class="help-img" src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/jumping-jacks.png"></image> <image class="ywqz-help-img" src="{{showImageUrl}}"></image>
<view class="help"> <view class="help">
<view class="title">互动小提示</view> <view class="title">互动小提示</view>
<view class="content">手机竖屏固定放置,调整屏幕角度,训练者全身及双脚出现至屏幕内,识别更精准。</view> <view class="content">手机竖屏固定放置,调整屏幕角度,训练者全身及双脚出现至屏幕内,识别更精准。</view>
......
...@@ -110,17 +110,21 @@ Page({ ...@@ -110,17 +110,21 @@ Page({
//运动时常 //运动时常
let time = this.data.timeList[this.data.popupActive].value let time = this.data.timeList[this.data.popupActive].value
if(this.data.sportDetail.id == 2){ //仰卧起坐 const sportName = {
wx.navigateTo({ 1:'ts', //跳绳
url:'../../../subPages/sport/ai-ywqz-sport/ai-ywqz-sport?sportTime=' + time, 2:'ywqz', //仰卧起坐
}) 3:'tjz', //踢毽子
}else if(this.data.sportDetail.id == 14){ //俯卧撑 11:'kht', //开合跳
wx.navigateTo({ 13:'sd', //深蹲
url:'../../../subPages/sport/ai-fwc-sport/ai-fwc-sport?sportTime=' + time, 14:'fwc', //俯卧撑
}) 15:'gtt', //高抬腿
}else{ 16:'ydtt', //原地踢腿
17:'ydp', //原地跑
}
// TODU 由于原生小程序受限,无法动态配置mixins和behaviors来做逻辑混淆,所以AI页面只能逐一列出
if([1,2,3,11,13,14,15,16,17].includes(this.data.sportDetail.id)){
wx.navigateTo({ wx.navigateTo({
url:'../../../subPages/sport/ai-sport/ai-sport?sportTime=' + time, url:`../../../subPages/sport/ai-${sportName[this.data.sportDetail.id]}-sport/ai-${sportName[this.data.sportDetail.id]}-sport?sportTime=${time}`,
}) })
} }
}, },
......
// packageA/sitUp/share/share.js
var API = require("../../../utils/request.js");
Page({
/**
* 页面的初始数据
*/
data: {
sportTime:'', //mm:ss
share:1,//是否是分享页 1 分享页
sportTime:'', // mm:ss
bg:'',//背景图
bgcolor:'',
sportInfo:[],//运动详情
lv:1,
id:0,
content:'恭喜你',
perserve:false,//是否有累计挑战
nowMedal:[],
ai:"",
showMedal:0,//是否查询勋章
text:'',
projectMap:{1:'跳绳',2:'仰卧起坐',3:'踢毽子',11:'开合跳',13:'深蹲',14:'俯卧撑',15:'高抬腿',16:'原地臀踢',17:'原地跑'},
title:'',
user:0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log('当前接收到的参数',options)
var that = this;
that.setData({
// id:10772914,
// share:0,
sportTime:options.sportTime || '',
ai:options.isDev,
id:options.id,
share:options.share,
showMedal:options.showMedal,
user:options.user || 0
},()=>{
console.log('获取运动详情')
that.getSportDetail(that.data.id)
if(options.showMedal == 1){
// that.getSportMedalByRecordId(that.data.id)
}
})
},
//关闭勋章
czyhClose(){
this.setData({
perserve:false
})
},
//获取当前运动详情是否显示勋章
getSportMedalByRecordId(uid){
var that = this;
API.getDataAll('/medal/getSportMedalByRecordId', {
sportDetailId:uid
}, (res) => {
console.log("当前的运动是否有勋章",res);
if(res.code == 200){
if(res.data.length > 0){
if(res.data[0].done == 1){
that.setData({
nowMedal:res.data[0],
perserve:true,//持之以恒是否显示
})
}else{
console.log('当前运动未获得勋章');
}
}
}
})
},
//获取运动详情
getSportDetail(sid){
var that = this;
API.getDataAll('/project/record/detail/' + sid, {}, (res) => {
console.log('我是运动详情:',res.data);
that.setData({
sportInfo:res.data,
lv:res.data.scoreLevel,
title:that.data.projectMap[res.data.projectId]
},()=>{
wx.setNavigationBarTitle({
title: that.data.projectMap[res.data.projectId]
})
})
if(that.data.share == 1){
console.log('当前是分享进来的')
that.setData({
content: res.data.peopleName + '在“小奔运动”'
})
}
if(res.data.scoreLevel == 1){
console.log('我是优秀')
that.setData({
bg:'https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/yx-medal.png', // 优秀 good 良好 well 达标 standard
bgcolor:'#2D97E8', // 优秀 2D97E8 良好 0099B0 达标 0099B0
text:'成绩达到“国家标准”'
})
wx.setNavigationBarColor({
frontColor: '#ffffff', // 必写项
backgroundColor: '#2D97E8', // 优秀 2D97E8 良好 0099B0 达标 0099B0 不及格 264653
animation: {
// 可选项,加上这项会有个显示的动画效果
duration: 2000,
timingFunc: 'easeIn'
}
})
}else if(res.data.scoreLevel == 2){
console.log('我是良好')
that.setData({
bg:'https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/lh-medal.png', // 优秀 good 良好 well 达标 standard
bgcolor:'#0099B0', // 优秀 2D97E8 良好 0099B0 达标 0099B0
text:'成绩达到“国家标准”',
})
wx.setNavigationBarColor({
frontColor: '#ffffff', // 必写项
backgroundColor: '#0099B0', // 优秀 2D97E8 良好 0099B0 达标 0099B0 不及格 264653
animation: {
// 可选项,加上这项会有个显示的动画效果
duration: 2000,
timingFunc: 'easeIn'
}
})
}else if(res.data.scoreLevel == 3){
console.log('我是及格')
that.setData({
bg:'https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/jg-medal.png', // 优秀 good 良好 well 达标 standard
bgcolor:'#0099B0', // 优秀 2D97E8 良好 0099B0 达标 0099B0
text:'成绩达到“国家标准”',
})
wx.setNavigationBarColor({
frontColor: '#ffffff', // 必写项
backgroundColor: '#0099B0', // 优秀 2D97E8 良好 0099B0 达标 0099B0 不及格 264653
animation: {
// 可选项,加上这项会有个显示的动画效果
duration: 2000,
timingFunc: 'easeIn'
}
})
}else if(res.data.scoreLevel == 4){
console.log('我是不及格')
that.setData({
bg:'https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/bjg-medal.png', // 优秀 good 良好 well 达标 standard
bgcolor:'#264653', // 优秀 2D97E8 良好 0099B0 达标 0099B0
})
wx.setNavigationBarColor({
frontColor: '#ffffff', // 必写项
backgroundColor: '#264653', // 优秀 2D97E8 良好 0099B0 达标 0099B0 不及格 264653
animation: {
// 可选项,加上这项会有个显示的动画效果
duration: 2000,
timingFunc: 'easeIn'
}
})
}else{
that.setData({
bg:'https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/dz-medal.png', // 优秀 good 良好 well 达标 standard
bgcolor:'#2D97E8', // 优秀 2D97E8 良好 0099B0 达标 0099B0
text:'“运动不是一蹴而就 ,是持之以恒”',
})
wx.setNavigationBarColor({
frontColor: '#ffffff', // 必写项
backgroundColor: '#2D97E8', // 优秀 2D97E8 良好 0099B0 达标 0099B0 不及格 264653
animation: {
// 可选项,加上这项会有个显示的动画效果
duration: 2000,
timingFunc: 'easeIn'
}
})
}
})
},
//再来一次
again(){
// wx.redirectTo({
// url: '/packageA/sitUp. /entrance/entrance'
// })
wx.navigateBack({
delta: 1,
})
},
//我也要运动
sport(){
wx.switchTab({
url: '/pages/sport/sport',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function (res) {
var that = this;
var name = that.data.sportInfo.peopleName;
var ai = that.data.sportInfo.sourceType == 21 ? 'AI' : '';
var project = that.data.projectMap[that.data.sportInfo.projectId];
var sportShareImg = {
1:'https://cdn.xiaobentiyu.cn/sport_minapp_img/ai/ai-rope-skipping.png', //跳绳
2:'https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/sit-fx.png', //仰卧起坐
3:'https://cdn.xiaobentiyu.cn/sport_minapp_img/ai/ai-shuttlecock-fx.png', //踢毽子
11:'https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/jumping-jacks-fx.png', //开合跳
13:'https://cdn.xiaobentiyu.cn/sport_minapp_img/ai/ai-squat-fx.png', //深蹲
14:'https://cdn.xiaobentiyu.cn/sport_minapp_img/ai/ai-push-ups-fx.png', //俯卧撑
15:'https://cdn.xiaobentiyu.cn/sport_minapp_img/ai/ai-highLegLifts-fx.png', //高抬腿
16:'https://cdn.xiaobentiyu.cn/sport_minapp_img/ai/ai-hipKicked-fx.png', //原地踢腿
17:'https://cdn.xiaobentiyu.cn/sport_minapp_img/ai/ai-situRun-fx.png', //原地跑
}
var imageUrl = sportShareImg[that.data.sportInfo.projectId] || ''
return{
title:name + '在“小奔运动”小程序中完成了一次' + ai + project +'训练,邀请您也一起参与!',
path:'packageA/sitUp/share/share?id=' + that.data.id + '&share=1&showMedal=0&sportTime='+that.data.sportTime,
imageUrl:imageUrl
}
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": ""
}
\ No newline at end of file
<!-- 及格以上 -->
<view class="top" style="background: {{bgcolor}};" wx:if="{{lv != 4}}">
<view class="lv">
<image src="{{bg}}"></image>
<view wx:if="{{sportInfo.score == null}}">
</view>
<view wx:else>
<view class="score">{{sportInfo.score || 0}}</view>
<view class="score-unit">分</view>
</view>
<view class="user">
<image src="{{sportInfo.imgSrc}}"></image>
<view class="name">{{sportInfo.peopleName}}</view>
</view>
<view class="text">{{text}}</view>
</view>
</view>
<!-- 不及格 -->
<view class="top" style="background: {{bgcolor}};" wx:else>
<view class="lv">
<image src="{{bg}}"></image>
<view class="bjg-score">{{sportInfo.score || 0}}</view>
<view class="bjg-score-unit">分</view>
<view class="user">
<image src="{{sportInfo.imgSrc}}"></image>
<view class="name">{{sportInfo.peopleName}}</view>
</view>
<view class="text">成绩未达到“国家标准”,继续加油</view>
</view>
</view>
<!-- 累计挑战 -->
<view class="challenge-medal" wx:if="{{perserve}}">
<view class="challenge-mask"></view>
<view class="my-medal">
<image class="medal-close" catchtap="czyhClose" src="../../../images/index/medal-close.png"></image>
<view class="medal-title">恭喜你,已获得</view>
<image class="medal" src="{{nowMedal.hasgetImg}}"></image>
<view class="medal-name">{{nowMedal.name}}</view>
<view class="medal-content">{{nowMedal.content}}</view>
<button class="medal-btn" open-type="share" data-item="{{nowMedal}}" id="2">炫耀勋章</button>
<view class="medal-number">已有{{nowMedal.ownerNum}}人获得</view>
</view>
</view>
<view class="results">
<view class="one-content">{{content}}</view>
<view class="two-content">完成一次【{{projectMap[sportInfo.projectId]}}】{{sportInfo.sourceType == 21 ? 'AI' : ''}}体育训练</view>
<view class="results-list">
<view class="results-li">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-time.png"></image>
<view class="content">{{sportTime?sportTime:'01:00'}}</view>
<view class="title">用时</view>
</view>
<view class="results-li">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-number.png"></image>
<view class="content">{{sportInfo.sportValue || 00}}</view>
<view class="title">个数</view>
</view>
<view class="results-li">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/icon-calorie.png"></image>
<view class="content">{{sportInfo.calorie || 00}}</view>
<view class="title">千卡</view>
</view>
</view>
<view class="time">{{sportInfo.createTime}} 完成</view>
<view class="share-content" wx:if="{{share == 1}}">
<view class="line"></view>
<view class="share-text">
<view class="share-yq">邀请你也一起来运动</view>
<view class="share-sm">扫码关注“小奔运动”公众号,了解更多</view>
</view>
<image class="share-img" src="https://cdn.xiaobentiyu.cn/sport_minapp_img/sitUp/gzh-ewm.png"></image>
</view>
</view>
<view class="foot" wx:if="{{share == 0}}">
<button open-type="share" class="share" id="1">分享成果,邀请小伙伴</button>
<view class="again" bindtap="again" wx:if="{{user == 0}}">再来一次训练</view>
</view>
<view class="foot" wx:else>
<view class="sport" bindtap="sport">我也要运动</view>
</view>
\ No newline at end of file
...@@ -7,7 +7,7 @@ var version = 'v2.0.5' ...@@ -7,7 +7,7 @@ var version = 'v2.0.5'
* doSuccess:成功的回调函数 * doSuccess:成功的回调函数
* doFail:失败的回调函数 * doFail:失败的回调函数
*/ */
function request(url, postData, doSuccess) { function requestAll(url, postData, doSuccess) {
// postData.userId = parseInt(wx.getStorageSync('userId')); // postData.userId = parseInt(wx.getStorageSync('userId'));
wx.request({ wx.request({
//项目的真正接口,通过字符串拼接方式实现 //项目的真正接口,通过字符串拼接方式实现
...@@ -83,7 +83,7 @@ function getData(url, data, doSuccess, doFail) { ...@@ -83,7 +83,7 @@ function getData(url, data, doSuccess, doFail) {
}) })
} }
//GET请求,不需传参,直接URL调用, //GET请求,不需传参,直接URL调用,
function getDataFail(url, data, doSuccess, doFail) { function getDataAll(url, data, doSuccess, doFail) {
wx.request({ wx.request({
url: wx.getStorageSync('host') + url, url: wx.getStorageSync('host') + url,
header: { header: {
...@@ -125,7 +125,7 @@ function log(val){ ...@@ -125,7 +125,7 @@ function log(val){
} }
module.exports.request = request; module.exports.requestAll = requestAll;
module.exports.getData = getData; module.exports.getData = getData;
module.exports.getDataFail = getDataFail module.exports.getDataAll = getDataAll
module.exports.log = log; module.exports.log = log;
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