124 lines
2.3 KiB
JavaScript
124 lines
2.3 KiB
JavaScript
import _ from '../../../commons/js/commons';
|
|
import * as echarts from '../../../ecCanvas/components/ec-canvas/echarts';
|
|
let chartData;
|
|
function initChart(canvas, width, height, dpr) {
|
|
const chart = echarts.init(canvas, null, {
|
|
width: width,
|
|
height: height,
|
|
devicePixelRatio: dpr // new
|
|
});
|
|
canvas.setChart(chart);
|
|
let option = chartData
|
|
chart.setOption(option);
|
|
return chart;
|
|
}
|
|
Page({
|
|
data: {
|
|
imgUrl: _.config.imgUrl,//静态图片路径
|
|
tab_list:[
|
|
{
|
|
title:'近7日',
|
|
value:7,
|
|
},
|
|
{
|
|
title:'近30日',
|
|
value:30,
|
|
},
|
|
],
|
|
tabvalue:7,
|
|
},
|
|
onLoad: function (options) {
|
|
for (let key in options) {
|
|
this.setData({
|
|
[key]: options[key]
|
|
})
|
|
}
|
|
|
|
this.getdata()
|
|
|
|
},
|
|
|
|
//获取统计数据
|
|
getdata(){
|
|
|
|
chartData = {
|
|
legend: {
|
|
data: ['浏览', '报名', '成交'],
|
|
bottom:20,
|
|
left: 'center',
|
|
z: 100
|
|
},
|
|
grid: {
|
|
containLabel: true
|
|
},
|
|
tooltip: {
|
|
show: true,
|
|
trigger: 'axis'
|
|
},
|
|
xAxis: {
|
|
type: 'category',
|
|
boundaryGap: false,
|
|
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
|
// show: false
|
|
},
|
|
yAxis: {
|
|
x: 'center',
|
|
type: 'value',
|
|
splitLine: {
|
|
lineStyle: {
|
|
type: 'dashed'
|
|
}
|
|
},
|
|
// show: false
|
|
},
|
|
series: [
|
|
{
|
|
name: '浏览',
|
|
type: 'line',
|
|
smooth: true,
|
|
data: [18, 36, 65, 30, 78, 40, 33]
|
|
},
|
|
{
|
|
name: '报名',
|
|
type: 'line',
|
|
smooth: true,
|
|
data: [12, 50, 51, 35, 70, 30, 20]
|
|
},
|
|
{
|
|
name: '成交',
|
|
type: 'line',
|
|
smooth: true,
|
|
data: [10, 30, 31, 50, 40, 20, 10]
|
|
}
|
|
]
|
|
};
|
|
|
|
this.setData({
|
|
ec: {
|
|
onInit:initChart
|
|
}
|
|
})
|
|
|
|
|
|
},
|
|
|
|
//却换时间tab
|
|
changeTab(e){
|
|
this.setData({
|
|
tabvalue: e.currentTarget.dataset.value,
|
|
})
|
|
//this.getDxtPhoneBill()
|
|
},
|
|
|
|
//推送链接
|
|
pushLink(e) {
|
|
if(e.currentTarget.dataset.url){
|
|
_.$router.openUrlScheme(e.currentTarget.dataset.url)
|
|
}
|
|
},
|
|
|
|
//页面相关事件处理函数--监听用户下拉动作
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
}) |