Toolbar.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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="addScene">设置封面</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">{{info.name.length}}/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">{{info.description.length}}/500</span>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="ui-title-big">全局设置</div>
  52. <ul class="setting-con">
  53. <li @click="activeSetting=item" v-for="(item,i) in settings" :key="i">
  54. <button class="ui-button" :class="{submit:activeSetting.id==item.id}">{{item.name}}</button>
  55. </li>
  56. </ul>
  57. </div>
  58. <eidt-panel :select="select" @openMaterial="handleOpen" v-if="activeSetting" @close="onCloseEdit" :show="activeSetting"></eidt-panel>
  59. <div class="dialog" style="z-index: 2000" v-if="isShowSelect">
  60. <Table
  61. :list="list"
  62. :tabHeader="$MAPTABLEHEADER[type]"
  63. @updateList="update"
  64. @cancle="isShowSelect = false"
  65. :title="`选择${$MARERIALSTR[type]}`"
  66. @changeCurrent="changeCurrent"
  67. :paging="paging"
  68. :hideAll="true"
  69. @submit="handleSelect"
  70. >
  71. </Table>
  72. </div>
  73. <div class="dialog" style="z-index: 2000" v-if="isShowScene">
  74. <Select
  75. @cancle="isShowScene = false"
  76. :title="'选择素材'"
  77. @submit="handleSelect"
  78. >
  79. </Select>
  80. </div>
  81. </div>
  82. </template>
  83. <script>
  84. import { getMaterialList} from "@/api";
  85. import EidtPanel from "./EditPanel";
  86. import Table from "@/components/tableSelect";
  87. import { changeByteUnit } from '@/utils/file'
  88. import { mapGetters } from "vuex";
  89. import Select from "@/components/select";
  90. export default {
  91. components: {
  92. EidtPanel,
  93. Table,
  94. Select
  95. },
  96. data() {
  97. return {
  98. type:'',
  99. settings:[{
  100. name:"开场提示",
  101. id:"opening"
  102. },{
  103. name:"自定义LOGO",
  104. id:"logo"
  105. },{
  106. name:"访问密码",
  107. id:"password"
  108. },{
  109. name:"自动巡游",
  110. id:"xy"
  111. }],
  112. activeSetting:'',
  113. dataURL: "",
  114. isShowScene:false, // 显示全景图片选择窗口
  115. isShowSelect:false, // 显示普通图片选择窗口
  116. list:[],
  117. key:'',
  118. clickFrom:'', // 来自“选择图片”:base。来自“全景封面”:scene。来自右侧的“选择图片”:editPanel
  119. paging: {
  120. pageSize: 8,
  121. pageNum: 1,
  122. total: 0,
  123. showSize: 4,
  124. current: 1
  125. },
  126. select:''
  127. };
  128. },
  129. computed: {
  130. ...mapGetters({
  131. info:'info'
  132. })
  133. },
  134. mounted(){
  135. },
  136. watch:{
  137. "paging.pageNum": function () {
  138. this.isShowSelect && this.getMaterialList();
  139. },
  140. isShowSelect(newVal){
  141. if (!newVal) {
  142. this.paging.pageNum = 1
  143. this.key = ''
  144. }
  145. }
  146. },
  147. methods: {
  148. handleOpen(){
  149. this.selectHandle('image','editpanel')
  150. },
  151. addScene(){
  152. this.clickFrom = 'scene'
  153. this.isShowScene = true
  154. },
  155. changeCurrent(data){
  156. this.paging.pageNum = data;
  157. },
  158. update(data) {
  159. this.key = data;
  160. this.getMaterialList();
  161. },
  162. handleSelect(data){
  163. if (this.clickFrom == 'scene') {
  164. this.info.icon = data.icon
  165. this.isShowScene = false
  166. }
  167. else{
  168. this.clickFrom == 'editpanel'? this.select = data[0].icon :this.info.icon = data[0].icon
  169. this.isShowSelect = false
  170. }
  171. setTimeout(() => {
  172. this.select = ''
  173. });
  174. },
  175. getMaterialList() {
  176. getMaterialList(
  177. {
  178. pageNum: this.paging.pageNum,
  179. pageSize: this.paging.pageSize,
  180. searchKey: this.key,
  181. type:this.type
  182. },
  183. (data) => {
  184. this.paging.pageNum = data.data.pageNum;
  185. this.paging.pageSize = data.data.pageSize;
  186. this.paging.total = data.data.total;
  187. this.list = data.data.list.map(i=>{
  188. i.isUse = i.fileSize>600 ?'1':'0'
  189. i.fileSize = changeByteUnit(Number(i.fileSize))
  190. i.createTime = i.createTime.substring(0,i.createTime.length-3)
  191. i.updateTime = i.updateTime.substring(0,i.updateTime.length-3)
  192. return i
  193. })
  194. }
  195. );
  196. },
  197. selectHandle(type, from='base'){
  198. this.clickFrom = from
  199. this.type = type
  200. this.isShowSelect = true
  201. this.getMaterialList()
  202. },
  203. onCloseEdit(){
  204. this.activeSetting = ''
  205. }
  206. },
  207. };
  208. </script>
  209. <style lang="less" scoped>
  210. .ui-title-big{
  211. margin-top: 20px;
  212. }
  213. .main {
  214. position: fixed;
  215. width: 930px;
  216. top: 15%;
  217. left: 50%;
  218. transform: translateX(-50%);
  219. }
  220. .upload-con {
  221. display: flex;
  222. }
  223. .uc-l {
  224. .ui-remark{
  225. margin-top: 16px;
  226. }
  227. }
  228. .uc-r {
  229. width: 100%;
  230. > .title-input-wrapper {
  231. position: relative;
  232. border: 1px solid rgba(151, 151, 151, 0.2);
  233. padding: 0 16px;
  234. background: #252526;
  235. border-radius: 2px;
  236. height: 36px;
  237. width: 100%;
  238. > input {
  239. border: none;
  240. background: transparent;
  241. outline: none;
  242. height: 100%;
  243. width: calc(100% - 50px);
  244. padding: none;
  245. color: #fff;
  246. letter-spacing: 1px;
  247. font-size: 14px;
  248. }
  249. > .count {
  250. position: absolute;
  251. top: 50%;
  252. transform: translateY(-50%);
  253. right: 16px;
  254. font-size: 14px;
  255. color: rgba(255, 255, 255, 0.2);
  256. }
  257. }
  258. > .jianjie {
  259. margin-top: 20px;
  260. }
  261. > .jianjie-textarea-wrapper {
  262. position: relative;
  263. border: 1px solid rgba(151, 151, 151, 0.2);
  264. background: #252526;
  265. border-radius: 2px;
  266. height: 123px;
  267. width: 100%;
  268. > textarea {
  269. padding: 9px 16px 30px 16px;
  270. resize: none;
  271. border: none;
  272. background: transparent;
  273. outline: none;
  274. width: 100%;
  275. height: calc(100% - 30px);
  276. padding: none;
  277. color: #fff;
  278. letter-spacing: 1px;
  279. font-size: 14px;
  280. }
  281. > .count {
  282. position: absolute;
  283. right: 16px;
  284. bottom: 9px;
  285. font-size: 14px;
  286. color: rgba(255, 255, 255, 0.2);
  287. }
  288. }
  289. }
  290. /*
  291. .upload-btn {
  292. display: flex;
  293. width: 216px;
  294. justify-content: space-between;
  295. align-items: center;
  296. margin-top: 15px;
  297. .ui-button {
  298. width: 48%;
  299. min-width: 64px;
  300. position: relative;
  301. &:hover {
  302. > div {
  303. display: block;
  304. }
  305. }
  306. > div {
  307. cursor: default;
  308. padding: 0 10px;
  309. display: none;
  310. z-index: 10000;
  311. position: absolute;
  312. left: 50%;
  313. transform: translateX(-50%);
  314. top: -46px;
  315. background: rgba(0, 0, 0, 0.8);
  316. border-radius: 5px;
  317. color: #fff;
  318. pointer-events: none;
  319. &::before{
  320. border: 10px solid transparent;
  321. border-top: 10px solid rgba(0, 0, 0, 0.8);
  322. width: 0;
  323. height: 0px;
  324. content: "";
  325. display: inline-block;
  326. position: absolute;
  327. bottom: -20px;
  328. left: 50%;
  329. transform: translateX(-50%);
  330. }
  331. .remark {
  332. line-height: 2.5;
  333. }
  334. }
  335. }
  336. }
  337. */
  338. .guide {
  339. cursor: pointer;
  340. position: relative;
  341. &:hover {
  342. > div {
  343. display: block;
  344. }
  345. }
  346. i {
  347. color: #ababab;
  348. }
  349. > div {
  350. cursor: default;
  351. padding: 10px 18px;
  352. display: none;
  353. z-index: 10000;
  354. position: fixed;
  355. right: 0;
  356. top: -90px;
  357. width: 500px;
  358. background: #161a1a;
  359. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  360. border-radius: 5px;
  361. overflow: hidden;
  362. color: rgba(255, 255, 255, 0.5);
  363. .remark {
  364. line-height: 2.5;
  365. }
  366. .strong {
  367. color: #fff;
  368. }
  369. .line {
  370. width: 100%;
  371. height: 1px;
  372. background: rgba(255, 255, 255, 0.16);
  373. margin: 10px 0;
  374. }
  375. }
  376. }
  377. .preview {
  378. overflow: hidden;
  379. position: relative;
  380. img {
  381. height: 100%;
  382. }
  383. .setting-cover-btn {
  384. position: absolute;
  385. left: 50%;
  386. transform: translateX(-50%);
  387. bottom: 16px;
  388. }
  389. }
  390. .setting-con{
  391. >li{
  392. display: inline-block;
  393. .ui-button{
  394. padding: 0 20px;
  395. margin-right: 10px;
  396. }
  397. }
  398. }
  399. </style>