PageDesignTop.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. <template>
  2. <div class="page-top-setting-wrap">
  3. <div class="logo-wrap item-wrap">
  4. <img
  5. class="menu-img"
  6. src="../BigScreenDesign/images/app.png"
  7. alt="返回"
  8. @click="goBackManage"
  9. >
  10. <span class="logo-text name-span">{{ pageInfo.name }}</span>
  11. </div>
  12. <div class="head-btn-group">
  13. <span style="margin-right:8px;font-size:12px">缩放</span>
  14. <el-input-number
  15. ref="zoomInput"
  16. class="bs-el-input-number"
  17. style="margin-right:10px"
  18. :value="zoom"
  19. :min="1"
  20. label="描述文字"
  21. :controls="true"
  22. @change="changeZoom"
  23. />
  24. <CusBtn
  25. :loading="saveAndPreviewLoading"
  26. @click.native="changeZoom('auto')"
  27. >
  28. 自适应
  29. </CusBtn>
  30. <el-dropdown
  31. trigger="click"
  32. class="align-list-dropdown"
  33. >
  34. <CusBtn type="primary">
  35. 对齐方式<i class="el-icon-arrow-down el-icon--right" />
  36. </CusBtn>
  37. <el-dropdown-menu
  38. slot="dropdown"
  39. class="align-dropdown-menu"
  40. >
  41. <el-dropdown-item
  42. v-for="(mode, index) in alignList"
  43. :key="mode.value"
  44. @click.native="setAlign(mode.value)"
  45. >
  46. <icon-svg
  47. style="padding:3px 8px"
  48. :name="iconList[index]"
  49. />
  50. <span style="color: #bcc9d4">{{ mode.label }}</span>
  51. </el-dropdown-item>
  52. </el-dropdown-menu>
  53. </el-dropdown>
  54. <CusBtn
  55. :loading="saveAndPreviewLoading"
  56. @click.native="designAssign()"
  57. >
  58. 设计分工
  59. </CusBtn>
  60. <CusBtn @click.native="showHostory">
  61. 历史操作
  62. </CusBtn>
  63. <CusBtn
  64. :disabled="undoDisabled"
  65. @click.native="undo(true)"
  66. >
  67. <i class="iconfont-bigscreen icon-jiantouqianjin icon-reverse" />
  68. </CusBtn>
  69. <CusBtn
  70. :disabled="redoDisabled"
  71. @click.native="undo(false)"
  72. >
  73. <i class="iconfont-bigscreen icon-jiantouqianjin" />
  74. </CusBtn>
  75. <CusBtn
  76. :loading="saveAndPreviewLoading"
  77. @click.native="createdImg()"
  78. >
  79. 生成图片
  80. </CusBtn>
  81. <CusBtn
  82. :loading="saveAndPreviewLoading"
  83. @click.native="execRun()"
  84. >
  85. 预览
  86. </CusBtn>
  87. <CusBtn
  88. :loading="saveLoading"
  89. @click="save('saveLoading')"
  90. >
  91. 保存
  92. </CusBtn>
  93. <CusBtn @click="empty">
  94. 清空
  95. </CusBtn>
  96. <CusBtn @click="showPageInfo">
  97. 设置
  98. </CusBtn>
  99. <CusBtn @click="updateRightVisiable">
  100. <i
  101. class="iconfont-bigscreen"
  102. :class="rightFold ? 'icon-zhankaicaidan' : 'icon-shouqicaidan'"
  103. />
  104. </CusBtn>
  105. </div>
  106. <ChooseTemplateDialog
  107. ref="ChooseTemplateDialog"
  108. :has-create="false"
  109. :page-info="pageInfo"
  110. @replaceItByTemplate="replaceItByTemplate"
  111. />
  112. <AssignDialog ref="AssignDialog" />
  113. <HistoryList ref="HistoryList" />
  114. </div>
  115. </template>
  116. <script>
  117. import { EventBus } from 'data-room-ui/js/utils/eventBus'
  118. import { toJpeg, toPng } from 'html-to-image'
  119. import { mapMutations, mapActions, mapState } from 'vuex'
  120. import { saveScreen } from 'data-room-ui/js/api/bigScreenApi'
  121. import ChooseTemplateDialog from 'data-room-ui/BigScreenManagement/ChooseTemplateDialog.vue'
  122. // import _ from 'lodash'
  123. import cloneDeep from 'lodash/cloneDeep'
  124. import uniqBy from 'lodash/uniqBy'
  125. import { stringifyObjectFunctions } from 'data-room-ui/js/utils/evalFunctions'
  126. import AssignDialog from 'data-room-ui/BigScreenDesign/AssignDialog/index.vue'
  127. import HistoryList from 'data-room-ui/BigScreenDesign/HistoryList/index.vue'
  128. import CusBtn from './BtnLoading'
  129. import icons from 'data-room-ui/assets/images/alignIcon/export'
  130. import IconSvg from 'data-room-ui/SvgIcon'
  131. import {
  132. showSize,
  133. compressImage
  134. } from 'data-room-ui/js/utils/compressImg'
  135. // import * as imageConversion from 'image-conversion'
  136. export default {
  137. name: 'PageTopSetting',
  138. components: {
  139. IconSvg,
  140. ChooseTemplateDialog,
  141. AssignDialog,
  142. CusBtn,
  143. HistoryList
  144. },
  145. props: {
  146. code: {
  147. type: String,
  148. default: ''
  149. },
  150. rightFold: {
  151. type: Boolean,
  152. default: false
  153. }
  154. },
  155. data () {
  156. return {
  157. iconList: icons.getNameList(),
  158. alignList: [
  159. {
  160. label: '左侧对齐',
  161. value: 'left'
  162. },
  163. {
  164. label: '居中对齐',
  165. value: 'center'
  166. },
  167. {
  168. label: '右侧对齐',
  169. value: 'right'
  170. },
  171. {
  172. label: '顶部对齐',
  173. value: 'top'
  174. },
  175. {
  176. label: '中部对齐',
  177. value: 'middle'
  178. },
  179. {
  180. label: '底部对齐',
  181. value: 'bottom'
  182. },
  183. {
  184. label: '水平均分',
  185. value: 'levelAround'
  186. },
  187. {
  188. label: '垂直均分',
  189. value: 'verticalAround'
  190. }
  191. ],
  192. initialCoverPicture: '',
  193. appInfo: '',
  194. saveLoading: false,
  195. createdImgLoading: false,
  196. saveAndPreviewLoading: false
  197. }
  198. },
  199. computed: {
  200. ...mapState({
  201. pageInfo: (state) => state.bigScreen.pageInfo,
  202. timelineStore: (state) => state.bigScreen.timelineStore,
  203. currentTimeLine: (state) => state.bigScreen.currentTimeLine,
  204. activeCodes: state => state.bigScreen.activeCodes,
  205. zoom: (state) => state.bigScreen.zoom
  206. }),
  207. pageCode () {
  208. return this.$route.query.code || this.code
  209. },
  210. undoDisabled () {
  211. return Boolean(this.currentTimeLine <= 1)
  212. },
  213. redoDisabled () {
  214. return Boolean(
  215. !this.timelineStore?.length ||
  216. (
  217. this.currentTimeLine &&
  218. this.currentTimeLine === this.timelineStore?.length
  219. )
  220. )
  221. }
  222. },
  223. mounted () {
  224. this.initialCoverPicture = this.pageInfo.coverPicture || ''
  225. this.$refs.zoomInput.$el.addEventListener('mousewheel', this.handleMouseWheel)
  226. },
  227. beforeDestroy () {
  228. this.$refs.zoomInput.$el.removeEventListener('mousewheel', this.handleMouseWheel)
  229. },
  230. methods: {
  231. ...mapActions({
  232. initLayout: 'bigScreen/initLayout'
  233. }),
  234. ...mapMutations({
  235. changeActiveCode: 'bigScreen/changeActiveCode',
  236. changeActiveItem: 'bigScreen/changeActiveItem',
  237. changePageInfo: 'bigScreen/changePageInfo',
  238. undoTimeLine: 'bigScreen/undoTimeLine',
  239. saveTimeLine: 'bigScreen/saveTimeLine'
  240. }),
  241. handleMouseWheel () {
  242. const delta = Math.sign(event.deltaY)
  243. // 限制最小缩放比例为10
  244. if (this.zoom <= 10 && delta > 0) return
  245. event.preventDefault()
  246. const zoom1 = this.zoom - delta
  247. this.$emit('changeZoom', zoom1)
  248. },
  249. changeZoom (val) {
  250. this.$emit('changeZoom', val)
  251. },
  252. setAlign (command) {
  253. const pageInfo = cloneDeep(this.pageInfo)
  254. // 获取所有选中的组件
  255. let activeChartList = pageInfo.chartList.filter((chart) => {
  256. return this.activeCodes.some(code => (code === chart.code))
  257. })
  258. // 找到选中组件内的xy最大最小值
  259. const maxXW = Math.max.apply(Math, activeChartList.map(item => { return item.x + item.w }))
  260. const maxYH = Math.max.apply(Math, activeChartList.map(item => { return item.y + item.h }))
  261. let maxX = Math.max.apply(Math, activeChartList.map(item => { return item.x }))
  262. let maxY = Math.max.apply(Math, activeChartList.map(item => { return item.y }))
  263. const minX = Math.min.apply(Math, activeChartList.map(item => { return item.x }))
  264. const minY = Math.min.apply(Math, activeChartList.map(item => { return item.y }))
  265. const centerW = maxXW - minX
  266. const centerH = maxYH - minY
  267. switch (command) {
  268. case 'left':
  269. activeChartList.forEach((chart) => {
  270. chart.x = minX
  271. })
  272. break
  273. case 'center':
  274. // eslint-disable-next-line no-case-declarations
  275. activeChartList.forEach((chart) => {
  276. chart.x = (centerW - chart.w) / 2 + minX
  277. })
  278. break
  279. case 'right':
  280. activeChartList.forEach((chart) => {
  281. chart.x = maxXW - chart.w
  282. })
  283. break
  284. case 'top':
  285. activeChartList.forEach((chart) => {
  286. chart.y = minY
  287. })
  288. break
  289. case 'middle':
  290. activeChartList.forEach((chart) => {
  291. chart.y = (centerH - chart.h) / 2 + minY
  292. })
  293. break
  294. case 'bottom':
  295. activeChartList.forEach((chart) => {
  296. chart.y = maxYH - chart.h
  297. })
  298. break
  299. case 'levelAround':
  300. // 先让数组根据x的属性进行排序
  301. activeChartList = activeChartList.sort(this.compare('x'))
  302. // eslint-disable-next-line no-case-declarations
  303. const minXW = activeChartList[0].x + activeChartList[0].w
  304. maxX = Math.max.apply(Math, activeChartList.map(item => { return item.x }))
  305. // 中间总的宽度
  306. // eslint-disable-next-line no-case-declarations
  307. let totalW = 0
  308. for (let i = 1; i < activeChartList.length - 1; i++) {
  309. totalW = totalW + activeChartList[i].w
  310. }
  311. // 中间剩余的空格
  312. // eslint-disable-next-line no-case-declarations
  313. const padding = (maxX - minXW - totalW) / (activeChartList.length - 1)
  314. // eslint-disable-next-line no-case-declarations
  315. let useW = 0
  316. for (let i = 1; i < activeChartList.length - 1; i++) {
  317. activeChartList[i].x = minXW + padding * i + useW
  318. useW = useW + activeChartList[i].w
  319. }
  320. break
  321. case 'verticalAround':
  322. // 先让数组根据y的属性进行排序
  323. activeChartList = activeChartList.sort(this.compare('y'))
  324. // eslint-disable-next-line no-case-declarations
  325. const minYH = activeChartList[0].y + activeChartList[0].h
  326. maxY = Math.max.apply(Math, activeChartList.map(item => { return item.y }))
  327. // eslint-disable-next-line no-case-declarations
  328. let totalH = 0
  329. for (let i = 1; i < activeChartList.length - 1; i++) {
  330. totalH = totalH + activeChartList[i].h
  331. }
  332. // eslint-disable-next-line no-case-declarations
  333. const paddingBottom = (maxY - minYH - totalH) / (activeChartList.length - 1)
  334. // eslint-disable-next-line no-case-declarations
  335. let useH = 0
  336. for (let i = 1; i < activeChartList.length - 1; i++) {
  337. activeChartList[i].y = minYH + paddingBottom * i + useH
  338. useH = useH + activeChartList[i].h
  339. }
  340. break
  341. }
  342. pageInfo.chartList = [...pageInfo.chartList, ...activeChartList]
  343. pageInfo.chartList = uniqBy(pageInfo.chartList, 'code')
  344. this.changePageInfo(pageInfo)
  345. },
  346. compare (property) {
  347. return function (obj1, obj2) {
  348. const value1 = obj1[property]
  349. const value2 = obj2[property]
  350. return value1 - value2 // 升序
  351. }
  352. },
  353. goBackManage () {
  354. this.$confirm('确定返回主页面吗?未保存的配置将会丢失。', '提示', {
  355. distinguishCancelAndClose: true,
  356. confirmButtonText: '保存后离开页面',
  357. cancelButtonText: '离开页面',
  358. cancelButtonClass: 'cancel-btn',
  359. type: 'warning',
  360. customClass: 'bs-el-message-box'
  361. }).then(async () => {
  362. const flag = await this.save()
  363. if (flag) {
  364. await this.backManagement()
  365. }
  366. }).catch((action) => {
  367. if (action === 'cancel') {
  368. this.backManagement()
  369. }
  370. })
  371. },
  372. backManagement () {
  373. const data = { componentsManagementType: 'component' }
  374. this.$router.app.$options.globalData = data // 将数据存储在全局变量中
  375. this.$router.push({ path: this.pageInfo.type === 'component' ? (window.BS_CONFIG?.routers?.componentUrl || '/big-screen-components') : (window.BS_CONFIG?.routers?.pageListUrl || '/big-screen-list') })
  376. },
  377. undo (isUndo) {
  378. this.undoTimeLine(isUndo)
  379. },
  380. // 清空
  381. empty () {
  382. this.changeActiveCode('')
  383. this.$emit('empty')
  384. },
  385. // 预览
  386. async execRun () {
  387. this.save('preview').then((res) => {
  388. if (res) {
  389. this.preview(res)
  390. }
  391. })
  392. },
  393. // 预览
  394. preview (previewCode) {
  395. const { href } = this.$router.resolve({
  396. path: window.BS_CONFIG?.routers?.previewUrl || '/big-screen/preview',
  397. query: {
  398. code: previewCode || this.pageCode
  399. }
  400. })
  401. window.open(href, '_blank')
  402. },
  403. // 保存时判断tabs组件里面的元素是否符合要求
  404. validateTabs (chartList) {
  405. let isValid = true
  406. if (chartList.length) {
  407. for (const chart of chartList) {
  408. if (chart.type === 'chartTab' && chart.customize.tabList.length !== 0) {
  409. for (const tab of chart.customize.tabList) {
  410. if ((!tab.name) || (!tab.chartCode)) {
  411. isValid = false
  412. return isValid
  413. }
  414. }
  415. }
  416. }
  417. }
  418. return isValid
  419. },
  420. // 保存
  421. async save (type, hasPageTemplateId = false) {
  422. const pageInfo = cloneDeep(this.handleSaveData())
  423. // 保存时判断tabs组件里面的元素是否符合要求
  424. const flag = this.validateTabs(pageInfo?.chartList)
  425. if (!flag) {
  426. this.$message.warning('请完成tab项配置')
  427. return false
  428. }
  429. // 保存页面
  430. try {
  431. if (!hasPageTemplateId) {
  432. delete pageInfo.pageTemplateId
  433. }
  434. if (type === 'preview') {
  435. pageInfo.isPreview = true
  436. const res = await saveScreen(pageInfo)
  437. return res
  438. } else {
  439. pageInfo.isPreview = false
  440. this.saveLoading = true
  441. pageInfo.coverPicture = this.initialCoverPicture
  442. const node = document.querySelector('.render-theme-wrap')
  443. let dataUrl = ''
  444. let res = null
  445. try {
  446. dataUrl = await toJpeg(node, { quality: 0.2 })
  447. } catch (error) {
  448. // 判断的error.currentTarget是img标签,如果是的,就弹出消息说是图片跨域
  449. // 确认框
  450. this.$confirm('保存封面失败,我们将使用上次保存的封面,不会影响大屏数据的保存。可能是因为图片、视频资源跨域了导致使用toDataURL API生成图片失败,我们可以将资源上传到资源库。然后在组件中使用资源库中的图片资源,以确保没有跨域问题。', '提示', {
  451. confirmButtonText: '确定',
  452. showCancelButton: false,
  453. type: 'warning',
  454. customClass: 'bs-el-message-box'
  455. }).then(async () => {
  456. res = await saveScreen(pageInfo)
  457. this.$message.success('保存成功')
  458. }).catch(async () => {
  459. res = await saveScreen(pageInfo)
  460. this.$message.success('保存成功')
  461. })
  462. }
  463. if (dataUrl) {
  464. if (showSize(dataUrl) > 200) {
  465. // const newData = compressImage(dataUrl, 800)
  466. // const url = dataURLtoBlob(dataUrl)
  467. // // 压缩到500KB,这里的500就是要压缩的大小,可自定义
  468. // const imgRes = await imageConversion.compressAccurately(url, {
  469. // size: 200, // 图片大小压缩到100kb
  470. // width: 1280, // 宽度压缩到1280
  471. // height: 720 // 高度压缩到720
  472. // })
  473. // const base64 = await translateBlobToBase64(imgRes)
  474. // pageInfo.coverPicture = base64.result
  475. this.$message.info('由于封面图片过大,进行压缩中')
  476. const compressCoverPicture = await compressImage(dataUrl, { width: 1280, height: 720, size: 400, quality: 1 })
  477. pageInfo.coverPicture = compressCoverPicture
  478. } else {
  479. pageInfo.coverPicture = dataUrl
  480. }
  481. res = await saveScreen(pageInfo)
  482. this.$message.success('保存成功')
  483. }
  484. return res
  485. }
  486. } catch (error) {
  487. console.error(error)
  488. this.saveLoading = false
  489. throw error
  490. } finally {
  491. this.saveLoading = false
  492. }
  493. },
  494. goBack (path) {
  495. this.$router.push({
  496. path: `/${path}`
  497. })
  498. },
  499. // 得到模板列表
  500. getTemplateList (type) {
  501. this.$nextTick(() => {
  502. this.$refs.ChooseTemplateDialog.init(undefined, type)
  503. })
  504. },
  505. // 选择模版后覆盖配置
  506. selectTemplate (template) {
  507. this.pageInfo.pageTemplateId = template.id
  508. this.save('saveLoading', true).then(() => {
  509. this.initLayout(this.pageCode)
  510. })
  511. },
  512. replaceItByTemplate (config) {
  513. this.changePageInfo(config)
  514. },
  515. // 处理保存数据
  516. handleSaveData () {
  517. const pageInfo = cloneDeep(this.pageInfo)
  518. const chartList = cloneDeep(this.pageInfo.chartList)
  519. pageInfo.pageConfig.cacheDataSets =
  520. pageInfo.pageConfig.cacheDataSets?.map((cache) => ({
  521. name: cache.name,
  522. dataSetId: cache.dataSetId
  523. })) || []
  524. const newChartList = chartList?.map((chart) => {
  525. // 如果是自定义组件,需要将option转换为json字符串,因为其中可能有函数
  526. if (['customComponent', 'remoteComponent', 'echartsComponent'].includes(chart.type)) {
  527. // chart.option.data = []
  528. chart.option = stringifyObjectFunctions(chart.option)
  529. }
  530. return chart
  531. })
  532. return cloneDeep({
  533. ...this.pageInfo,
  534. chartList: newChartList
  535. })
  536. },
  537. updateRightVisiable () {
  538. this.$emit('updateRightVisiable', !this.rightFold)
  539. },
  540. showPageInfo () {
  541. this.$emit('showPageInfo')
  542. },
  543. designAssign () {
  544. this.$refs.AssignDialog.init()
  545. },
  546. showHostory () {
  547. this.$refs.HistoryList.init()
  548. },
  549. createdImg () {
  550. this.saveAndPreviewLoading = true
  551. // 暂停跑马灯动画
  552. EventBus.$emit('stopMarquee')
  553. const node = document.querySelector('.render-theme-wrap')
  554. toPng(node)
  555. .then((dataUrl) => {
  556. const link = document.createElement('a')
  557. link.download = `${this.pageInfo.name}.png`
  558. link.href = dataUrl
  559. link.click()
  560. link.addEventListener('click', () => {
  561. link.remove()
  562. })
  563. this.saveAndPreviewLoading = false
  564. // 恢复跑马灯动画
  565. EventBus.$emit('startMarquee')
  566. }).catch((error) => {
  567. this.saveAndPreviewLoading = false
  568. if (error.type === 'error') {
  569. // 判断的error.currentTarget是img标签,如果是的,就弹出消息说是图片跨域
  570. if (error.currentTarget.tagName.toLowerCase() === 'img') {
  571. // 确认框
  572. this.$confirm('图片资源跨域导致使用toDataURL API生成图片失败,请将图片上传到资源库,然后在组件中使用资源库中的图片资源,确保没有跨域问题。', '提示', {
  573. confirmButtonText: '确定',
  574. showCancelButton: false,
  575. type: 'warning',
  576. customClass: 'bs-el-message-box'
  577. }).then(() => { }).catch(() => { })
  578. }
  579. } else {
  580. this.$message.warning('出现未知错误,请重试')
  581. }
  582. })
  583. }
  584. // createdImg () {
  585. // this.saveAndPreviewLoading = true
  586. // // 暂停跑马灯动画
  587. // EventBus.$emit('stopMarquee')
  588. // const node = document.querySelector('.render-theme-wrap')
  589. // // 获取node 下的所有img标签,拿到他们的src
  590. // const imgTags = node.querySelectorAll('img')
  591. // const requests = Array.from(imgTags).map(img => {
  592. // const src = img.getAttribute('src')
  593. // return fetch(src, {
  594. // headers: { 'Access-Control-Allow-Origin': '*' }
  595. // }).then(response => {
  596. // if (response.ok) {
  597. // return response.blob()
  598. // } else {
  599. // throw new Error('网络请求失败')
  600. // }
  601. // }).then(blob => {
  602. // return new Promise((resolve, reject) => {
  603. // const reader = new FileReader()
  604. // reader.onload = () => resolve(reader.result)
  605. // reader.onerror = reject
  606. // reader.readAsDataURL(blob)
  607. // })
  608. // }).then(dataUrl => {
  609. // img.setAttribute('src', dataUrl)
  610. // }).catch(error => {
  611. // console.error('Fetch error:', error)
  612. // })
  613. // })
  614. // Promise.all(requests).then(() => {
  615. // toPng(node)
  616. // .then((dataUrl) => {
  617. // const link = document.createElement('a')
  618. // link.download = `${this.pageInfo.name}.png`
  619. // link.href = dataUrl
  620. // link.click()
  621. // link.addEventListener('click', () => {
  622. // link.remove()
  623. // })
  624. // this.saveAndPreviewLoading = false
  625. // // 恢复跑马灯动画
  626. // EventBus.$emit('startMarquee')
  627. // }).catch((error) => {
  628. // console.info(error)
  629. // this.$message.warning('出现未知错误,请重试')
  630. // this.saveAndPreviewLoading = false
  631. // })
  632. // }).catch(error => {
  633. // console.error('Fetch error:', error)
  634. // })
  635. // }
  636. }
  637. }
  638. </script>
  639. <style lang="scss" scoped>
  640. @import '../BigScreenDesign/fonts/iconfont.css';
  641. .default-layout-box {
  642. display: flex;
  643. flex-wrap: wrap;
  644. .default-layout-item {
  645. cursor: pointer;
  646. width: 42%;
  647. margin: 9px;
  648. display: flex;
  649. flex-direction: column;
  650. align-items: center;
  651. .component-name {
  652. font-size: 12px;
  653. }
  654. .sampleImg {
  655. margin: 0 auto;
  656. width: 102px;
  657. height: 73px;
  658. display: block;
  659. }
  660. .img_dispaly {
  661. margin: 0 auto;
  662. text-align: center;
  663. width: 100px;
  664. height: 70px;
  665. line-height: 70px;
  666. background-color: #d7d7d7;
  667. color: #999;
  668. }
  669. .demonstration {
  670. text-align: center;
  671. }
  672. }
  673. .default-layout-item:hover {
  674. cursor: pointer;
  675. }
  676. ::v-deep .el-radio__label {
  677. display: none;
  678. }
  679. }
  680. .page-top-setting-wrap {
  681. height: 40px;
  682. background-color: var(--bs-background-2);
  683. display: flex;
  684. align-items: center;
  685. justify-content: space-between;
  686. position: relative;
  687. color: #ffffff;
  688. padding: 0 5px;
  689. .app-name {
  690. cursor: pointer;
  691. }
  692. .head-btn-group {
  693. display: flex;
  694. margin-left: 50px;
  695. align-items: center;
  696. i {
  697. font-size: 14px;
  698. }
  699. .icon-reverse {
  700. transform: rotate(180deg);
  701. }
  702. }
  703. .item-wrap {
  704. display: flex;
  705. align-items: center;
  706. .menu-img {
  707. width: 18px;
  708. height: 18px;
  709. margin-left: 9px;
  710. margin-right: 15px;
  711. cursor: pointer;
  712. }
  713. .logo-text {
  714. user-select: none;
  715. margin-left: 9px;
  716. font-size: 14px;
  717. color: #ffffff;
  718. }
  719. .name-span {
  720. max-width: 300px;
  721. overflow: hidden;
  722. white-space: nowrap;
  723. text-overflow: ellipsis;
  724. }
  725. }
  726. .theme-switch {
  727. margin-right: 10px;
  728. ::v-deep .el-switch__label {
  729. color: #bcc9d4 !important;
  730. }
  731. ::v-deep .el-switch__label.is-active {
  732. color: var(--bs-el-color-primary) !important;
  733. }
  734. }
  735. .align-list-dropdown {
  736. width: 100px !important;
  737. color: #ffffff !important;
  738. }
  739. }
  740. // 自定义dropdown的样式
  741. .align-dropdown-menu {
  742. background-color: var(--bs-background-2) !important;
  743. border: 1px solid var(--bs-border-1);
  744. ::v-deep .el-dropdown-menu__item {
  745. background-color: var(--bs-background-2) !important;
  746. &:hover {
  747. color: var(--bs-el-color-primary) !important;
  748. background-color: var(--bs-el-background-3) !important;
  749. }
  750. }
  751. }
  752. ::v-deep .el-input__inner,
  753. ::v-deep .el-color-picker__color-inner,
  754. ::v-deep .el-input-number--mini,
  755. ::v-deep .el-textarea__inner,
  756. ::v-deep .el-input-group__append {
  757. background: var(--bs-el-background-1);
  758. color: var(--bs-el-text);
  759. border: 0 !important;
  760. width: 100px;
  761. }
  762. // .bs-el-input-number{
  763. // }
  764. </style>