Setting.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <div class="view-setting" app-border dir-left>
  3. <div class="title">
  4. {{ $i18n.t("screen.init_screen") }}
  5. <i
  6. class="iconfont icon-help_i tool-tip-for-editor"
  7. v-tooltip="$i18n.t('screen.screen_tips')"
  8. />
  9. </div>
  10. <template v-if="currentScene.type !== '4dkk'">
  11. <img
  12. class="preview"
  13. v-if="initImg"
  14. :src="`${initImg}?${Math.random()}`"
  15. alt=""
  16. />
  17. <img
  18. class="placeholder"
  19. v-else
  20. src="@/assets/images/pano-image-placeholder.png"
  21. alt=""
  22. />
  23. <div class="item">
  24. <div class="">垂直视角限制</div>
  25. <slider v-model="vlookat" range show-stops :min="-90" :max="90">
  26. </slider>
  27. </div>
  28. <div class="col">
  29. <span>应用到全部全景图</span>
  30. <Switcher :value="applyToAll" @change="onSwitcherChange"></Switcher>
  31. </div>
  32. </template>
  33. <div class="goto-4dkk-tip" v-if="currentScene.type === '4dkk'">
  34. <div class="img-wrap">
  35. <img
  36. class=""
  37. src="@/assets/images/default/goto-4dage.png"
  38. alt=""
  39. draggable="false"
  40. />
  41. <div class="tip-text">
  42. {{ $i18n.t("screen.goto_4dkk_edit_tips") }}
  43. </div>
  44. </div>
  45. <button class="ui-button submit" @click="onClickGo4dkk">
  46. {{ $i18n.t("navigation.go_scene_editor") }}
  47. </button>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. import { mapGetters } from "vuex";
  53. import { Slider } from "element-ui";
  54. import Switcher from "@/components/shared/Switcher";
  55. export default {
  56. components: {
  57. Slider,
  58. Switcher,
  59. },
  60. computed: {
  61. ...mapGetters({
  62. currentScene: "scene/currentScene",
  63. }),
  64. },
  65. data() {
  66. return {
  67. initImg: "",
  68. vlookat: null,
  69. applyToAll: false,
  70. };
  71. },
  72. watch: {
  73. "currentScene.initVisual": {
  74. handler(val) {
  75. const { vlookatmin, vlookatmax } = val;
  76. if (vlookatmin && vlookatmax) {
  77. this.vlookat = [vlookatmin, vlookatmax];
  78. }
  79. },
  80. deep: true,
  81. immediate: true,
  82. },
  83. vlookat: {
  84. handler: function (val) {
  85. this.handleVlootAt(val);
  86. },
  87. },
  88. },
  89. methods: {
  90. onClickGo4dkk() {
  91. window.open("/#/scene");
  92. },
  93. onSwitcherChange(value) {
  94. this.applyToAll = value;
  95. },
  96. handleVlootAt(val) {
  97. if (val) {
  98. const min = Math.min(...val);
  99. const max = Math.max(...val);
  100. this.currentScene.initVisual.vlookatmin = min;
  101. this.currentScene.initVisual.vlookatmax = max;
  102. this.handleKrAction(min, max);
  103. }
  104. },
  105. handleKrAction(min, max) {
  106. const kr = this.$getKrpano();
  107. if (kr) {
  108. kr.set("view.limitview", "lookat");
  109. const mid = min + max;
  110. kr.set("view.vlookat", mid);
  111. kr.set("view.vlookatmin", String(min));
  112. kr.set("view.vlookatmax", String(max));
  113. }
  114. },
  115. },
  116. mounted() {
  117. this.$bus.on("initView", (data) => {
  118. this.initImg = data;
  119. });
  120. if (!this.initImg) {
  121. this.initImg = this.currentScene.icon;
  122. }
  123. },
  124. };
  125. </script>
  126. <style lang="less" scoped>
  127. .view-setting {
  128. padding: 20px;
  129. > .title {
  130. font-size: 18px;
  131. color: #fff;
  132. margin-bottom: 16px;
  133. > i {
  134. font-size: 12px;
  135. position: relative;
  136. top: -2px;
  137. }
  138. }
  139. .preview {
  140. width: 100%;
  141. height: 132px;
  142. border-radius: 4px;
  143. margin-bottom: 16px;
  144. object-fit: cover;
  145. image-rendering: smooth;
  146. }
  147. .placeholder {
  148. width: 100%;
  149. height: 132px;
  150. margin-bottom: 16px;
  151. }
  152. .item {
  153. .el-slider {
  154. padding: 0 5px;
  155. }
  156. }
  157. .col {
  158. width: 100%;
  159. margin: 15px 0;
  160. display: inline-flex;
  161. justify-content: space-between;
  162. align-items: center;
  163. }
  164. .goto-4dkk-tip {
  165. > .img-wrap {
  166. position: relative;
  167. width: 100%;
  168. > .img {
  169. width: 100%;
  170. }
  171. > .tip-text {
  172. position: absolute;
  173. left: 50%;
  174. bottom: 32px;
  175. transform: translateX(-50%);
  176. font-size: 14px;
  177. color: #fff;
  178. opacity: 0.6;
  179. white-space: pre;
  180. }
  181. }
  182. > button {
  183. margin-top: 16px;
  184. width: 100%;
  185. }
  186. }
  187. }
  188. </style>