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

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