Bladeren bron

feat:删除主题mock接口

liu.shiyi 1 jaar geleden
bovenliggende
commit
33e08eeb7a

+ 3 - 34
data-room-ui/packages/BigScreenDesign/OverallSetting/index.vue

@@ -188,10 +188,6 @@ import SettingTitle from 'data-room-ui/SettingTitle/index.vue'
 import ColorPicker from 'data-room-ui/ColorPicker/index.vue'
 import BgImg from './BgImgDialog.vue'
 import { mapState, mapMutations } from 'vuex'
-import { getThemeConfig } from 'data-room-ui/js/api/bigScreenApi'
-// import _ from 'lodash'
-import cloneDeep from 'lodash/cloneDeep'
-import { G2 } from '@antv/g2plot'
 import { themeToSetting } from 'data-room-ui/js/utils/themeFormatting'
 export default {
   name: 'OverallSetting',
@@ -378,6 +374,9 @@ export default {
       const pageInfo = this.pageInfo
       pageInfo.chartList = themeToSetting(pageInfo.chartList, theme)
       this.changePageInfo(pageInfo)
+      pageInfo.chartList.forEach(chart => {
+        // if (chart.type === 'remoteComponent')
+      })
     },
     init () {
       if (!this.pageInfo.pageConfig.refreshConfig) {
@@ -432,36 +431,6 @@ export default {
     initResolution () {
       this.resolutionRatioValue = this.pageInfo.pageConfig.w + '*' + this.pageInfo.pageConfig.h
     },
-    getThemeConfig (themeName) {
-      // this.changePageLoading(true)
-      if (!['dark', 'light', 'auto'].includes(themeName)) {
-        getThemeConfig().then(res => {
-          this.form.themeJson = res
-          this.changePageConfig(cloneDeep(this.form))
-          // 统一注册主题
-          const { registerTheme } = G2
-          registerTheme(themeName, { ...res.chart })
-          this.changeChart(themeName)
-        })
-      } else {
-        this.form.themeJson = {}
-        this.changePageConfig(this.form)
-        this.changeChart(themeName)
-      }
-    },
-    // 改变
-    // changeChart (themeName) {
-    //   // 统一改变组件的主题
-    //   const newChartList = cloneDeep(this.pageInfo.chartList)
-    //   const chartList = newChartList.map(chart => {
-    //     chart.option.theme = themeName
-    //     chart.key = new Date().getTime()
-    //     // this.changeChartKey(chart.code)
-    //     return chart
-    //   })
-    //   // 可能需要强制性更新chartList
-    //   this.changeLayout(chartList)
-    // },
 
     // 新增数据集
     addCacheDataSet () {

+ 2 - 16
data-room-ui/packages/BigScreenDesign/index.vue

@@ -127,9 +127,8 @@ import PageTopSetting from './PageDesignTop.vue'
 import Render from '../Render'
 import { mapActions, mapMutations, mapState } from 'vuex'
 import SketchDesignRuler from 'data-room-ui/BigScreenDesign/RulerTool/SketchRuler.vue'
-import { G2 } from '@antv/g2plot'
 import multipleSelectMixin from 'data-room-ui/js/mixins/multipleSelectMixin'
-import { getThemeConfig, getScreenInfo } from 'data-room-ui/js/api/bigScreenApi'
+import { getScreenInfo } from 'data-room-ui/js/api/bigScreenApi'
 import MouseSelect from './MouseSelect/index.vue'
 import cloneDeep from 'lodash/cloneDeep'
 import { randomString } from '../js/utils'
@@ -367,20 +366,7 @@ export default {
       this.changePageLoading(true)
       this.initLayout(this.pageCode)
         .then(() => {
-          const themeName = this.pageConfig.customTheme
-          if (!['dark', 'light', 'auto'].includes(themeName)) {
-            getThemeConfig().then((res) => {
-              // 初始化时如果就是自定义主题则统一注册
-              const { registerTheme } = G2
-              registerTheme(themeName, { ...res.chart })
-              const pageConfig = this.pageConfig
-              pageConfig.themeJson = res
-              this.changePageConfig(pageConfig)
-              this.changePageLoading(false)
-            })
-          } else {
-            this.changePageLoading(false)
-          }
+          this.changePageLoading(false)
         })
         .finally(() => {
           setTimeout(() => {

+ 1 - 17
data-room-ui/packages/BigScreenRun/index.vue

@@ -36,9 +36,7 @@
 <script>
 import RenderCard from 'data-room-ui/Render/RenderCard.vue'
 import { mapActions, mapMutations, mapState } from 'vuex'
-import { getThemeConfig } from 'data-room-ui/js/api/bigScreenApi'
 import { compile } from 'tiny-sass-compiler/dist/tiny-sass-compiler.esm-browser.prod.js'
-import { G2 } from '@antv/g2plot'
 import NotPermission from 'data-room-ui/NotPermission'
 export default {
   name: 'BigScreenRun',
@@ -182,21 +180,7 @@ export default {
       if (!this.pageCode) { return }
       this.changePageLoading(true)
       this.initLayout(this.pageCode).then(() => {
-        const themeName = this.pageConfig.customTheme
-        if (this.pageConfig.customTheme === 'custom') {
-          getThemeConfig().then((res) => {
-            // 初始化时如果就是自定义主题则统一注册
-            const { registerTheme } = G2
-            registerTheme(themeName, { ...res.chart })
-            const pageConfig = this.pageConfig
-            pageConfig.themeJson = res
-            this.changePageConfig(pageConfig)
-            this.styleSet()
-            this.changePageLoading(false)
-          })
-        } else {
-          this.changePageLoading(false)
-        }
+        this.changePageLoading(false)
         this.getParentWH()
       })
     },

+ 0 - 4
data-room-ui/packages/js/api/bigScreenApi.js

@@ -13,10 +13,6 @@ export function saveScreen (data) {
 export function getDataSetDetails (id) {
   return Vue.prototype.$dataRoomAxios.get('/dataset/datasetInfo/' + id)
 }
-// 模拟后端返回自定义主题配置
-export function getThemeConfig () {
-  return Vue.prototype.$dataRoomAxios.get('https://mock.mengxuegu.com/mock/64239ff6e24b4b4cfeaca5ea/example/theme')
-}
 
 // 根据数据集id获取数据
 export function getDataByDataSetId (dataSetId) {