Toolbar.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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="upload-btn">
  13. <button class="ui-button submit" @click="selectHandle('image')">选择图片</button>
  14. <button class="ui-button submit" @click="addScene">全景封面
  15. <div>
  16. <div class="remark">
  17. 选择全景图封面做为作品封面
  18. </div>
  19. </div>
  20. </button>
  21. </div> -->
  22. <div class="ui-remark">512*512px,支持jpg/png格式</div>
  23. </div>
  24. <div class="uc-r">
  25. <div class="ui-title">
  26. <span class="">标题</span>
  27. </div>
  28. <div class="title-input-wrapper">
  29. <input
  30. v-model="info.name"
  31. @blur="$store.commit('SetInfo',info)"
  32. type="text"
  33. maxlength="50"
  34. placeholder="请输入作品标题"
  35. />
  36. <span class="count">{{titleLength}}/50</span>
  37. </div>
  38. <div class="ui-title jianjie"><span>简介</span></div>
  39. <div class="jianjie-textarea-wrapper">
  40. <textarea
  41. v-model="info.description"
  42. @blur="$store.commit('SetInfo',info)"
  43. maxlength="500"
  44. placeholder="请输入作品简介"
  45. type="text"
  46. />
  47. <span class="count">{{jianjieLength}}/500</span>
  48. </div>
  49. </div>
  50. </div>
  51. <ul class="setting-con">
  52. <li @click="activeSetting=item" v-for="(item,i) in settings" :key="i">
  53. <button class="ui-button" :class="{submit:activeSetting.id==item.id}">{{item.name}}</button>
  54. </li>
  55. </ul>
  56. <menu>
  57. <li
  58. v-for="(item) in tabs"
  59. :key="item"
  60. :class="{active: activeTab === item}"
  61. @click="activeTab = item"
  62. >
  63. {{item}}
  64. </li>
  65. </menu>
  66. <div class="settings-view-wrapper">
  67. <OpeningTipSettings v-show="activeTab === '开场提示'"></OpeningTipSettings>
  68. </div>
  69. </div>
  70. <eidt-panel
  71. :select="select"
  72. @openMaterial="selectHandle('image','editpanel')"
  73. v-if="activeSetting"
  74. @close="onCloseEdit"
  75. :show="activeSetting"
  76. ></eidt-panel>
  77. <div class="dialog" style="z-index: 2000" v-if="isShowSettingCoverWindow">
  78. <Table2
  79. title="选择素材"
  80. @cancle="isShowSettingCoverWindow = false"
  81. @submit="handleSubmitFromTable2"
  82. />
  83. </div>
  84. <div class="dialog" style="z-index: 2000" v-if="isShowSelect">
  85. <Table
  86. :list="list"
  87. :tabHeader="$MAPTABLEHEADER[type]"
  88. @updateList="updateList"
  89. @cancle="isShowSelect = false"
  90. title="选择素材"
  91. @changeCurrent="changeCurrent"
  92. :paging="paging"
  93. :hideAll="true"
  94. @submit="handleSelect"
  95. />
  96. </div>
  97. <div class="dialog" style="z-index: 2000" v-if="isShowScene">
  98. <Select
  99. @cancle="isShowScene = false"
  100. :title="'选择素材'"
  101. @submit="handleSelect"
  102. >
  103. </Select>
  104. </div>
  105. </div>
  106. </template>
  107. <script>
  108. import { getMaterialList} from "@/api";
  109. import EidtPanel from "./EditPanel";
  110. import OpeningTipSettings from '@/views/base/openingTipSettings.vue'
  111. import Table from "@/components/tableSelect";
  112. import Table2 from "@/components/tableSelect2";
  113. import Select from "@/components/select";
  114. import { changeByteUnit } from '@/utils/file'
  115. import { mapGetters } from "vuex";
  116. export default {
  117. components: {
  118. EidtPanel,
  119. Table,
  120. Table2,
  121. Select,
  122. OpeningTipSettings,
  123. },
  124. data() {
  125. return {
  126. type:'',
  127. settings:[{
  128. name:"开场提示",
  129. id:"opening"
  130. },{
  131. name:"自定义LOGO",
  132. id:"logo"
  133. },{
  134. name:"访问密码",
  135. id:"password"
  136. },{
  137. name:"自动巡游",
  138. id:"xy"
  139. }],
  140. activeSetting:'',
  141. dataURL: "",
  142. isShowScene:false, // 显示全景图片选择窗口
  143. isShowSelect:false, // 显示普通图片选择窗口
  144. isShowSettingCoverWindow: false,
  145. list:[],
  146. key:'',
  147. clickFrom:'', // 来自“选择图片”:base。来自“全景封面”:scene。来自右侧的“选择图片”:editPanel
  148. paging: {
  149. pageSize: 8,
  150. pageNum: 1,
  151. total: 0,
  152. showSize: 4,
  153. current: 1
  154. },
  155. select:'',
  156. tabs: [
  157. '开场提示',
  158. '开场动画',
  159. '访问密码',
  160. '自动巡游',
  161. '背景音乐',
  162. '自定义LOGO',
  163. '自定义遮罩',
  164. '自定义按钮',
  165. ],
  166. activeTab: '开场提示',
  167. };
  168. },
  169. computed: {
  170. ...mapGetters({
  171. info:'info'
  172. }),
  173. titleLength() {
  174. return this.info?.name?.length || '0'
  175. },
  176. jianjieLength() {
  177. return this.info?.description?.length || '0'
  178. },
  179. },
  180. mounted(){
  181. },
  182. watch:{
  183. "paging.pageNum": function () {
  184. this.isShowSelect && this.getMaterialListProxy();
  185. },
  186. isShowSelect(newVal){
  187. if (!newVal) {
  188. this.paging.pageNum = 1
  189. this.key = ''
  190. }
  191. }
  192. },
  193. methods: {
  194. addScene(){
  195. this.clickFrom = 'scene'
  196. this.isShowScene = true
  197. },
  198. changeCurrent(data){
  199. this.paging.pageNum = data;
  200. },
  201. updateList(data) {
  202. this.key = data;
  203. this.getMaterialListProxy();
  204. },
  205. handleSelect(data){
  206. if (this.clickFrom == 'scene') {
  207. this.info.icon = data.icon
  208. this.isShowScene = false
  209. } else {
  210. this.clickFrom == 'editpanel'? this.select = data[0].icon :this.info.icon = data[0].icon
  211. this.isShowSelect = false
  212. }
  213. setTimeout(() => {
  214. this.select = ''
  215. });
  216. },
  217. getMaterialListProxy() {
  218. getMaterialList(
  219. {
  220. pageNum: this.paging.pageNum,
  221. pageSize: this.paging.pageSize,
  222. searchKey: this.key,
  223. type:this.type
  224. },
  225. (data) => {
  226. this.paging.pageNum = data.data.pageNum;
  227. this.paging.pageSize = data.data.pageSize;
  228. this.paging.total = data.data.total;
  229. this.list = data.data.list.map(i=>{
  230. i.isUse = i.fileSize>600 ?'1':'0'
  231. i.fileSize = changeByteUnit(Number(i.fileSize))
  232. i.createTime = i.createTime.substring(0,i.createTime.length-3)
  233. i.updateTime = i.updateTime.substring(0,i.updateTime.length-3)
  234. return i
  235. })
  236. }
  237. );
  238. },
  239. onClickSettingCover() {
  240. this.isShowSettingCoverWindow = true
  241. },
  242. // 点击各种选择素材按钮后调用这个
  243. selectHandle(type, from='base'){
  244. this.clickFrom = from
  245. this.type = type
  246. this.isShowSelect = true
  247. this.getMaterialListProxy()
  248. },
  249. handleSubmitFromTable2(selected) {
  250. this.info.icon = selected[0].icon
  251. this.isShowSettingCoverWindow = false
  252. },
  253. onCloseEdit(){
  254. this.activeSetting = ''
  255. }
  256. },
  257. }
  258. </script>
  259. <style lang="less" scoped>
  260. .main {
  261. position: fixed;
  262. width: 930px;
  263. top: 15%;
  264. left: calc(50% - (930px) / 2);
  265. }
  266. .upload-con {
  267. display: flex;
  268. }
  269. .uc-l {
  270. .ui-remark{
  271. margin-top: 16px;
  272. }
  273. }
  274. .uc-r {
  275. width: 100%;
  276. > .title-input-wrapper {
  277. position: relative;
  278. border: 1px solid rgba(151, 151, 151, 0.2);
  279. padding: 0 16px;
  280. background: #252526;
  281. border-radius: 2px;
  282. height: 36px;
  283. width: 100%;
  284. > input {
  285. border: none;
  286. background: transparent;
  287. outline: none;
  288. height: 100%;
  289. width: calc(100% - 50px);
  290. padding: none;
  291. color: #fff;
  292. letter-spacing: 1px;
  293. font-size: 14px;
  294. }
  295. > .count {
  296. position: absolute;
  297. top: 50%;
  298. transform: translateY(-50%);
  299. right: 16px;
  300. font-size: 14px;
  301. color: rgba(255, 255, 255, 0.2);
  302. }
  303. }
  304. > .jianjie {
  305. margin-top: 20px;
  306. }
  307. > .jianjie-textarea-wrapper {
  308. position: relative;
  309. border: 1px solid rgba(151, 151, 151, 0.2);
  310. background: #252526;
  311. border-radius: 2px;
  312. height: 123px;
  313. width: 100%;
  314. > textarea {
  315. padding: 9px 16px 30px 16px;
  316. resize: none;
  317. border: none;
  318. background: transparent;
  319. outline: none;
  320. width: 100%;
  321. height: calc(100% - 30px);
  322. padding: none;
  323. color: #fff;
  324. letter-spacing: 1px;
  325. font-size: 14px;
  326. }
  327. > .count {
  328. position: absolute;
  329. right: 16px;
  330. bottom: 9px;
  331. font-size: 14px;
  332. color: rgba(255, 255, 255, 0.2);
  333. }
  334. }
  335. }
  336. /*
  337. .upload-btn {
  338. display: flex;
  339. width: 216px;
  340. justify-content: space-between;
  341. align-items: center;
  342. margin-top: 15px;
  343. .ui-button {
  344. width: 48%;
  345. min-width: 64px;
  346. position: relative;
  347. &:hover {
  348. > div {
  349. display: block;
  350. }
  351. }
  352. > div {
  353. cursor: default;
  354. padding: 0 10px;
  355. display: none;
  356. z-index: 10000;
  357. position: absolute;
  358. left: 50%;
  359. transform: translateX(-50%);
  360. top: -46px;
  361. background: rgba(0, 0, 0, 0.8);
  362. border-radius: 5px;
  363. color: #fff;
  364. pointer-events: none;
  365. &::before{
  366. border: 10px solid transparent;
  367. border-top: 10px solid rgba(0, 0, 0, 0.8);
  368. width: 0;
  369. height: 0px;
  370. content: "";
  371. display: inline-block;
  372. position: absolute;
  373. bottom: -20px;
  374. left: 50%;
  375. transform: translateX(-50%);
  376. }
  377. .remark {
  378. line-height: 2.5;
  379. }
  380. }
  381. }
  382. }
  383. */
  384. .guide {
  385. cursor: pointer;
  386. position: relative;
  387. &:hover {
  388. > div {
  389. display: block;
  390. }
  391. }
  392. i {
  393. color: #ababab;
  394. }
  395. > div {
  396. cursor: default;
  397. padding: 10px 18px;
  398. display: none;
  399. z-index: 10000;
  400. position: fixed;
  401. right: 0;
  402. top: -90px;
  403. width: 500px;
  404. background: #161a1a;
  405. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  406. border-radius: 5px;
  407. overflow: hidden;
  408. color: rgba(255, 255, 255, 0.5);
  409. .remark {
  410. line-height: 2.5;
  411. }
  412. .strong {
  413. color: #fff;
  414. }
  415. .line {
  416. width: 100%;
  417. height: 1px;
  418. background: rgba(255, 255, 255, 0.16);
  419. margin: 10px 0;
  420. }
  421. }
  422. }
  423. .preview {
  424. overflow: hidden;
  425. position: relative;
  426. img {
  427. height: 100%;
  428. }
  429. .setting-cover-btn {
  430. position: absolute;
  431. left: 50%;
  432. transform: translateX(-50%);
  433. bottom: 16px;
  434. }
  435. }
  436. .setting-con{
  437. >li{
  438. display: inline-block;
  439. .ui-button{
  440. padding: 0 20px;
  441. margin-right: 10px;
  442. }
  443. }
  444. }
  445. menu {
  446. display: inline-block;
  447. width: 133px;
  448. font-size: 14px;
  449. color: rgba(255, 255, 255, 0.5);
  450. padding-left: 0;
  451. margin: 0;
  452. vertical-align: top;
  453. li {
  454. display: block;
  455. height: 47px;
  456. padding-left: 16px;
  457. cursor: pointer;
  458. &::after {
  459. content: "";
  460. display: inline-block;
  461. height: 100%;
  462. vertical-align: middle;
  463. }
  464. &.active {
  465. font-size: 16px;
  466. font-weight: bold;
  467. color: #FFFFFF;
  468. background: #252526;
  469. &::before {
  470. content: "";
  471. display: inline-block;
  472. width: 2px;
  473. height: 10px;
  474. border-radius: 1px;
  475. background: #0076F6;
  476. margin-right: 4px;
  477. vertical-align: middle;
  478. }
  479. }
  480. }
  481. }
  482. .settings-view-wrapper {
  483. vertical-align: top;
  484. display: inline-block;
  485. width: 797px;
  486. }
  487. </style>