Browse Source

交易的跳转,修改首页图表

master
[liang] 3 years ago
parent
commit
6c2bd0e017
  1. 46
      pages/home/index.vue
  2. 11
      pages/markets/trade.vue
  3. 45
      static/echarts.min.js

46
pages/home/index.vue

@ -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;

11
pages/markets/trade.vue

@ -28,8 +28,9 @@
</view>
<!-- 列表 -->
<view class="coinList">
<scroll-view scroll-y="true" style="height: 86vh;" scroll-with-animation="true" @touchmove.stop.prevent="">
<view class="coin" v-for="(item, index) in 20" :key="index" @click="goto(item)">
<scroll-view scroll-y="true" style="height: 86vh;" scroll-with-animation="true"
@touchmove.stop.prevent="">
<view class="coin" v-for="(item, index) in 20" :key="index" @click="switchTo(item)">
<view class="name">BTC/USDT</view>
<view class="price">{{ 5145 * index * index * index }}</view>
<view class="priceChange" :class="{ 'down': index % 2 === 0 }">500.30%</view>
@ -76,6 +77,12 @@ export default {
uni.navigateTo({
url,
});
},
/**
* 切换当前交易货币对
*/
switchTo(item) {
this.popupShow = false;
}
},

45
static/echarts.min.js

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save