Toolbar.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <!-- 编辑器-基础-中间部分 -->
  3. <div class="app-view-toolbar app-view-full-toolbar">
  4. <div class="main">
  5. <div class="ui-title-big">{{$i18n.t(`edit_settings.base_setting`)}}</div>
  6. <div class="upload-con">
  7. <div class="uc-l">
  8. <div class="preview">
  9. <img :src="info.icon || require('@/assets/images/default/img_cover_default_2.png')" alt="" />
  10. <button class="ui-button submit setting-cover-btn" @click="onClickSettingCover">{{$i18n.t(`edit_settings.setting_cover`)}}</button>
  11. </div>
  12. <div class="ui-remark" v-html="$i18n.t(`edit_settings.cover_size`)"></div>
  13. </div>
  14. <div class="uc-r">
  15. <div class="ui-title">
  16. <span class="">{{$i18n.t(`edit_settings.title`)}}</span>
  17. </div>
  18. <div class="title-input-wrapper">
  19. <input
  20. v-model.trim="info.name"
  21. @input="emojistr"
  22. @keydown.enter="onTitleInputEnter"
  23. type="text"
  24. autocomplete="new-password"
  25. maxlength="50"
  26. :placeholder="$i18n.t(`edit_settings.work_placeholder`)"
  27. />
  28. <span class="count">{{titleLength}}/50</span>
  29. </div>
  30. <div class="ui-title jianjie"><span>{{$i18n.t(`edit_settings.description`)}}</span></div>
  31. <div class="jianjie-textarea-wrapper">
  32. <!-- <textarea
  33. v-model.trim="info.description"
  34. maxlength="500"
  35. placeholder="请输入作品简介"
  36. type="text"
  37. /> -->
  38. <editor ref="editor" :html="info.description" :placeholder="$i18n.t(`edit_settings.intro_placeholder`)" :maxlength="500" @change="onEditorChange"></editor>
  39. <span class="count">{{jianjieLength}}/500</span>
  40. </div>
  41. </div>
  42. </div>
  43. <menu>
  44. <li
  45. v-for="(item) in tabs"
  46. :key="item"
  47. :class="{active: activeTab === item}"
  48. @click="activeTab = item"
  49. >
  50. {{$i18n.t(`zh_key.${item}`)}}
  51. </li>
  52. </menu>
  53. <div class="settings-view-wrapper">
  54. <OpeningTipSettings v-show="activeTab === '开场提示'"></OpeningTipSettings>
  55. <OpeningAnimationSettings v-show="activeTab === '开场动画'"></OpeningAnimationSettings>
  56. <PasswordSettings v-show="activeTab === '访问密码'"></PasswordSettings>
  57. <AutoCruiseSettings v-show="activeTab === '自动巡游'"></AutoCruiseSettings>
  58. <BackgroundMusicSettings v-show="activeTab === '背景音乐'"></BackgroundMusicSettings>
  59. <CustomLogoSettings v-show="activeTab === '自定义LOGO'"></CustomLogoSettings>
  60. <CustomMaskSettings v-show="activeTab === '自定义遮罩'"></CustomMaskSettings>
  61. <CustomButtonSettings v-show="activeTab === '自定义按钮'"></CustomButtonSettings>
  62. <CoverBase v-show="activeTab === '开场封面'"></CoverBase>
  63. </div>
  64. </div>
  65. <div class="dialog" style="z-index: 2000" v-if="isShowSettingCoverWindow">
  66. <MaterialSelectorForEditor
  67. :selectableType="['image', 'pano', '3D']"
  68. :title="$i18n.t(`gather.select_material`)"
  69. @cancle="isShowSettingCoverWindow = false"
  70. @submit="onCoverSelected"
  71. />
  72. </div>
  73. </div>
  74. </template>
  75. <script>
  76. import { mapGetters } from "vuex";
  77. import MaterialSelectorForEditor from "@/components/materialSelectorForEditor.vue";
  78. import OpeningTipSettings from '@/views/base/openingTipSettings.vue'
  79. import OpeningAnimationSettings from '@/views/base/openingAnimationSettings.vue'
  80. import PasswordSettings from "@/views/base/passwordSettings.vue";
  81. import AutoCruiseSettings from '@/views/base/autoCruiseSettings.vue'
  82. import BackgroundMusicSettings from "@/views/base/backgroundMusicSettings.vue";
  83. import CustomLogoSettings from "@/views/base/customLogoSettings.vue";
  84. import CustomMaskSettings from "@/views/base/customMaskSettings.vue";
  85. import CustomButtonSettings from "@/views/base/customButtonSettings.vue";
  86. import Editor from "@/components/shared/Editor"
  87. import CoverBase from "@/views/base/coverBase.vue";
  88. export default {
  89. components: {
  90. Editor,
  91. MaterialSelectorForEditor,
  92. OpeningTipSettings,
  93. OpeningAnimationSettings,
  94. PasswordSettings,
  95. AutoCruiseSettings,
  96. BackgroundMusicSettings,
  97. CustomLogoSettings,
  98. CustomMaskSettings,
  99. CustomButtonSettings,
  100. CoverBase
  101. },
  102. data() {
  103. return {
  104. isShowSettingCoverWindow: false,
  105. tabs: [
  106. '开场提示',
  107. '开场动画',
  108. '访问密码',
  109. '自动巡游',
  110. '背景音乐',
  111. '自定义LOGO',
  112. '自定义遮罩',
  113. '自定义按钮',
  114. '开场封面'
  115. ],
  116. activeTab: '开场提示',
  117. jianjieLength:0
  118. }
  119. },
  120. computed: {
  121. ...mapGetters({
  122. info: 'info'
  123. }),
  124. titleLength() {
  125. return this.info.name.length || '0'
  126. }
  127. },
  128. mounted() {
  129. },
  130. watch: {
  131. },
  132. methods: {
  133. emojistr() {
  134. this.info.name = this.info.name.replace(/(\ud83c[\udf00-\udfff])|(\ud83d[\udc00-\ude4f])|(\ud83d[\ude80-\udeff])/g, function (char) {
  135. if (char.length === 2) {
  136. return ""
  137. } else {
  138. return char;
  139. }
  140. });
  141. },
  142. onEditorChange(content){
  143. this.info.description = content.html
  144. this.jianjieLength = content.size
  145. },
  146. onClickSettingCover() {
  147. this.isShowSettingCoverWindow = true
  148. },
  149. onCoverSelected(selected) {
  150. if (selected[0].materialType === 'image') {
  151. this.info.icon = selected[0].icon
  152. } else if (selected[0].materialType === 'pano') {
  153. this.info.icon = selected[0].icon
  154. } else if (selected[0].materialType === '3D') {
  155. this.info.icon = selected[0].thumb
  156. }
  157. this.isShowSettingCoverWindow = false
  158. },
  159. onTitleInputEnter(e) {
  160. e.target.blur()
  161. },
  162. },
  163. }
  164. </script>
  165. <style lang="less" scoped>
  166. .main {
  167. position: fixed;
  168. width: 930px;
  169. top: 90px;
  170. left: calc(50% - (930px) / 2);
  171. }
  172. .upload-con {
  173. display: flex;
  174. margin-bottom: 30px;
  175. .uc-l {
  176. .preview {
  177. overflow: hidden;
  178. position: relative;
  179. border: 1px solid #404040;
  180. img {
  181. height: 100%;
  182. }
  183. .setting-cover-btn {
  184. position: absolute;
  185. left: 50%;
  186. transform: translateX(-50%);
  187. bottom: 16px;
  188. }
  189. }
  190. .ui-remark{
  191. margin-top: 16px;
  192. }
  193. }
  194. .uc-r {
  195. width: 100%;
  196. max-width: 660px;
  197. > .title-input-wrapper {
  198. position: relative;
  199. border: 1px solid rgba(151, 151, 151, 0.2);
  200. padding: 0 16px;
  201. background: #252526;
  202. border-radius: 2px;
  203. height: 36px;
  204. width: 100%;
  205. &:focus-within {
  206. border-color: #0076F6;
  207. }
  208. > input {
  209. border: none;
  210. background: transparent;
  211. outline: none;
  212. height: 100%;
  213. width: calc(100% - 50px);
  214. padding: 0;
  215. color: #fff;
  216. letter-spacing: 1px;
  217. font-size: 14px;
  218. }
  219. > .count {
  220. position: absolute;
  221. top: 50%;
  222. transform: translateY(-50%);
  223. right: 16px;
  224. font-size: 14px;
  225. color: rgba(255, 255, 255, 0.2);
  226. }
  227. }
  228. > .jianjie {
  229. margin-top: 20px;
  230. }
  231. > .jianjie-textarea-wrapper {
  232. position: relative;
  233. border: 1px solid rgba(151, 151, 151, 0.2);
  234. background: #252526;
  235. border-radius: 2px;
  236. height: 123px;
  237. width: 100%;
  238. &:focus-within {
  239. border-color: #0076F6;
  240. }
  241. > textarea {
  242. padding: 9px 16px 30px 16px;
  243. resize: none;
  244. border: none;
  245. background: transparent;
  246. outline: none;
  247. width: 100%;
  248. height: calc(100% - 30px);
  249. color: #fff;
  250. letter-spacing: 1px;
  251. font-size: 14px;
  252. }
  253. > .count {
  254. position: absolute;
  255. right: 16px;
  256. bottom: 9px;
  257. font-size: 14px;
  258. color: rgba(255, 255, 255, 0.2);
  259. }
  260. }
  261. }
  262. }
  263. menu {
  264. display: inline-block;
  265. width: 168px;
  266. font-size: 14px;
  267. color: rgba(255, 255, 255, 0.5);
  268. padding-left: 0;
  269. margin: 0;
  270. vertical-align: top;
  271. li {
  272. display: block;
  273. height: 47px;
  274. padding-left: 16px;
  275. cursor: pointer;
  276. &::after {
  277. content: "";
  278. display: inline-block;
  279. height: 100%;
  280. vertical-align: middle;
  281. }
  282. &.active {
  283. font-size: 16px;
  284. font-weight: bold;
  285. color: #FFFFFF;
  286. background: #252526;
  287. &::before {
  288. content: "";
  289. display: inline-block;
  290. width: 2px;
  291. height: 10px;
  292. border-radius: 1px;
  293. background: #0076F6;
  294. margin-right: 4px;
  295. vertical-align: middle;
  296. }
  297. }
  298. }
  299. }
  300. .settings-view-wrapper {
  301. vertical-align: top;
  302. display: inline-block;
  303. width: 762px;
  304. }
  305. </style>