index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div>
  3. <n-drawer
  4. v-model:show="active"
  5. :width="240"
  6. placement="right"
  7. :trap-focus="false"
  8. :block-scroll="false"
  9. :show-mask="false"
  10. :mask-closable="false"
  11. to="#drawer-target"
  12. style="--n-body-padding: 0px"
  13. >
  14. <n-drawer-content title="专题导航">
  15. <div class="drawerContent m-5"></div>
  16. <n-flex justify="center">
  17. <n-button type="primary" @click="handleAdd">+ 添加</n-button>
  18. </n-flex>
  19. <n-list
  20. hoverable
  21. clickable
  22. style="--n-color-modal: none; margin-top: 20px"
  23. :show-divider="false"
  24. @select="handleSelect"
  25. >
  26. <n-list-item v-for="(nav, index) in dataList" :key="index" style="">
  27. <n-flex justify="space-between">
  28. <n-flex align="center">
  29. <n-icon size="20">
  30. <WalkSharp />
  31. </n-icon>
  32. {{ nav.title }}
  33. </n-flex>
  34. <n-dropdown trigger="hover" :options="fullOptions">
  35. <n-icon :size="20">
  36. <svg
  37. xmlns="http://www.w3.org/2000/svg"
  38. xmlns:xlink="http://www.w3.org/1999/xlink"
  39. viewBox="0 0 32 32"
  40. >
  41. <circle cx="8" cy="16" r="2" fill="currentColor"></circle>
  42. <circle cx="16" cy="16" r="2" fill="currentColor"></circle>
  43. <circle cx="24" cy="16" r="2" fill="currentColor"></circle>
  44. </svg>
  45. </n-icon>
  46. </n-dropdown>
  47. </n-flex>
  48. </n-list-item>
  49. </n-list>
  50. </n-drawer-content>
  51. </n-drawer>
  52. </div>
  53. </template>
  54. <script setup lang="ts">
  55. import { ref } from 'vue'
  56. import { sdk, clearScreen } from '@/sdk'
  57. import { onMounted, onUnmounted } from 'vue'
  58. import {
  59. NRadio,
  60. NPopover,
  61. useDialog,
  62. useMessage,
  63. NDropdown,
  64. NList,
  65. NListItem
  66. } from 'naive-ui'
  67. import { WalkSharp, TrashOutline, EllipsisHorizontal } from '@vicons/ionicons5'
  68. const panos = ref([])
  69. const isEditing = ref({
  70. index: NaN
  71. })
  72. const dataList = ref<
  73. {
  74. title: string
  75. panos: string[]
  76. }[]
  77. >([])
  78. sdk.then((sdk) => {
  79. sdk.PanoCheckManager.on('changed', (list: any) => {
  80. panos.value = list
  81. console.log('panos', panos.value)
  82. })
  83. })
  84. const handleAdd = () => {
  85. sdk.then((sdk) => {
  86. sdk.Scene.whenLoaded(() => {
  87. sdk.PanoCheckManager.enter()
  88. clearScreen(true)
  89. })
  90. })
  91. if (panos.value.length === 0) {
  92. dataList.value.push({
  93. title: '新增路线',
  94. panos: []
  95. })
  96. } else {
  97. // message.warning('请先保存数据!')
  98. }
  99. }
  100. onMounted(() => {
  101. sdk.then((sdk) => {
  102. sdk.Scene.whenLoaded(() => {
  103. sdk.PanoCheckManager.enter()
  104. // debugger
  105. clearScreen(true)
  106. })
  107. })
  108. })
  109. onUnmounted(() => {
  110. sdk.then((sdk) => {
  111. sdk.PanoCheckManager.leave()
  112. clearScreen(false)
  113. })
  114. })
  115. defineProps<{ msg: string }>()
  116. const dialog = useDialog()
  117. const message = useMessage()
  118. const active = ref(true)
  119. // const show = ref(true)
  120. const fullOptions = ref([
  121. {
  122. label: '编辑',
  123. key: '1'
  124. },
  125. {
  126. label: '删除',
  127. key: '2'
  128. }
  129. ])
  130. const handleSelect = (key: string) => {
  131. switch (key) {
  132. case '1':
  133. break
  134. case '2':
  135. break
  136. }
  137. }
  138. </script>
  139. <style lang="sass" scoped>
  140. a
  141. color: #42b983
  142. label
  143. margin: 0 0.5em
  144. font-weight: bold
  145. code
  146. background-color: #eee
  147. padding: 2px 4px
  148. border-radius: 4px
  149. color: #304455
  150. </style>