Toolbar.vue 8.3 KB

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