@ -1,7 +1,7 @@
<!--
<!--
* @ Author : xw
* @ Author : xw
* @ Date : 2021 - 10 - 09 09 : 04 : 01
* @ Date : 2021 - 10 - 09 09 : 04 : 01
* @ LastEditTime : 2021 - 10 - 2 1 18 : 03 : 22
* @ LastEditTime : 2021 - 10 - 2 2 09 : 29 : 49
* @ LastEditors : Please set LastEditors
* @ LastEditors : Please set LastEditors
* @ Description : 用户画像
* @ Description : 用户画像
* @ FilePath : / d a t a - s h o w / s r c / v i e w s / I n d e x / u s e r P o r t r a i t / i n d e x . v u e
* @ FilePath : / d a t a - s h o w / s r c / v i e w s / I n d e x / u s e r P o r t r a i t / i n d e x . v u e
@ -13,18 +13,20 @@
< / v - l a b e l - d i v >
< / v - l a b e l - d i v >
< div class = "u-p-bd" >
< div class = "u-p-bd" >
< div class = "u-p-char" >
< div class = "u-p-char" >
< v -echarts :opt ="opt" > < / v - e c h a r t s >
< v -echarts :opt ="opt" > < / v - e c h a r t s >
< / div >
< / div >
< div class = "u-p-bd-1" >
< div class = "u-p-bd-1" >
< vue -scroll >
< v -label -ctx :label ="item.key" :cont ="item.value" : percentage = "(item.value/totalData*100).toFixed(2) +'%'" :color ="colors[index]" v-for ="(item,index) in labelData" :key ="index" > < / v -label -ctx >
< v -label -ctx :label ="item.key" :cont ="item.value" : percentage = "(item.value/totalData*100).toFixed(2) +'%'" :color ="colors[index]" v-for ="(item,index) in labelData" :key ="index" > < / v -label -ctx >
< / v u e - s c r o l l >
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< / template >
< / template >
< script >
< script >
import createOpt from "./opt"
import createOpt from "./opt" ;
import { getSexOrAttestationOrRegionHome0528 } from "@/api/home"
import { getSexOrAttestationOrRegionHome0528 } from "@/api/home" ;
export default {
export default {
name : "user-portrait" ,
name : "user-portrait" ,
data ( ) {
data ( ) {
@ -35,61 +37,80 @@ export default {
opt : { } ,
opt : { } ,
labelData : [ ] ,
labelData : [ ] ,
totalData : 0 ,
totalData : 0 ,
colors : [ '#54BF93' , '#3373CC' , '#CC9D12' , '#f15c80' , '#e4d354' , '#8085e8' , '#8d4653' , '#91e8e1' , '#f7a35c' , '#90ed7d' ]
colors : [
}
"#54BF93" ,
"#3373CC" ,
"#CC9D12" ,
"#f15c80" ,
"#e4d354" ,
"#8085e8" ,
"#8d4653" ,
"#91e8e1" ,
"#f7a35c" ,
"#90ed7d" ,
] ,
} ;
} ,
} ,
created ( ) {
created ( ) {
this . getData ( )
this . getData ( ) ;
} ,
} ,
methods : {
methods : {
/ / 切 换 数 据
/ / 切 换 数 据
handlerTab ( n ) {
handlerTab ( n ) {
if ( n === 0 ) {
if ( n === 0 ) {
this . labelData = this . sex ;
this . labelData = this . sex ;
let total = 0 ;
let total = 0 ;
this . sex . forEach ( ele => {
this . sex . forEach ( ( ele ) => {
total += ele . value ;
total += ele . value ;
} )
} ) ;
this . totalData = total ;
this . totalData = total ;
this . opt = createOpt ( this . sex , [ '#54BF93' , '#3373CC' , '#CC9D12' ] ) ;
this . opt = createOpt ( this . sex , [
} else if ( n === 1 ) {
"#54BF93" ,
"#3373CC" ,
"#CC9D12" ,
] ) ;
} else if ( n === 1 ) {
this . labelData = this . attestation ;
this . labelData = this . attestation ;
let total = 0 ;
let total = 0 ;
this . attestation . forEach ( ele => {
this . attestation . forEach ( ( ele ) => {
total += ele . value ;
total += ele . value ;
} )
} ) ;
this . totalData = total ;
this . totalData = total ;
this . opt = createOpt ( this . attestation , this . colors ) ;
this . opt = createOpt ( this . attestation , this . colors ) ;
} else {
} else {
this . labelData = this . region ;
this . labelData = this . region ;
let total = 0 ;
let total = 0 ;
this . region . forEach ( ele => {
this . region . forEach ( ( ele ) => {
total += ele . value ;
total += ele . value ;
} )
} ) ;
this . totalData = total ;
this . totalData = total ;
this . opt = createOpt ( this . region , this . colors ) ;
this . opt = createOpt ( this . region , this . colors ) ;
}
}
} ,
} ,
/ / 获 取 远 程 数 据
/ / 获 取 远 程 数 据
getData ( ) {
getData ( ) {
getSexOrAttestationOrRegionHome0528 ( this . getCommTime ) . then ( res => {
getSexOrAttestationOrRegionHome0528 ( this . getCommTime ) . then (
( res ) => {
let data = res . data ;
let data = res . data ;
this . attestation = data . attestation ;
this . attestation = data . attestation ;
this . sex = data . sex ;
this . sex = data . sex ;
this . region = data . region ;
this . region = data . region ;
let total = 0 ;
let total = 0 ;
this . sex . forEach ( ele => {
this . sex . forEach ( ( ele ) => {
total += ele . value ;
total += ele . value ;
} )
} ) ;
this . totalData = total ;
this . totalData = total ;
this . labelData = this . sex ;
this . labelData = this . sex ;
this . opt = createOpt ( this . sex , [ '#54BF93' , '#3373CC' , '#CC9D12' ] ) ;
this . opt = createOpt ( this . sex , [
} )
"#54BF93" ,
} ,
"#3373CC" ,
"#CC9D12" ,
] ) ;
}
}
}
) ;
} ,
} ,
} ;
< / script >
< / script >
< style lang = "less" scoped >
< style lang = "less" scoped >
. u - p - outter {
. u - p - outter {