userProfiling.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. <template>
  2. <div class="page">
  3. <div class="top adfac">
  4. <div class="top-pre">
  5. <div class="top-pre-num adfacjb">
  6. <div class="top-pre-num-l">
  7. <p>累计注册用户总数</p>
  8. <p class="n">{{ 24589 }}</p>
  9. </div>
  10. <div class="top-pre-num-r">
  11. <img src="@/assets/images/agent/user_img1.png">
  12. </div>
  13. </div>
  14. <div class="top-pre-text adfac">
  15. <div class="tn">较昨日&nbsp;{{ 23345 }}%&nbsp;<i class="el-icon-caret-bottom" style="color: #FD4F66;"></i></div>
  16. </div>
  17. </div>
  18. <div class="top-pre">
  19. <div class="top-pre-num adfacjb">
  20. <div class="top-pre-num-l">
  21. <p>今日新增用户总数</p>
  22. <p class="n">{{ 679 }}</p>
  23. </div>
  24. <div class="top-pre-num-r">
  25. <img src="@/assets/images/agent/user_img2.png">
  26. </div>
  27. </div>
  28. <div class="top-pre-text adfac">
  29. <div class="tn">较昨日&nbsp;{{ 345 }}%&nbsp;<i class="el-icon-caret-top" style="color: #33A7A7;"></i></div>
  30. </div>
  31. </div>
  32. <div class="top-pre">
  33. <div class="top-pre-num adfacjb">
  34. <div class="top-pre-num-l">
  35. <p>创衡运营邀请渠道</p>
  36. <p class="n">{{ 2458 }}</p>
  37. </div>
  38. <div class="top-pre-num-r">
  39. <img src="@/assets/images/agent/user_img3.png">
  40. </div>
  41. </div>
  42. <div class="top-pre-text adfac">
  43. <div class="tn">较昨日&nbsp;{{ 345 }}%&nbsp;<i class="el-icon-caret-top" style="color: #33A7A7;"></i></div>
  44. </div>
  45. </div>
  46. <div class="top-pre">
  47. <div class="top-pre-num adfacjb">
  48. <div class="top-pre-num-l">
  49. <p>用户推荐转发</p>
  50. <p class="n">{{ 7289 }}</p>
  51. </div>
  52. <div class="top-pre-num-r">
  53. <img src="@/assets/images/agent/user_img4.png">
  54. </div>
  55. </div>
  56. <div class="top-pre-text adfac">
  57. <div class="tn">较昨日&nbsp;{{ 345 }}%&nbsp;<i class="el-icon-caret-top" style="color: #33A7A7;"></i></div>
  58. </div>
  59. </div>
  60. <div class="top-pre">
  61. <div class="top-pre-num adfacjb">
  62. <div class="top-pre-num-l">
  63. <p>团队教练转发问卷任务</p>
  64. <p class="n">{{ 4589 }}</p>
  65. </div>
  66. <div class="top-pre-num-r">
  67. <img src="@/assets/images/agent/user_img5.png">
  68. </div>
  69. </div>
  70. <div class="top-pre-text adfac">
  71. <div class="tn">较昨日&nbsp;{{ 345 }}%&nbsp;<i class="el-icon-caret-bottom" style="color: #FD4F66;"></i></div>
  72. </div>
  73. </div>
  74. </div>
  75. <div class="middle adfacjb">
  76. <div class="box box1 adffc">
  77. <div class="box-title">用户注册渠道</div>
  78. <div class="box-echart adfac">
  79. <div class="box-echart-qd">
  80. <div ref="yhzcqdRef" style="width: 100%; height: 100%;"></div>
  81. </div>
  82. <div class="box-echart-type adfacjb">
  83. <div class="box-echart-type-pre" v-for="(item,index) in yhzcqdTypeList" :key="index">
  84. <div class="box-echart-type-pre-top adfac">
  85. <div class="circle" :style="{'background-color':item.color}"></div>
  86. <div class="text">{{ item.name }}</div>
  87. </div>
  88. <div class="box-echart-type-pre-num">{{ item.num }}</div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. <div class="box box1 adffc">
  94. <div class="box-title">行业分布</div>
  95. <div class="box-echart">
  96. <div class="list">
  97. <div class="list-item adfac" v-for="(item,index) in hyfbData" :key="index">
  98. <div class="list-item-name">{{ item.name }}</div>
  99. <div class="list-item-num">
  100. <div class="list-item-num-current" :style="{width:item.bl+'%'}"></div>
  101. </div>
  102. <div class="list-item-bl">{{ item.bl }}%</div>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. <div class="middle adfacjb">
  109. <div class="box box2 adffc">
  110. <div class="date adfac">
  111. <div class="date-pre" :class="{'active':didx==1}" @click="changeDate(1)">本周</div>
  112. <div class="date-pre" :class="{'active':didx==2}" @click="changeDate(2)">本月</div>
  113. <el-select v-model="queryDate" placeholder="自定义时间" @change="changeCusDate" style="width: 167px;">
  114. <el-option label="近10天" value="10"></el-option>
  115. </el-select>
  116. </div>
  117. <div class="box-title">用户概览</div>
  118. <div class="box-echart">
  119. <div ref="yhglRef" style="width: 100%; height: 100%;"></div>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. </template>
  125. <script setup name="">
  126. import * as echarts from "echarts";
  127. import {
  128. getRegisterChannelStats,
  129. getIndustryScattergram
  130. } from '@/api/agent/indexTwo.js'
  131. import { ref, getCurrentInstance, onMounted } from 'vue'
  132. const { proxy } = getCurrentInstance();
  133. const didx = ref(1)
  134. const queryDate = ref('')
  135. const yhglRef = ref(null)
  136. const yhzcqdRef = ref(null)
  137. const yhhxRef = ref(null)
  138. const hyfbData = ref([])
  139. const nlfbRef1 = ref(null)
  140. const nlfbRef2 = ref(null)
  141. const nlfbRef3 = ref(null)
  142. const nlfbRef4 = ref(null)
  143. const yhzcqdTypeList = ref([])
  144. const changeDate = (idx) => {
  145. didx.value = idx
  146. }
  147. const changeCusDate = () => {
  148. didx.value = ''
  149. }
  150. const getRegisterChannelStatsFn = () => {
  151. let colors = ['#009191','#35CBCA','#7CC5C5','#FBD438']
  152. getRegisterChannelStats().then(res => {
  153. yhzcqdTypeList.value = res.data.map((item,index) => {
  154. return { color:colors[index],name:item.channelName,num:item.registerCount??0 }
  155. })
  156. let data = yhzcqdTypeList.value.map(d=>({name:d.name,value:d.num}))
  157. let sum = data.reduce((total,item)=>{return total+item.value},0)
  158. initYhzcqdData(colors,data,sum)
  159. })
  160. }
  161. const initYhglEchart = () => {
  162. const chart = echarts.init(yhglRef.value)
  163. let option = {
  164. color: ['#01A79C','#0177B3'],
  165. xAxis: {
  166. type: 'category',
  167. boundaryGap: false,
  168. data: ['11-01', '11-02', '11-03', '11-04', '11-05', '11-06', '11-07']
  169. },
  170. yAxis: {
  171. type: 'value'
  172. },
  173. grid: {
  174. left: '1%',
  175. right: '1%',
  176. top: '20%',
  177. bottom: '1%',
  178. containLabel: true
  179. },
  180. legend: {
  181. data: ['新增用户', '累计用户'],
  182. top:'3%',
  183. left:'1%'
  184. },
  185. tooltip: {
  186. trigger: 'axis',
  187. axisPointer: {
  188. type: 'cross',
  189. label: {
  190. backgroundColor: '#6a7985'
  191. }
  192. }
  193. },
  194. series: [
  195. {
  196. name:'新增用户',
  197. data: [30,170,30,80,50,160,20],
  198. type: 'line',
  199. smooth: true,
  200. lineStyle: {
  201. width: 4,
  202. },
  203. showSymbol: false,
  204. },
  205. {
  206. name:'累计用户',
  207. data: [200,90,130,90,220,60,80],
  208. type: 'line',
  209. smooth: true,
  210. lineStyle: {
  211. width: 4,
  212. },
  213. showSymbol: false,
  214. }
  215. ]
  216. }
  217. chart.setOption(option)
  218. }
  219. const initHyfbData = () => {
  220. getIndustryScattergram().then(res => {
  221. hyfbData.value = res.data.map(item => {
  222. return {name:item.industryName,num:item.industryCount||0}
  223. })
  224. let sum = hyfbData.value.reduce((total,item)=>{return total+item.num},0)||1
  225. hyfbData.value.forEach(item=>{
  226. item.bl = (item.num/sum*100).toFixed(2)
  227. })
  228. })
  229. }
  230. const initYhhxEchart = () => {
  231. const data = [
  232. { name: '男', value: '58' },
  233. { name: '女', value: '42' }
  234. ]
  235. const chart = echarts.init(yhhxRef.value)
  236. let option = {
  237. color: [
  238. new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  239. { offset: 0, color: '#33A7A7' },
  240. { offset: 1, color: '#06C6BF' },
  241. ]),
  242. '#FFDF73'
  243. ],
  244. tooltip: {
  245. trigger: 'item',
  246. backgroundColor: 'rgba(3,50,86,0.8)',
  247. textStyle: {
  248. fontSize: 16,
  249. color: '#ffffff',
  250. },
  251. formatter: (params) => {
  252. return params.name + ': ' + params.value + '%'
  253. }
  254. },
  255. series: [
  256. {
  257. type: 'pie',
  258. roseType: 'radius',
  259. radius: ['50%', '95%'],
  260. center: ['50%', '50%'],
  261. data: data,
  262. itemStyle: {
  263. borderWidth: 2
  264. },
  265. labelLine: {
  266. length: 0
  267. },
  268. label: {
  269. formatter: (params) => {
  270. return '{name|' + params.name + ': }{value|' + params.value + '%}'
  271. },
  272. rich: {
  273. name: {
  274. fontSize: 14,
  275. color: '#002846',
  276. },
  277. value: {
  278. fontSize: 32,
  279. color: '#002846',
  280. },
  281. }
  282. }
  283. }
  284. ]
  285. }
  286. chart.setOption(option)
  287. }
  288. const initNlfbEcharts = () => {
  289. let refs = [nlfbRef1.value,nlfbRef2.value,nlfbRef3.value,nlfbRef4.value]
  290. let arr = [
  291. {color:'#FFDF73',data:[{value:38},{value:62}]},
  292. {color:'#35CBCA',data:[{value:52},{value:62}]},
  293. {color:'#3AA1FF',data:[{value:7},{value:62}]},
  294. {color:'#F3637C',data:[{value:3},{value:62}]}
  295. ]
  296. arr.forEach((item,index)=>{
  297. initNlfbEchart(item.color,item.data,refs[index])
  298. })
  299. }
  300. const initYhzcqdData = (color,data,sum) => {
  301. const chart = echarts.init(yhzcqdRef.value)
  302. let option = {
  303. color,
  304. grid: {
  305. left: 20,
  306. right: 20,
  307. bottom: 10,
  308. top: 10,
  309. containLabel: true
  310. },
  311. title: {
  312. show: true,
  313. text: '{a|'+sum+'}\n{b|注册总数}',
  314. x: '38%',
  315. y: '46%',
  316. textStyle: {
  317. rich: {
  318. a: {
  319. align: 'center',
  320. fontSize: 28,
  321. fontWeight:'bold',
  322. color: '#002846',
  323. padding: [0, 0, 10, 0],
  324. },
  325. b: {
  326. align: 'center',
  327. fontSize: 14,
  328. color: '#667E90'
  329. },
  330. },
  331. }
  332. },
  333. tooltip: {
  334. trigger: 'item',
  335. formatter: '{b}:{c}({d}%)'
  336. },
  337. series: [{
  338. type: 'pie',
  339. startAngle: 90,
  340. radius: ['55%', '90%'],
  341. center: ['50%', '53%'],
  342. hoverAnimation: false,
  343. roseType: 'radius',
  344. data,
  345. label: {
  346. show: false
  347. },
  348. labelLine: {
  349. show: false
  350. }
  351. }]
  352. }
  353. chart.setOption(option)
  354. }
  355. const initNlfbEchart = (color,data,ref) => {
  356. const chart = echarts.init(ref)
  357. let option = {
  358. color:[color,'#F1F2F6'],
  359. series: [
  360. {
  361. type: 'pie',
  362. radius: ['40%', '70%'],
  363. padAngle: 3,
  364. itemStyle: {
  365. borderRadius: 5
  366. },
  367. labelLine: {
  368. show: false
  369. },
  370. data
  371. }
  372. ]
  373. }
  374. chart.setOption(option)
  375. }
  376. onMounted(()=>{
  377. getRegisterChannelStatsFn()
  378. initYhglEchart()
  379. initHyfbData()
  380. initYhhxEchart()
  381. initNlfbEcharts()
  382. proxy.$nextTick(()=>{
  383. })
  384. })
  385. </script>
  386. <style scoped lang="scss">
  387. .page{
  388. padding: 16px;
  389. .top{
  390. justify-content: space-between;
  391. &-pre{
  392. width: calc(20% - 9.6px);
  393. background: #FFFFFF;
  394. box-shadow: 0px 2px 12px 0px rgba(0,0,0,0.06);
  395. border-radius: 6px;
  396. padding: 24px 20px;
  397. box-sizing: border-box;
  398. &-num{
  399. &-l{
  400. p{
  401. font-family: PingFangSC, PingFang SC;
  402. font-weight: 400;
  403. font-size: 14px;
  404. color: #335368;
  405. line-height: 14px;
  406. &.n{
  407. font-family: DINAlternate, DINAlternate;
  408. font-weight: bold;
  409. font-size: 28px;
  410. color: #002846;
  411. line-height: 28px;
  412. margin-top: 16px;
  413. }
  414. }
  415. }
  416. &-r{
  417. img{
  418. width: 60px;
  419. height: 60px;
  420. }
  421. }
  422. }
  423. &-text{
  424. margin-top: 16px;
  425. .tn{
  426. width: 100%;
  427. font-family: PingFangSC, PingFang SC;
  428. font-weight: 400;
  429. font-size: 14px;
  430. color: #667E90;
  431. line-height: 14px;
  432. }
  433. }
  434. }
  435. }
  436. .box{
  437. background: #FFFFFF;
  438. box-shadow: 0px 2px 12px 0px rgba(0,0,0,0.06);
  439. border-radius: 6px;
  440. padding: 20px;
  441. box-sizing: border-box;
  442. height: 420px;
  443. position: relative;
  444. &.box1{
  445. width: calc(50% - 8px);
  446. }
  447. &.box2{
  448. width: 100%;
  449. }
  450. }
  451. .box-title{
  452. font-family: PingFang-SC, PingFang-SC;
  453. font-weight: bold;
  454. font-size: 16px;
  455. color: #002846;
  456. line-height: 16px;
  457. }
  458. .box-echart{
  459. flex: 1;
  460. margin-top: 10px;
  461. overflow-y: auto;
  462. &-half{
  463. width: 50%;
  464. height: 100%;
  465. &-title{
  466. padding-left: 7px;
  467. margin-top: 10px;
  468. font-family: PingFangSC, PingFang SC;
  469. font-weight: 400;
  470. font-size: 14px;
  471. color: #002846;
  472. line-height: 14px;
  473. position: relative;
  474. &::before{
  475. content: '';
  476. width: 3px;
  477. height: 14px;
  478. background: #33A7A7;
  479. position: absolute;
  480. left: 0;
  481. top: 50%;
  482. transform: translateY(-50%);
  483. }
  484. }
  485. &-tb{
  486. flex: 1;
  487. }
  488. &-num{
  489. margin-top: 60px;
  490. padding-bottom: 30px;
  491. &-pre{
  492. width: 50%;
  493. img{
  494. width: 43px;
  495. height: 43px;
  496. }
  497. &-info{
  498. margin-left: 12px;
  499. p{
  500. font-family: PingFangSC, PingFang SC;
  501. font-weight: 400;
  502. font-size: 14px;
  503. color: #667E90;
  504. line-height: 14px;
  505. &.num{
  506. margin-top: 6px;
  507. span{
  508. font-family: D-DINCondensed, D-DINCondensed;
  509. font-weight: bold;
  510. font-size: 24px;
  511. color: #002846;
  512. line-height: 24px;
  513. }
  514. }
  515. }
  516. }
  517. }
  518. }
  519. &-boxs{
  520. flex-wrap: wrap;
  521. &-box{
  522. width: calc(50% - 18px);
  523. background: #FCFCFE;
  524. border-radius: 6px;
  525. padding: 24px 20px;
  526. box-sizing: border-box;
  527. margin-top: 15px;
  528. &-l{
  529. padding-right: 20px;
  530. .p1{
  531. font-family: PingFangSC, PingFang SC;
  532. font-weight: 400;
  533. font-size: 14px;
  534. color: #002846;
  535. line-height: 14px;
  536. }
  537. .p2{
  538. font-family: PingFangSC, PingFang SC;
  539. font-weight: 400;
  540. font-size: 14px;
  541. color: #99A9B5;
  542. line-height: 14px;
  543. margin-top: 16px;
  544. }
  545. .p3{
  546. font-family: D-DINCondensed, D-DINCondensed;
  547. font-weight: bold;
  548. font-size: 32px;
  549. color: #002846;
  550. line-height: 32px;
  551. margin-top: 8px;
  552. }
  553. }
  554. }
  555. }
  556. }
  557. &-qd{
  558. width: 380px;
  559. height: 100%;
  560. }
  561. &-type{
  562. flex: 1;
  563. margin-top: -80px;
  564. flex-wrap: wrap;
  565. &-pre{
  566. width: 50%;
  567. margin-top: 80px;
  568. &-top{
  569. .circle{
  570. width: 8px;
  571. height: 8px;
  572. border-radius: 50%;
  573. }
  574. .text{
  575. font-family: PingFangSC, PingFang SC;
  576. font-weight: 400;
  577. font-size: 14px;
  578. color: #667E90;
  579. line-height: 16px;
  580. margin-left: 8px;
  581. }
  582. }
  583. &-num{
  584. margin: 16px 0 0 12px;
  585. font-family: D-DINCondensed, D-DINCondensed;
  586. font-weight: bold;
  587. font-size: 24px;
  588. color: #002846;
  589. line-height: 24px;
  590. }
  591. }
  592. }
  593. }
  594. .middle{
  595. margin-top: 16px;
  596. }
  597. .date{
  598. position: absolute;
  599. top: 42px;
  600. right: 20px;
  601. &-pre{
  602. width: 54px;
  603. height: 40px;
  604. border-radius: 6px;
  605. border: 1px solid #DDE0E6;
  606. font-family: PingFangSC, PingFang SC;
  607. font-weight: 400;
  608. font-size: 14px;
  609. color: #335368;
  610. line-height: 40px;
  611. text-align: center;
  612. margin-right: 16px;
  613. cursor: pointer;
  614. &.active{
  615. background: rgba(51,167,167,0.08);
  616. border-radius: 6px;
  617. border: 1px solid #33A7A7;
  618. color: #009191;
  619. }
  620. }
  621. }
  622. .list{
  623. &-item{
  624. margin-top: 19px;
  625. &-name{
  626. width: 158px;
  627. padding-right: 18px;
  628. box-sizing: border-box;
  629. font-family: PingFangSC, PingFang SC;
  630. font-weight: 400;
  631. font-size: 14px;
  632. color: #33536B;
  633. line-height: 20px;
  634. text-align: right;
  635. }
  636. &-num{
  637. flex: 1;
  638. height: 8px;
  639. background: #F3F4FA;
  640. position: relative;
  641. &-current{
  642. height: 8px;
  643. background: #4CB2B2;
  644. }
  645. }
  646. &-bl{
  647. width: 82px;
  648. padding-left: 16px;
  649. box-sizing: border-box;
  650. font-family: PingFangSC, PingFang SC;
  651. font-weight: 400;
  652. font-size: 14px;
  653. color: #536387;
  654. line-height: 20px;
  655. text-align: left;
  656. }
  657. }
  658. }
  659. }
  660. </style>