openingTipSettings.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <div class="opening-tip-settings">
  3. <span class="title">{{$i18n.t(`edit_settings.opening_tips_setting`)}}</span>
  4. <i class="iconfont icon-help_i tool-tip-for-editor" v-tooltip="$i18n.t(`edit_settings.opening_tips`)">
  5. </i>
  6. <br>
  7. <div class="image-selection">
  8. <div class="title">{{$i18n.t(`edit_settings.pc`)}}</div>
  9. <div class="bottom">
  10. <SelectedImage
  11. :imgSrc="info.pcIcon"
  12. :defaultImgSrc="require('@/assets/images/default/img_tipspc_default.png')"
  13. @cancel="onCancelPcTip"
  14. ></SelectedImage>
  15. <div class="bottom-right">
  16. <button class="ui-button submit" @click="isShowSelectionWindow = true, selectingFor = 'pc'">{{$i18n.t(`edit_settings.select_image`)}}</button>
  17. <div class="ui-remark" v-html="$i18n.t(`edit_settings.opening_size`)"></div>
  18. </div>
  19. </div>
  20. </div>
  21. <div class="image-selection">
  22. <div class="title">{{$i18n.t(`edit_settings.mobile`)}}</div>
  23. <div class="bottom">
  24. <SelectedImage
  25. :imgSrc="info.appIcon"
  26. :defaultImgSrc="require('@/assets/images/default/img_tipsmb_default.png')"
  27. @cancel="onCancelAppTip"
  28. ></SelectedImage>
  29. <div class="bottom-right">
  30. <button class="ui-button submit" @click="isShowSelectionWindow = true, selectingFor = 'mobile'">{{$i18n.t(`edit_settings.select_image`)}}</button>
  31. <div class="ui-remark" v-html="$i18n.t(`edit_settings.opening_size`)"></div>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="title">{{$i18n.t(`edit_settings.show_setting`)}}</div>
  36. <div class="switch-wrapper">
  37. <span class="label">{{$i18n.t(`edit_settings.first_notice`)}}</span>
  38. <switcher :value="info.isRemind" @change="onSwitcherChange"></switcher>
  39. </div>
  40. <div class="range-wrapper">
  41. <RangeItem :value="rang" @input="onRangeChange" />
  42. </div>
  43. <div class="dialog" style="z-index: 2000" v-if="isShowSelectionWindow">
  44. <MaterialSelector
  45. :title="$i18n.t(`gather.select_material`)"
  46. :isMultiSelection="false"
  47. @cancel="isShowSelectionWindow = false"
  48. @submit="handleSubmitFromMaterialSelector"
  49. :selectableType="['image']"
  50. />
  51. </div>
  52. </div>
  53. </template>
  54. <script>
  55. import MaterialSelector from "@/components/materialSelector.vue";
  56. import { mapGetters } from "vuex";
  57. import Switcher from "@/components/shared/Switcher";
  58. import RangeItem from "@/components/rangeItem/index.vue";
  59. import SelectedImage from "@/components/selectedImageInEditor.vue";
  60. export default {
  61. components: {
  62. MaterialSelector,
  63. Switcher,
  64. RangeItem,
  65. SelectedImage,
  66. },
  67. data() {
  68. return {
  69. isShowSelectionWindow: false,
  70. selectingFor: '', // 'pc', 'mobile'
  71. rang: {
  72. label: this.$i18n.t('edit_settings.display_time'),
  73. unit: this.$i18n.t('edit_settings.second'),
  74. value: 1,
  75. min: 0,
  76. max: 3,
  77. gradient: 1,
  78. tip:true
  79. }
  80. }
  81. },
  82. computed: {
  83. ...mapGetters({
  84. info:'info'
  85. })
  86. },
  87. mounted() {
  88. this.$nextTick(()=>{
  89. this.rang.value = this.info.remindTime
  90. })
  91. },
  92. methods: {
  93. handleSubmitFromMaterialSelector(selected) {
  94. if (this.selectingFor === 'pc') {
  95. this.info.pcIcon = selected[0].icon
  96. this.info.pcIconId = selected[0].id
  97. } else if (this.selectingFor === 'mobile') {
  98. this.info.appIcon = selected[0].icon
  99. this.info.appIconId = selected[0].id
  100. }
  101. this.isShowSelectionWindow = false
  102. },
  103. onCancelPcTip() {
  104. this.info.pcIcon = ''
  105. this.info.pcIconId = null
  106. },
  107. onCancelAppTip() {
  108. this.info.appIcon = ''
  109. this.info.appIconId = null
  110. },
  111. onSwitcherChange(data){
  112. this.info.isRemind = data
  113. },
  114. onRangeChange(data) {
  115. console.log(data.value);
  116. this.info.remindTime = parseInt(data.value)
  117. },
  118. }
  119. }
  120. </script>
  121. <style lang="less" scoped>
  122. .opening-tip-settings {
  123. padding: 24px 30px;
  124. background: #252526;
  125. height: 546px;
  126. .title {
  127. font-size: 18px;
  128. color: #FFFFFF;
  129. }
  130. .tool-tip-for-editor {
  131. margin-left: 4px;
  132. font-size: 12px;
  133. cursor: default;
  134. position: relative;
  135. top: -2px;
  136. }
  137. .image-selection {
  138. width: 50%;
  139. display: inline-block;
  140. margin-top: 16px;
  141. margin-bottom: 24px;
  142. .title {
  143. color: rgba(255, 255, 255, 0.6);
  144. font-size: 14px;
  145. margin-bottom: 16px;
  146. }
  147. .bottom {
  148. display: flex;
  149. align-items: flex-start;
  150. .bottom-right {
  151. display: inline-block;
  152. button {
  153. margin-bottom: 20px;
  154. }
  155. .ui-remark {
  156. font-size: 14px;
  157. }
  158. }
  159. }
  160. }
  161. .switch-wrapper {
  162. display: flex;
  163. align-items: center;
  164. justify-content: space-between;
  165. margin-top: 18px;
  166. .label {
  167. color: rgba(255, 255, 255, 0.6);
  168. font-size: 14px;
  169. }
  170. }
  171. .range-wrapper {
  172. margin-top: 18px;
  173. }
  174. }
  175. </style>