|
@@ -88,57 +88,53 @@
|
|
|
</view>
|
|
|
|
|
|
<!-- pk模式下的跳绳 -->
|
|
|
- <view v-if="currentMode == 'pkMode' && 1 === currentModeIndex" class="flex justify-center "
|
|
|
- style="height: 180rpx; margin-top: 20rpx;">
|
|
|
- <view class="flex flex-direction justify-center align-center">
|
|
|
- <view class="cu-avatar-group" style="position: relative;">
|
|
|
- <view class="cu-avatar round xl" :class="bAiHitShake?' screen-jitter':''"
|
|
|
- :style="[{ backgroundImage:'url('+avatarUrl+')' }]"></view>
|
|
|
- <HitEffect ref="aiHitEffectRef"></HitEffect>
|
|
|
- </view>
|
|
|
- <view style="margin-top: 20rpx; width: 165rpx; "
|
|
|
- class="text-cut text-white text-center">
|
|
|
- {{userName}}
|
|
|
+ <block v-if="1 === currentModeIndex">
|
|
|
+ <view v-if="currentMode == 'pkMode'" class="flex justify-center "
|
|
|
+ style="height: 180rpx; margin-top: 20rpx;">
|
|
|
+ <view class="flex flex-direction justify-center align-center">
|
|
|
+ <view class="cu-avatar-group" style="position: relative;">
|
|
|
+ <view class="cu-avatar round xl" :class="bAiHitShake?' screen-jitter':''"
|
|
|
+ :style="[{ backgroundImage:'url('+avatarUrl+')' }]"></view>
|
|
|
+ </view>
|
|
|
+ <view style="margin-top: 20rpx; width: 165rpx; "
|
|
|
+ class="text-cut text-white text-center">
|
|
|
+ {{userName}}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
|
|
|
- <view class="flex justify-center align-center " style=" width: 300rpx;">
|
|
|
- <LEDFont style="" :showValue='myAcionJumpScore' :size="30" color='#FFFFFF'>
|
|
|
- </LEDFont>
|
|
|
- <view class="text-white text-bold">:</view>
|
|
|
- <LEDFont style="" :showValue='otherActionJumpScore' :size="30" color='#FFFFFF'>
|
|
|
- </LEDFont>
|
|
|
- </view>
|
|
|
- <view v-if="finallySelectFriendInfo"
|
|
|
- class="flex flex-direction justify-center align-center"
|
|
|
- @click="onNavToSelectFriend()">
|
|
|
- <view class="cu-avatar-group" style="position: relative;">
|
|
|
- <view class="cu-avatar round xl" :class="bHitShake?' screen-jitter':''"
|
|
|
- :style="[{ backgroundImage:'url('+finallySelectFriendInfo.avatarUrl+')' }]">
|
|
|
- </view>
|
|
|
- <HitEffect ref="hitEffectRef"></HitEffect>
|
|
|
+ <view class="flex justify-center align-center " style=" width: 300rpx;">
|
|
|
+ <LEDFont style="" :showValue='AJData.myScore' :size="30" color='#FFFFFF'>
|
|
|
+ </LEDFont>
|
|
|
+ <view class="text-white text-bold">:</view>
|
|
|
+ <LEDFont style="" :showValue='AJData.othreScore' :size="30" color='#FFFFFF'>
|
|
|
+ </LEDFont>
|
|
|
</view>
|
|
|
- <view style="margin-top: 20rpx; width: 165rpx;"
|
|
|
- class="text-cut text-white text-center">
|
|
|
- {{finallySelectFriendInfo.username}}
|
|
|
+ <view v-if="finallySelectFriendInfo"
|
|
|
+ class="flex flex-direction justify-center align-center"
|
|
|
+ @click="onNavToSelectFriend()">
|
|
|
+ <view class="cu-avatar-group" style="position: relative;">
|
|
|
+ <view class="cu-avatar round xl" :class="bHitShake?' screen-jitter':''"
|
|
|
+ :style="[{ backgroundImage:'url('+finallySelectFriendInfo.avatarUrl+')' }]">
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view style="margin-top: 20rpx; width: 165rpx;"
|
|
|
+ class="text-cut text-white text-center">
|
|
|
+ {{finallySelectFriendInfo.username}}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
- <view v-else class="flex flex-direction justify-center align-center"
|
|
|
- @click="onNavToSelectFriend()">
|
|
|
- <image style="width: 100rpx ;height: 100rpx;" src="/static/friend/friend-add.png">
|
|
|
- </image>
|
|
|
- <view style="margin-top: 20rpx; width: 165rpx;"
|
|
|
- class="text-cut text-white text-center">
|
|
|
- 选择好友
|
|
|
+ <view v-else class="flex flex-direction justify-center align-center"
|
|
|
+ @click="onNavToSelectFriend()">
|
|
|
+ <image style="width: 100rpx ;height: 100rpx;"
|
|
|
+ src="/static/friend/friend-add.png">
|
|
|
+ </image>
|
|
|
+ <view style="margin-top: 20rpx; width: 165rpx;"
|
|
|
+ class="text-cut text-white text-center">
|
|
|
+ 选择好友
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
- <view
|
|
|
- style="position: absolute;left: 0;right: 0;top: 0;bottom: 0; height: 200rpx; margin-top: 120rpx;">
|
|
|
- <HitFistEffect ref="hitFistRef"></HitFistEffect>
|
|
|
- </view>
|
|
|
-
|
|
|
- </view>
|
|
|
+ <view v-else style="height:80rpx;"> </view>
|
|
|
+ </block>
|
|
|
|
|
|
<!-- 圆形进度条 -->
|
|
|
<view
|
|
@@ -155,16 +151,16 @@
|
|
|
<!-- 图标 -->
|
|
|
<view class="personal-fruit-container">
|
|
|
<view class="text-13px text-white" style="margin-top: -50px;">
|
|
|
- 失误:{{actionJumpFaultCount}}</view>
|
|
|
+ 失误:{{AJData.faultCount}}</view>
|
|
|
</view>
|
|
|
<!-- 水果卡路里-->
|
|
|
<!-- <view class="personal-fruit-container">
|
|
|
<fruit ref="personalFruitRef" :calorie="planData.allCalorie"></fruit>
|
|
|
</view> -->
|
|
|
|
|
|
- <!-- 计划运动时间提示 -->
|
|
|
+ <!-- 跳动次数 -->
|
|
|
<view class="personal-fruit-container">
|
|
|
- <LEDFont style="margin-top: 40px;" :showValue='actionJumpAllCount' :size="60"
|
|
|
+ <LEDFont style="margin-top: 40px;" :showValue='AJData.allCount' :size="60"
|
|
|
color='#FFFFFF'>
|
|
|
</LEDFont>
|
|
|
<!-- <view style="margin-top: 130px;font-size:12px;color: #FFFFFF;">计划时间{{planData.sportTime}}分钟</view> -->
|
|
@@ -184,9 +180,10 @@
|
|
|
<view class="personal-fruit-container">
|
|
|
<arcbarCountDown
|
|
|
style="margin-top: 150px; border: 1rpx solid rgba(255,255,255,0.33); padding: 0 10px; border-radius: 40rpx;"
|
|
|
- ref="arcbarCountDownRef" :show-day="false" :second="actionJumpCountDown"
|
|
|
+ ref="arcbarCountDownRef" :show-day="false" :second="AJData.gameLimitTime"
|
|
|
color="#FFFFFF" background-color="rgba(255,255,255,0);" border-color="#007AFF"
|
|
|
- :size="18" splitorColor="#FFFFFF" />
|
|
|
+ :size="18" splitorColor="#FFFFFF" @timeUp="arcbarCountDownTimeUp"
|
|
|
+ @timeUpdate="arcbarCountDownTimeUpdate" />
|
|
|
</view>
|
|
|
|
|
|
|
|
@@ -216,7 +213,7 @@
|
|
|
|
|
|
<!-- 用于定位 -->
|
|
|
<!-- <view id="boxingHitID" style="position: absolute;top: 180rpx; pointer-events: none;" ></view> -->
|
|
|
- <view id="boxingHitID" v-if="currentModeIndex == 0" class="charts-pring-bottom">
|
|
|
+ <view id="boxingHitID" v-if="0 === currentModeIndex" class="charts-pring-bottom">
|
|
|
<!-- 添加一个 ConnectBindingDevice 测试 -->
|
|
|
<boxing-hit ref="boxingPostRef"
|
|
|
:bUpdate="!bHide&&(ConnectBindingDevice!=null)||(cIndex!=-1 && BLEConnectDevice!=null &&
|
|
@@ -226,17 +223,19 @@
|
|
|
@updateCalorie="boxingUpdateCalorie" @boxingPostCheck="onPersonalCheck"
|
|
|
@shake="onScreenShake" @updateSportTime="onUpdateSportTime"
|
|
|
@boxingGuideFinish="onBoxingGuideFinish"
|
|
|
- @boxingPostControlPlay="onBoxingPostControlPlay" @modeEvent="onModeEvent"
|
|
|
+ @boxingPostControlPlay="onActionControlPlay" @modeEvent="onModeEvent"
|
|
|
@hitEvent="onHitEvent" @aiHitEvent="onAiHitEvent" @gameOver="onBoxingGameOver"
|
|
|
@closeBoxingControl="onCloseBoxingHit"></boxing-hit>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
- <view id='actionJumpID' v-if="true" class="charts-pring-bottom">
|
|
|
- <action-jump ref="actionJumpRef" @actionJumpCheck="onPersonalCheck"
|
|
|
- @actionJumpControllerPlay="onBoxingPostControlPlay"
|
|
|
+ <view id='actionJumpID' v-if="1 === currentModeIndex" class="charts-pring-bottom">
|
|
|
+ <action-jump ref="actionJumpRef"
|
|
|
+ :levelData="currentJumpTask!=null?currentJumpTask.item:null"
|
|
|
+ @actionJumpCheck="onPersonalCheck" @actionJumpControllerPlay="onActionControlPlay"
|
|
|
@actionJumpDataUpdate="onActionJumpDataUpdate"
|
|
|
- @actionJumpCountDownUpdate="onActionJumpCountDownUpdate"></action-jump>
|
|
|
+ @actionJumpCountDownUpdate="onActionJumpCountDownUpdate"
|
|
|
+ @gameOver="onActionJumpGameOver"></action-jump>
|
|
|
</view>
|
|
|
<!-- <button @tap="onTestAddLocalCalorie">11</button> -->
|
|
|
</view>
|
|
@@ -249,15 +248,14 @@
|
|
|
<!-- <button @tap="onShowBoxingHitTip">11</button> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
- <modal-mask></modal-mask>
|
|
|
+ <!-- <modal-mask></modal-mask> -->
|
|
|
|
|
|
- <view class="example">
|
|
|
+ <!-- <view class="example">
|
|
|
<view class="example-title">从左侧滑出</view>
|
|
|
<button @click="showDrawer">显示抽屉</button>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
<view class="example">
|
|
|
- <view class="example-title">从上侧竖向滑出</view>
|
|
|
- <button @click="showPopup">显示 弹出层</button>
|
|
|
+ <button @click="showPopup('signIn',null)">显示 每日签到</button>
|
|
|
</view>
|
|
|
<view style="height: 100rpx;"></view>
|
|
|
</scroll-view>
|
|
@@ -272,9 +270,6 @@
|
|
|
<!-- 右下角导航栏 -->
|
|
|
<round-fab :connect="cIndex!=-1 && BLEConnectDevice!=null" @fabClick="fabClick"></round-fab>
|
|
|
|
|
|
- <!-- 底部操作条 -->
|
|
|
- <!-- <myTabbar style="position:fixed;bottom:0;width:100%;left:0;right:0;" ></myTabbar> -->
|
|
|
-
|
|
|
<!-- 侧边栏 -->
|
|
|
<sideBar ref="sideBar"></sideBar>
|
|
|
|
|
@@ -403,15 +398,18 @@
|
|
|
<view class="flex justify-between" style="width: 100%; padding: 34rpx 60rpx 46rpx 81rpx;">
|
|
|
<view class="flex align-center justify-center">
|
|
|
<view class="text-16px text-bold make-text-bPurple"
|
|
|
- style="line-height: 32rpx; margin-right: 18rpx;">PK模式</view>
|
|
|
+ style="line-height: 32rpx; margin-right: 18rpx;">{{currentMode == 'pkMode'?'PK模式':'健身模式'}}
|
|
|
+ </view>
|
|
|
<image style="width: 42rpx;height: 24rpx;" src="/static/common/modal/right-arrow.png"></image>
|
|
|
</view>
|
|
|
<view>
|
|
|
- <button class="make-bg-bPurple flex justify-center align-center">
|
|
|
+ <button class="make-bg-bPurple flex justify-center align-center" @click="onSwitchMode">
|
|
|
<view class="flex align-center justify-center" style="width: 190rpx;height: 60rpx;">
|
|
|
<image style="width: 24rpx;height: 22rpx; margin-right: 18rpx;"
|
|
|
src="/static/personal/switchWhite.png"></image>
|
|
|
- <view class="text-14px text-white" style="line-height: 28rpx;">健身模式</view>
|
|
|
+ <view class="text-14px text-white" style="line-height: 28rpx;">
|
|
|
+ {{currentMode !== 'pkMode'?'PK模式':'健身模式'}}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</button>
|
|
|
</view>
|
|
@@ -421,48 +419,70 @@
|
|
|
:style="{ height: modalHeight + 'px' }" :scroll-into-view="taskIntoView"
|
|
|
:scroll-top="taskScrollTop">
|
|
|
<view class="my-column-cu-steps">
|
|
|
- <view class="cu-item" :class="index>basics?'':'make-text-bPurple'"
|
|
|
- v-for="(item,index) in basicsList" :key="index" :id='"task_"+index'
|
|
|
+ <view class="cu-item" :class="!item.isUnlock?'':'make-text-bPurple'"
|
|
|
+ v-for="(item,index) in currentTaskList" :key="index" :id='"task_"+index'
|
|
|
@click="selectTask(index,item)">
|
|
|
- <image v-if="index>basics" class="my-column-cu-image"
|
|
|
- src="../../../static/common/modal/lock.png"></image>
|
|
|
- <image v-else class="my-column-cu-image" src="../../../static/common/modal/unLock.png">
|
|
|
+ <image v-if="item.isUnlock" class="my-column-cu-image"
|
|
|
+ src="../../../static/common/modal/unLock.png"></image>
|
|
|
+ <image
|
|
|
+ v-else-if="index>=1&¤tTaskList[index-1].isUnlock&¤tTaskList[index-1].isPassed"
|
|
|
+ class="my-column-cu-image" src="../../../static/common/modal/canUnlock.png">
|
|
|
+ </image>
|
|
|
+ <image v-else class="my-column-cu-image" src="../../../static/common/modal/lock.png">
|
|
|
</image>
|
|
|
<view class="content">
|
|
|
- <!-- 这是第一次,我家的铲屎官走了这么久。久到足足有三天!! -->
|
|
|
<view class="text-15px text-bold text-cut text-left "
|
|
|
style="margin-left: 48rpx; width: 360rpx;">
|
|
|
- {{index+1}}. 拉伸运动拉伸运动拉伸运动拉伸运动
|
|
|
+ {{index+1}}. {{item.name}}
|
|
|
</view>
|
|
|
- <view class="flex justify-start align-center" style="margin-left: 86rpx;">
|
|
|
+ <view class="flex justify-start align-center" style="margin:30rpx 0 30rpx 86rpx;">
|
|
|
<!-- 居中绘制星星样式 -->
|
|
|
<view class="flex align-center justify-center"
|
|
|
style="margin-right: 36rpx;margin-top: 4rpx;">
|
|
|
<image style="width: 24rpx;height: 26rpx; margin-right: 18rpx;"
|
|
|
- src="/static/common/modal/reward.png"></image>
|
|
|
- <view class="text-13px" style="line-height: 26rpx;">{{cDiamond}}</view>
|
|
|
+ src="/static/common/sideBar/sGold.png"></image>
|
|
|
+ <view class="text-13px" style="line-height: 26rpx;">{{item.consumeGold}}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="flex align-center justify-center"
|
|
|
+ style="margin-right: 36rpx;margin-top: 4rpx;">
|
|
|
+ <image style="width: 24rpx;height: 26rpx; margin-right: 18rpx;"
|
|
|
+ src="/static/common/sideBar/sDiamond.png"></image>
|
|
|
+ <view class="text-13px" style="line-height: 26rpx;">{{item.consumeDiamond}}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
+
|
|
|
+ </view>
|
|
|
+ <!-- <view class="text-13px text-grey text-left" style="margin: 20rpx 20rpx 0 86rpx;">
|
|
|
+ {{item.conditionPassed.explain}}
|
|
|
+ </view> -->
|
|
|
+ <view class="flex justify-start align-center" style="margin-left: 86rpx;">
|
|
|
<view class="flex flex-direction align-center" v-for="(item, index) in 5"
|
|
|
:key="index">
|
|
|
<image style="width: 34rpx;height: 32rpx;"
|
|
|
src="../../../static/modal/action-jump/stars.png">
|
|
|
</image>
|
|
|
</view>
|
|
|
+
|
|
|
</view>
|
|
|
- <view class="text-13px text-grey text-left" style="margin: 20rpx 20rpx 0 86rpx;">
|
|
|
- 本关卡是为了让用户开始放松,需要在两分钟内跳100下</view>
|
|
|
- </view>
|
|
|
|
|
|
- <image class="my-column-cu-right-image" src="../../../static/common/modal/medal.png">
|
|
|
+ </view>
|
|
|
+ <image class="my-column-cu-right-image" style="pointer-events:auto;"
|
|
|
+ src="../../../static/common/modal/medal.png" @click="showPopup('prompt',item)">
|
|
|
</image>
|
|
|
|
|
|
+ <image class="my-column-cu-image"
|
|
|
+ style="left: 130rpx;top: 40rpx; width: 50rpx;height: 50rpx;"
|
|
|
+ :src="(currentJumpTask!=null&&item.id==currentJumpTask.item.id)?'/static/devicesOther/radio-b.png':'/static/devicesOther/radio-g.png'"
|
|
|
+ mode="aspectFit"></image>
|
|
|
+
|
|
|
</view>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
|
|
|
|
|
|
<button class="cu-btn make-bg-bPurple text-white margin-top margin-bottom"
|
|
|
- style="width: 604rpx;height: 88rpx;" @tap="BasicsSteps">开始</button>
|
|
|
+ style="width: 604rpx;height: 88rpx;" @tap="onPassTheLevel">点击直接通过所选关卡</button>
|
|
|
|
|
|
</view>
|
|
|
</view>
|
|
@@ -490,7 +510,6 @@
|
|
|
import promptBox from "@/components/prompt-box/prompt-box.vue"
|
|
|
|
|
|
import roundFab from "@/components/round-fab/round-fab.vue"
|
|
|
- import myTabbar from "@/components/hans-tabbar/hans-tabbar.vue"
|
|
|
|
|
|
import codeElfGuide from '@/components/code-elf-guide/code-elf-guide.vue'
|
|
|
|
|
@@ -547,7 +566,7 @@
|
|
|
'systemInfo', 'navHeight', 'tabbarHeight',
|
|
|
'cDiamond', 'cGold',
|
|
|
'finallySelectFriendInfo',
|
|
|
- 'currentJumpTask'
|
|
|
+ 'currentJumpTask', 'singlePersonList', 'multiPersonList'
|
|
|
]),
|
|
|
components: {
|
|
|
// uniNavBar,
|
|
@@ -558,7 +577,6 @@
|
|
|
fruit,
|
|
|
|
|
|
roundFab,
|
|
|
- myTabbar,
|
|
|
|
|
|
codeElfGuide,
|
|
|
boxingPost,
|
|
@@ -662,7 +680,7 @@
|
|
|
avatar: '/static/defaultAvatar.png'
|
|
|
},
|
|
|
|
|
|
- currentMode: 'pkMode', //pkMode calorieMode
|
|
|
+ currentMode: 'calorieMode', //pkMode calorieMode
|
|
|
|
|
|
bHitShake: false,
|
|
|
|
|
@@ -705,15 +723,23 @@
|
|
|
currentTask: null, //当前选择的任务
|
|
|
taskIntoView: '',
|
|
|
taskScrollTop: 0,
|
|
|
+ currentTaskList: [],
|
|
|
+ nextTaskCanUnlock: false, //下一个关卡是否可解锁
|
|
|
|
|
|
/**
|
|
|
* actionJump 模块对应的交互参数
|
|
|
*/
|
|
|
- actionJumpAllCount: 0,
|
|
|
- actionJumpFaultCount: 0,
|
|
|
- actionJumpCountDown: 0,
|
|
|
- myAcionJumpScore: 1000,
|
|
|
- otherActionJumpScore: 80,
|
|
|
+ //pk部分参数
|
|
|
+ AJData: {
|
|
|
+ allCount: 0,
|
|
|
+ faultCount: 0,
|
|
|
+ perCountDown: 0,
|
|
|
+ gameCountDown: 0,
|
|
|
+ myScore: 0,
|
|
|
+ othreScore: 0,
|
|
|
+ gameLimitTime: 0,
|
|
|
+ describe: '', //关卡说明
|
|
|
+ },
|
|
|
|
|
|
/**
|
|
|
* 任务参数
|
|
@@ -741,46 +767,47 @@
|
|
|
// uni.$on('callbackBLEState', this.callbackBLEState);
|
|
|
|
|
|
//获得游戏列表
|
|
|
- reqUtil
|
|
|
- .requestData(config.URL.GAMERECOMMENDBYPLATFORM, {
|
|
|
- recommendType: 2,
|
|
|
- endTime: config.endTime
|
|
|
- })
|
|
|
- .then(
|
|
|
- res => {
|
|
|
- // console.log('GAMERECOMMEND =====', res);
|
|
|
- if (res.code == 0) {
|
|
|
- if (res.data.gameList.length > 3) {
|
|
|
- this.gameList = this.gameList.concat(res.data.gameList.slice(0, 3));
|
|
|
- } else {
|
|
|
- this.gameList = this.gameList.concat(res.data.gameList);
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- e => {
|
|
|
- console.log(e);
|
|
|
- }
|
|
|
- );
|
|
|
+ // reqUtil
|
|
|
+ // .requestData(config.URL.GAMERECOMMENDBYPLATFORM, {
|
|
|
+ // recommendType: 2,
|
|
|
+ // endTime: config.endTime
|
|
|
+ // })
|
|
|
+ // .then(
|
|
|
+ // res => {
|
|
|
+ // // console.log('GAMERECOMMEND =====', res);
|
|
|
+ // if (res.code == 0) {
|
|
|
+ // if (res.data.gameList.length > 3) {
|
|
|
+ // this.gameList = this.gameList.concat(res.data.gameList.slice(0, 3));
|
|
|
+ // } else {
|
|
|
+ // this.gameList = this.gameList.concat(res.data.gameList);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // e => {
|
|
|
+ // console.log(e);
|
|
|
+ // }
|
|
|
+ // );
|
|
|
//获得视频列表
|
|
|
- reqUtil
|
|
|
- .requestData(config.URL.GAMERECOMMENDBYPLATFORM, {
|
|
|
- recommendType: 1,
|
|
|
- endTime: config.endTime
|
|
|
- })
|
|
|
- .then(
|
|
|
- res => {
|
|
|
- if (res.code == 0) {
|
|
|
- if (res.data.gameList.length > 3) {
|
|
|
- this.videoList = this.videoList.concat(res.data.gameList.slice(0, 3));
|
|
|
- } else {
|
|
|
- this.videoList = this.videoList.concat(res.data.gameList);
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- e => {
|
|
|
- console.log(e);
|
|
|
- }
|
|
|
- );
|
|
|
+ // reqUtil
|
|
|
+ // .requestData(config.URL.GAMERECOMMENDBYPLATFORM, {
|
|
|
+ // recommendType: 1,
|
|
|
+ // endTime: config.endTime
|
|
|
+ // })
|
|
|
+ // .then(
|
|
|
+ // res => {
|
|
|
+ // if (res.code == 0) {
|
|
|
+ // if (res.data.gameList.length > 3) {
|
|
|
+ // this.videoList = this.videoList.concat(res.data.gameList.slice(0, 3));
|
|
|
+ // } else {
|
|
|
+ // this.videoList = this.videoList.concat(res.data.gameList);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // e => {
|
|
|
+ // console.log(e);
|
|
|
+ // }
|
|
|
+ // );
|
|
|
+
|
|
|
|
|
|
//初始化后设置一下pickerObj
|
|
|
this.pickerObj = {
|
|
@@ -818,29 +845,14 @@
|
|
|
this.gOnAddClientInfo();
|
|
|
|
|
|
|
|
|
- // 接收 popup 的消息
|
|
|
- uni.$on('popup-page', (data) => {
|
|
|
- switch (data.type) {
|
|
|
- case 'interactive':
|
|
|
- uni.showModal({
|
|
|
- title: '来自Popup的消息',
|
|
|
- content: data.info
|
|
|
- })
|
|
|
- break;
|
|
|
- default:
|
|
|
- uni.showToast({
|
|
|
- title: data.title,
|
|
|
- })
|
|
|
- break;
|
|
|
- }
|
|
|
- })
|
|
|
- // 监听 drawer 消息
|
|
|
- uni.$on('drawer-page', (data) => {
|
|
|
- uni.showToast({
|
|
|
- title: '点击了第' + data + '项',
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- })
|
|
|
+ this.registerPopupEvent();
|
|
|
+
|
|
|
+ //获取任务数据
|
|
|
+ this.getLevelList(() => {
|
|
|
+ this.switchTaskInfo();
|
|
|
+ });
|
|
|
+ //钱包信息
|
|
|
+ this.getUserWallets();
|
|
|
},
|
|
|
onShow() {
|
|
|
_self.bHide = false;
|
|
@@ -915,6 +927,7 @@
|
|
|
// _self.topScrollHight = _self.phoneHeight - _self.navHeight - 30;
|
|
|
// }
|
|
|
// }).exec();
|
|
|
+
|
|
|
},
|
|
|
onUnload() {
|
|
|
console.log("personal ********* onUnload *********");
|
|
@@ -931,8 +944,7 @@
|
|
|
//unload 时候清除timeout
|
|
|
this.onUnloadCreateBLEConnectionTimeout();
|
|
|
|
|
|
- uni.$off('popup-page')
|
|
|
- uni.$off('drawer-page')
|
|
|
+ this.unregisterPopupEvent();
|
|
|
|
|
|
},
|
|
|
onHide() {
|
|
@@ -956,7 +968,8 @@
|
|
|
'gCreateSandbagAlgorithm', 'gUpdateSandbagAlgorithm', 'gStartSimulateBLEUpdate',
|
|
|
'gStopSimulateBLEUpdate',
|
|
|
'getActionJumpTask',
|
|
|
- 'setActionJumpTask'
|
|
|
+ 'setActionJumpTask', 'getLevelList',
|
|
|
+ 'getUserWallets', 'setGoldAndDiamond'
|
|
|
]),
|
|
|
BasicsSteps() {
|
|
|
this.basics = this.basics == this.basicsList.length - 1 ? 0 : this.basics + 1
|
|
@@ -972,8 +985,8 @@
|
|
|
showModal(e) {
|
|
|
this.modalName = e.currentTarget.dataset.target;
|
|
|
this.$store.state.bCanvasShow = false;
|
|
|
-
|
|
|
- if(this.modalName == "slideUpModal"){
|
|
|
+
|
|
|
+ if (this.modalName == "slideUpModal") {
|
|
|
this.updateTaskScroll();
|
|
|
}
|
|
|
},
|
|
@@ -997,6 +1010,27 @@
|
|
|
console.log(_add);
|
|
|
this.onUpdateCaloriePlane(10);
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 首页圆形表部分时间计时器
|
|
|
+ */
|
|
|
+ arcbarCountDownTimeUp() {
|
|
|
+ //todo,涉及到倒计时的关卡。时间到。游戏结束
|
|
|
+ if (1 === this.currentModeIndex) {
|
|
|
+ this.$refs.actionJumpRef.onGameOver();
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ arcbarCountDownTimeUpdate(data) {
|
|
|
+ this.AJData.gameCountDown = data.curSeconds;
|
|
|
+ this.updateArcbarDataFromActionJump();
|
|
|
+ },
|
|
|
+ arcbarCountDownTimeReset() {
|
|
|
+ //清除时间计时器
|
|
|
+ this.$refs.arcbarCountDownRef.timePause();
|
|
|
+ },
|
|
|
+ arcbarCountDownPlay() {
|
|
|
+ this.$refs.arcbarCountDownRef.timePlay();
|
|
|
+ },
|
|
|
// 进度条数据
|
|
|
arcbarData(_planData) {
|
|
|
let showCal = 0,
|
|
@@ -1038,11 +1072,12 @@
|
|
|
|
|
|
series = [{
|
|
|
name: showTip,
|
|
|
- data: this.actionJumpAllCount == 0 ? 0 : this.actionJumpAllCount / 200,
|
|
|
+ data: this.AJData.gameCountDown == 0 ? 0 : this.AJData.gameCountDown / this.AJData
|
|
|
+ .gameLimitTime,
|
|
|
color: '#2fc25b'
|
|
|
}];
|
|
|
|
|
|
- console.log(series);
|
|
|
+ // console.log(series);
|
|
|
}
|
|
|
|
|
|
return {
|
|
@@ -1607,8 +1642,16 @@
|
|
|
if (0 === this.currentModeIndex) {
|
|
|
this.onBoxingGuideFinish();
|
|
|
} else if (1 === this.currentModeIndex) {
|
|
|
+ if (this.currentJumpTask == null) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '先选一个挑战关卡',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000,
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
//调用开始
|
|
|
- this.$refs.actionJumpRef.onActionJumpPlay();
|
|
|
+ this.onActionJumpPlay();
|
|
|
}
|
|
|
|
|
|
return;
|
|
@@ -1650,6 +1693,7 @@
|
|
|
// }
|
|
|
|
|
|
} else if (1 === this.currentModeIndex) {
|
|
|
+
|
|
|
//2.检测是否连接设备 || this.BLEConnectDevice.ename !== 'BT04'
|
|
|
if (this.cIndex == -1) {
|
|
|
//没有连接设备,提示去连接设备
|
|
@@ -1747,8 +1791,7 @@
|
|
|
uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
|
|
|
|
|
|
//调用开始
|
|
|
- this.$refs.actionJumpRef.onActionJumpPlay();
|
|
|
-
|
|
|
+ this.onActionJumpPlay();
|
|
|
}
|
|
|
},
|
|
|
onShowBoxingHitTip() {
|
|
@@ -1759,14 +1802,16 @@
|
|
|
},
|
|
|
//检测是否符合要求,没有的话进行新手提示
|
|
|
onPersonalCheck() {
|
|
|
- // //判断一下,是否达标,给moadal 提示
|
|
|
- // if (this.planData.allCalorie >= this.planData.calorie) {
|
|
|
- // this.modalName = 'showPlanTipModal';
|
|
|
- // this.planTipIndex = 0;
|
|
|
- // } else {
|
|
|
- // //如果是一开始,还没达标,就不给modal 提示
|
|
|
- // this.onStartCheck();
|
|
|
- // }
|
|
|
+
|
|
|
+ if (1 === this.currentModeIndex && this.currentJumpTask == null) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '先选一个挑战关卡',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000,
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
this.onStartCheck();
|
|
|
},
|
|
|
//
|
|
@@ -1777,8 +1822,8 @@
|
|
|
this.b_countDown = null;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if (this.currentMode == 'calorieMode' || this.currentMode == 'ropeMode') {
|
|
|
+ //|| this.currentMode == 'ropeMode'
|
|
|
+ if (this.currentMode == 'calorieMode') {
|
|
|
this.personalAudioContext.stop();
|
|
|
this.personalAudioContext.play();
|
|
|
|
|
@@ -1885,7 +1930,7 @@
|
|
|
this.modalName = null;
|
|
|
if (this.planTipIndex === 1) {
|
|
|
// 您今天的目标还没完成 是否结束训练
|
|
|
- this.onBoxingPause(false);
|
|
|
+ this.onActionPause(false);
|
|
|
}
|
|
|
},
|
|
|
confirmPlanTipModal() {
|
|
@@ -1894,7 +1939,7 @@
|
|
|
this.onStartCheck()
|
|
|
} else if (this.planTipIndex === 1) {
|
|
|
// 您今天的目标还没完成 是否结束训练
|
|
|
- this.onBoxingPause(true);
|
|
|
+ this.onActionPause(true);
|
|
|
}
|
|
|
},
|
|
|
//断开连接时候,关闭
|
|
@@ -1903,28 +1948,30 @@
|
|
|
if (this.currentMode == 'pkMode') {
|
|
|
this.$refs.hitEffectRef.onStop();
|
|
|
}
|
|
|
- this.onBoxingPause(true);
|
|
|
+ this.onActionPause(true);
|
|
|
},
|
|
|
//点击暂停时候,判断一下是否完成目标
|
|
|
- onBoxingPostControlPlay(bPlay) {
|
|
|
+ onActionControlPlay(bPlay) {
|
|
|
if (!bPlay) {
|
|
|
-
|
|
|
if (this.planData.allCalorie < this.planData.calorie) {
|
|
|
this.modalName = 'showPlanTipModal';
|
|
|
this.planTipIndex = 1;
|
|
|
} else {
|
|
|
//假如完成了目标,更新卡路里
|
|
|
- this.onBoxingPause(true);
|
|
|
+ this.onActionPause(true);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- //点击切换模式
|
|
|
+ /**
|
|
|
+ * 切换体验模式
|
|
|
+ * @param {Object} data
|
|
|
+ */
|
|
|
onModeEvent(data) {
|
|
|
console.log("当前模式:", data);
|
|
|
this.currentMode = data.mode;
|
|
|
this.title = data.name;
|
|
|
-
|
|
|
- if (this.currentMode == 'calorieMode' || this.currentMode == 'ropeMode') {
|
|
|
+ // || this.currentMode == 'ropeMode'
|
|
|
+ if (this.currentMode == 'calorieMode') {
|
|
|
setTimeout(() => {
|
|
|
this.updateNoLimit();
|
|
|
}, 0)
|
|
@@ -1978,46 +2025,50 @@
|
|
|
},
|
|
|
|
|
|
//弹出目标提示后,进行下一步
|
|
|
- onBoxingPause(bFinish) {
|
|
|
+ onActionPause(bFinish) {
|
|
|
if (bFinish) {
|
|
|
-
|
|
|
if (this.ConnectBindingDevice) {
|
|
|
this.gStopSimulateBLEUpdate();
|
|
|
} else {
|
|
|
- if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
|
|
|
- this.B_CloseRopeSkipping();
|
|
|
- } else {
|
|
|
- console.log("停止时候,上传卡路里");
|
|
|
- this.$refs.boxingPostRef.onBoxingPostStop();
|
|
|
-
|
|
|
+ // if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
|
|
|
+ // this.B_CloseRopeSkipping();
|
|
|
+ // } else {
|
|
|
|
|
|
+ // }
|
|
|
+ if (0 === this.currentModeIndex) {
|
|
|
+ this.$refs.boxingPostRef.onBoxingPostStop();
|
|
|
//停止时候,重置ai信息
|
|
|
this.aiObj.name = this.aiOldObj.name;
|
|
|
this.aiObj.avatar = this.aiOldObj.avatar;
|
|
|
|
|
|
- //停止蓝牙加速计
|
|
|
- this.onWriteBLEConnectionValue({
|
|
|
- value: "4"
|
|
|
- });
|
|
|
+ } else if (1 === this.currentModeIndex) {
|
|
|
+ //todo actionJump
|
|
|
+ this.$refs.actionJumpRef.onClearActionJumpData();
|
|
|
}
|
|
|
+ //停止蓝牙加速计
|
|
|
+ this.onWriteBLEConnectionValue({
|
|
|
+ value: "4"
|
|
|
+ });
|
|
|
|
|
|
}
|
|
|
uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
|
|
|
-
|
|
|
this.syncRequestEvent({
|
|
|
success: () => {
|
|
|
this.updateArcbarData();
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
} else {
|
|
|
- if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
|
|
|
- this.$refs.actionJumpRef.onActionJumpPlay();
|
|
|
- } else {
|
|
|
- //如果不是,继续调用播放
|
|
|
+ //如果不是,继续调用播放
|
|
|
+ if (0 === this.currentModeIndex) {
|
|
|
this.$refs.boxingPostRef.onBoxingPostPlay(true);
|
|
|
+ } else if (1 === this.currentModeIndex) {
|
|
|
+ //actionJump
|
|
|
+ this.$refs.actionJumpRef.onContinueGame();
|
|
|
}
|
|
|
+ // if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
|
|
|
+
|
|
|
+ // } else {
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
},
|
|
@@ -2194,7 +2245,7 @@
|
|
|
onBoxingGameOver(res) {
|
|
|
this.$refs.hitEffectRef.onStop();
|
|
|
|
|
|
- this.onBoxingPause(true);
|
|
|
+ this.onActionPause(true);
|
|
|
|
|
|
let _title = res.myWin ? "胜利" : "失败";
|
|
|
let _context = res.myWin ? "你已经赢得PK胜利!" : "你在PK中被打败了!";
|
|
@@ -2202,16 +2253,26 @@
|
|
|
|
|
|
this.$refs.modalTipRef.setShowData({
|
|
|
title: _title,
|
|
|
- context: _context
|
|
|
+ context: _context,
|
|
|
+ operationItem: null
|
|
|
});
|
|
|
},
|
|
|
onModalTipHide() {
|
|
|
this.modalName = null;
|
|
|
|
|
|
},
|
|
|
- onModalTipConfirm() {
|
|
|
+ onModalTipConfirm(data) {
|
|
|
+ let {
|
|
|
+ type,
|
|
|
+ operationItem
|
|
|
+ } = data;
|
|
|
this.modalName = null;
|
|
|
//再来一局
|
|
|
+ //提示过关奖励
|
|
|
+ console.log('onModalTipConfirm', type, operationItem);
|
|
|
+ if (type == 'PASSTHELEVEL') {
|
|
|
+ this.showPopup('levelReward', operationItem);
|
|
|
+ }
|
|
|
},
|
|
|
onTestShare() {
|
|
|
uni.share({
|
|
@@ -2380,50 +2441,470 @@
|
|
|
* action 模块相关数据更新
|
|
|
*/
|
|
|
onActionJumpDataUpdate(obj) {
|
|
|
- console.log(obj);
|
|
|
- this.actionJumpAllCount = obj.eliminationCount + obj.faultCount;
|
|
|
- this.actionJumpFaultCount = obj.faultCount;
|
|
|
-
|
|
|
- this.updateArcbarDataFromActionJump();
|
|
|
+ // console.log(obj);
|
|
|
+ this.AJData.allCount = obj.eliminationCount + obj.faultCount;
|
|
|
+ this.AJData.faultCount = obj.faultCount;
|
|
|
},
|
|
|
onActionJumpCountDownUpdate(obj) {
|
|
|
// console.log(obj);
|
|
|
- this.actionJumpCountDown = obj.countDown;
|
|
|
+ this.AJData.perCountDown = obj.countDown;
|
|
|
},
|
|
|
+ //actionJump 模块跳关卡开始处理
|
|
|
+ onActionJumpPlay() {
|
|
|
+ this.$refs.actionJumpRef.onActionJumpPlay();
|
|
|
+ //todo 首先判断时间处理
|
|
|
+ if (0 !== this.currentJumpTask.item.limitTime) {
|
|
|
+ //0默认不限时,所以限时的才走计时间
|
|
|
|
|
|
+ this.arcbarCountDownPlay();
|
|
|
+ }
|
|
|
+ //开始时候,设置默认参数
|
|
|
+ this.onSetActionJumpData();
|
|
|
+ },
|
|
|
+ //重置actionJump数据
|
|
|
+ onResetActionJumpData() {
|
|
|
+ this.AJData = {
|
|
|
+ allCount: 0,
|
|
|
+ faultCount: 0,
|
|
|
+ perCountDown: 0,
|
|
|
+ gameCountDown: 0,
|
|
|
+ myScore: 0,
|
|
|
+ othreScore: 0,
|
|
|
+ gameLimitTime: 0,
|
|
|
+ describe: '', //关卡说明
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onSetActionJumpData() {
|
|
|
+ let _item = this.currentJumpTask.item;
|
|
|
+ this.AJData = {
|
|
|
+ allCount: 0,
|
|
|
+ faultCount: 0,
|
|
|
+ perCountDown: 0,
|
|
|
+ gameCountDown: 0,
|
|
|
+ myScore: 0,
|
|
|
+ othreScore: 0,
|
|
|
+ gameLimitTime: _item.limitTime,
|
|
|
+ describe: '', //关卡说明
|
|
|
+ }
|
|
|
+ console.log('onSetActionJumpData', JSON.stringify(this.AJData), JSON.stringify(_item));
|
|
|
+ },
|
|
|
+ onActionJumpGameOver(data) {
|
|
|
+ // console.log('onActionJumpGameOver');
|
|
|
+ //todo 可能区分 levelJump 关卡类型
|
|
|
+ // if (this.currentMode == "calorieMode") {
|
|
|
+
|
|
|
+ // }
|
|
|
+
|
|
|
+ if (data.myWin) {
|
|
|
+ //通过关卡,处理逻辑
|
|
|
+ let _item = this.currentJumpTask.item;
|
|
|
+ reqUtil
|
|
|
+ .requestData(config.URL.PASSTHELEVEL, {
|
|
|
+ levelId: _item.id,
|
|
|
+ levelType: 1,
|
|
|
+ })
|
|
|
+ .then(
|
|
|
+ res => {
|
|
|
+ if (res.code == 0) {
|
|
|
+ console.log('PASSTHELEVEL:' + JSON.stringify(res.data));
|
|
|
+ //处理 列表数据
|
|
|
+ this.nextTaskCanUnlock = false;
|
|
|
+ for (let i = 0; i < this.currentTaskList.length; i++) {
|
|
|
+ if (this.currentTaskList[i].id == _item.id) {
|
|
|
+ this.currentTaskList[i].isPassed = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let _title = data.myWin ? "胜利" : "失败";
|
|
|
+ let _context = data.myWin ? "通关关卡成功!" : "通关关卡失败!";
|
|
|
+ this.modalName = "showModalTip"
|
|
|
+ if (0 !== res.data.rewardHonor.type || 0 !== res.data.rewardGold || 0 !== res.data
|
|
|
+ .rewardDiamond) {
|
|
|
+ //todo
|
|
|
+ this.$refs.modalTipRef.setShowData({
|
|
|
+ title: _title,
|
|
|
+ context: _context,
|
|
|
+ operationItem: res.data,
|
|
|
+ type: 'PASSTHELEVEL'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ //没有奖励数据
|
|
|
+ this.$refs.modalTipRef.setShowData({
|
|
|
+ title: _title,
|
|
|
+ context: _context,
|
|
|
+ operationItem: null,
|
|
|
+ type: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //
|
|
|
+ this.arcbarCountDownTimeReset();
|
|
|
+
|
|
|
+ //todo 通过关卡后,处理荣誉值,解锁成就
|
|
|
+ }
|
|
|
+ },
|
|
|
+ e => {
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
showDrawer() {
|
|
|
uni.getSubNVueById('personal-drawer').show('slide-in-left', 200);
|
|
|
},
|
|
|
- showPopup() {
|
|
|
- // 向 popup 传递消息
|
|
|
- uni.$emit('page-popup', {
|
|
|
- title: '请阅读软件内容',
|
|
|
- content: 'uni-app 是一个使用 Vue.js 开发跨平台应用的前端框架,开发者编写一套代码,可编译到iOS、Android、H5、小程序等多个平台。'
|
|
|
- });
|
|
|
+ showPopup(type, item) {
|
|
|
+ console.log(type, item);
|
|
|
+ switch (type) {
|
|
|
+ case 'levelReward':
|
|
|
+ uni.$emit('reward-popup', {
|
|
|
+ title: '奖励',
|
|
|
+ content: '',
|
|
|
+ type: type,
|
|
|
+ item: {
|
|
|
+ gold: item.rewardGold,
|
|
|
+ diamond: item.rewardDiamond,
|
|
|
+ honor: item.rewardHonor
|
|
|
+ },
|
|
|
+ operationItem: item
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case 'prompt':
|
|
|
+ // 向 popup 传递消息
|
|
|
+ uni.$emit('reward-popup', {
|
|
|
+ title: '奖励',
|
|
|
+ content: '',
|
|
|
+ type: type,
|
|
|
+ item: {
|
|
|
+ gold: item.rewardGold,
|
|
|
+ diamond: item.rewardDiamond,
|
|
|
+ honor: item.rewardHonor.explain
|
|
|
+ },
|
|
|
+ operationItem: item
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case 'unlock':
|
|
|
+ // 向 popup 传递消息
|
|
|
+ uni.$emit('reward-popup', {
|
|
|
+ title: '解锁关卡',
|
|
|
+ content: '',
|
|
|
+ type: type,
|
|
|
+ item: {
|
|
|
+ consumeGold: item.consumeGold,
|
|
|
+ consumeDiamond: item.consumeDiamond
|
|
|
+ },
|
|
|
+ operationItem: item
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case 'signIn':
|
|
|
+ // 向 popup 传递消息
|
|
|
+ uni.$emit('reward-popup', {
|
|
|
+ title: '每日签到',
|
|
|
+ content: '',
|
|
|
+ type: type,
|
|
|
+ lists: [{
|
|
|
+ name: 'gold',
|
|
|
+ width: 28,
|
|
|
+ height: 28,
|
|
|
+ url: '../../../static/common/sideBar/sGold.png',
|
|
|
+ selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
|
|
|
+ explain: '',
|
|
|
+ value: 20,
|
|
|
+ isSelect: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'diamond',
|
|
|
+ width: 28,
|
|
|
+ height: 28,
|
|
|
+ url: '../../../static/common/sideBar/sDiamond.png',
|
|
|
+ selectedUrl: '../../../static/common/subNVue/sign/sign-grey-diamond@2x.png',
|
|
|
+ explain: '',
|
|
|
+ value: 20,
|
|
|
+ isSelect: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'gold',
|
|
|
+ width: 28,
|
|
|
+ height: 28,
|
|
|
+ url: '../../../static/common/sideBar/sGold.png',
|
|
|
+ selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
|
|
|
+ explain: '',
|
|
|
+ value: 20,
|
|
|
+ isSelect: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'gold',
|
|
|
+ width: 28,
|
|
|
+ height: 28,
|
|
|
+ url: '../../../static/common/sideBar/sGold.png',
|
|
|
+ selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
|
|
|
+ explain: '',
|
|
|
+ value: 20,
|
|
|
+ isSelect: false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'diamond',
|
|
|
+ width: 28,
|
|
|
+ height: 28,
|
|
|
+ url: '../../../static/common/sideBar/sDiamond.png',
|
|
|
+ selectedUrl: '../../../static/common/subNVue/sign/sign-grey-diamond@2x.png',
|
|
|
+ explain: '',
|
|
|
+ value: 20,
|
|
|
+ isSelect: false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'gold',
|
|
|
+ width: 28,
|
|
|
+ height: 28,
|
|
|
+ url: '../../../static/common/sideBar/sGold.png',
|
|
|
+ selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
|
|
|
+ explain: '',
|
|
|
+ value: 20,
|
|
|
+ isSelect: false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'gold',
|
|
|
+ width: 28,
|
|
|
+ height: 28,
|
|
|
+ url: '../../../static/common/sideBar/sGold.png',
|
|
|
+ selectedUrl: '../../../static/common/subNVue/sign/sign-grey-gold@2x.png',
|
|
|
+ explain: '',
|
|
|
+ value: 20,
|
|
|
+ isSelect: false
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ uni.showToast({
|
|
|
+ title: 'showPopup 类型为空',
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ // #ifdef APP-PLUS
|
|
|
const subNVue = uni.getSubNVueById('personal-popup')
|
|
|
- subNVue.show('slide-in-top', 250)
|
|
|
+ subNVue.show('zoom-out', 250)
|
|
|
+ // #endif
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 任务相关
|
|
|
*/
|
|
|
selectTask(_index, _item) {
|
|
|
- console.log('taskSelect=', _index);
|
|
|
- this.setActionJumpTask(_index);
|
|
|
+ // console.log('taskSelect=', _index, JSON.stringify(_item));
|
|
|
+ if (_item.isUnlock) {
|
|
|
+ let _data = {
|
|
|
+ modeName: this.currentMode, //记录时候记录当前的mode
|
|
|
+ index: _index,
|
|
|
+ item: _item,
|
|
|
+ }
|
|
|
+ this.setActionJumpTask(_data);
|
|
|
+ } else {
|
|
|
+ let isCanUnlock = _index == 0 || (_index >= 1 && this.currentTaskList[_index - 1].isUnlock && this
|
|
|
+ .currentTaskList[_index - 1].isPassed) ? true : false;
|
|
|
+ if (!isCanUnlock) return;
|
|
|
+
|
|
|
+ this.showPopup('unlock', _item);
|
|
|
+ // return;
|
|
|
+ // let _content = '条件:';
|
|
|
+
|
|
|
+ // for (let i = 0; i < _item.conditionUnlock.length; i++) {
|
|
|
+ // let _condition = _item.conditionUnlock[i];
|
|
|
+ // let _consume = '';
|
|
|
+ // if (_condition.limitType == 2) {
|
|
|
+ // _consume = _item.consumeGold;
|
|
|
+ // } else if (_condition.limitType == 3) {
|
|
|
+ // _consume = _item.consumeDiamond;
|
|
|
+ // }
|
|
|
+ // _content += _consume + _condition.explain;
|
|
|
+ // if (i == _item.conditionUnlock.length - 1) {
|
|
|
+ // _content += '.';
|
|
|
+ // } else {
|
|
|
+ // _content += ',';
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // //解锁关卡
|
|
|
+ // uni.showModal({
|
|
|
+ // title: '解锁-' + _item.name,
|
|
|
+ // content: _content,
|
|
|
+ // /**
|
|
|
+ // * 如果需要强制,不显示取消按钮
|
|
|
+ // */
|
|
|
+ // showCancel: true,
|
|
|
+ // ConfirmColor: '#A488DC',
|
|
|
+ // confirmText: '解锁',
|
|
|
+ // success: res => {
|
|
|
+ // if (res.confirm) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // } else if (res.cancel) {
|
|
|
+ // //todo
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
- updateTaskScroll(){
|
|
|
+ updateTaskScroll() {
|
|
|
/**
|
|
|
* 获取任务对象
|
|
|
*/
|
|
|
this.getActionJumpTask();
|
|
|
- // console.error('当前的任务对象===========:' + this.currentJumpTask);
|
|
|
- if (this.currentJumpTask != null) {
|
|
|
- let _index = this.currentJumpTask-1<0?0:this.currentJumpTask-1;
|
|
|
- this.taskIntoView = "task_" + _index ;
|
|
|
- console.log(this.taskScrollTop);
|
|
|
- // this.taskIntoView = '';
|
|
|
+ //console.error('当前的任务对象===========:' + JSON.stringify(this.currentJumpTask.modeName) + '= '+this.currentMode);
|
|
|
+ if (this.currentJumpTask != null && this.currentJumpTask.modeName == this.currentMode) {
|
|
|
+ let _index = this.currentJumpTask.index - 1 < 0 ? 0 : this.currentJumpTask.index - 1;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.taskIntoView = "task_" + _index;
|
|
|
+ });
|
|
|
+ this.taskIntoView = '' //不清空再次跳到锚点位置会不起作用
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ switchTaskInfo() {
|
|
|
+ if (this.currentMode == 'calorieMode') {
|
|
|
+ this.currentTaskList = this.singlePersonList;
|
|
|
+ } else if (this.currentMode == 'pkMode') {
|
|
|
+ this.currentTaskList = this.multiPersonList;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ },
|
|
|
+ onSwitchMode() {
|
|
|
+ if (this.currentMode == 'calorieMode') {
|
|
|
+ this.currentMode = 'pkMode';
|
|
|
+ } else if (this.currentMode == 'pkMode') {
|
|
|
+ this.currentMode = 'calorieMode';
|
|
|
+ }
|
|
|
+
|
|
|
+ this.switchTaskInfo();
|
|
|
+ },
|
|
|
+ onPassTheLevel() {
|
|
|
+
|
|
|
+ this.onActionJumpGameOver({
|
|
|
+ myWin: true
|
|
|
+ });
|
|
|
+ },
|
|
|
+ registerPopupEvent() {
|
|
|
+ // 接收 popup 的消息
|
|
|
+ uni.$on('reward-popup-page', (data) => {
|
|
|
+ switch (data.type) {
|
|
|
+ case 'interactive':
|
|
|
+ uni.showModal({
|
|
|
+ title: '来自Popup的消息',
|
|
|
+ content: data.info
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case 'button':
|
|
|
+ if (data.messageType == 'prompt') {
|
|
|
+ if (data.confirm) {
|
|
|
+ console.log('prompt confirm!');
|
|
|
+ } else if (data.cancel) {
|
|
|
+
|
|
|
+ }
|
|
|
+ } else if (data.messageType == 'unlock') {
|
|
|
+ if (data.confirm) {
|
|
|
+ let _operationItem = data.operationItem;
|
|
|
+ console.log('unlock confirm!', _operationItem);
|
|
|
+ uni.showToast({
|
|
|
+ title: '正在解锁',
|
|
|
+ icon: 'loading',
|
|
|
+ duration: 10000
|
|
|
+ })
|
|
|
+ //todo 处理解锁流程
|
|
|
+ reqUtil
|
|
|
+ .requestData(config.URL.UNLOCKLEVEL, {
|
|
|
+ levelId: _operationItem.id,
|
|
|
+ levelType: 1, //levelJump = 1
|
|
|
+ numberType: _operationItem.numberType,
|
|
|
+
|
|
|
+ })
|
|
|
+ .then(
|
|
|
+ res => {
|
|
|
+ uni.hideToast();
|
|
|
+ console.log('UNLOCKLEVEL:' + JSON.stringify(res));
|
|
|
+ if (res.code === 404) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '金币不足',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 1000
|
|
|
+ })
|
|
|
+ } else if (res.code === 405) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '钻石不足',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 1000
|
|
|
+ })
|
|
|
+ } else if (res.code === 0) {
|
|
|
+ //解锁成功
|
|
|
+ uni.showToast({
|
|
|
+ title: '解锁成功',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 1000
|
|
|
+ })
|
|
|
+ //更新本地金币和钻石
|
|
|
+ this.setGoldAndDiamond({
|
|
|
+ gold: res.data.gold,
|
|
|
+ diamond: res.data.diamond
|
|
|
+ });
|
|
|
+
|
|
|
+ for (let i = 0; i < this.currentTaskList.length; i++) {
|
|
|
+ if (this.currentTaskList[i].id == _operationItem.id) {
|
|
|
+ this.currentTaskList[i].isUnlock = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (res.code === 803) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '需要' + res.data[0].explain,
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ } else if (res.code === 802 || res.code === 805) {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ e => {
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ uni.showToast({
|
|
|
+ title: data.title,
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 监听 drawer 消息
|
|
|
+ uni.$on('drawer-page', (data) => {
|
|
|
+ uni.showToast({
|
|
|
+ title: '点击了第' + data + '项',
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ unregisterPopupEvent() {
|
|
|
+ uni.$off('reward-popup-page')
|
|
|
+ uni.$off('drawer-page')
|
|
|
}
|
|
|
}
|
|
|
};
|