Authored by baoss

交易收入页面优化

<template>
<div class="progress-box">
<!-- 绘制圆环背景 -->
<canvas ref="canvasProgressbg" class="progress-bg" id="canvasProgressbg" width="280" height="280" />
<canvas ref="canvasProgressbg" class="progress-bg" id="canvasProgressbg" width="240" height="240" />
<!-- 绘制加载中圆弧 -->
<canvas ref ="canvasProgress" class="progress-canvas" id="canvasProgress" width="280" height="280" />
<canvas ref ="canvasProgress" class="progress-canvas" id="canvasProgress" width="240" height="240" />
</div>
</template>
... ... @@ -16,7 +16,8 @@ export default {
data: {
type: Object,
default: {}
}
},
},
data() {
return {
... ... @@ -25,32 +26,21 @@ export default {
},
computed: {
...mapState({
radio: (state) => {
return (state.yoho.window.clientWidth/750).toFixed(2);
clientWidth: (state) => {
return state.yoho.window.clientWidth;
},
// summary:(state) => {
// return {
// goodsIncome: state.home.mine.assetData.goodsIncome,
// totalIncome: state.home.mine.assetData.totalIncome,
// compensateIncome: state.home.mine.assetData.compensateIncome
// }
// },
})
},
mounted() {
// console.log(typeof this.data.compensateIncome)
let summary = {}
// console.log(this.goodsIncome)
// console.log(summary)
// console.log('---------')
// console.log(this.data)
summary.compensateIncome = '299.26';
summary.goodsIncome = '955.78';
summary.totalIncome = '1255.04';
for(let key in this.data) {
let item = this.data[key];
if(item.includes('¥')) {
let value = this.data[key].split('¥')[1];
summary[key] = value
}
}
this.drawProgressbg(summary);
this.startProgress(summary);
},
... ... @@ -58,8 +48,8 @@ export default {
methods: {
// 画progress底部背景
drawProgressbg: function (summary) {
var c=document.getElementById("canvasProgressbg");
var ctx=c.getContext("2d");
let c=document.getElementById("canvasProgressbg");
let ctx=c.getContext("2d");
ctx.lineWidth= 28 ;
let strokeStyle = '#E0E0E0'
if (summary && summary.totalIncome > 0) {
... ... @@ -69,7 +59,6 @@ export default {
ctx.lineCap='round'
ctx.beginPath();
//设置一个原点(110,110),半径为100的圆的路径到当前路径
console.log("起始点:" + Math.PI)
ctx.arc(120, 120, 100, 0, 2 * Math.PI, false);
ctx.stroke();
//开始绘制
... ... @@ -78,8 +67,8 @@ export default {
// 画progress进度
drawCircle: function (step) {
var c=document.getElementById("canvasProgress");
var context=c.getContext("2d");
let c=document.getElementById("canvasProgress");
let context=c.getContext("2d");
context.lineWidth=28;
let strokeColor = '#002B47'
context.strokeStyle=strokeColor;
... ...
... ... @@ -29,7 +29,7 @@ import incomeItem from './components/incomeItem';
import pullDown from './components/pullDown';
import { createNamespacedHelpers } from 'vuex';
import {Style, Scroll} from 'cube-ui';
import scrollMixin from '../../../mixins/scroll'
import scrollMixin from '../../../mixins/scroll';
const {mapState, mapActions} = createNamespacedHelpers('home/mine');
export default {
mixins: [scrollMixin],
... ... @@ -51,7 +51,7 @@ export default {
}),
},
mounted() {
created() {
this.fetchAssets(true)
},
methods: {
... ...
... ... @@ -28,9 +28,9 @@ export default function() {
currentPage: 1,
pageSize: 20,
endReached: false,
compensateIncome: '¥0.00',
goodsIncome: '¥0.00',
totalIncome: '¥0.00'
compensateIncome: '¥0.00',
goodsIncome: '¥0.00',
totalIncome: '¥0.00'
},
resource1: {},
resource2: {}
... ... @@ -207,17 +207,16 @@ export default function() {
}
let oldList = isRefresh ? [] : list;
commit('assetFetching', {isFetching: true});
// commit('assetFetching', {isFetching: true});
let page = isRefresh ? 1 : currentPage + 1;
const result = await this.$api.get('/api/ufo/mine/assets', {page, limit: pageSize, uid});
commit('assetFetching', {isFetching: false});
// commit('assetFetching', {isFetching: false});
if (result.code === 200) {
let assetData = parseAssetList(result.data);
let newList = [...oldList, ...assetData.list];
assetData.list = newList;
console.log(assetData)
if (typeof assetData.totalIncome !== 'undefined') {
commit('addAssets', assetData);
}
... ...