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 41 kB

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