|
@@ -5,10 +5,11 @@
|
|
|
<div class="box">
|
|
|
<div class="title-box">
|
|
|
<div class="title">分享次数</div>
|
|
|
- <el-radio-group v-model="tabPosition" style="margin-right:33px;" size="small">
|
|
|
- <el-radio-button label="year">年</el-radio-button>
|
|
|
- <el-radio-button label="month">月</el-radio-button>
|
|
|
- <el-radio-button label="day">日</el-radio-button>
|
|
|
+ <el-radio-group v-model="tabPosition" style="margin-right:33px;" size="small"
|
|
|
+ @change="getLineChartOfShare">
|
|
|
+ <el-radio-button label="1">年</el-radio-button>
|
|
|
+ <el-radio-button label="2">月</el-radio-button>
|
|
|
+ <el-radio-button label="3">日</el-radio-button>
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
<div id="container" style="width: calc(100% - 33px); height: 374px; margin-top: 40px;"></div>
|
|
@@ -28,19 +29,34 @@ export default {
|
|
|
name: "adShareData",
|
|
|
data() {
|
|
|
return {
|
|
|
- tabPosition: "year",
|
|
|
+ tabPosition: 1,//年月日
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
/* 折线图 */
|
|
|
- fetch('https://gw.alipayobjects.com/os/bmw-prod/1d565782-dde4-4bb6-8946-ea6a38ccf184.json')
|
|
|
- .then((res) => res.json())
|
|
|
- .then((data) => {
|
|
|
+ this.getLineChartOfShare();
|
|
|
+ /* 饼状图 */
|
|
|
+ this.getChannel();
|
|
|
+ /* 表格 */
|
|
|
+ this.getShareData();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getLineChartOfShare() {
|
|
|
+ this.$api.requested({
|
|
|
+ "classname": "webmanage.saletool.sharematerial.statistics.share",
|
|
|
+ "method": "getLineChartOfShare",
|
|
|
+ "content": {
|
|
|
+ "sat_sharematerialid": this.$route.query.id,
|
|
|
+ "date": (new Date()).toLocaleDateString(),
|
|
|
+ "type": this.tabPosition
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ document.getElementById('container').innerHTML = ''
|
|
|
const line = new Line('container', {
|
|
|
- data,
|
|
|
+ data: res.data,
|
|
|
padding: '0',
|
|
|
- xField: 'Date',
|
|
|
- yField: 'scales',
|
|
|
+ xField: 'time',
|
|
|
+ yField: 'sharecount',
|
|
|
xAxis: {
|
|
|
// type: 'timeCat',
|
|
|
tickCount: 12,
|
|
@@ -50,32 +66,51 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
line.render();
|
|
|
- });
|
|
|
-
|
|
|
- /* 饼状图 */
|
|
|
- const data = [
|
|
|
- { type: '分类一', value: 27 },
|
|
|
- { type: '分类二', value: 25 },
|
|
|
- ];
|
|
|
-
|
|
|
- const piePlot = new Pie('pie', {
|
|
|
- appendPadding: 10,
|
|
|
- data,
|
|
|
- angleField: 'value',
|
|
|
- colorField: 'type',
|
|
|
- radius: 0.75,
|
|
|
- legend: {
|
|
|
- position: 'leftTop'
|
|
|
- },
|
|
|
- label: {
|
|
|
- type: 'spider',
|
|
|
- labelHeight: 28,
|
|
|
- content: '{name}\n{percentage}',
|
|
|
- },
|
|
|
- interactions: [{ type: 'element-selected' }, { type: 'element-active' }],
|
|
|
- });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getChannel() {
|
|
|
+ this.$api.requested({
|
|
|
+ "classname": "webmanage.saletool.sharematerial.statistics.share",
|
|
|
+ "method": "getChannel",
|
|
|
+ "content": {
|
|
|
+ "sat_sharematerialid": this.$route.query.id
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ const piePlot = new Pie('pie', {
|
|
|
+ appendPadding: 10,
|
|
|
+ data: res.data,
|
|
|
+ angleField: 'sharecount',
|
|
|
+ colorField: 'channel',
|
|
|
+ radius: 0.75,
|
|
|
+ color: ['#E263CD', '#F77655'],
|
|
|
+ legend: {
|
|
|
+ position: 'leftTop'
|
|
|
+ },
|
|
|
+ label: {
|
|
|
+ type: 'spider',
|
|
|
+ labelHeight: 28,
|
|
|
+ content: '{name}\n{percentage}',
|
|
|
+ },
|
|
|
+ interactions: [{ type: 'element-selected' }, { type: 'element-active' }],
|
|
|
+ });
|
|
|
|
|
|
- piePlot.render();
|
|
|
+ piePlot.render();
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getShareData() {
|
|
|
+ this.$api.requested({
|
|
|
+ "classname": "webmanage.saletool.sharematerial.statistics.share",
|
|
|
+ "method": "getShareData",
|
|
|
+ "content": {
|
|
|
+ "sat_sharematerialid": this.$route.query.id,
|
|
|
+ "isAll": false,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 10
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("sdsdsds",res)
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|