123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- <template>
- <div class="view-setting" app-border dir-left>
- <div class="title">
- {{ $i18n.t("screen.init_screen") }}
- <i class="iconfont icon-help_i tool-tip-for-editor" v-tooltip="$i18n.t('screen.screen_tips')" />
- </div>
- <template v-if="currentScene.type !== '4dkk'">
- <img class="preview" v-if="initImg" :src="`${initImg}?${Math.random()}`" alt="" />
- <img class="placeholder" v-else src="@/assets/images/pano-image-placeholder.png" alt="" />
- <div class="item">
- <div class="">
- {{ $i18n.t("modules.screen.v_angle_re") }}
- </div>
- <vue-slider
- v-model="vlookat"
- :min="-90"
- :max="90"
- :height="6"
- :width="`95%`"
- :marks="marks"
- direction="rtl"
- tooltip="active"
- @change="handleChange"
- :tooltip-formatter="formatterMarks"
- :processStyle="{
- backgroundColor: '#409eff',
- }"
- :enable-cross="false"
- :minRange="30"
- />
- <!-- <slider
- v-model="vlookat"
- range
- show-stops
- :marks="marks"
- :min="-90"
- :max="90"
- >
- </slider> -->
- </div>
- <div class="col">
- <span>{{ $i18n.t("mask.apply_to_all_pano") }}</span>
- <Switcher :value="applyToAll" @change="onSwitcherChange"></Switcher>
- </div>
- </template>
- <div class="goto-4dkk-tip" v-if="currentScene.type === '4dkk'">
- <div class="img-wrap">
- <img class="" src="@/assets/images/default/goto-4dage.png" alt="" draggable="false" />
- <div class="tip-text">
- {{ $i18n.t("screen.goto_4dkk_edit_tips") }}
- </div>
- </div>
- <button class="ui-button submit" @click="onClickGo4dkk">
- {{ $i18n.t("navigation.go_scene_editor") }}
- </button>
- </div>
- </div>
- </template>
- <script>
- import { mapGetters } from "vuex";
- import { Slider } from "element-ui";
- import VueSlider from "vue-slider-component";
- import "vue-slider-component/theme/antd.css";
- import Switcher from "@/components/shared/Switcher";
- export default {
- components: {
- // Slider,
- Switcher,
- VueSlider,
- },
- computed: {
- ...mapGetters({
- currentScene: "scene/currentScene",
- workVisualAngleList: "screen/workVisualAngleList",
- baseInfo: "base/baseInfo",
- sceneList: "base/sceneList",
- }),
- },
- data() {
- return {
- formatterMarks: (v) => `${v * -1}`,
- marks: {
- "-90": this.$i18n.t("modules.model.attr_top"),
- 90: this.$i18n.t("modules.model.attr_bottom"),
- },
- initImg: "",
- vlookat: [-90, 90],
- applyToAll: false,
- };
- },
- watch: {
- baseInfo: {
- handler(newVal, oldVal) {
- if (newVal && this.$route.name == "screen") {
- console.error("screen change");
- this.$store.commit("scene/setSaveApiList", "screen");
- }
- },
- deep: true,
- },
- "$route.name": {
- handler() {
- this.handleHiddenAllMasks();
- },
- immediate: true,
- },
- "currentScene.id": {
- handler(val, oldVal) {
- if (val && val !== oldVal) {
- this.applyToAll = false;
- this.handleHiddenAllMasks();
- }
- },
- immediate: true,
- },
- // "currentScene.initVisual": {
- // handler(val) {
- // console.error(val)
- // if (val) {
- // const { vlookatmin, vlookatmax } = val;
- // if (vlookatmin && vlookatmax) {
- // this.vlookat = [vlookatmin, vlookatmax];
- // }
- // }
- // },
- // deep: true,
- // immediate: true,
- // },
- currentScene: {
- handler(val) {
- if (val) {
- console.error("currentScene change", val);
- // let vlookatmin, vlookatmax;
- let item = this.workVisualAngleList.find((item) => item.navigationId == this.currentScene.id || item.navigationId == this.currentScene.sid);
- if (item) {
- const { vlookatmin, vlookatmax } = item;
- if (vlookatmin && vlookatmax) {
- this.vlookat = [vlookatmin, vlookatmax];
- }
- }
- let scene = this.sceneList.find((scene) => scene.id == val.id);
- if (scene) {
- scene.icon = val.icon;
- }
- // const { vlookatmin, vlookatmax } = this.baseInfo.workVisualAngleList;
- // if (vlookatmin && vlookatmax) {
- // this.vlookat = [vlookatmin, vlookatmax];
- // }
- }
- },
- deep: true,
- immediate: true,
- },
- vlookat: {
- handler: function (val) {
- this.handleVlootAt(val);
- },
- },
- applyToAll: {
- handler: function (val) {
- if (val) {
- const kr = this.$getKrpano();
- const vlookat = kr.get("view.vlookat");
- const hlookat = kr.get("view.hlookat");
- console.log("当前视野", vlookat, hlookat);
- this.$confirm({
- content: this.$i18n.t("mask.is_apply_to_all_pano"),
- ok: () => {
- this.$store.dispatch("screen/applyInitVisualToAll", this.vlookat);
- // this.$store.dispatch("scene/applyInitVisualToAll", {
- // vlookat,
- // hlookat,
- // });
- // this.updateCurrentScene();
- this.$msg.success(this.$i18n.t("gather.edit_success"));
- setTimeout(() => (this.applyToAll = false), 1000);
- },
- no: () => {
- this.applyToAll = false;
- },
- });
- }
- },
- immediate: true,
- },
- },
- methods: {
- handleChange(value, index) {
- this.workVisualAngleList.forEach((item, index) => {
- if (item.navigationId == this.currentScene.id || item.navigationId == this.currentScene.sid) {
- item.vlookatmin = this.vlookat[0];
- item.vlookatmax = this.vlookat[1];
- }
- });
- console.error(this.workVisualAngleList);
- // 拖动结束时的处理逻辑
- },
- onClickGo4dkk() {
- window.open("/#/scene");
- },
- onSwitcherChange(value) {
- this.applyToAll = value;
- },
- handleVlootAt(val) {
- if (val) {
- const min = Math.min(...val);
- const max = Math.max(...val);
- // if (this.currentScene.initVisual) {
- // this.currentScene.initVisual.vlookatmin = min;
- // this.currentScene.initVisual.vlookatmax = max;
- this.handleKrAction(min, max);
- // }
- }
- },
- handleKrAction(min, max) {
- const kr = this.$getKrpano();
- if (kr) {
- kr.set("view.limitview", "lookat");
- // const mid = min + max;
- // console.log("mid", min, max);
- // kr.set("view.vlookat", min);
- kr.set("view.vlookatmin", String(min));
- kr.set("view.vlookatmax", String(max));
- }
- },
- handleHiddenAllMasks() {
- if (this.$getKrpano()) {
- if (this.$route.name === "screen") {
- // console.log('handleHiddenAllMasks')
- setTimeout(() => {
- this.$getKrpano().set("hotspot[peaklogo].visible", false);
- this.$getKrpano().set("hotspot[nadirlogo].visible", false);
- }, 500);
- }
- }
- },
- updateCurrentScene() {
- this.$store.dispatch("scene/syncCurrentSceneToStore");
- },
- },
- mounted() {
- this.$bus.on("initView", (data) => {
- this.initImg = data;
- });
- if (!this.initImg) {
- this.initImg = this.currentScene.icon;
- }
- },
- };
- </script>
- <style>
- /* .vue-slider-dot-tooltip {
- display: none !important;
- } */
- </style>
- <style lang="less" scoped>
- .view-setting {
- padding: 20px;
- > .title {
- font-size: 18px;
- color: #fff;
- margin-bottom: 16px;
- > i {
- font-size: 12px;
- position: relative;
- top: -2px;
- }
- }
- .preview {
- width: 100%;
- height: 132px;
- border-radius: 4px;
- margin-bottom: 16px;
- object-fit: cover;
- image-rendering: smooth;
- }
- .placeholder {
- width: 100%;
- height: 132px;
- margin-bottom: 16px;
- }
- .item {
- .el-slider {
- padding: 0 5px;
- margin-bottom: 10px;
- }
- .vue-slider {
- margin: 15px auto;
- }
- }
- .col {
- width: 100%;
- margin: 15px 0;
- display: inline-flex;
- justify-content: space-between;
- align-items: center;
- }
- .goto-4dkk-tip {
- > .img-wrap {
- position: relative;
- width: 100%;
- > .img {
- width: 100%;
- }
- > .tip-text {
- position: absolute;
- left: 50%;
- bottom: 32px;
- transform: translateX(-50%);
- font-size: 14px;
- color: #fff;
- opacity: 0.6;
- white-space: pre;
- }
- }
- > button {
- margin-top: 16px;
- width: 100%;
- }
- }
- }
- </style>
|