initialSceneSettings.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <div class="initial-scene-settings" app-border dir-left>
  3. <div class="initial-scene-settings__title">
  4. {{$i18n.t('navigation.init_scene')}}
  5. <i class="iconfont icon-help_i tool-tip-for-editor" v-tooltip="$i18n.t('navigation.init_scene_tips')"/>
  6. </div>
  7. <img class="preview" v-if="info.firstScene" :src="info.firstScene.icon" alt="">
  8. <img class="placeholder" v-else src="@/assets/images/pano-image-placeholder.png" alt="">
  9. <div class="change-init" v-if="info.firstScene">
  10. <button class="ui-button deepcancel" @click="deleteIndexInfo">{{$i18n.t('navigation.delete_init_scene')}}</button>
  11. <button @click="showInitScene=true" class="ui-button submit">
  12. {{$i18n.t('navigation.edit_init_scene')}}
  13. </button>
  14. </div>
  15. <div class="set-init" v-else>
  16. <button @click="showInitScene=true" class="ui-button submit">
  17. {{$i18n.t('navigation.setting_init_scene')}}
  18. </button>
  19. </div>
  20. <div class="dialog" style="z-index: 2000" v-if="showInitScene">
  21. <Selector
  22. @cancle="showInitScene = false"
  23. @submit="handleSelect"
  24. />
  25. </div>
  26. <!-- <div class="dialog" style="z-index: 2000" v-if="showInitScene">
  27. <Select
  28. @cancle="showInitScene = false"
  29. :selected='info.firstScene'
  30. :title="'选择素材'"
  31. @submit="handleSelect"
  32. >
  33. </Select>
  34. </div> -->
  35. </div>
  36. </template>
  37. <script>
  38. import { mapGetters } from "vuex";
  39. import Selector from "@/components/materialSelectorFromWork.vue";
  40. export default {
  41. components:{
  42. Selector,
  43. },
  44. data(){
  45. return {
  46. showInitScene:false
  47. }
  48. },
  49. methods:{
  50. deleteIndexInfo(){
  51. this.$confirm({
  52. content: this.$i18n.t('tips.delete'),
  53. ok: () => {
  54. this.info.firstScene = ''
  55. this.$store.commit("SetInfo", this.info);
  56. this.$msg.success(this.$i18n.t('tips.delete_done'))
  57. }
  58. });
  59. },
  60. handleSelect(data) {
  61. this.info.firstScene = data[0] // 注意此处是浅拷贝
  62. this.showInitScene = false
  63. }
  64. },
  65. computed: {
  66. ...mapGetters({
  67. info: "info",
  68. })
  69. },
  70. mounted(){
  71. }
  72. }
  73. </script>
  74. <style lang="less" scoped>
  75. .initial-scene-settings {
  76. padding: 20px;
  77. > .initial-scene-settings__title {
  78. font-size: 18px;
  79. color: #fff;
  80. margin-bottom: 16px;
  81. > i {
  82. font-size: 12px;
  83. position: relative;
  84. top: -2px;
  85. }
  86. }
  87. .preview {
  88. width: 100%;
  89. height: 132px;
  90. border-radius: 4px;
  91. margin-bottom: 16px;
  92. object-fit: cover;
  93. image-rendering: smooth;
  94. }
  95. .placeholder {
  96. width: 100%;
  97. height: 132px;
  98. margin-bottom: 16px;
  99. }
  100. .change-init {
  101. width: 100%;
  102. display: flex;
  103. justify-content: space-between;
  104. .ui-button {
  105. width: calc((100% - 14px) / 2);
  106. white-space: initial;
  107. }
  108. }
  109. .set-init {
  110. width: 100%;
  111. .ui-button {
  112. width: 100%;
  113. }
  114. }
  115. .dialog {
  116. position: fixed;
  117. z-index: 30;
  118. left: 0;
  119. top: 0;
  120. width: 100%;
  121. height: 100%;
  122. background-color: rgba(0, 0, 0, 0.5);
  123. }
  124. }
  125. </style>