Index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <div id="app-base-file">
  3. <div class="one-block-2">
  4. <a-list v-if="image_info.length !== 0" size="small" bordered :data-source="image_info">
  5. <a-list-item slot="renderItem" slot-scope="item" style="text-align:left;">
  6. {{ item.id }}.&nbsp;{{ item.imageUrlText }}:&nbsp;
  7. <a :href="item.url" target="_blank">{{ item.url }}</a>
  8. </a-list-item>
  9. </a-list>
  10. </div>
  11. <div class="one-block-1">
  12. <span>
  13. 1. 系统原生对话框
  14. </span>
  15. </div>
  16. <div class="one-block-2">
  17. <a-space>
  18. <a-button @click="messageShow('ipc')">消息提示(ipc)</a-button>
  19. <a-button @click="messageShowConfirm('ipc')">消息提示与确认(ipc)</a-button>
  20. </a-space>
  21. </div>
  22. <div class="one-block-1">
  23. <span>
  24. 2. 选择保存目录
  25. </span>
  26. </div>
  27. <div class="one-block-2">
  28. <a-row>
  29. <a-col :span="12">
  30. <a-input v-model="dir_path" :value="dir_path" addon-before="保存目录" />
  31. </a-col>
  32. <a-col :span="12">
  33. <a-button @click="selectDir">
  34. 修改目录
  35. </a-button>
  36. </a-col>
  37. </a-row>
  38. </div>
  39. <div class="one-block-1">
  40. <span>
  41. 4. 打开文件夹
  42. </span>
  43. </div>
  44. <div class="one-block-2">
  45. <a-list :grid="{ gutter: 16, column: 4 }" :data-source="file_list">
  46. <a-list-item slot="renderItem" slot-scope="item" @click="openDirectry(item.id)">
  47. <a-card :title="item.content">
  48. <a-button type="link">
  49. 打开
  50. </a-button>
  51. </a-card>
  52. </a-list-item>
  53. </a-list>
  54. </div>
  55. <div class="footer">
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. import { ipcApiRoute } from '@/api/main'
  61. const fileList = [
  62. {
  63. content: '【下载】目录',
  64. id: 'downloads'
  65. },
  66. {
  67. content: '【图片】目录',
  68. id: 'pictures'
  69. },
  70. {
  71. content: '【文档】目录',
  72. id: 'documents'
  73. },
  74. {
  75. content: '【音乐】目录',
  76. id: 'music'
  77. }
  78. ];
  79. export default {
  80. data() {
  81. return {
  82. file_list: fileList,
  83. image_info: [],
  84. num: 0,
  85. dir_path: "D:\\www\\ee",
  86. };
  87. },
  88. methods: {
  89. openDirectry (id) {
  90. this.$ipcCall(ipcApiRoute.openDirectory, {id: id}).then(res => {
  91. //console.log('res:', res)
  92. })
  93. },
  94. selectDir() {
  95. const self = this;
  96. self.$ipcCall(ipcApiRoute.selectFolder, '').then(r => {
  97. self.dir_path = r;
  98. self.$message.info(r);
  99. })
  100. },
  101. messageShow(type) {
  102. const self = this;
  103. console.log('[messageShow] type:', type)
  104. this.$ipcCall(ipcApiRoute.messageShow, '').then(r => {
  105. self.$message.info(r);
  106. })
  107. },
  108. messageShowConfirm(type) {
  109. const self = this;
  110. console.log('[messageShowConfirm] type:', type)
  111. this.$ipcCall(ipcApiRoute.messageShowConfirm, '').then(r => {
  112. self.$message.info(r);
  113. })
  114. },
  115. }
  116. };
  117. </script>
  118. <style lang="less" scoped>
  119. #app-base-file {
  120. padding: 0px 10px;
  121. text-align: left;
  122. width: 100%;
  123. .one-block-1 {
  124. font-size: 16px;
  125. padding-top: 10px;
  126. }
  127. .one-block-2 {
  128. padding-top: 10px;
  129. }
  130. .footer {
  131. padding-top: 10px;
  132. }
  133. }
  134. </style>