Toolbar.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <div class="app-view-toolbar app-view-full-toolbar">
  3. <div class="main">
  4. <div class="ui-title-big">基础设置</div>
  5. <div class="upload-con">
  6. <div class="uc-r">
  7. <div class="ui-title">
  8. <span class="">名称</span>
  9. </div>
  10. <div :class="{ 'ui-warning': false }">
  11. <input
  12. v-model.trim="info.name"
  13. @blur="$store.commit('SetInfo',info)"
  14. type="text"
  15. class="ui-input"
  16. maxlength="50"
  17. placeholder="作品标题,限50字"
  18. />
  19. </div>
  20. </div>
  21. </div>
  22. <div class="ui-title-big">全局设置</div>
  23. <ul class="setting-con">
  24. <li @click="activeSetting=item" v-for="(item,i) in settings" :key="i">
  25. <button class="ui-button" :class="{submit:activeSetting.id==item.id}">{{item.name}}</button>
  26. </li>
  27. </ul>
  28. </div>
  29. <eidt-panel :select="select" @openMaterial="handleOpen" v-if="activeSetting" @close="onCloseEdit" :show="activeSetting"></eidt-panel>
  30. <div class="dialog" style="z-index: 2000" v-if="isShowSelect">
  31. <Table
  32. :list="list"
  33. :tabHeader="$MAPTABLEHEADER[type]"
  34. @updateList="update"
  35. @cancle="isShowSelect = false"
  36. :title="`选择${$MARERIALSTR[type]}`"
  37. @changeCurrent="changeCurrent"
  38. :paging="paging"
  39. :hideAll="true"
  40. @submit="handleSelect"
  41. >
  42. </Table>
  43. </div>
  44. <div class="dialog" style="z-index: 2000" v-if="showScene">
  45. <Select
  46. @cancle="showScene = false"
  47. :title="'选择素材'"
  48. @submit="handleSelect"
  49. >
  50. </Select>
  51. </div>
  52. </div>
  53. </template>
  54. <script>
  55. import { getMaterialList} from "@/api";
  56. import EidtPanel from "./EditPanel";
  57. import Table from "@/components/tableSelect";
  58. import { changeByteUnit } from '@/utils/file'
  59. import { mapGetters } from "vuex";
  60. import Select from "@/components/select";
  61. export default {
  62. components: {
  63. EidtPanel,
  64. Table,
  65. Select
  66. },
  67. data() {
  68. return {
  69. type:'',
  70. settings:[
  71. // {
  72. // name:"开场提示",
  73. // id:"opening"
  74. // },
  75. {
  76. name:"自动巡游",
  77. id:"xy"
  78. },{
  79. name:"背景音乐",
  80. id:"bgm"
  81. }],
  82. showScene:false,
  83. activeSetting:'',
  84. dataURL: "",
  85. isShowSelect:false,
  86. list:[],
  87. key:'',
  88. clickFrom:'',
  89. paging: {
  90. pageSize: 8,
  91. pageNum: 1,
  92. total: 0,
  93. showSize: 4,
  94. current: 1
  95. },
  96. select:''
  97. };
  98. },
  99. computed: {
  100. ...mapGetters({
  101. info:'info'
  102. })
  103. },
  104. mounted(){
  105. },
  106. watch:{
  107. "paging.pageNum": function () {
  108. this.isShowSelect && this.getMaterialList();
  109. },
  110. isShowSelect(newVal){
  111. if (!newVal) {
  112. this.paging.pageNum = 1
  113. this.key = ''
  114. }
  115. }
  116. },
  117. methods: {
  118. handleOpen(){
  119. this.selectHandle('image','editpanel')
  120. },
  121. addScene(){
  122. this.clickFrom = 'scene'
  123. this.showScene = true
  124. },
  125. changeCurrent(data){
  126. this.paging.pageNum = data;
  127. },
  128. update(data) {
  129. this.key = data;
  130. this.getMaterialList();
  131. },
  132. handleSelect(data){
  133. if (this.clickFrom == 'scene') {
  134. this.info.icon = data.icon
  135. this.showScene = false
  136. }
  137. else{
  138. this.clickFrom == 'editpanel'? this.select = data[0].icon :this.info.icon = data[0].icon
  139. this.isShowSelect = false
  140. }
  141. setTimeout(() => {
  142. this.select = ''
  143. });
  144. },
  145. getMaterialList() {
  146. getMaterialList(
  147. {
  148. pageNum: this.paging.pageNum,
  149. pageSize: this.paging.pageSize,
  150. searchKey: this.key,
  151. type:this.type
  152. },
  153. (data) => {
  154. this.paging.pageNum = data.data.pageNum;
  155. this.paging.pageSize = data.data.pageSize;
  156. this.paging.total = data.data.total;
  157. this.list = data.data.records.map(i=>{
  158. i.isUse = i.fileSize>600 ?'1':'0'
  159. i.fileSize = changeByteUnit(Number(i.fileSize))
  160. i.createTime = i.createTime.substring(0,i.createTime.length-3)
  161. i.updateTime = i.updateTime.substring(0,i.updateTime.length-3)
  162. return i
  163. })
  164. }
  165. );
  166. },
  167. selectHandle(type, from='base'){
  168. this.clickFrom = from
  169. this.type = type
  170. this.isShowSelect = true
  171. this.getMaterialList()
  172. },
  173. onCloseEdit(){
  174. this.activeSetting = ''
  175. }
  176. },
  177. };
  178. </script>
  179. <style lang="less" scoped>
  180. .ui-title-big{
  181. margin-top: 40px;
  182. }
  183. .main {
  184. position: fixed;
  185. width: 468px;
  186. top: 50%;
  187. left: 50%;
  188. transform: translate(-50%,-50%);
  189. }
  190. .upload-con {
  191. display: flex;
  192. margin-top: 50px;
  193. }
  194. .uc-l {
  195. .ui-remark{
  196. margin-top: 10px;
  197. }
  198. }
  199. .uc-r {
  200. width: 100%;
  201. }
  202. .upload-btn {
  203. display: flex;
  204. width: 216px;
  205. justify-content: space-between;
  206. align-items: center;
  207. margin-top: 15px;
  208. .ui-button {
  209. width: 48%;
  210. min-width: 64px;
  211. position: relative;
  212. &:hover {
  213. > div {
  214. display: block;
  215. }
  216. }
  217. > div {
  218. cursor: default;
  219. padding: 0 10px;
  220. display: none;
  221. z-index: 10000;
  222. position: absolute;
  223. left: 50%;
  224. transform: translateX(-50%);
  225. top: -46px;
  226. background: rgba(0, 0, 0, 0.8);
  227. border-radius: 5px;
  228. color: #fff;
  229. pointer-events: none;
  230. &::before{
  231. border: 10px solid transparent;
  232. border-top: 10px solid rgba(0, 0, 0, 0.8);
  233. width: 0;
  234. height: 0px;
  235. content: "";
  236. display: inline-block;
  237. position: absolute;
  238. bottom: -20px;
  239. left: 50%;
  240. transform: translateX(-50%);
  241. }
  242. .remark {
  243. line-height: 2.5;
  244. }
  245. }
  246. }
  247. }
  248. .guide {
  249. cursor: pointer;
  250. position: relative;
  251. &:hover {
  252. > div {
  253. display: block;
  254. }
  255. }
  256. i {
  257. color: #ababab;
  258. }
  259. > div {
  260. cursor: default;
  261. padding: 10px 18px;
  262. display: none;
  263. z-index: 10000;
  264. position: fixed;
  265. right: 0;
  266. top: -90px;
  267. width: 500px;
  268. background: #161a1a;
  269. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  270. border-radius: 5px;
  271. overflow: hidden;
  272. color: rgba(255, 255, 255, 0.5);
  273. .remark {
  274. line-height: 2.5;
  275. }
  276. .strong {
  277. color: #fff;
  278. }
  279. .line {
  280. width: 100%;
  281. height: 1px;
  282. background: rgba(255, 255, 255, 0.16);
  283. margin: 10px 0;
  284. }
  285. }
  286. }
  287. .preview {
  288. overflow: hidden;
  289. img {
  290. height: 100%;
  291. }
  292. }
  293. .setting-con{
  294. >li{
  295. display: inline-block;
  296. .ui-button{
  297. padding: 0 20px;
  298. margin-right: 10px;
  299. }
  300. }
  301. }
  302. </style>