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