You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

UserTrend.vue 42 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954
  1. <template>
  2. <div class="el-col el-col-21" style="padding-right:10px">
  3. <div id='user_tend'>
  4. <div style="margin-top: 10px;">
  5. <b class="pro_item">增长趋势分析</b> <span class="update_time">数据更新时间:</span><span style="font-size: 12px;">{{lastUpdatedTime}} &nbsp/&nbsp从{{recordBeginTime}}开始统计</span>
  6. </div>
  7. <div id = 'isShow'>
  8. <el-col :span="11">
  9. <el-col id="ys_add_user" class="draw_region">
  10. </el-col>
  11. <el-col :span="8" :style="{ height: '180px'}" v-if="ys_count>0">
  12. <span class="yesterday_blk yesterday_title" >昨日新增注册用户数 </span>
  13. <span class="yesterday_blk yesterday_color1 yesterday_pdrt yesterday_text">未激活:<span class="bold_num">{{ tableDataYesterday.NotActivateRegistUser }}</span> 人 </span>
  14. <span class="yesterday_blk yesterday_color2 yesterday_pdrt yesterday_text">已激活: <span class="bold_num">{{ tableDataYesterday.ActivateRegistUser }} </span>人</span>
  15. <span class="yesterday_blk yesterday_pdrt yesterday_text">有贡献活动: <span class="bold_num">{{ tableDataYesterday.RegistActivityUser }} </span>人</span>
  16. </el-col>
  17. </el-col>
  18. <el-col :span="13">
  19. <el-col id="ys_all_user" class="draw_region">
  20. </el-col>
  21. <el-col :span="8" :style="{ height: '180px'}" v-if="ys_count>0">
  22. <span class="yesterday_blk yesterday_title" >注册用户数 </span>
  23. <span class="yesterday_blk yesterday_color2 yesterday_pdrt yesterday_text">未激活:<span class="bold_num">{{ tableDataYesterday.TotalNotActivateRegistUser }} </span>人</span>
  24. <span class="yesterday_blk yesterday_color1 yesterday_pdrt yesterday_text">已激活:<span class="bold_num">{{ tableDataYesterday.TotalActivateRegistUser}} </span>人 </span>
  25. <span class="yesterday_blk yesterday_pdrt yesterday_text">有贡献活动:<span class="bold_num"> {{ tableDataYesterday.TotalHasActivityUser}} </span>人</span>
  26. </el-col>
  27. </el-col>
  28. </div>
  29. <div style="margin-top: 20px;">
  30. <span class="sta_iterm">统计周期:</span>
  31. <button type="button" class='btn' id = "current_week_usr" v-bind:class="{colorChange:1==dynamic}" @click="resetPage(),getUserList('current_week_usr',1)">本周</button>
  32. <button type="button" class='btn' id = "current_month_usr" v-bind:class="{colorChange:2==dynamic}" @click="resetPage(),getUserList('current_month_usr',2)">本月</button>
  33. <button type="button" class='btn' id = "last_month_usr" v-bind:class="{colorChange:3==dynamic}" @click="resetPage(),getUserList('last_month_usr',3)">上月</button>
  34. <button type="button" class='btn' id = "monthly_usr" v-bind:class="{colorChange:4==dynamic}" @click="resetPage(),getUserList('monthly_usr',4)">近30天</button>
  35. <button type="button" class='btn' id = "current_year_usr" v-bind:class="{colorChange:5==dynamic}" @click="resetPage(),getUserList('current_year_usr',5)">今年</button>
  36. <button type="button" class='btnLast' id = "all_usr" v-bind:class="{colorChange:6==dynamic}" @click="resetPage(),getUserList('all_usr',6)">所有</button>
  37. <span style="margin-left: 20px;">
  38. <el-date-picker
  39. v-model="value_time"
  40. prefix-icon="el-icon-time"
  41. @change="resetPage(),getUserList('',0)"
  42. type="daterange"
  43. size='small'
  44. unlink-panels
  45. range-separator="至"
  46. start-placeholder="开始日期"
  47. end-placeholder="结束日期">
  48. </el-date-picker>
  49. </span>
  50. <span style="float:right; margin-right: 20px;" >
  51. <a style="display:inline-block;margin-left: 20px; " id = 'download'>
  52. <a class="el-icon-download" v-if="tableData!=''" :href= "this.dataUrl + '?startDate='+this.params.startDate+'&endDate='+this.params.endDate+'&IsReturnFile=true' " ></a>
  53. <i class="el-icon-download" v-else="tableData=''" href="#" style="color:rgba(187, 187, 187, 100);" @click='popMark()'></i>
  54. <span >
  55. <a v-if="tableData!=''" :href= "this.dataUrl + '?startDate='+this.params.startDate+'&endDate='+this.params.endDate+'&IsReturnFile=true' " >下载报告</a>
  56. <a v-else="tableData=''" href= "#" style="color:rgba(187, 187, 187, 100);" @click='popMark()'>下载报告</a>
  57. </span>
  58. </a>
  59. <!-- <span style="display:inline-block;margin-left: 20px; ">
  60. <el-input size="small" placeholder="输入用户名搜索" v-model="search" class="input-with-select" @keyup.enter.native="searchName() "><i slot="suffix" class="el-input__icon el-icon-search" @click="searchName() "></i>
  61. </el-input>
  62. </span> -->
  63. </span>
  64. </div>
  65. <div class="item_echart" id ='linecharts'>
  66. <div style="margin: 15px 10px 30px;">
  67. <label for="label" @change='clickCheckBox'>
  68. <input type="checkbox" class="checkboxchart" name="checkboxchart" checked="checked" value="新增项目"/> 新增注册用户
  69. <input type="checkbox" class="checkboxchart" name="checkboxchart" checked="checked" value="新增公开项目"/>新增已激活
  70. <input type="checkbox" class="checkboxchart" name="checkboxchart" checked="checked" value="新增私有项目"/>新增有贡献活动
  71. <input type="checkbox" class="checkboxchart" name="checkboxchart" value="新增自建项目"/>新增未激活
  72. <input type="checkbox" class="checkboxchart" name="checkboxchart" value="新增派生项目"/>累计注册用户
  73. <input type="checkbox" class="checkboxchart" name="checkboxchart" value="新增镜像项目"/>累计已激活
  74. <input type="checkbox" class="checkboxchart" name="checkboxchart" value="累计项目"/>累计有贡献活动
  75. </label>
  76. </div>
  77. <div id ="selectData" style="height: 300px;">
  78. </div>
  79. </div>
  80. <div style="margin-top: 30px;">
  81. <el-table
  82. :data="tableData.slice((page-1)*pageSize,page*pageSize)"
  83. style="width: 100%"
  84. :header-cell-style="tableHeaderStyle"
  85. :cell-style='cellStyle'>
  86. <el-table-column
  87. label="日期"
  88. prop="DisplayDate"
  89. align="center"
  90. stripe
  91. >
  92. </el-table-column>
  93. <el-table-column
  94. label="新增注册用户"
  95. prop="TotalRegistUser"
  96. align="center">
  97. </el-table-column>
  98. <el-table-column
  99. prop="ActivateRegistUser"
  100. label="新增已激活"
  101. width="120px"
  102. align="center">
  103. </el-table-column>
  104. <el-table-column
  105. prop="RegistActivityUser"
  106. label="新增有贡献活动"
  107. align="center">
  108. </el-table-column>
  109. <el-table-column
  110. prop="NotActivateRegistUser"
  111. label="新增未激活"
  112. align="center">
  113. </el-table-column>
  114. <el-table-column
  115. prop="ActivateIndex"
  116. label="新增用户激活率"
  117. align="center">
  118. <template slot-scope="scope">
  119. {{scope.row.ActivateIndex | rounding}}
  120. </template>
  121. </el-table-column>
  122. <el-table-column
  123. prop="HasActivityUser"
  124. label="当日有贡献活动"
  125. align="center">
  126. </el-table-column>
  127. <el-table-column
  128. prop="TotalUser"
  129. label="累计注册用户"
  130. align="center">
  131. </el-table-column>
  132. <el-table-column
  133. prop="TotalActivateRegistUser"
  134. label="累计已激活"
  135. align="center">
  136. </el-table-column>
  137. <el-table-column
  138. prop="TotalHasActivityUser"
  139. label="累计有贡献活动"
  140. align="center">
  141. </el-table-column>
  142. </el-table>
  143. </div>
  144. <div style="margin-top:50px;text-align:center">
  145. <el-pagination
  146. background
  147. @size-change="handleSizeChange"
  148. @current-change="handleCurrentChange"
  149. :current-page="page"
  150. :page-size="pageSize"
  151. :page-sizes="[5,10,20]"
  152. layout="total, sizes, prev, pager, next,jumper"
  153. :total="tableData.length">
  154. </el-pagination>
  155. </div>
  156. </div>
  157. </div>
  158. </template>
  159. <script>
  160. import { export2Excel } from '../excel/util.js'
  161. export default{
  162. name:'UserAnalysis',
  163. data() {
  164. return {
  165. type_val:'',
  166. recordBeginTime:'',
  167. lastUpdatedTime:'',
  168. page:1,
  169. pageSize:10,
  170. params:{startDate:'',endDate:''},
  171. tableData: [],
  172. totalNum:0,
  173. dataUrl:'../../api/v1/query_user_metrics_page',
  174. dataYesterdayUrl:'../../api/v1/query_metrics_yesterday',
  175. ys_count:0,
  176. tableDataYesterday: {},
  177. option:'',
  178. optionYesterdayUser:'',
  179. optionYesterdaAllUser:'',
  180. echartsSelectData:'',
  181. echartsYsAddUser:'',
  182. echartsYsAllUser:'',
  183. pickerOptions: {
  184. },
  185. value_time: '',
  186. search:'',
  187. data:'',
  188. // columns: [{title: 'ID',key: 'ID'},{title: '用户名',key: 'Name'},{title: 'PR数',key: 'CodeMergeCount'},{title: 'commit数',key:'CommitCount'},{title: '提出任务数',key: 'IssueCount'},{title: '评论数',key: 'CommentCount'},{title: '关注项目数',key: 'FocusRepoCount'},{title: '点赞项目数',key: 'StarRepoCount'},{title: '登录次数',key: 'LoginCount'},{title:'关注者数',key:'WatchedCount'},{title:'commit代码行数',key:'CommitCodeSize'},{title:'已解决任务数',key:'SolveIssueCount'},{title:'百科页面贡献次数',key:'EncyclopediasCount'},{title:'创建项目',key:'CreateRepoCount'},{title:'用户注册时间',key:'RegistDate'},{title:'云脑任务数',key:'CloudBrainTaskNum'},{title:'云脑运行时间(小时)',key:'CloudBrainRunTime'},{title:'上传(提交)数据集文件数',key:'CommitDatasetNum'},{title:'提交模型数',key:'CommitModelCount'},{title:'用户指数',key:'UserIndex'},{title:'系统统计时间',key:'CountDate'}],
  189. blob:'',
  190. fileName:'',
  191. dynamic:4,
  192. params_pro:{type:'all',page:1,pagesize:10,beginTime:'',endTime:'',q:'',sort:'openi'},
  193. };
  194. },
  195. methods: {
  196. popMark(){
  197. alert("数据为空时,不能下载!")
  198. },
  199. // exportData(){
  200. // // this.getUserList('all_usr',7)
  201. // var saveFileName = this.getFileName()
  202. // export2Excel(this.columns,this.tableData,saveFileName)
  203. // },
  204. // getFileName(){
  205. // var saveFileName=''
  206. // var Date=(this.params.startDate).split('-')
  207. // var startDate=Date[0]+''+Date[1]+''+Date[2]
  208. // Date=(this.params.endDate).split('-')
  209. // var endDate=Date[0]+Date[1]+Date[2]
  210. // saveFileName = '用户分析_'+this.search+''+startDate+'_'+endDate
  211. // if (this.type_val=='all_usr'){
  212. // saveFileName = '用户分析_'+this.search+'_all'
  213. // }
  214. // return saveFileName
  215. // },
  216. handleCurrentChange(val){
  217. this.page = val
  218. },
  219. handleSizeChange(val){
  220. this.pageSize = val
  221. },
  222. resetPage(){
  223. this.page=1
  224. },
  225. addUser(val1, val2){
  226. return (val1+val2)
  227. },
  228. formatDate(myyear,mymonth,myweekday) {
  229. // var myyear = this.date.getFullYear();
  230. // var mymonth = this.date.getMonth() + 1;
  231. // var myweekday = this.date.getDate();
  232. if (mymonth < 10) {
  233. mymonth = "0" + mymonth;
  234. }
  235. if (myweekday < 10) {
  236. myweekday = "0" + myweekday;
  237. }
  238. return (myyear + "-" + mymonth + "-" + myweekday);
  239. },
  240. // 获得某月的天数
  241. getMonthDays(nowYear,month){
  242. let monthStartDate = new Date(nowYear, month, 1);
  243. let monthEndDate = new Date(nowYear, month + 1, 1);
  244. let days = (monthEndDate - monthStartDate)/(1000 * 60 * 60 * 24);
  245. return days;
  246. },
  247. getUpdateTime(){
  248. this.$axios.get('../../api/v1/query_metrics_yesterday',{
  249. params:this.params_pro
  250. }).then((res)=>{
  251. this.recordBeginTime=res.data.datarecordbegintime
  252. this.lastUpdatedTime=res.data.lastUpdatedTime
  253. })
  254. },
  255. getUserList(type_val,index){
  256. this.type_val = type_val
  257. this.dynamic = index;
  258. var now = new Date(); // 当前日期
  259. var nowDayOfWeek = now.getDay(); // 今天本周的第几天
  260. var nowDay = now.getDate(); // 当前日
  261. var nowMonth = now.getMonth(); // 当前月
  262. var nowYear = now.getFullYear(); // 当前年
  263. var today = this.formatDate(nowYear,nowMonth+1,nowDay);
  264. let lastMonthDate = new Date(); // 上月日期
  265. lastMonthDate.setDate(1);
  266. lastMonthDate.setMonth(lastMonthDate.getMonth()-1);
  267. let lastYear = lastMonthDate.getYear();
  268. let lastMonth = lastMonthDate.getMonth();
  269. this.dataUrl = '../../api/v1/query_user_metrics_page';
  270. if (typeof type_val=="undefined" || type_val=="null" || type_val==""){
  271. this.params.startDate= this.formatDate(this.value_time[0].getFullYear(),this.value_time[0].getMonth() + 1,this.value_time[0].getDate());
  272. this.params.endDate = this.formatDate(this.value_time[1].getFullYear(),this.value_time[1].getMonth() + 1,this.value_time[1].getDate());
  273. }else{
  274. switch(type_val){
  275. case "yesterday_usr":{
  276. this.value_time=[]
  277. this.dataUrl = '../../api/v1/query_metrics_yesterday';
  278. break
  279. }
  280. case "current_week_usr":{
  281. this.value_time=[]
  282. this.dataUrl = '../../api/v1/query_metrics_current_week';
  283. break
  284. }
  285. case "current_month_usr":{
  286. this.value_time=[]
  287. this.dataUrl = '../../api/v1/query_metrics_current_month';
  288. break
  289. }
  290. case "last_month_usr":{
  291. this.value_time=[]
  292. this.dataUrl = '../../api/v1/query_metrics_last_month';
  293. break
  294. }
  295. case "monthly_usr":{
  296. this.value_time=[]
  297. this.dataUrl = '../../api/v1/query_metrics_last30_day';
  298. break
  299. }
  300. case "current_year_usr":{
  301. this.value_time=[]
  302. this.dataUrl = '../../api/v1/query_metrics_current_year';
  303. break
  304. }
  305. case "all_usr":{
  306. this.value_time=[]
  307. this.dataUrl = '../../api/v1/query_metrics_all';
  308. break
  309. }
  310. }
  311. };
  312. this.$axios.get(this.dataUrl,{
  313. params:this.params
  314. }).then((res)=>{
  315. this.tableData = res.data.data
  316. // console.log("res.data:"+res.data.data)
  317. this.totalNum = res.data.count
  318. this.drawSelectData()
  319. })
  320. },
  321. getYesterdayUser(){
  322. this.$axios.get(this.dataYesterdayUrl,{
  323. }).then((res)=>{
  324. this.ys_count = res.data.count
  325. this.tableDataYesterday = res.data.data[0]
  326. if(this.ys_count>0){
  327. this.drawYesterdayUser()
  328. this.drawSumUser()
  329. }else{
  330. document.getElementById("isShow").style.display='none'
  331. }
  332. })
  333. },
  334. drawYesterdayUser(){
  335. this.optionYesterdayUser = {
  336. tooltip: {
  337. trigger: 'item',
  338. show:false
  339. },
  340. legend: {
  341. top: '5%',
  342. left: 'center',
  343. show:false
  344. },
  345. // graphic:{
  346. // type:'text',
  347. // left:'center',
  348. // top:'center',
  349. // style:{
  350. // text:this.tableDataYesterday.TotalRegistUser,
  351. // fontSize:18,
  352. // fontWeight:'bold',
  353. // color:'#101010'
  354. // }
  355. // },
  356. color:['#5087Ec','#DBDBDB'],
  357. series: [
  358. {
  359. name: '',
  360. type: 'pie',
  361. radius: ['65%', '70%'],
  362. center:['50%','50%'],
  363. avoidLabelOverlap: false,
  364. label: {
  365. normal:{
  366. show: true,
  367. position: 'center',
  368. formatter:''+this.tableDataYesterday.TotalRegistUser,
  369. fontSize:18,
  370. fontWeight:'bold',
  371. color:'#101010'
  372. }
  373. },
  374. emphasis: {
  375. label: {
  376. show: false,
  377. fontSize: '40',
  378. fontWeight: 'bold'
  379. }
  380. },
  381. labelLine: {
  382. normal:{
  383. show:false
  384. }
  385. },
  386. data: [
  387. { value: this.tableDataYesterday.ActivateRegistUser, name: '已激活' },
  388. { value: this.tableDataYesterday.NotActivateRegistUser, name: '未激活'},
  389. ],
  390. hoverAnimation:false,
  391. }
  392. ]
  393. };
  394. this.echartsYsAddUser.setOption(this.optionYesterdayUser)
  395. },
  396. drawSumUser(){
  397. this.optionYesterdaAllUser = {
  398. tooltip: {
  399. trigger: 'item',
  400. show:false
  401. },
  402. legend: {
  403. top: '5%',
  404. left: 'center',
  405. show:false
  406. },
  407. // graphic:{
  408. // type:'text',
  409. // left:'center',
  410. // top:'center',
  411. // style:{
  412. // text:this.tableDataYesterday.TotalRegistUser,
  413. // fontSize:18,
  414. // fontWeight:'bold',
  415. // color:'#101010'
  416. // }
  417. // },
  418. color:['#5087Ec','#DBDBDB'],
  419. series: [
  420. {
  421. name: '',
  422. type: 'pie',
  423. radius: ['65%', '70%'],
  424. center:['50%','50%'],
  425. avoidLabelOverlap: false,
  426. label: {
  427. normal:{
  428. show: true,
  429. position: 'center',
  430. formatter:''+this.tableDataYesterday.TotalUser,
  431. fontSize:18,
  432. fontWeight:'bold',
  433. color:'#101010'
  434. }
  435. },
  436. emphasis: {
  437. label: {
  438. show: false,
  439. fontSize: '40',
  440. fontWeight: 'bold'
  441. }
  442. },
  443. labelLine: {
  444. normal:{
  445. show:false
  446. }
  447. },
  448. data: [
  449. { value: this.tableDataYesterday.TotalActivateRegistUser, name: '已激活' },
  450. { value: this.tableDataYesterday.TotalNotActivateRegistUser, name: '未激活'},
  451. ],
  452. hoverAnimation:false,
  453. }
  454. ]
  455. };
  456. this.echartsYsAllUser.setOption(this.optionYesterdaAllUser)
  457. },
  458. // searchName(){
  459. // this.params.userName = this.search
  460. // this.params.page = 1
  461. // this.page=1
  462. // this.getUserList(this.type_val, this.dynamic)
  463. // },
  464. tableHeaderStyle({row,column,rowIndex,columnIndex}){
  465. if(rowIndex===0){
  466. return 'background:#f5f5f6;color:#606266'
  467. }
  468. },
  469. cellStyle({row,column,rowIndex,columnIndex}){
  470. if(rowIndex%2 === 1){
  471. return 'background:#f5f5f6;color:#606266'
  472. }
  473. },
  474. drawSelectData(){
  475. // $("#selectData").removeAttr("selectData").empty();
  476. var xdata=[]
  477. var ydata_TotalRegistUser=[]
  478. var ydata_ActivateRegistUser=[]
  479. var ydata_NotActivateRegistUser=[]
  480. var ydata_RegistActivityUser=[]
  481. var ydata_TotalUser=[]
  482. var ydata_TotalActivateRegistUser=[]
  483. var ydata_TotalHasActivityUser=[]
  484. // if ()
  485. for(var i =0;i<this.tableData.length;i++){
  486. xdata.push(this.tableData[this.tableData.length-1-i].DisplayDate);
  487. ydata_TotalRegistUser.push(this.tableData[this.tableData.length-1-i].TotalRegistUser)
  488. ydata_ActivateRegistUser.push(this.tableData[this.tableData.length-1-i].ActivateRegistUser)
  489. ydata_RegistActivityUser.push(this.tableData[this.tableData.length-1-i].RegistActivityUser)
  490. ydata_NotActivateRegistUser.push(this.tableData[this.tableData.length-1-i].NotActivateRegistUser)
  491. ydata_TotalUser.push(this.tableData[this.tableData.length-1-i].TotalUser)
  492. ydata_TotalActivateRegistUser.push(this.tableData[this.tableData.length-1-i].TotalActivateRegistUser)
  493. ydata_TotalHasActivityUser.push(this.tableData[this.tableData.length-1-i].TotalHasActivityUser)
  494. }
  495. this.option = {
  496. title : {
  497. text: '',
  498. textStyle: {
  499.                 fontSize: 12,
  500.             },
  501. left:'center',
  502. top:'bottom',
  503. subtext: '',
  504. },
  505. tooltip : {
  506. trigger: 'axis',
  507. backgroundColor:'rgba(255,255,255,0.8)',
  508. color:'black',
  509. borderWidth:'1',
  510. borderColor:'gray',
  511. textStyle:{
  512. color:'black'
  513. },
  514. },
  515. legend: {
  516. data:['新增注册用户','新增已激活','新增有贡献活动','新增未激活','累计注册用户','累计已激活','累计有贡献活动'],
  517. selected:{
  518. // '新增注册用户':true,
  519. // '新增已激活':true,
  520. // '新增有贡献活动':true,
  521. // '新增未激活':false,
  522. // '累计注册用户':false,
  523. // '累计已激活':false,
  524. // '累计有贡献活动':false
  525. }
  526. // orient: 'vertical',
  527. // top:'top',  
  528. },
  529. toolbox: {
  530. show : false,
  531. feature : {
  532. mark : {show: true},
  533. dataView : {show: false, readOnly: false},
  534. magicType : {show: true, type: ['line', 'bar']},
  535. restore : {show: false},
  536. saveAsImage : {show: true}
  537. }
  538. },
  539. calculable : true,
  540. xAxis : [
  541. {
  542. type : 'category',
  543. data : xdata,
  544. axisLine: {
  545. show: false, //x轴线消失
  546. },
  547. axisTick:{
  548. show:false//刻度隐藏
  549. }
  550. }
  551. ],
  552. yAxis : [
  553. {
  554. type : 'value',
  555. axisLine: {
  556. show: false, //y轴线消失
  557. },
  558. axisTick:{
  559. show:false//刻度隐藏
  560. }
  561. }
  562. ],
  563. series : [
  564. { name:"新增注册用户",
  565. data: ydata_TotalRegistUser,
  566. type: 'line',
  567. areaStyle: {},
  568. itemStyle:{
  569. normal:{
  570. lineStyle:{
  571. color:"#3894FF ",
  572. },
  573. color:"#3894FF ",
  574. }
  575. },
  576. },
  577. {
  578. name:"新增已激活",
  579. data: ydata_ActivateRegistUser,
  580. type: 'line',
  581. areaStyle: {},
  582. itemStyle:{
  583. normal:{
  584. lineStyle:{
  585. color:"#67B3BB",
  586. },
  587. color:"#67B3BB",
  588. }
  589. },
  590. },
  591. {
  592. name:"新增有贡献活动",
  593. data: ydata_RegistActivityUser,
  594. type: 'line',
  595. areaStyle: {},
  596. itemStyle:{
  597. normal:{
  598. lineStyle:{
  599. color:"#58A55C",
  600. },
  601. color:"#58A55C",
  602. }
  603. },
  604. },
  605. {
  606. name:"新增未激活",
  607. data: ydata_NotActivateRegistUser,
  608. type: 'line',
  609. areaStyle: {},
  610. itemStyle:{
  611. normal:{
  612. lineStyle:{
  613. color:"#F2BD42",
  614. },
  615. color:"#F2BD42",
  616. }
  617. },
  618. },
  619. {
  620. name:"累计注册用户",
  621. data: ydata_TotalUser,
  622. type: 'line',
  623. areaStyle: {},
  624. itemStyle:{
  625. normal:{
  626. lineStyle:{
  627. color:"#2E4552",
  628. },
  629. color:"#2E4552",
  630. }
  631. },
  632. },
  633. {
  634. name:"累计已激活",
  635. data: ydata_TotalActivateRegistUser,
  636. type: 'line',
  637. areaStyle: {},
  638. itemStyle:{
  639. normal:{
  640. lineStyle:{
  641. color:"#4786B4",
  642. },
  643. color:"#4786B4",
  644. }
  645. },
  646. },
  647. {
  648. name:"累计有贡献活动",
  649. data: ydata_TotalHasActivityUser,
  650. type: 'line',
  651. areaStyle: {},
  652. itemStyle:{
  653. normal:{
  654. lineStyle:{
  655. color:"#4E9C8F",
  656. },
  657. color:"#4E9C8F",
  658. }
  659. },
  660. },
  661. ]
  662. };
  663. // this.echartsSelectData.resize()
  664. var checkboxs=document.getElementsByName('checkboxchart');
  665. // $(".checkboxchart").click(function(){
  666. for(var i=0; i<checkboxs.length; i++){
  667. // console.log("selectArr[i]:",this.option.legend.data[i])
  668. if(checkboxs[i].checked){
  669. this.option.legend.selected[this.option.legend.data[i]]=true;
  670. }else{
  671. this.option.legend.selected[this.option.legend.data[i]]=false;
  672. }
  673. }
  674. this.echartsSelectData.setOption(this.option)
  675. // this.clickCheckBox()
  676. // setTimeout(function (){
  677. // window.onresize = function () {
  678. // this.echartsSelectData.resize;
  679. // }
  680. // },200)
  681. // // 使用刚指定的选择项数据显示图表。
  682. // var selectArr = this.echartsSelectData.getOption().legend[0].data;//legend所有值
  683. // var checkboxs=document.getElementsByName('checkboxchart');
  684. // $(".checkboxchart").click(function(){
  685. // var obj = {};
  686. // for(var i=0; i<checkboxs.length; i++){
  687. // if(checkboxs[i].checked){
  688. // obj[selectArr[i]] = true;
  689. // }else{
  690. // obj[selectArr[i]] = false;
  691. // }
  692. // }
  693. // option.legend.selected = obj;
  694. // this.echartsSelectData.setOption(option);
  695. // });
  696. },
  697. clickCheckBox(){
  698. // 使用刚指定的选择项数据显示图表。
  699. var selectArr = this.echartsSelectData.getOption().legend[0].data;//legend所有值
  700. var checkboxs=document.getElementsByName('checkboxchart');
  701. // $(".checkboxchart").click(function(){
  702. var obj = {};
  703. for(var i=0; i<checkboxs.length; i++){
  704. if(checkboxs[i].checked){
  705. obj[selectArr[i]] = true;
  706. }else{
  707. obj[selectArr[i]] = false;
  708. }
  709. }
  710. // console.log("obj:",obj)
  711. this.option.legend.selected = obj;
  712. this.echartsSelectData.setOption(this.option);
  713. // });
  714. },
  715. },
  716. filters:{
  717. rounding (value) {
  718. if(value>=1){
  719. return "100%"
  720. }else if(value==0){
  721. return "-"
  722. }else{
  723. return Number(value*100).toFixed(2) + "%"
  724. }
  725. },
  726. transformTimestamp(timestamp){
  727. let a = new Date(timestamp*1000);
  728. const date = new Date(a);
  729. const Y = date.getFullYear() + '/';
  730. const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '/';
  731. const D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
  732. const h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
  733. const m = (date.getMinutes() <10 ? '0'+date.getMinutes() : date.getMinutes());// + ':' ;
  734. // const s = (date.getSeconds() <10 ? '0'+date.getSeconds() : date.getSeconds()) ; // 秒
  735. const dateString = Y + M + D + h + m ;//+ s;
  736. return dateString;
  737. },
  738. addUser(val1,val2){
  739. return val1+val2
  740. }
  741. },
  742. mounted() {
  743. // document.getElementById("all_usr").style.outline="none"
  744. // document.getElementById("all_usr").focus()
  745. this.getUpdateTime()
  746. this.getUserList("monthly_usr",4)
  747. this.getYesterdayUser()
  748. document.getElementById('selectData').style.width = document.getElementById('user_tend').offsetWidth*0.8+'px'
  749. this.echartsSelectData = this.$echarts.init(document.getElementById('selectData'))
  750. this.echartsYsAddUser = this.$echarts.init(document.getElementById('ys_add_user'))
  751. this.echartsYsAllUser = this.$echarts.init(document.getElementById('ys_all_user'))
  752. },
  753. created() {
  754. this.getUserList("monthly_usr",4)
  755. this.getYesterdayUser()
  756. },
  757. watch:{
  758. // search(val){
  759. // if(!val){
  760. // this.params.userName = this.search
  761. // this.params.page = 1
  762. // this.page=1
  763. // this.getUserList(this.type_val, this.dynamic)
  764. // }
  765. // }
  766. },
  767. }
  768. </script>
  769. <style scoped>
  770. .pro_item{
  771. font-size: 16px;
  772. color: rgba(16, 16, 16, 100);
  773. font-family: SourceHanSansSC-bold;
  774. }
  775. .sta_item{
  776. font-size: 14px;
  777. color: rgb(0 0 0);
  778. font-family: SourceHanSansSC-bold;
  779. }
  780. .update_time{
  781. line-height: 17px;
  782. font-size: 12px;
  783. color:rgba(187, 187, 187, 100);
  784. margin-left: 10px;
  785. }
  786. /* .btn{
  787. line-height: 1.5;
  788. margin: -3px;
  789. border: 1px solid #409effd6;
  790. background: #FFFF;
  791. color: #409eff;
  792. width: 60px;
  793. height: 30px;
  794. border-radius:4px ;
  795. } */
  796. .btnFirst{
  797. line-height: 1.5;
  798. margin: -3.5px;
  799. border: 1px solid rgba(22, 132, 252, 100);
  800. border-right: none;
  801. background: #FFFF;
  802. color: #1684FC;
  803. width: 60px;
  804. height: 30px;
  805. border-radius:4px 0px 0px 4px;
  806. }
  807. .btn{
  808. line-height: 1.5;
  809. margin: -3.5px;
  810. border: 1px solid rgba(22, 132, 252, 100);
  811. border-right: none;
  812. background: #FFFF;
  813. color: #1684FC;
  814. width: 60px;
  815. height: 30px;
  816. }
  817. .btnLast{
  818. line-height: 1.5;
  819. margin: -3.5px;
  820. border: 1px solid rgba(22, 132, 252, 100);
  821. /* border-right: none; */
  822. background: #FFFF;
  823. color: #1684FC;
  824. width: 60px;
  825. height: 30px;
  826. border-radius:0px 4px 4px 0px;
  827. }
  828. .btnFirst,.btn,.btnLast {
  829. cursor: pointer;
  830. }
  831. /* .btn:focus,
  832. .btn:active{
  833. background-color:#409effd6 ;
  834. } */
  835. /* /deep/ .el-date-picker {
  836. width: 220px;
  837. } */
  838. /deep/ .el-table {
  839. font-size: 12px;
  840. }
  841. /deep/ .el-table tbody tr:hover>td {
  842. background-color:#D3D3D3!important;
  843. opacity:1
  844. }
  845. /deep/ .el-range-separator{
  846. width: 20% !important;
  847. }
  848. /deep/ .el-pagination {
  849. padding-bottom: 30px;
  850. }
  851. .colorChange {
  852. background-color: #1684FC;
  853. color: #FFFF;
  854. cursor: default;
  855. }
  856. .item_echart{
  857. margin-top: 10px;
  858. margin-right: 5px;
  859. border:1px solid rgba(219, 219, 219, 100);
  860. height: 350px;
  861. width: 100%;
  862. }
  863. .yesterday_blk{
  864. display: block;
  865. margin-top:40px
  866. }
  867. .yesterday_pdrt{
  868. padding-left: 10px;
  869. }
  870. .yesterday_color1{
  871. border-left: 3px solid #DBDBDB;
  872. }
  873. .yesterday_color2{
  874. border-left: 3px solid #5087Ec;
  875. }
  876. .yesterday_title{
  877. font-size: 14px;
  878. font-weight: bold;
  879. }
  880. .yesterday_text{
  881. font-size: 12px;
  882. line-height: 12px;
  883. color: #888888;
  884. margin-top: 10px;
  885. }
  886. .bold_num{
  887. font-weight: bold;
  888. }
  889. .draw_region{
  890. width: 180px;
  891. height: 180px;
  892. }
  893. </style>