|
|
@ -19,102 +19,105 @@ |
|
|
|
</u-overlay> |
|
|
|
</view> |
|
|
|
<!-- 轮播图 --> |
|
|
|
<!-- #ifdef APP-PLUS --> |
|
|
|
<u-swiper class="swiper" :list="swiperList" @click="bannerClick" previousMargin="48rpx" nextMargin="80rpx" circular |
|
|
|
:autoplay="true" radius="32rpx" bgColor="rgba(0,0,0,0)" height="360rpx"> |
|
|
|
<!-- #endif --> |
|
|
|
<!-- #ifdef APP-PLUS --> |
|
|
|
<u-swiper class="swiper" :list="swiperList" @click="bannerClick" previousMargin="48rpx" nextMargin="80rpx" |
|
|
|
circular :autoplay="true" radius="32rpx" bgColor="rgba(0,0,0,0)" height="360rpx"> |
|
|
|
<!-- #endif --> |
|
|
|
<!-- #ifdef H5 --> |
|
|
|
<u-swiper class="swiper" :list="swiperList" @click="bannerClick" previousMargin="48rpx" nextMargin="80rpx" circular |
|
|
|
:autoplay="true" radius="32rpx" bgColor="rgba(0,0,0,0)" height="360rpx" style="margin-top: 145rpx;"> |
|
|
|
<u-swiper class="swiper" :list="swiperList" @click="bannerClick" previousMargin="48rpx" |
|
|
|
nextMargin="80rpx" circular :autoplay="true" radius="32rpx" bgColor="rgba(0,0,0,0)" height="360rpx" |
|
|
|
style="margin-top: 145rpx;"> |
|
|
|
<!-- #endif --> |
|
|
|
</u-swiper> |
|
|
|
<!-- 消息 --> |
|
|
|
<view class="message" @click="go('/pages/me/notification')"> |
|
|
|
<u-icon class="icon" name="../../static/home/ic_proclamation.png" size="60rpx" width="60rpx"></u-icon> |
|
|
|
<!-- <view class="text">{{ i18n.homeMessage }}</view> --> |
|
|
|
<u-notice-bar class="notice" :text="messageList" icon="" fontSize="24rpx" bgColor="#211F32" color="#fff" |
|
|
|
direction="column" > |
|
|
|
</u-notice-bar> |
|
|
|
</view> |
|
|
|
<!-- 三个按钮 --> |
|
|
|
<view class="btnDiv"> |
|
|
|
<view class="item" @click="goto('recharge')"> |
|
|
|
<u--image class="img" :showLoading="true" src="../../static/home/img_recharge.png" width="144rpx" |
|
|
|
height="144rpx"></u--image> |
|
|
|
<view class="text">{{ i18n.Recharge }}</view> |
|
|
|
</view> |
|
|
|
<view class="item" @click="goto('mine')"> |
|
|
|
<u--image class="img" :showLoading="true" src="../../static/home/img_Mine.png" width="144rpx" |
|
|
|
height="144rpx"></u--image> |
|
|
|
<view class="text">{{ i18n.Mine }}</view> |
|
|
|
<!-- 消息 --> |
|
|
|
<view class="message" @click="go('/pages/me/notification')"> |
|
|
|
<u-icon class="icon" name="../../static/home/ic_proclamation.png" size="60rpx" width="60rpx"> |
|
|
|
</u-icon> |
|
|
|
<!-- <view class="text">{{ i18n.homeMessage }}</view> --> |
|
|
|
<u-notice-bar class="notice" :text="messageList" icon="" fontSize="24rpx" bgColor="#211F32" |
|
|
|
color="#fff" direction="column"> |
|
|
|
</u-notice-bar> |
|
|
|
</view> |
|
|
|
<view class="item" @click="goto('subcription')"> |
|
|
|
<u--image class="img" :showLoading="true" src="../../static/home/img_Subcription.png" width="144rpx" |
|
|
|
height="144rpx"></u--image> |
|
|
|
<view class="text">{{ i18n.Subcription }}</view> |
|
|
|
<!-- 三个按钮 --> |
|
|
|
<view class="btnDiv"> |
|
|
|
<view class="item" @click="goto('recharge')"> |
|
|
|
<u--image class="img" :showLoading="true" src="../../static/home/img_recharge.png" |
|
|
|
width="144rpx" height="144rpx"></u--image> |
|
|
|
<view class="text">{{ i18n.Recharge }}</view> |
|
|
|
</view> |
|
|
|
<view class="item" @click="goto('mine')"> |
|
|
|
<u--image class="img" :showLoading="true" src="../../static/home/img_Mine.png" width="144rpx" |
|
|
|
height="144rpx"></u--image> |
|
|
|
<view class="text">{{ i18n.Mine }}</view> |
|
|
|
</view> |
|
|
|
<view class="item" @click="goto('subcription')"> |
|
|
|
<u--image class="img" :showLoading="true" src="../../static/home/img_Subcription.png" |
|
|
|
width="144rpx" height="144rpx"></u--image> |
|
|
|
<view class="text">{{ i18n.Subcription }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- 步数 --> |
|
|
|
<view class="steps"> |
|
|
|
<view class="content"> |
|
|
|
<view class="title">{{ i18n.TodaySteps }}</view> |
|
|
|
<!-- 步数 --> |
|
|
|
<view class="steps"> |
|
|
|
<view class="content"> |
|
|
|
<view class="title">{{ i18n.TodaySteps }}</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view id="chart" :stepsNum="stepsNum" :stepTarget="stepTarget" :change:stepTarget="echarts.stepTargetReceive" |
|
|
|
:change:stepsNum="echarts.receive" style="width: 280rpx;height:280rpx; font-size: 40rpx;"> |
|
|
|
</view> |
|
|
|
<view id="chart" :stepsNum="stepsNum" :stepTarget="stepTarget" |
|
|
|
:change:stepTarget="echarts.stepTargetReceive" :change:stepsNum="echarts.receive" |
|
|
|
style="width: 280rpx;height:280rpx; font-size: 40rpx;"> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<!-- <canvas id="chart" ref="chart" style="width: 280rpx;height:280rpx; font-size: 40rpx;"></canvas> --> |
|
|
|
<u-button class="button" color="#00E8A2" @click="closeModalShow=true">{{ i18n.ReceiveEarnings }} |
|
|
|
</u-button> |
|
|
|
<!-- <canvas id="chart" ref="chart" style="width: 280rpx;height:280rpx; font-size: 40rpx;"></canvas> --> |
|
|
|
<u-button class="button" color="#00E8A2" @click="closeModalShow=true">{{ i18n.ReceiveEarnings }} |
|
|
|
</u-button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- close确认框 --> |
|
|
|
<u-modal :show="closeModalShow" :confirmText="i18n.Confirm" :cancelText="i18n.Cancel" |
|
|
|
:showCancelButton="true" :title="i18n.WarmTips" :content='i18n.WarmTipsText' @confirm="closeConfirm" |
|
|
|
@cancel="closeModalShow = false" confirmColor="#00E8A2" cancelColor="#96959E"> |
|
|
|
</u-modal> |
|
|
|
<!-- close确认框 --> |
|
|
|
<u-modal :show="closeModalShow" :confirmText="i18n.Confirm" :cancelText="i18n.Cancel" |
|
|
|
:showCancelButton="true" :title="i18n.WarmTips" :content='i18n.WarmTipsText' @confirm="closeConfirm" |
|
|
|
@cancel="closeModalShow = false" confirmColor="#00E8A2" cancelColor="#96959E"> |
|
|
|
</u-modal> |
|
|
|
|
|
|
|
<!-- 播放器 --> |
|
|
|
<view class="videoList" v-for="(item, index) in videoList" :key="index" @click="playVideo(item.adText)"> |
|
|
|
<view class="videoImage" :style="`background-image: url(${baseURL+item.adImgPath});background-repeat: no-repeat; |
|
|
|
<!-- 播放器 --> |
|
|
|
<view class="videoList" v-for="(item, index) in videoList" :key="index" @click="playVideo(item.adText)"> |
|
|
|
<view class="videoImage" :style="`background-image: url(${baseURL+item.adImgPath});background-repeat: no-repeat; |
|
|
|
background-size: cover;`"> |
|
|
|
<view class="VideoBg"> |
|
|
|
<view class="VideoLogo"></view> |
|
|
|
<view class="VideoTitle">{{ item.adTitle }}</view> |
|
|
|
<view class="VideoBg"> |
|
|
|
<view class="VideoLogo"></view> |
|
|
|
<view class="VideoTitle">{{ item.adTitle }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<video class="video" v-show="videoShow" id="video" :enable-progress-gesture="false" autoplay="true" |
|
|
|
:src="videoUrl" controls x5-video-player-type="h5-page" @fullscreenchange="ifStopVideo"></video> |
|
|
|
<!-- 通知弹出层 --> |
|
|
|
<view class=""> |
|
|
|
<u-popup class="popup" :show="popupShow" round="32rpx" mode="center" @close="popupShow = false" |
|
|
|
@open="popupShow = true" bgColor="#211F32" :customStyle="{ |
|
|
|
<video class="video" v-show="videoShow" id="video" :enable-progress-gesture="false" autoplay="true" |
|
|
|
:src="videoUrl" controls x5-video-player-type="h5-page" @fullscreenchange="ifStopVideo"></video> |
|
|
|
<!-- 通知弹出层 --> |
|
|
|
<view class=""> |
|
|
|
<u-popup class="popup" :show="popupShow" round="32rpx" mode="center" @close="popupShow = false" |
|
|
|
@open="popupShow = true" bgColor="#211F32" :customStyle="{ |
|
|
|
margin: 'auto 102rpx auto 118rpx', |
|
|
|
}"> |
|
|
|
<view class="content"> |
|
|
|
<scroll-view scroll-y="true" style="max-height: 288rpx;" scroll-with-animation="true" |
|
|
|
@touchmove.stop.prevent=""> |
|
|
|
<view class="" v-html="contentFirst"></view> |
|
|
|
</scroll-view> |
|
|
|
<u-button class="button" color="#00E8A2" @click="toRead" :throttleTime="500">OK</u-button> |
|
|
|
</view> |
|
|
|
</u-popup> |
|
|
|
</view> |
|
|
|
<view class="content"> |
|
|
|
<scroll-view scroll-y="true" style="max-height: 288rpx;" scroll-with-animation="true" |
|
|
|
@touchmove.stop.prevent=""> |
|
|
|
<view class="" v-html="contentFirst"></view> |
|
|
|
</scroll-view> |
|
|
|
<u-button class="button" color="#00E8A2" @click="toRead" :throttleTime="500">OK</u-button> |
|
|
|
</view> |
|
|
|
</u-popup> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<!-- <view class="" @click="startStep"> |
|
|
|
<!-- <view class="" @click="startStep"> |
|
|
|
开始记步 |
|
|
|
</view> |
|
|
|
<view class="" @click="startStep"> |
|
|
|
步数:{{stepCount}} |
|
|
|
</view> --> |
|
|
|
<!-- tabBar --> |
|
|
|
<tab-bar :selectActive="1"></tab-bar> |
|
|
|
<!-- tabBar --> |
|
|
|
<tab-bar :selectActive="1"></tab-bar> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
@ -156,7 +159,7 @@ |
|
|
|
swiperList: [ |
|
|
|
|
|
|
|
], |
|
|
|
bannerList:[], |
|
|
|
bannerList: [], |
|
|
|
videoShow: false, |
|
|
|
videoUrl: '', |
|
|
|
videoList: [], |
|
|
@ -188,13 +191,13 @@ |
|
|
|
this.langTrue = uni.getStorageSync('langTrue') |
|
|
|
} |
|
|
|
// #ifdef APP-PLUS |
|
|
|
this.getSept() |
|
|
|
// this.startStep() |
|
|
|
// this.resStartStep() |
|
|
|
this.updateSteps('show'); |
|
|
|
this.getSept() |
|
|
|
// this.startStep() |
|
|
|
// this.resStartStep() |
|
|
|
this.updateSteps('show'); |
|
|
|
// #endif |
|
|
|
// #ifdef H5 |
|
|
|
this.stepsNum=0; |
|
|
|
this.stepsNum = 0; |
|
|
|
// #endif |
|
|
|
}, |
|
|
|
|
|
|
@ -208,57 +211,57 @@ |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 更新步数逻辑 |
|
|
|
updateSteps(soucre){ |
|
|
|
var today=this.$index.formatyymmdd(new Date().getTime()); |
|
|
|
var stepsNum_date= uni.getStorageSync("stepsNum_date"); |
|
|
|
|
|
|
|
var isUpdate=false; |
|
|
|
console.log(today) |
|
|
|
console.log(uni.getStorageSync("stepsNum_date")) |
|
|
|
console.log(stepsNum_date) |
|
|
|
|
|
|
|
if(stepsNum_date){ |
|
|
|
if(today!=stepsNum_date.date){ |
|
|
|
uni.setStorageSync("stepsNum_date",null); |
|
|
|
|
|
|
|
}else{ |
|
|
|
if(this.stepsNum==0){ |
|
|
|
this.stepsNum=stepsNum_date.newStepsNum; |
|
|
|
updateSteps(soucre) { |
|
|
|
var today = this.$index.formatyymmdd(new Date().getTime()); |
|
|
|
var stepsNum_date = uni.getStorageSync("stepsNum_date"); |
|
|
|
|
|
|
|
var isUpdate = false; |
|
|
|
// console.log(today) |
|
|
|
// console.log(uni.getStorageSync("stepsNum_date")) |
|
|
|
// console.log(stepsNum_date) |
|
|
|
|
|
|
|
if (stepsNum_date) { |
|
|
|
if (today != stepsNum_date.date) { |
|
|
|
uni.setStorageSync("stepsNum_date", null); |
|
|
|
|
|
|
|
} else { |
|
|
|
if (this.stepsNum == 0) { |
|
|
|
this.stepsNum = stepsNum_date.newStepsNum; |
|
|
|
} |
|
|
|
if(parseInt(this.stepsNum)>parseInt(stepsNum_date.stepsNum)){ |
|
|
|
|
|
|
|
uni.setStorageSync("stepsNum_date",{ |
|
|
|
stepsNum:stepsNum_date.stepsNum, |
|
|
|
date:today, |
|
|
|
newStepsNum:this.stepsNum |
|
|
|
}); |
|
|
|
if(soucre){ |
|
|
|
isUpdate=true; |
|
|
|
} |
|
|
|
if (parseInt(this.stepsNum) > parseInt(stepsNum_date.stepsNum)) { |
|
|
|
|
|
|
|
uni.setStorageSync("stepsNum_date", { |
|
|
|
stepsNum: stepsNum_date.stepsNum, |
|
|
|
date: today, |
|
|
|
newStepsNum: this.stepsNum |
|
|
|
}); |
|
|
|
if (soucre) { |
|
|
|
isUpdate = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
isUpdate=true; |
|
|
|
} else { |
|
|
|
isUpdate = true; |
|
|
|
} |
|
|
|
|
|
|
|
if(isUpdate){ |
|
|
|
if (isUpdate) { |
|
|
|
this.$api.updateSteps({ |
|
|
|
steps: this.stepsNum |
|
|
|
}).then(res => { |
|
|
|
console.log(res,'res更新') |
|
|
|
uni.setStorageSync("stepsNum_date",{ |
|
|
|
stepsNum:this.stepsNum, |
|
|
|
date:today, |
|
|
|
newStepsNum:this.stepsNum |
|
|
|
console.log(res, 'res更新') |
|
|
|
uni.setStorageSync("stepsNum_date", { |
|
|
|
stepsNum: this.stepsNum, |
|
|
|
date: today, |
|
|
|
newStepsNum: this.stepsNum |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
console.log(this.stepsNum) |
|
|
|
}, |
|
|
|
|
|
|
|
bannerClick(i){ |
|
|
|
bannerClick(i) { |
|
|
|
// #ifdef APP-PLUS |
|
|
|
plus.runtime.openUrl(this.bannerList[i].adUrl) |
|
|
|
// #endif |
|
|
@ -270,26 +273,25 @@ |
|
|
|
}, |
|
|
|
// 获取用户余额信息 |
|
|
|
getUserInfoBalance() { |
|
|
|
api.userAccount().then(res => { |
|
|
|
api.userAccount().then(res => { |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 捐步 |
|
|
|
closeConfirm() { |
|
|
|
this.$api.receivStepsAward().then(res => { |
|
|
|
uni.$u.toast(this.$t("markets").Succeeded) |
|
|
|
this.closeModalShow=false |
|
|
|
}) |
|
|
|
|
|
|
|
this.closeModalShow = false |
|
|
|
}, |
|
|
|
// 开启计步服务 |
|
|
|
getSept() { |
|
|
|
try{ |
|
|
|
try { |
|
|
|
//整个应用设置一次即可,停止计步后需重新调用,所有接口调用必须先开启计步服务 |
|
|
|
StepCounter.startStep((res) => { |
|
|
|
console.log(res, '步数res'); |
|
|
|
this.stepCount = res.stepCount |
|
|
|
this.stepsNum=res.stepCount; |
|
|
|
this.stepsNum = res.stepCount; |
|
|
|
this.updateSteps(); |
|
|
|
//res.stepCount 当天累计步数 |
|
|
|
}, (res) => { |
|
|
@ -312,8 +314,8 @@ |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}catch(e){ |
|
|
|
console.error("获取步数出错",e) |
|
|
|
} catch (e) { |
|
|
|
console.error("获取步数出错", e) |
|
|
|
} |
|
|
|
}, |
|
|
|
startStep() { |
|
|
@ -365,7 +367,7 @@ |
|
|
|
// 如果循环都是已读的就关闭弹框 |
|
|
|
if (!this.noticeId) { |
|
|
|
this.popupShow = false |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
// 读公告 |
|
|
|
toRead() { |
|
|
@ -374,10 +376,12 @@ |
|
|
|
}).then(res => { |
|
|
|
|
|
|
|
}) |
|
|
|
this.noticeId = null; |
|
|
|
this.popupShow = false |
|
|
|
this.getNoReadNotice() |
|
|
|
console.log(res, '已经读了吗') |
|
|
|
setTimeout(() => { |
|
|
|
this.noticeId = null; |
|
|
|
this.getNoReadNotice() |
|
|
|
}, 1500) |
|
|
|
|
|
|
|
}, |
|
|
|
go(url) { |
|
|
|
uni.navigateTo({ |
|
|
@ -402,7 +406,7 @@ |
|
|
|
api.indexBanner({ |
|
|
|
'mark': 'APP_INDEX' |
|
|
|
}).then(res => { |
|
|
|
this.bannerList=res |
|
|
|
this.bannerList = res |
|
|
|
for (var i = 0; i < res.length; i++) { |
|
|
|
this.swiperList.push(this.baseURL + res[i].adImgPath) |
|
|
|
} |
|
|
@ -516,16 +520,16 @@ |
|
|
|
|
|
|
|
methods: { |
|
|
|
receive(newValue, oldValue, ownerVm, vm) { |
|
|
|
console.log(newValue,'变化') |
|
|
|
console.log(newValue, '变化') |
|
|
|
this.initEcharts() |
|
|
|
// if(!this.myChart){ |
|
|
|
// this.initEcharts() |
|
|
|
// }else{ |
|
|
|
// this.myChart.setOption(this.option) |
|
|
|
// } |
|
|
|
// if(!this.myChart){ |
|
|
|
// this.initEcharts() |
|
|
|
// }else{ |
|
|
|
// this.myChart.setOption(this.option) |
|
|
|
// } |
|
|
|
|
|
|
|
}, |
|
|
|
stepTargetReceive(newValue, oldValue, ownerVm, vm){ |
|
|
|
stepTargetReceive(newValue, oldValue, ownerVm, vm) { |
|
|
|
|
|
|
|
}, |
|
|
|
initEcharts() { |
|
|
|