customLogoSettings.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <div class="custom-logo-settings">
  3. <span class="title">{{$i18n.t(`edit_settings.custom_logo`)}}</span>
  4. <br>
  5. <div class="switch-wrapper">
  6. <span class="label">{{$i18n.t(`edit_settings.show_logo`)}}</span>
  7. <Switcher :value="info.isLogo" @change="onSwitcherChange"></Switcher>
  8. </div>
  9. <div class="bottom" :class="{disabled: !info.isLogo}">
  10. <SelectedImage
  11. :imgSrc="info.logo"
  12. :defaultImgSrc="require(`@/assets/images/default/logo_white_${$lang}.svg`)"
  13. @cancel="onClickCancelCustomLogo"
  14. ></SelectedImage>
  15. <div class="bottom-right">
  16. <img
  17. class="select-pic-btn"
  18. :src="require(`@/assets/images/select_pic_btn_${$lang}.png`)" alt=""
  19. @click="onClickSelectingPicBtn"
  20. >
  21. <!-- <button
  22. class="ui-button submit"
  23. @click="onClickSelectingPicBtn"
  24. >
  25. 选择图片
  26. </button> -->
  27. <div class="remark" v-html="$i18n.t(`edit_settings.logo_size`)">
  28. </div>
  29. </div>
  30. </div>
  31. <div class="dialog" style="z-index: 2000" v-if="isShowSelectionWindow">
  32. <MaterialSelectorForEditor
  33. :title="$i18n.t(`gather.select_material`)"
  34. @cancle="isShowSelectionWindow = false"
  35. @submit="handleSubmitFromMaterialSelector"
  36. :selectableType="['image']"
  37. />
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import { mapGetters } from "vuex";
  43. import Switcher from "@/components/shared/Switcher";
  44. import MaterialSelectorForEditor from "@/components/materialSelectorForEditor.vue";
  45. import { getUserInfo } from "@/api";
  46. import SelectedImage from "@/components/selectedImageInEditor.vue";
  47. export default {
  48. components: {
  49. Switcher,
  50. MaterialSelectorForEditor,
  51. SelectedImage,
  52. },
  53. data() {
  54. return {
  55. password:'',
  56. canSee: false,
  57. isShowSelectionWindow: false,
  58. }
  59. },
  60. computed: {
  61. ...mapGetters({
  62. info:'info'
  63. })
  64. },
  65. methods: {
  66. onSwitcherChange(data) {
  67. this.info.isLogo = data
  68. },
  69. onClickSelectingPicBtn() {
  70. this.isShowSelectionWindow = true
  71. // getUserInfo((res) => {
  72. // try {
  73. // if (res.data.incrementNum > 0) {
  74. // this.isShowSelectionWindow = true
  75. // } else {
  76. // // 非会员,点击跳转四维看看会员权益页。
  77. // window.open('/#/mall/member')
  78. // }
  79. // } catch(e) {
  80. // console.error('解析会员身份失败:', e)
  81. // }
  82. // })
  83. },
  84. handleSubmitFromMaterialSelector(selected) {
  85. this.info.logo = selected[0].icon
  86. this.info.logoChange = true
  87. this.isShowSelectionWindow = false
  88. },
  89. onClickCancelCustomLogo() {
  90. this.info.logo = ''
  91. this.info.logoChange = false
  92. }
  93. },
  94. mounted() {
  95. }
  96. }
  97. </script>
  98. <style lang="less" scoped>
  99. .custom-logo-settings {
  100. padding: 24px 30px;
  101. background: #252526;
  102. height: 546px;
  103. .title {
  104. font-size: 18px;
  105. color: #FFFFFF;
  106. }
  107. .switch-wrapper {
  108. display: flex;
  109. align-items: center;
  110. justify-content: space-between;
  111. margin-top: 18px;
  112. .label {
  113. color: rgba(255, 255, 255, 0.6);
  114. font-size: 14px;
  115. }
  116. }
  117. .bottom {
  118. margin-top: 19px;
  119. display: flex;
  120. align-items: flex-start;
  121. &.disabled {
  122. opacity: 0.5;
  123. }
  124. .img-wrapper {
  125. position: relative;
  126. width: 136px;
  127. height: 136px;
  128. border-radius: 4px;
  129. background: #1a1b1d;
  130. overflow: hidden;
  131. .logo-img {
  132. width: 100%;
  133. height: 100%;
  134. object-fit: cover;
  135. }
  136. .cancel-btn-background {
  137. width: 52px;
  138. height: 52px;
  139. position: absolute;
  140. top: -28px;
  141. right: -28px;
  142. background: rgba(0, 0, 0, 0.5);
  143. border-radius: 50%;
  144. cursor: pointer;
  145. i {
  146. font-size: 12px;
  147. transform: scale(0.8);
  148. position: absolute;
  149. left: 9px;
  150. bottom: 9px;
  151. }
  152. }
  153. }
  154. .bottom-right {
  155. margin-left: 16px;
  156. .select-pic-btn {
  157. cursor: pointer;
  158. }
  159. .remark {
  160. margin-top: 20px;
  161. font-size: 14px;
  162. font-family: MicrosoftYaHei;
  163. color: rgba(255, 255, 255, 0.3);
  164. line-height: 19px;
  165. }
  166. }
  167. }
  168. }
  169. </style>