project init
This commit is contained in:
@@ -1,3 +1,113 @@
|
||||
import * as echarts from '../../ec-canvas/echarts';
|
||||
function initPieChart(canvas, width, height, dpr) {
|
||||
const chart = echarts.init(canvas, null, {
|
||||
width: 400,
|
||||
height: 250,
|
||||
devicePixelRatio: dpr // new
|
||||
});
|
||||
canvas.setChart(chart);
|
||||
var option = {
|
||||
backgroundColor: "#3C4043",
|
||||
series: [{
|
||||
label: {
|
||||
normal: {
|
||||
fontSize: 14
|
||||
}
|
||||
},
|
||||
type: 'pie',
|
||||
center: ['50%', '50%'],
|
||||
radius: ['0%', '70%'],
|
||||
data: [{
|
||||
value: 55,
|
||||
name: '数码产品'
|
||||
}, {
|
||||
value: 20,
|
||||
name: '零食'
|
||||
}, {
|
||||
value: 10,
|
||||
name: '娱乐'
|
||||
}, {
|
||||
value: 20,
|
||||
name: '房贷'
|
||||
}, {
|
||||
value: 38,
|
||||
name: '房租'
|
||||
}]
|
||||
}]
|
||||
};
|
||||
|
||||
chart.setOption(option);
|
||||
return chart;
|
||||
}
|
||||
|
||||
function initLineChart(canvas, width, height, dpr) {
|
||||
const chart = echarts.init(canvas, null, {
|
||||
width: 400,
|
||||
height: 300,
|
||||
devicePixelRatio: dpr // new
|
||||
});
|
||||
canvas.setChart(chart);
|
||||
|
||||
var option = {
|
||||
title: {
|
||||
text: '的撒打',
|
||||
left: 'center'
|
||||
},
|
||||
legend: {
|
||||
data: ['支出', '收入', '转账','还款'],
|
||||
top: 20,
|
||||
left: 'center',
|
||||
backgroundColor: 'white',
|
||||
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]
|
||||
}, {
|
||||
name: '还款',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
data: [50, 80, 11, 25, 30, 110, 20]
|
||||
}]
|
||||
};
|
||||
chart.setOption(option);
|
||||
return chart;
|
||||
}
|
||||
Page({
|
||||
data: {
|
||||
// 指定选择区间起始值
|
||||
@@ -5,6 +115,16 @@ Page({
|
||||
end: '2030-09-09 12:12:12',
|
||||
showDateVisible:false,
|
||||
showDate:'2022-01',
|
||||
accountList: [
|
||||
{"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
],
|
||||
ecPie: {
|
||||
onInit: initPieChart
|
||||
},
|
||||
ecLine: {
|
||||
onInit: initLineChart
|
||||
}
|
||||
},
|
||||
onLoad: function (options) {
|
||||
|
||||
@@ -15,8 +135,6 @@ Page({
|
||||
}
|
||||
},
|
||||
showPicker(e) {
|
||||
console.log('12312312')
|
||||
console.log(e.currentTarget.dataset)
|
||||
const { mode } = e.currentTarget.dataset;
|
||||
this.setData({
|
||||
mode,
|
||||
@@ -37,7 +155,6 @@ Page({
|
||||
[mode]: value
|
||||
// [`${mode}Text`]: value,
|
||||
});
|
||||
|
||||
this.hidePicker();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"ec-canvas": "/ec-canvas/ec-canvas"
|
||||
},
|
||||
"navigationBarTitleText": "统计"
|
||||
}
|
||||
|
||||
@@ -3,22 +3,70 @@
|
||||
</view>
|
||||
<t-tabs defaultValue="{{0}}" t-class="custom-tabs" theme="card">
|
||||
<t-tab-panel label="总览" value="0" class="tab_content">
|
||||
<view class="space_box">
|
||||
<text>总资产\n {{1203.00}}</text>
|
||||
<text>总资产\n {{1203.00}}</text>
|
||||
<text>总资产\n {{1203.00}}</text>
|
||||
<text>总资产\n {{1203.00}}</text>
|
||||
<text>总资产\n {{1203.00}}</text>
|
||||
<view class="space_box font_big">
|
||||
<text class="t-color-expend">支出\n {{1203.00}}</text>
|
||||
<text class="t-color-income">收入\n {{1203.00}}</text>
|
||||
<text class="t-color-transfer">转账\n {{1203.00}}</text>
|
||||
<text class="t-color-repayment">还款\n {{1203.00}}</text>
|
||||
</view>
|
||||
<view class="padding_box">
|
||||
<t-divider dashed content="账单明细"/>
|
||||
<view wx:if="{{accountList != null && accountList.length > 0}}">
|
||||
<t-cell wx:for="{{accountList}}" wx:key="index"
|
||||
title="{{item.title}}"
|
||||
description="{{item.dateTime}} • {{item.from}}"
|
||||
align="top"
|
||||
image="https://tdesign.gtimg.com/mobile/%E5%9B%BE%E7%89%87.png"
|
||||
note="{{item.money}}"
|
||||
class="t-cell-{{item.type}}"
|
||||
/>
|
||||
</view>
|
||||
<view wx:else class="empty-view" >
|
||||
<t-empty icon="chart-bubble" description="今日还未记账" />
|
||||
</view>
|
||||
</view>
|
||||
</t-tab-panel>
|
||||
<t-tab-panel label="分类" value="1" class="tab_content">
|
||||
Jodijawoidjwoaidjwaoij
|
||||
<t-tab-panel label="支出分类" value="1">
|
||||
<view class="chart-box">
|
||||
<ec-canvas id="mychart-dom-pie" canvas-id="mychart-pie" ec="{{ ecPie }}"></ec-canvas>
|
||||
<view class="padding_box">
|
||||
<t-progress label="数码产品55%" theme="plump" percentage="{{55}}" status="{{55 > 80 ? 'error' : 'success' }}" />
|
||||
<t-divider/>
|
||||
<t-progress label="零食20%" theme="plump" percentage="{{20}}" status="{{81 > 80 ? 'error' : 'success' }}" />
|
||||
<t-divider/>
|
||||
<t-progress label="娱乐10%" theme="plump" percentage="{{10}}" status="{{10 > 80 ? 'error' : 'success' }}" />
|
||||
<t-divider/>
|
||||
<t-progress label="房贷20%" theme="plump" percentage="{{20}}" status="{{20 > 80 ? 'error' : 'success' }}" />
|
||||
<t-divider/>
|
||||
<t-progress label="房租38%" theme="plump" percentage="{{38}}" status="{{38 > 80 ? 'error' : 'success' }}" />
|
||||
<t-divider/>
|
||||
</view>
|
||||
</view>
|
||||
</t-tab-panel>
|
||||
<t-tab-panel label="趋势" value="2" class="tab_content">
|
||||
|
||||
<t-tab-panel label="趋势" value="2">
|
||||
<view class="chart-box">
|
||||
<ec-canvas id="mychart-dom-line" canvas-id="mychart-line" ec="{{ ecLine }}"></ec-canvas>
|
||||
</view>
|
||||
</t-tab-panel>
|
||||
<t-tab-panel label="排行" value="3" class="tab_content">
|
||||
|
||||
<t-tab-panel label="排行" value="3">
|
||||
<t-divider/>
|
||||
<t-tabs defaultValue="{{0}}" t-class="custom-tabs" theme="card">
|
||||
<t-tab-panel label="支出" value="0">
|
||||
<t-divider/>
|
||||
<view class="test">
|
||||
<t-progress label="数码产品45%" theme="plump" percentage="{{45}}" status="error" />
|
||||
<t-progress label="房租25%" theme="plump" percentage="{{25}}" status="error" />
|
||||
<t-progress label="干饭10%" theme="plump" percentage="{{15}}" status="error" />
|
||||
</view>
|
||||
</t-tab-panel>
|
||||
<t-tab-panel label="收入" value="1">
|
||||
<t-divider/>
|
||||
<view class="test">
|
||||
<t-progress label="工资收入80%" theme="plump" percentage="{{80}}" status="success" />
|
||||
<t-progress label="捡钱20%" theme="plump" percentage="{{20}}" status="success" />
|
||||
</view>
|
||||
</t-tab-panel>
|
||||
</t-tabs>
|
||||
</t-tab-panel>
|
||||
</t-tabs>
|
||||
<view class="placeholder"/>
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
.tab_content {
|
||||
height: 100%;
|
||||
background: #3C4043 !important;
|
||||
.chart-box {
|
||||
width:100%;
|
||||
height:500rpx;
|
||||
position: absolute;
|
||||
top: 100rpx;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
ec-canvas {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.test .t-progress--plump {
|
||||
height: 100rpx !important;
|
||||
border-bottom: 2rpx solid orange;
|
||||
border-radius: 0 !important;
|
||||
/*--td-font-size-s: 28rpx;*/
|
||||
}
|
||||
.test .t-progress__inner {
|
||||
--td-radius-round: 0;
|
||||
}
|
||||
.test .t-progress__bar {
|
||||
--td-progress-track-bg-color: --td-bg-color;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user