|
|
|
@ -50,9 +50,8 @@ Blame |
|
|
|
<view class="steps"> |
|
|
|
<view class="content"> |
|
|
|
<view class="title">{{ i18n.TodaySteps }}</view> |
|
|
|
<view id="chart" :stepsNum="stepsNum" :stepTarget="stepTarget" |
|
|
|
:change:stepTarget="echarts.receive" :change:stepsNum="echarts.receive" |
|
|
|
style="width: 280rpx;height:280rpx; font-size: 40rpx;"></view> |
|
|
|
<view id="chart" :stepsNum="stepsNum" :stepTarget="stepTarget" :change:stepTarget="echarts.receive" |
|
|
|
: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">{{ i18n.ReceiveEarnings }}</u-button> |
|
|
|
</view> |
|
|
|
@ -75,7 +74,8 @@ Blame |
|
|
|
margin: 'auto 102rpx auto 118rpx', |
|
|
|
}"> |
|
|
|
<view class="content"> |
|
|
|
<scroll-view scroll-y="true" style="height: 288rpx;" scroll-with-animation="true" @touchmove.stop.prevent=""> |
|
|
|
<scroll-view scroll-y="true" style="height: 288rpx;" scroll-with-animation="true" |
|
|
|
@touchmove.stop.prevent=""> |
|
|
|
{{ i18n.homeMessage }} |
|
|
|
</scroll-view> |
|
|
|
<u-button class="button" color="#00E8A2" @click="popupShow = false">OK</u-button> |
|
|
|
@ -342,26 +342,18 @@ export default { |
|
|
|
let myChart |
|
|
|
export default { |
|
|
|
mounted() { |
|
|
|
console.log(0); |
|
|
|
console.log(window); |
|
|
|
console.log(typeof window.echarts); |
|
|
|
// this.initEcharts(); |
|
|
|
if (typeof window.echarts === 'object') { |
|
|
|
this.initEcharts() |
|
|
|
}else if (typeof window.echarts === 'function') { |
|
|
|
this.initEcharts() |
|
|
|
} else { |
|
|
|
console.log(1); |
|
|
|
// 动态引入较大类库避免影响页面展示 |
|
|
|
const script = document.createElement('script'); |
|
|
|
console.log(2); |
|
|
|
// view 层的页面运行在 www 根目录,其相对路径相对于 www 计算 |
|
|
|
script.src = './static/echarts.js'; |
|
|
|
console.log(3); |
|
|
|
script.src = './static/echarts.min.js'; |
|
|
|
script.onload = this.initEcharts.bind(this); |
|
|
|
console.log(4); |
|
|
|
document.head.appendChild(script); |
|
|
|
console.log(5); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
@ -371,20 +363,10 @@ export default { |
|
|
|
|
|
|
|
}, |
|
|
|
initEcharts() { |
|
|
|
console.log(31); |
|
|
|
// let t1=null; |
|
|
|
this.initChart() |
|
|
|
console.log(32); |
|
|
|
myChart = echarts.init(document.getElementById('chart')) |
|
|
|
console.log(33); |
|
|
|
// 观测更新的数据在 view 层可以直接访问到 |
|
|
|
myChart.setOption(this.option) |
|
|
|
console.log(34); |
|
|
|
// clearInterval(t1) |
|
|
|
// t1= setInterval(() => { |
|
|
|
// console.log(1); |
|
|
|
// myChart.setOption(this.option) |
|
|
|
// }, 1000); |
|
|
|
}, |
|
|
|
updateEcharts(newValue, oldValue, ownerInstance, instance) { |
|
|
|
// 监听 service 层数据变更 |
|
|
|
@ -397,12 +379,6 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
initChart() { |
|
|
|
// let myChart = echarts.init(this.$refs.chart); |
|
|
|
// console.log(document); |
|
|
|
// console.log(this.$refs.chart); |
|
|
|
// this.myChart = echarts.init(document.getElementById('chart')); |
|
|
|
// this.myChart = echarts.init(this.$refs.chart); |
|
|
|
// myChart = echarts.init(document.getElementById('chart')) |
|
|
|
this.option = { |
|
|
|
title: { |
|
|
|
text: this.stepsNum, |
|
|
|
@ -421,6 +397,7 @@ export default { |
|
|
|
series: [{ |
|
|
|
name: '环形饼图', |
|
|
|
type: 'pie', |
|
|
|
roundCap: true, |
|
|
|
radius: ['48%', '70%'], |
|
|
|
avoidLabelOverlap: false, |
|
|
|
label: { |
|
|
|
@ -432,7 +409,7 @@ export default { |
|
|
|
shadowBlur: 30, |
|
|
|
shadowColor: '#15141F', |
|
|
|
shadowOffsetX: 'center', |
|
|
|
shadowOffsetY: 'center' |
|
|
|
shadowOffsetY: 'center', |
|
|
|
|
|
|
|
}, |
|
|
|
data: [{ |
|
|
|
@ -452,8 +429,6 @@ export default { |
|
|
|
} |
|
|
|
]), |
|
|
|
borderRadius: 800, |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
@ -469,9 +444,9 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
// myChart.setOption(this.option, true); |
|
|
|
// window.addEventListener('resize', () => { |
|
|
|
// myChart.resize(); |
|
|
|
// }); |
|
|
|
window.addEventListener('resize', () => { |
|
|
|
myChart.resize(); |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
@ -487,6 +462,7 @@ export default { |
|
|
|
<style lang="scss" scoped> |
|
|
|
.main { |
|
|
|
padding-bottom: 198rpx; // 避免底部TabBar盖住内容 |
|
|
|
|
|
|
|
.nav-head { |
|
|
|
position: fixed; |
|
|
|
top: 0rpx; |
|
|
|
|