Index.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <div id="app-base-powermonitor">
  3. <div class="one-block-1">
  4. <span>
  5. 1. 监控电源状态
  6. </span>
  7. </div>
  8. <div class="one-block-2">
  9. <a-space>
  10. <p>* 当前状态:{{ currentStatus }}</p>
  11. </a-space>
  12. <p>* 拔掉电源,使用电池供电</p>
  13. <p>* 接入电源</p>
  14. <p>* 锁屏</p>
  15. <p>* 解锁</p>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. import { ipcApiRoute } from '@/api/main'
  21. export default {
  22. data() {
  23. return {
  24. currentStatus: '无',
  25. };
  26. },
  27. mounted () {
  28. this.init();
  29. },
  30. methods: {
  31. init () {
  32. const self = this;
  33. this.$ipc.removeAllListeners(ipcApiRoute.initPowerMonitor);
  34. this.$ipc.on(ipcApiRoute.initPowerMonitor, (event, result) => {
  35. if (Object.prototype.toString.call(result) == '[object Object]') {
  36. self.currentStatus = result.msg;
  37. self.$message.info(result.msg);
  38. }
  39. })
  40. this.$ipc.send(ipcApiRoute.initPowerMonitor, '');
  41. }
  42. }
  43. };
  44. </script>
  45. <style lang="less" scoped>
  46. #app-base-powermonitor {
  47. padding: 0px 10px;
  48. text-align: left;
  49. width: 100%;
  50. .one-block-1 {
  51. font-size: 16px;
  52. padding-top: 10px;
  53. }
  54. .one-block-2 {
  55. padding-top: 10px;
  56. }
  57. }
  58. </style>