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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929
  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. 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. }
  322. })
  323. },
  324. drawYesterdayUser(){
  325. this.optionYesterdayUser = {
  326. tooltip: {
  327. trigger: 'item',
  328. show:false
  329. },
  330. legend: {
  331. top: '5%',
  332. left: 'center',
  333. show:false
  334. },
  335. // graphic:{
  336. // type:'text',
  337. // left:'center',
  338. // top:'center',
  339. // style:{
  340. // text:this.tableDataYesterday.TotalRegistUser,
  341. // fontSize:18,
  342. // fontWeight:'bold',
  343. // color:'#101010'
  344. // }
  345. // },
  346. color:['#5087Ec','#DBDBDB'],
  347. series: [
  348. {
  349. name: '',
  350. type: 'pie',
  351. radius: ['65%', '70%'],
  352. center:['50%','50%'],
  353. avoidLabelOverlap: false,
  354. label: {
  355. normal:{
  356. show: true,
  357. position: 'center',
  358. formatter:''+this.tableDataYesterday.TotalRegistUser,
  359. fontSize:18,
  360. fontWeight:'bold',
  361. color:'#101010'
  362. }
  363. },
  364. emphasis: {
  365. label: {
  366. show: false,
  367. fontSize: '40',
  368. fontWeight: 'bold'
  369. }
  370. },
  371. labelLine: {
  372. normal:{
  373. show:false
  374. }
  375. },
  376. data: [
  377. { value: this.tableDataYesterday.ActivateRegistUser, name: '已激活' },
  378. { value: this.tableDataYesterday.NotActivateRegistUser, name: '未激活'},
  379. ],
  380. hoverAnimation:false,
  381. }
  382. ]
  383. };
  384. this.echartsYsAddUser.setOption(this.optionYesterdayUser)
  385. },
  386. drawSumUser(){
  387. this.optionYesterdaAllUser = {
  388. tooltip: {
  389. trigger: 'item',
  390. show:false
  391. },
  392. legend: {
  393. top: '5%',
  394. left: 'center',
  395. show:false
  396. },
  397. // graphic:{
  398. // type:'text',
  399. // left:'center',
  400. // top:'center',
  401. // style:{
  402. // text:this.tableDataYesterday.TotalRegistUser,
  403. // fontSize:18,
  404. // fontWeight:'bold',
  405. // color:'#101010'
  406. // }
  407. // },
  408. color:['#5087Ec','#DBDBDB'],
  409. series: [
  410. {
  411. name: '',
  412. type: 'pie',
  413. radius: ['65%', '70%'],
  414. center:['50%','50%'],
  415. avoidLabelOverlap: false,
  416. label: {
  417. normal:{
  418. show: true,
  419. position: 'center',
  420. formatter:''+this.tableDataYesterday.TotalUser,
  421. fontSize:18,
  422. fontWeight:'bold',
  423. color:'#101010'
  424. }
  425. },
  426. emphasis: {
  427. label: {
  428. show: false,
  429. fontSize: '40',
  430. fontWeight: 'bold'
  431. }
  432. },
  433. labelLine: {
  434. normal:{
  435. show:false
  436. }
  437. },
  438. data: [
  439. { value: this.tableDataYesterday.TotalActivateRegistUser, name: '已激活' },
  440. { value: this.tableDataYesterday.TotalNotActivateRegistUser, name: '未激活'},
  441. ],
  442. hoverAnimation:false,
  443. }
  444. ]
  445. };
  446. this.echartsYsAllUser.setOption(this.optionYesterdaAllUser)
  447. },
  448. // searchName(){
  449. // this.params.userName = this.search
  450. // this.params.page = 1
  451. // this.page=1
  452. // this.getUserList(this.type_val, this.dynamic)
  453. // },
  454. tableHeaderStyle({row,column,rowIndex,columnIndex}){
  455. if(rowIndex===0){
  456. return 'background:#f5f5f6;color:#606266'
  457. }
  458. },
  459. cellStyle({row,column,rowIndex,columnIndex}){
  460. if(rowIndex%2 === 1){
  461. return 'background:#f5f5f6;color:#606266'
  462. }
  463. },
  464. drawSelectData(){
  465. // $("#selectData").removeAttr("selectData").empty();
  466. var xdata=[]
  467. var ydata_TotalRegistUser=[]
  468. var ydata_ActivateRegistUser=[]
  469. var ydata_NotActivateRegistUser=[]
  470. var ydata_RegistActivityUser=[]
  471. var ydata_TotalUser=[]
  472. var ydata_TotalActivateRegistUser=[]
  473. var ydata_TotalHasActivityUser=[]
  474. // if ()
  475. for(var i =0;i<this.tableData.length;i++){
  476. xdata.push(this.tableData[this.tableData.length-1-i].DisplayDate);
  477. ydata_TotalRegistUser.push(this.tableData[this.tableData.length-1-i].TotalRegistUser)
  478. ydata_ActivateRegistUser.push(this.tableData[this.tableData.length-1-i].ActivateRegistUser)
  479. ydata_RegistActivityUser.push(this.tableData[this.tableData.length-1-i].RegistActivityUser)
  480. ydata_NotActivateRegistUser.push(this.tableData[this.tableData.length-1-i].NotActivateRegistUser)
  481. ydata_TotalUser.push(this.tableData[this.tableData.length-1-i].TotalUser)
  482. ydata_TotalActivateRegistUser.push(this.tableData[this.tableData.length-1-i].TotalActivateRegistUser)
  483. ydata_TotalHasActivityUser.push(this.tableData[this.tableData.length-1-i].TotalHasActivityUser)
  484. }
  485. this.option = {
  486. title : {
  487. text: '',
  488. textStyle: {
  489.                 fontSize: 12,
  490.             },
  491. left:'center',
  492. top:'bottom',
  493. subtext: '',
  494. },
  495. tooltip : {
  496. trigger: 'axis',
  497. backgroundColor:'rgba(255,255,255,0.8)',
  498. color:'black',
  499. borderWidth:'1',
  500. borderColor:'gray',
  501. textStyle:{
  502. color:'black'
  503. },
  504. },
  505. legend: {
  506. data:['新增注册用户','新增已激活','新增有贡献活动','新增未激活','累计注册用户','累计已激活','累计有贡献活动'],
  507. selected:{
  508. '新增未激活':false,
  509. '累计注册用户':false,
  510. '累计已激活':false,
  511. '累计有贡献活动':false
  512. }
  513. // orient: 'vertical',
  514. // top:'top',  
  515. },
  516. toolbox: {
  517. show : false,
  518. feature : {
  519. mark : {show: true},
  520. dataView : {show: false, readOnly: false},
  521. magicType : {show: true, type: ['line', 'bar']},
  522. restore : {show: false},
  523. saveAsImage : {show: true}
  524. }
  525. },
  526. calculable : true,
  527. xAxis : [
  528. {
  529. type : 'category',
  530. data : xdata,
  531. axisLine: {
  532. show: false, //x轴线消失
  533. },
  534. axisTick:{
  535. show:false//刻度隐藏
  536. }
  537. }
  538. ],
  539. yAxis : [
  540. {
  541. type : 'value',
  542. axisLine: {
  543. show: false, //y轴线消失
  544. },
  545. axisTick:{
  546. show:false//刻度隐藏
  547. }
  548. }
  549. ],
  550. series : [
  551. { name:"新增注册用户",
  552. data: ydata_TotalRegistUser,
  553. type: 'line',
  554. areaStyle: {},
  555. itemStyle:{
  556. normal:{
  557. lineStyle:{
  558. color:"#3894FF ",
  559. },
  560. color:"#3894FF ",
  561. }
  562. },
  563. },
  564. {
  565. name:"新增已激活",
  566. data: ydata_ActivateRegistUser,
  567. type: 'line',
  568. areaStyle: {},
  569. itemStyle:{
  570. normal:{
  571. lineStyle:{
  572. color:"#67B3BB",
  573. },
  574. color:"#67B3BB",
  575. }
  576. },
  577. },
  578. {
  579. name:"新增有贡献活动",
  580. data: ydata_RegistActivityUser,
  581. type: 'line',
  582. areaStyle: {},
  583. itemStyle:{
  584. normal:{
  585. lineStyle:{
  586. color:"#58A55C",
  587. },
  588. color:"#58A55C",
  589. }
  590. },
  591. },
  592. {
  593. name:"新增未激活",
  594. data: ydata_NotActivateRegistUser,
  595. type: 'line',
  596. areaStyle: {},
  597. itemStyle:{
  598. normal:{
  599. lineStyle:{
  600. color:"#F2BD42",
  601. },
  602. color:"#F2BD42",
  603. }
  604. },
  605. },
  606. {
  607. name:"累计注册用户",
  608. data: ydata_TotalUser,
  609. type: 'line',
  610. areaStyle: {},
  611. itemStyle:{
  612. normal:{
  613. lineStyle:{
  614. color:"#2E4552",
  615. },
  616. color:"#2E4552",
  617. }
  618. },
  619. },
  620. {
  621. name:"累计已激活",
  622. data: ydata_TotalActivateRegistUser,
  623. type: 'line',
  624. areaStyle: {},
  625. itemStyle:{
  626. normal:{
  627. lineStyle:{
  628. color:"#4786B4",
  629. },
  630. color:"#4786B4",
  631. }
  632. },
  633. },
  634. {
  635. name:"累计有贡献活动",
  636. data: ydata_TotalHasActivityUser,
  637. type: 'line',
  638. areaStyle: {},
  639. itemStyle:{
  640. normal:{
  641. lineStyle:{
  642. color:"#4E9C8F",
  643. },
  644. color:"#4E9C8F",
  645. }
  646. },
  647. },
  648. ]
  649. };
  650. // this.echartsSelectData.resize()
  651. this.echartsSelectData.setOption(this.option)
  652. // setTimeout(function (){
  653. // window.onresize = function () {
  654. // this.echartsSelectData.resize;
  655. // }
  656. // },200)
  657. // // 使用刚指定的选择项数据显示图表。
  658. // var selectArr = this.echartsSelectData.getOption().legend[0].data;//legend所有值
  659. // var checkboxs=document.getElementsByName('checkboxchart');
  660. // $(".checkboxchart").click(function(){
  661. // var obj = {};
  662. // for(var i=0; i<checkboxs.length; i++){
  663. // if(checkboxs[i].checked){
  664. // obj[selectArr[i]] = true;
  665. // }else{
  666. // obj[selectArr[i]] = false;
  667. // }
  668. // }
  669. // option.legend.selected = obj;
  670. // this.echartsSelectData.setOption(option);
  671. // });
  672. },
  673. clickCheckBox(){
  674. // 使用刚指定的选择项数据显示图表。
  675. var selectArr = this.echartsSelectData.getOption().legend[0].data;//legend所有值
  676. var checkboxs=document.getElementsByName('checkboxchart');
  677. // $(".checkboxchart").click(function(){
  678. var obj = {};
  679. for(var i=0; i<checkboxs.length; i++){
  680. if(checkboxs[i].checked){
  681. obj[selectArr[i]] = true;
  682. }else{
  683. obj[selectArr[i]] = false;
  684. }
  685. }
  686. this.option.legend.selected = obj;
  687. this.echartsSelectData.setOption(this.option);
  688. // });
  689. },
  690. },
  691. filters:{
  692. rounding (value) {
  693. return Number(value).toFixed(2)
  694. },
  695. roundingToHour (value) {
  696. return (Number(value)/3600).toFixed(2)
  697. },
  698. transformTimestamp(timestamp){
  699. let a = new Date(timestamp*1000);
  700. const date = new Date(a);
  701. const Y = date.getFullYear() + '/';
  702. const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '/';
  703. const D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
  704. const h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
  705. const m = (date.getMinutes() <10 ? '0'+date.getMinutes() : date.getMinutes());// + ':' ;
  706. // const s = (date.getSeconds() <10 ? '0'+date.getSeconds() : date.getSeconds()) ; // 秒
  707. const dateString = Y + M + D + h + m ;//+ s;
  708. return dateString;
  709. },
  710. addUser(val1,val2){
  711. return val1+val2
  712. }
  713. },
  714. mounted() {
  715. // document.getElementById("all_usr").style.outline="none"
  716. // document.getElementById("all_usr").focus()
  717. this.getUpdateTime()
  718. this.getUserList("monthly_usr",4)
  719. this.getYesterdayUser()
  720. document.getElementById('selectData').style.width = document.getElementById('user_tend').offsetWidth*0.8+'px'
  721. this.echartsSelectData = this.$echarts.init(document.getElementById('selectData'))
  722. // document.getElementById('ys_add_user').style.width = document.getElementById('user_tend').offsetWidth*0.2+'px'
  723. this.echartsYsAddUser = this.$echarts.init(document.getElementById('ys_add_user'))
  724. // document.getElementById('ys_all_user').style.width = document.getElementById('user_tend').offsetWidth*0.2+'px'
  725. this.echartsYsAllUser = this.$echarts.init(document.getElementById('ys_all_user'))
  726. // document.getElementById('ys_sum_user').style.width = document.getElementById('user_tend').offsetWidth*0.23+'px'
  727. // this.echartsYsSumUser = this.$echarts.init(document.getElementById('ys_sum_user'))
  728. },
  729. created() {
  730. this.getUserList("monthly_usr",4)
  731. this.getYesterdayUser()
  732. },
  733. watch:{
  734. // search(val){
  735. // if(!val){
  736. // this.params.userName = this.search
  737. // this.params.page = 1
  738. // this.page=1
  739. // this.getUserList(this.type_val, this.dynamic)
  740. // }
  741. // }
  742. },
  743. }
  744. </script>
  745. <style scoped>
  746. .pro_item{
  747. font-size: 16px;
  748. color: rgba(16, 16, 16, 100);
  749. font-family: SourceHanSansSC-bold;
  750. }
  751. .sta_item{
  752. font-size: 14px;
  753. color: rgb(0 0 0);
  754. font-family: SourceHanSansSC-bold;
  755. }
  756. .update_time{
  757. line-height: 17px;
  758. font-size: 12px;
  759. color:rgba(187, 187, 187, 100);
  760. margin-left: 10px;
  761. }
  762. /* .btn{
  763. line-height: 1.5;
  764. margin: -3px;
  765. border: 1px solid #409effd6;
  766. background: #FFFF;
  767. color: #409eff;
  768. width: 60px;
  769. height: 30px;
  770. border-radius:4px ;
  771. } */
  772. .btnFirst{
  773. line-height: 1.5;
  774. margin: -3.5px;
  775. border: 1px solid rgba(22, 132, 252, 100);
  776. border-right: none;
  777. background: #FFFF;
  778. color: #1684FC;
  779. width: 60px;
  780. height: 30px;
  781. border-radius:4px 0px 0px 4px;
  782. }
  783. .btn{
  784. line-height: 1.5;
  785. margin: -3.5px;
  786. border: 1px solid rgba(22, 132, 252, 100);
  787. border-right: none;
  788. background: #FFFF;
  789. color: #1684FC;
  790. width: 60px;
  791. height: 30px;
  792. }
  793. .btnLast{
  794. line-height: 1.5;
  795. margin: -3.5px;
  796. border: 1px solid rgba(22, 132, 252, 100);
  797. /* border-right: none; */
  798. background: #FFFF;
  799. color: #1684FC;
  800. width: 60px;
  801. height: 30px;
  802. border-radius:0px 4px 4px 0px;
  803. }
  804. .btnFirst,.btn,.btnLast {
  805. cursor: pointer;
  806. }
  807. /* .btn:focus,
  808. .btn:active{
  809. background-color:#409effd6 ;
  810. } */
  811. /* /deep/ .el-date-picker {
  812. width: 220px;
  813. } */
  814. /deep/ .el-table {
  815. font-size: 12px;
  816. }
  817. /deep/ .el-table tbody tr:hover>td {
  818. background-color:#D3D3D3!important;
  819. opacity:1
  820. }
  821. /deep/ .el-range-separator{
  822. width: 20% !important;
  823. }
  824. /deep/ .el-pagination {
  825. padding-bottom: 30px;
  826. }
  827. .colorChange {
  828. background-color: #1684FC;
  829. color: #FFFF;
  830. cursor: default;
  831. }
  832. .item_echart{
  833. margin-top: 10px;
  834. margin-right: 5px;
  835. border:1px solid rgba(219, 219, 219, 100);
  836. height: 350px;
  837. width: 100%;
  838. }
  839. .yesterday_blk{
  840. display: block;
  841. margin-top:40px
  842. }
  843. .yesterday_pdrt{
  844. padding-left: 10px;
  845. }
  846. .yesterday_color1{
  847. border-left: 3px solid #DBDBDB;
  848. }
  849. .yesterday_color2{
  850. border-left: 3px solid #5087Ec;
  851. }
  852. .yesterday_title{
  853. font-size: 14px;
  854. font-weight: bold;
  855. }
  856. .yesterday_text{
  857. font-size: 12px;
  858. line-height: 12px;
  859. color: #888888;
  860. margin-top: 10px;
  861. }
  862. .bold_num{
  863. font-weight: bold;
  864. }
  865. .draw_region{
  866. width: 180px;
  867. height: 180px;
  868. }
  869. </style>