Browse Source

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

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

52
pages/home/index.vue

@ -50,9 +50,8 @@ Blame
<view class="steps"> <view class="steps">
<view class="content"> <view class="content">
<view class="title">{{ i18n.TodaySteps }}</view> <view class="title">{{ i18n.TodaySteps }}</view>
<view id="chart" :stepsNum="stepsNum" :stepTarget="stepTarget" <view id="chart" :stepsNum="stepsNum" :stepTarget="stepTarget" :change:stepTarget="echarts.receive"
:change:stepTarget="echarts.receive" :change:stepsNum="echarts.receive" :change:stepsNum="echarts.receive" style="width: 280rpx;height:280rpx; font-size: 40rpx;"></view>
style="width: 280rpx;height:280rpx; font-size: 40rpx;"></view>
<!-- <canvas id="chart" ref="chart" style="width: 280rpx;height:280rpx; font-size: 40rpx;"></canvas> --> <!-- <canvas id="chart" ref="chart" style="width: 280rpx;height:280rpx; font-size: 40rpx;"></canvas> -->
<u-button class="button" color="#00E8A2">{{ i18n.ReceiveEarnings }}</u-button> <u-button class="button" color="#00E8A2">{{ i18n.ReceiveEarnings }}</u-button>
</view> </view>
@ -75,7 +74,8 @@ Blame
margin: 'auto 102rpx auto 118rpx', margin: 'auto 102rpx auto 118rpx',
}"> }">
<view class="content"> <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 }} {{ i18n.homeMessage }}
</scroll-view> </scroll-view>
<u-button class="button" color="#00E8A2" @click="popupShow = false">OK</u-button> <u-button class="button" color="#00E8A2" @click="popupShow = false">OK</u-button>
@ -175,8 +175,8 @@ export default {
} }
}, },
methods: { methods: {
getbanner(){ getbanner() {
const indexBanner=api.indexBanner({'mark':'APP_INDEX'}); const indexBanner = api.indexBanner({ 'mark': 'APP_INDEX' });
console.log(indexBanner) console.log(indexBanner)
}, },
// //
@ -342,26 +342,18 @@ export default {
let myChart let myChart
export default { export default {
mounted() { mounted() {
console.log(0);
console.log(window);
console.log(typeof window.echarts);
// this.initEcharts(); // this.initEcharts();
if (typeof window.echarts === 'object') { if (typeof window.echarts === 'object') {
this.initEcharts() this.initEcharts()
}else if (typeof window.echarts === 'function') { }else if (typeof window.echarts === 'function') {
this.initEcharts() this.initEcharts()
} else { } else {
console.log(1);
// //
const script = document.createElement('script'); const script = document.createElement('script');
console.log(2);
// view www www // view www www
script.src = './static/echarts.js'; script.src = './static/echarts.min.js';
console.log(3);
script.onload = this.initEcharts.bind(this); script.onload = this.initEcharts.bind(this);
console.log(4);
document.head.appendChild(script); document.head.appendChild(script);
console.log(5);
} }
}, },
@ -371,20 +363,10 @@ export default {
}, },
initEcharts() { initEcharts() {
console.log(31);
// let t1=null;
this.initChart() this.initChart()
console.log(32);
myChart = echarts.init(document.getElementById('chart')) myChart = echarts.init(document.getElementById('chart'))
console.log(33);
// view 访 // view 访
myChart.setOption(this.option) myChart.setOption(this.option)
console.log(34);
// clearInterval(t1)
// t1= setInterval(() => {
// console.log(1);
// myChart.setOption(this.option)
// }, 1000);
}, },
updateEcharts(newValue, oldValue, ownerInstance, instance) { updateEcharts(newValue, oldValue, ownerInstance, instance) {
// service // service
@ -397,12 +379,6 @@ export default {
}) })
}, },
initChart() { 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 = { this.option = {
title: { title: {
text: this.stepsNum, text: this.stepsNum,
@ -421,6 +397,7 @@ export default {
series: [{ series: [{
name: '环形饼图', name: '环形饼图',
type: 'pie', type: 'pie',
roundCap: true,
radius: ['48%', '70%'], radius: ['48%', '70%'],
avoidLabelOverlap: false, avoidLabelOverlap: false,
label: { label: {
@ -432,7 +409,7 @@ export default {
shadowBlur: 30, shadowBlur: 30,
shadowColor: '#15141F', shadowColor: '#15141F',
shadowOffsetX: 'center', shadowOffsetX: 'center',
shadowOffsetY: 'center' shadowOffsetY: 'center',
}, },
data: [{ data: [{
@ -452,8 +429,6 @@ export default {
} }
]), ]),
borderRadius: 800, borderRadius: 800,
} }
}, },
{ {
@ -469,9 +444,9 @@ export default {
} }
// myChart.setOption(this.option, true); // myChart.setOption(this.option, true);
// window.addEventListener('resize', () => { window.addEventListener('resize', () => {
// myChart.resize(); myChart.resize();
// }); });
} }
}, },
watch: { watch: {
@ -487,6 +462,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.main { .main {
padding-bottom: 198rpx; // TabBar padding-bottom: 198rpx; // TabBar
.nav-head { .nav-head {
position: fixed; position: fixed;
top: 0rpx; top: 0rpx;
@ -574,7 +550,7 @@ export default {
left: 20rpx; left: 20rpx;
} }
.notice{ .notice {
width: 574rpx; width: 574rpx;
margin-left: 80rpx; margin-left: 80rpx;
margin-top: 10rpx; margin-top: 10rpx;

11
pages/markets/trade.vue

@ -28,8 +28,9 @@
</view> </view>
<!-- 列表 --> <!-- 列表 -->
<view class="coinList"> <view class="coinList">
<scroll-view scroll-y="true" style="height: 86vh;" scroll-with-animation="true" @touchmove.stop.prevent=""> <scroll-view scroll-y="true" style="height: 86vh;" scroll-with-animation="true"
<view class="coin" v-for="(item, index) in 20" :key="index" @click="goto(item)"> @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="name">BTC/USDT</view>
<view class="price">{{ 5145 * index * index * index }}</view> <view class="price">{{ 5145 * index * index * index }}</view>
<view class="priceChange" :class="{ 'down': index % 2 === 0 }">500.30%</view> <view class="priceChange" :class="{ 'down': index % 2 === 0 }">500.30%</view>
@ -76,6 +77,12 @@ export default {
uni.navigateTo({ uni.navigateTo({
url, 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