Files
zyt/TongjiUniApp/unpackage/dist/dev/mp-weixin/training/pages/dumbbell.js
2026-08-17 13:59:12 +08:00

3 lines
6.7 KiB
JavaScript

"use strict";const e=require("../../common/vendor.js"),ge="https://gz-1349751149.cos.ap-guangzhou.myqcloud.com/uploads/video/20260528/202605281739117bf3c2914.mp4",B="https://gz-1349751149.cos.ap-guangzhou.myqcloud.com/uploads/images/20260529/202605291142269212d9402.jpg",he="https://gz-1349751149.cos.ap-guangzhou.myqcloud.com/uploads/file/20260528/20260528093709c669f4659.mp3",W=e.defineComponent({__name:"dumbbell",setup(Re){const w=[{id:"light",bpm:50,met:3.5,label:"轻度",desc:"热身 · 激活"},{id:"medium",bpm:65,met:5,label:"中度",desc:"日常 · 塑形"},{id:"heavy",bpm:80,met:6.5,label:"重度",desc:"强化 · 挑战"}],L=[{minutes:0,label:"自由"},{minutes:5,label:"5 分钟"},{minutes:10,label:"10 分钟"},{minutes:15,label:"15 分钟"}],v=[{emoji:"💪",title:"热身完成",desc:"肌肉已激活!",minReps:8,maxReps:12},{emoji:"🔥",title:"力量提升",desc:"动作很标准!",minReps:15,maxReps:20},{emoji:"⚡",title:"塑形进阶",desc:"线条感很棒!",minReps:25,maxReps:30},{emoji:"🏆",title:"完美收官",desc:"太强了!",minReps:40,maxReps:50}],X=[{emoji:"🍬",name:"糖果",sugar:95,unit:"颗",weight:5},{emoji:"🍪",name:"饼干",sugar:65,unit:"块",weight:10},{emoji:"🍫",name:"巧克力",sugar:51.5,unit:"块",weight:50},{emoji:"🍎",name:"苹果",sugar:10.3,unit:"个",weight:200},{emoji:"🍌",name:"香蕉",sugar:12.2,unit:"根",weight:120},{emoji:"🍚",name:"米饭",sugar:25.9,unit:"碗",weight:150},{emoji:"🥤",name:"可乐",sugar:10.6,unit:"罐",weight:330}],y=e.ref("medium"),i=e.ref(0),n=e.ref(!1),p=e.ref(null),x=e.ref(!1),s=e.ref(!1),S=e.ref(v[0]),l=e.ref(null),g=e.ref(!0),o=e.ref(0),c=e.ref(0),m=e.ref(0),M=e.ref(0),f=e.ref(0),I=e.ref(0),j=e.ref(0),h=e.ref(null),U=e.computed(()=>w.find(t=>t.id===y.value)||w[1]),E=e.computed(()=>U.value.bpm),Y=e.computed(()=>U.value.met),b=e.ref(!1),Z=e.computed(()=>{const t=L.find(u=>u.minutes===i.value);return t?t.label:"自由"}),R=e.ref(!1),C={muscles:["肱二头肌","三角肌","胸大肌","背阔肌"],effect:"多角度抗阻训练上肢与肩背肌群,提升肌肉力量与耐力,雕塑手臂与肩部线条,增强骨密度,改善上肢日常功能。"};e.watch(n,t=>{const u=e.index.createVideoContext("dumbbellDemoVideo");u&&(t?u.play():u.pause())});const ee=e.computed(()=>6e4/E.value),D=e.computed(()=>n.value||o.value>0),d=e.computed(()=>!n.value&&o.value>0&&!s.value),O=e.computed(()=>{if(i.value===0)return null;const t=i.value*60;return Math.max(0,t-c.value)}),te=e.computed(()=>d.value?"点击继续":"点击开始"),ae=e.computed(()=>n.value?"训练中":d.value?"已暂停":"待开始"),$=e.computed(()=>o.value===0?"哑铃训练 · 一起练起来":`刚刚完成 ${o.value} 次哑铃训练,约消耗 ${m.value.toFixed(1)}g 糖分 💪`),ue=e.computed(()=>({"--beat-duration":`${ee.value}ms`})),P=e.computed(()=>{if(m.value===0)return[];const t=[];for(const u of X){const a=u.sugar*u.weight/100,r=m.value/a;r>=.1&&r<=50&&t.push({emoji:u.emoji,name:u.name,count:r>=10?Math.round(r).toString():r.toFixed(1),unit:u.unit})}return t.slice(0,3)});function ne(){M.value++,M.value%2===0&&(o.value++,o.value>=I.value&&f.value<v.length&&oe())}function le(t){const u=t/3600;return Y.value*60*u/4}function k(t){const u=Math.floor(t/60),a=t%60;return`${u}:${a.toString().padStart(2,"0")}`}function oe(){const t=v[f.value];if(S.value=t,re(),f.value++,f.value<v.length){const u=v[f.value],a=u.maxReps-u.minReps;I.value=o.value+u.minReps+Math.floor(Math.random()*(a+1))}setTimeout(()=>{x.value=!0},400)}function z(){x.value=!1}function re(){e.index.vibrateShort({type:"medium",fail:()=>{try{e.index.vibrateShort({})}catch{}}})}function F(){T(),n.value=!0;const t=6e4/E.value;p.value=setInterval(ne,t)}function T(){n.value=!1,p.value&&(clearInterval(p.value),p.value=null)}function N(){if(g.value){if(l.value){try{l.value.play()}catch{}return}l.value=e.index.createInnerAudioContext(),l.value.src=he,l.value.loop=!0,l.value.obeyMuteSwitch=!1,l.value.volume=.4;try{l.value.play()}catch{}}}function V(){if(l.value)try{l.value.pause()}catch{}}function ie(){g.value=!g.value,g.value&&n.value?N():V()}function se(t){n.value||(y.value=t,p.value&&(T(),F()))}function ce(t){n.value||(i.value=t)}function q(){n.value?H():(o.value===0&&_(),G())}function G(){F(),N(),de(),e.index.setKeepScreenOn({keepScreenOn:!0})}function H(){T(),V(),J(),e.index.setKeepScreenOn({keepScreenOn:!1})}function K(){o.value!==0&&(H(),s.value=!0)}function ve(){s.value=!1,_()}function me(){s.value=!1,_()}function fe(){s.value=!1,_(),G()}function _(){o.value=0,c.value=0,m.value=0,M.value=0,f.value=0,j.value=Date.now();const t=v[0],u=t.maxReps-t.minReps;I.value=t.minReps+Math.floor(Math.random()*(u+1))}function de(){h.value||(j.value=Date.now()-c.value*1e3,h.value=setInterval(()=>{c.value=Math.floor((Date.now()-j.value)/1e3),m.value=le(c.value),i.value>0&&c.value>=i.value*60&&K()},1e3))}function J(){h.value&&(clearInterval(h.value),h.value=null)}e.onShareAppMessage(()=>({title:$.value,path:"/training/pages/dumbbell",imageUrl:B})),e.onShareTimeline(()=>({title:$.value,imageUrl:B}));function Q(){var t;T(),J(),e.index.setKeepScreenOn({keepScreenOn:!1});try{(t=e.index.createVideoContext("dumbbellDemoVideo"))==null||t.pause()}catch{}if(l.value){try{l.value.stop()}catch{}try{l.value.destroy()}catch{}l.value=null}}return e.onHide(Q),e.onUnload(Q),(t,u)=>e.e({a:e.t(ae.value),b:n.value?1:"",c:d.value?1:"",d:ge,e:B,f:!n.value},n.value?{h:e.t(E.value)}:{g:e.t(te.value)},{i:e.o(q,"f3"),j:n.value?1:"",k:e.t(g.value?"🎵":"🔇"),l:e.o(ie,"e3"),m:O.value!==null&&D.value},O.value!==null&&D.value?{n:e.t(k(O.value))}:{},{o:n.value},n.value?{}:{},{p:e.f(w,(a,r,A)=>({a:e.t(a.label),b:e.t(a.bpm),c:a.id,d:y.value===a.id?1:"",e:e.o(pe=>se(a.id),a.id)})),q:n.value?1:"",r:e.t(Z.value),s:e.t(b.value?"▲":"▼"),t:e.o(a=>b.value=!b.value,"52"),v:b.value},b.value?{w:e.f(L,(a,r,A)=>({a:e.t(a.label),b:a.minutes,c:i.value===a.minutes?1:"",d:e.o(pe=>ce(a.minutes),a.minutes)})),x:n.value?1:""}:{},{y:e.t(R.value?"收起 ▲":"展开 ▼"),z:e.o(a=>R.value=!R.value,"f5"),A:R.value},R.value?{B:e.f(C.muscles,(a,r,A)=>({a:e.t(a),b:a})),C:e.t(C.effect)}:{},{D:d.value},d.value?{E:e.o(q,"6e"),F:e.o(K,"4a")}:{},{G:n.value?1:"",H:d.value?1:"",I:e.s(ue.value),J:x.value},x.value?{K:e.t(S.value.emoji),L:e.t(S.value.title),M:e.t(S.value.desc),N:e.t(o.value),O:e.o(z,"7c"),P:e.o(()=>{},"ef"),Q:e.o(z,"fd")}:{},{R:s.value},s.value?e.e({S:e.t(o.value),T:e.t(k(c.value)),U:e.t(m.value.toFixed(1)),V:P.value.length>0},P.value.length>0?{W:e.f(P.value,(a,r,A)=>({a:e.t(a.emoji),b:e.t(a.count),c:e.t(a.unit),d:e.t(a.name),e:r}))}:{},{X:e.o(fe,"f6"),Y:e.o(me,"44"),Z:e.o(()=>{},"16"),aa:e.o(ve,"84")}):{})}});W.__runtimeHooks=6;const be=e._export_sfc(W,[["__scopeId","data-v-99a2f98c"]]);wx.createPage(be);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/training/pages/dumbbell.js.map