Index.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <div id="app-base-system-launch">
  3. <div class="one-block-2">
  4. <a-list class="set-auto" itemLayout="horizontal">
  5. <a-list-item style="text-align: left;">
  6. <a-list-item-meta>
  7. <template v-slot:title>
  8. <a>启动</a>
  9. </template>
  10. <template v-slot:description>
  11. <span>
  12. 开机自动启动
  13. </span>
  14. </template>
  15. </a-list-item-meta>
  16. <template v-slot:actions>
  17. <a-switch v-model="autoLaunchChecked" checkedChildren="开" unCheckedChildren="关" @change="autoLaunchChange(autoLaunchChecked)" />
  18. </template>
  19. </a-list-item>
  20. </a-list>
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. import { ipcApiRoute } from '@/api/main'
  26. export default {
  27. data () {
  28. return {
  29. autoLaunchChecked: false
  30. }
  31. },
  32. mounted () {
  33. this.init();
  34. },
  35. methods: {
  36. init () {
  37. const self = this;
  38. this.$ipc.on(ipcApiRoute.autoLaunch, (event, result) => {
  39. console.log('[ipcRenderer] [autoLaunch] result:', result)
  40. self.autoLaunchChecked = result.status;
  41. })
  42. this.$ipc.send(ipcApiRoute.autoLaunch, 'check');
  43. },
  44. autoLaunchChange (checkStatus) {
  45. console.log('[ipcRenderer] [autoLaunch] checkStatus:', checkStatus)
  46. if (checkStatus) {
  47. this.$ipc.send(ipcApiRoute.autoLaunch, 'close');
  48. } else {
  49. this.$ipc.send(ipcApiRoute.autoLaunch, 'open');
  50. }
  51. },
  52. }
  53. }
  54. </script>
  55. <style lang="less" scoped>
  56. #app-base-system-launch {
  57. padding: 0px 10px;
  58. text-align: left;
  59. width: 100%;
  60. .one-block-1 {
  61. font-size: 16px;
  62. padding-top: 10px;
  63. }
  64. .one-block-2 {
  65. padding-top: 10px;
  66. }
  67. .set-auto {
  68. .ant-list-item:last-child {
  69. border-bottom: 1px solid #e8e8e8;
  70. }
  71. }
  72. }
  73. </style>