customMaskSettings.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <div class="custom-mask-settings">
  3. <span class="title">遮罩设置</span>
  4. <i class="iconfont icon-material_prompt tool-tip-for-editor" v-tooltip="'天空遮罩显示在场景的顶部,地面遮罩显示在场景的底部。'">
  5. </i>
  6. <br>
  7. <div class="image-selection">
  8. <div class="title">
  9. <span class="label">天空遮罩</span>
  10. <Switcher :value="info.customMask.sky.isShow" @change="(data)=>{info.customMask.sky.isShow=data}"></Switcher>
  11. </div>
  12. <div class="bottom">
  13. <SelectedImage
  14. :imgSrc="info && info.customMask && info.customMask.sky.icon"
  15. :defaultImgSrc="require('@/assets/images/default/mask_bg.png')"
  16. @cancel="onCancelSelection('sky')"
  17. ></SelectedImage>
  18. <div class="bottom-right">
  19. <!-- <img
  20. class="select-pic-btn"
  21. :src="require('@/assets/images/select_pic_btn.png')" alt=""
  22. @click="onSelectPic('sky')"
  23. > -->
  24. <button
  25. class="ui-button submit"
  26. @click="onSelectPic('sky')"
  27. >
  28. 选择图片
  29. </button>
  30. <div class="ui-remark">建议500*500px,<br/>支持jpg/png格式</div>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="image-selection">
  35. <div class="title">
  36. <span class="label">地面遮罩</span>
  37. <Switcher :value="info.customMask.earth.isShow" @change="(data)=>{info.customMask.earth.isShow=data}"></Switcher>
  38. </div>
  39. <div class="bottom">
  40. <SelectedImage
  41. :imgSrc="info && info.customMask && info.customMask.earth.icon"
  42. :defaultImgSrc="require('@/assets/images/default/mask_bg.png')"
  43. @cancel="onCancelSelection('earth')"
  44. ></SelectedImage>
  45. <div class="bottom-right">
  46. <!-- <img
  47. class="select-pic-btn"
  48. :src="require('@/assets/images/select_pic_btn.png')" alt=""
  49. @click="onSelectPic('earth')"
  50. > -->
  51. <button
  52. class="ui-button submit"
  53. @click="onSelectPic('earth')"
  54. >
  55. 选择图片
  56. </button>
  57. <div class="ui-remark">建议500*500px,<br/>支持jpg/png格式</div>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="dialog" style="z-index: 2000" v-if="isShowSelectionWindow">
  62. <MaterialSelectorForEditor
  63. title="选择素材"
  64. @cancle="isShowSelectionWindow = false"
  65. @submit="handleSubmitFromMaterialSelector"
  66. :selectableType="['image']"
  67. />
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. import MaterialSelectorForEditor from "@/components/materialSelectorForEditor.vue";
  73. import Switcher from "@/components/shared/Switcher";
  74. import { mapGetters } from "vuex";
  75. import SelectedImage from "@/components/selectedImageInEditor.vue";
  76. import { getUserInfo } from "@/api";
  77. export default {
  78. components: {
  79. MaterialSelectorForEditor,
  80. SelectedImage,
  81. Switcher
  82. },
  83. data() {
  84. return {
  85. isShowSelectionWindow: false,
  86. selectingFor: '', // 'sky', 'earth'
  87. }
  88. },
  89. computed: {
  90. ...mapGetters({
  91. info:'info'
  92. })
  93. },
  94. methods: {
  95. onSelectPic(selectingFor) {
  96. this.selectingFor = selectingFor
  97. this.isShowSelectionWindow = true
  98. // getUserInfo((res) => {
  99. // try {
  100. // if (res.data.incrementNum > 0) {
  101. // this.selectingFor = selectingFor
  102. // this.isShowSelectionWindow = true
  103. // } else {
  104. // // 非会员,点击跳转四维看看会员权益页。
  105. // window.open('/#/mall/member')
  106. // }
  107. // } catch(e) {
  108. // console.error('解析会员身份失败:', e)
  109. // }
  110. // })
  111. },
  112. handleSubmitFromMaterialSelector(selected) {
  113. this.info.customMask[this.selectingFor].icon = selected[0].icon
  114. this.isShowSelectionWindow = false
  115. },
  116. onCancelSelection(cancelFor) {
  117. this.info.customMask[cancelFor].icon = ''
  118. },
  119. },
  120. mounted() {
  121. if (!this.info.customMask) {
  122. this.info.customMask = {
  123. earth: {
  124. icon:'',
  125. isShow:false
  126. },
  127. sky:{
  128. icon:'',
  129. isShow:true
  130. },
  131. }
  132. }
  133. },
  134. }
  135. </script>
  136. <style lang="less" scoped>
  137. .custom-mask-settings {
  138. padding: 24px 30px;
  139. background: #252526;
  140. height: 546px;
  141. .title {
  142. font-size: 18px;
  143. color: #FFFFFF;
  144. }
  145. .tool-tip-for-editor {
  146. margin-left: 4px;
  147. font-size: 12px;
  148. cursor: default;
  149. position: relative;
  150. top: -2px;
  151. }
  152. .image-selection {
  153. width: 100%;
  154. display: inline-block;
  155. margin-top: 16px;
  156. margin-bottom: 24px;
  157. .title {
  158. color: rgba(255, 255, 255, 0.6);
  159. font-size: 14px;
  160. margin-bottom: 16px;
  161. display: flex;
  162. width: 100%;
  163. align-items: center;
  164. justify-content: space-between;
  165. }
  166. .bottom {
  167. display: flex;
  168. align-items: flex-start;
  169. .bottom-right {
  170. display: inline-block;
  171. .select-pic-btn {
  172. cursor: pointer;
  173. }
  174. .ui-remark {
  175. margin-top: 20px;
  176. font-size: 14px;
  177. }
  178. }
  179. }
  180. }
  181. }
  182. </style>