index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <div class="base-setting">
  3. <!-- 基础设置页面 -->
  4. <n-drawer
  5. v-model:show="show"
  6. :width="240"
  7. placement="right"
  8. :trap-focus="false"
  9. :block-scroll="false"
  10. :show-mask="false"
  11. :mask-closable="false"
  12. to="#drawer-target"
  13. style="--n-body-padding: 0px"
  14. >
  15. <n-drawer-content title="基础设置">
  16. <div class="drawerContent m-5">
  17. <!-- <div class="text-lg my-2.5" @click="active = false">基础设置</div>-->
  18. <n-radio-group
  19. v-model:value="basicConfig.mode"
  20. name="radiobuttongroup1"
  21. >
  22. <n-radio-button value="pc" label="pc端" />
  23. <n-radio-button value="mobile" label="移动端" />
  24. </n-radio-group>
  25. <div class="text-sm my-2.5" @click="changeActive">展示页面风格</div>
  26. <n-select
  27. v-model:value="basicConfig.themes"
  28. placeholder="选择主题"
  29. :options="options"
  30. />
  31. <div class="flex justify-between my-2.5">
  32. <span>全景图自动播放</span>
  33. <n-switch v-model:value="basicConfig.autoRotate" />
  34. </div>
  35. <div class="flex justify-between my-2.5">
  36. <span>操纵杆</span>
  37. <n-switch v-model:value="basicConfig.joystick.show" />
  38. </div>
  39. <div
  40. class="flex justify-between my-2.5"
  41. v-if="basicConfig.joystick.show"
  42. >
  43. <n-radio-group
  44. v-model:value="basicConfig.joystick.position"
  45. name="radiobuttongroup1"
  46. size="small"
  47. >
  48. <n-radio-button value="left" label="靠左" />
  49. <n-radio-button value="center" label="居中" />
  50. <n-radio-button value="right" label="靠右" />
  51. </n-radio-group>
  52. </div>
  53. </div>
  54. </n-drawer-content>
  55. </n-drawer>
  56. </div>
  57. </template>
  58. <script setup lang="ts">
  59. import {
  60. ref,
  61. watch,
  62. computed,
  63. onMounted,
  64. // onDeactivated,
  65. onUnmounted
  66. } from 'vue'
  67. import { useMainStore } from '@/store'
  68. import { sdk, sdk_unmounted } from '@/sdk'
  69. // import { useMessage } from 'naive-ui'
  70. defineProps<{ msg: string }>()
  71. const main = useMainStore()
  72. const { setWidthSceneRef } = main
  73. const show = ref(true)
  74. const basicConfig = computed(() => {
  75. return main.basicConfig
  76. })
  77. // const message = useMessage()
  78. const options = [
  79. {
  80. label: '默认',
  81. value: ''
  82. },
  83. {
  84. label: '科技感',
  85. value: 'ThemesTechnology'
  86. },
  87. {
  88. label: '红色元素',
  89. value: 'ThemesParty'
  90. },
  91. {
  92. label: '博物馆',
  93. value: 'ThemesMuseum'
  94. }
  95. ]
  96. watch(basicConfig.value.joystick, (val) => {
  97. main.setSceneConfig({ joystick: val })
  98. })
  99. watch(
  100. () => basicConfig.value.autoRotate,
  101. (val) => {
  102. main.setSceneConfig({ autoRotate: val })
  103. }
  104. )
  105. watch(
  106. () => basicConfig.value.mode,
  107. (val) => {
  108. main.setSceneMode(val)
  109. }
  110. )
  111. watch(
  112. () => basicConfig.value.themes,
  113. (val) => {
  114. main.setSceneConfig({ themes: val })
  115. }
  116. )
  117. function handleChange(file, event) {
  118. console.log(event)
  119. // message.success((event?.target).response)
  120. const ext = file.name.split('.')[1]
  121. file.name = `更名.${ext}`
  122. file.url = '__HTTPS__://www.mocky.io/v2/5e4bafc63100007100d8b70f'
  123. return file
  124. }
  125. function changeActive() {
  126. console.warn('changeActive')
  127. //TODO unkown action
  128. // console.log('changeActive', active.value)
  129. // active.value = active.value ? false : true
  130. // console.log('changeActive', active.value)
  131. }
  132. onMounted(() => {
  133. // active.value = true
  134. })
  135. onUnmounted(() => {
  136. if (basicConfig.value.mode == 'mobile') {
  137. sdk_unmounted()
  138. main.setSceneMode('pc')
  139. }
  140. })
  141. </script>
  142. <style lang="sass" scoped>
  143. a
  144. color: #42b983
  145. code
  146. background-color: #eee
  147. padding: 2px 4px
  148. border-radius: 4px
  149. color: #304455
  150. </style>