main.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. SPA_RESOLVE_INIT = function ($el, $router) {
  2. let contentAera = document.querySelector('.mdui-container.main-container'),
  3. getUserCountUrl = 'http://admin.cloudsql.1473.cn/v1/index/userList/getUserCount',
  4. getDatabaseCountUrl = 'http://admin.cloudsql.1473.cn/v1/index/databaseList/getDatabaseCount',
  5. content = `
  6. <div class="mdui-row-xs-1 mdui-row-sm-1 mdui-row-md-3 mdui-row-xl-3 mdui-m-t-3 main-status-row">
  7. <div class="mdui-col mdui-clearfix main-status-col">
  8. <div class="mdui-float-left icon-row">
  9. <i class="mdui-list-item-icon mdui-icon material-icons">person</i>
  10. </div>
  11. <div class="mdui-float-left info-row">
  12. <div class="name-col">用户数量</div>
  13. <div id="numberOfUser" class="value-col">1024</div>
  14. </div>
  15. </div>
  16. <div class="mdui-col mdui-clearfix main-status-col">
  17. <div class="mdui-float-left icon-row">
  18. <i class="mdui-list-item-icon mdui-icon material-icons">view_list</i>
  19. </div>
  20. <div class="mdui-float-left info-row">
  21. <div class="name-col">数据库数量</div>
  22. <div id="numberOfDatabse" class="value-col">1024</div>
  23. </div>
  24. </div>
  25. <div class="mdui-col mdui-clearfix main-status-col">
  26. <div class="mdui-float-left icon-row">
  27. <i class="mdui-list-item-icon mdui-icon material-icons">cloud</i>
  28. </div>
  29. <div class="mdui-float-left info-row">
  30. <div class="name-col">服务状态</div>
  31. <div class="value-col">正常</div>
  32. </div>
  33. </div>
  34. </div>
  35. `;
  36. mdui.JQ(contentAera).append(content);
  37. Utils.ajaxGet(getUserCountUrl, function (response) {
  38. document.querySelector('#numberOfUser').innerText = response.data.results;
  39. });
  40. Utils.ajaxGet(getDatabaseCountUrl, function (response) {
  41. document.querySelector('#numberOfDatabse').innerText = response.data.results;
  42. });
  43. }