Explorar el Código

fix: 优化业务组件展示

wu.jian2 hace 1 año
padre
commit
8e4a7809fe

+ 1 - 1
data-room-ui/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@gcpaas/data-room-ui",
-  "version": "1.0.1-2023081501-Alpha",
+  "version": "1.0.1-2023081502-Alpha",
   "description": "自定义大屏",
   "author": "gcpaas",
   "license": "MIT",

+ 12 - 14
data-room-ui/packages/BizComponent/Preview.vue

@@ -79,17 +79,15 @@ export default {
     this.viewComponent()
   },
   methods: {
-    viewComponent () {
+    async viewComponent () {
       // 如果有编码,则获取组件信息
       if (this.$route.query?.code) {
-        getBizComponentInfo(this.$route.query?.code).then(data => {
-          this.vueContentInner = data.vueContent
-          this.settingContentInner = data.settingContent
-          this.dataFormatting(this.config)
-          this.remoteComponent = remoteVueLoader('data:text/plain,' + encodeURIComponent(this.vueContentInner))
-        }).finally(() => {
-          this.loading = false
-        })
+        const data = await getBizComponentInfo(this.$route.query?.code)
+        this.vueContentInner = data.vueContent
+        this.settingContentInner = data.settingContent
+        this.dataFormatting(this.config)
+        this.remoteComponent = remoteVueLoader('data:text/plain,' + encodeURIComponent(this.vueContentInner))
+        this.loading = false
       }
 
       // 如果有组件的dirName,则获取系统组件信息
@@ -139,12 +137,12 @@ export default {
     },
     dataFormatting (config, data) {
       // 数据返回成功则赋值
-      if (data.success) {
+      if (data?.success) {
         data = data.data
         config = this.transformSettingToOption(config, 'data')
         // 获取到后端返回的数据,有则赋值
-        const option = config.option
-        const setting = config.setting
+        // const option = config.option
+        // const setting = config.setting
         if (config.dataHandler) {
           try {
             // 此处函数处理data
@@ -165,8 +163,8 @@ export default {
       config = { ...this.config, ...config }
       config = this.transformSettingToOption(config, 'custom')
       // 这里定义了option和setting是为了保证在执行eval时,optionHandler、dataHandler里面可能会用到,
-      const option = config.option
-      const setting = config.setting
+      // const option = config.option
+      // const setting = config.setting
       if (this.config.optionHandler) {
         try {
           // 此处函数处理config

+ 0 - 1
data-room-ui/packages/RemoteComponents/index.vue

@@ -77,7 +77,6 @@ export default {
             this.resolveStrSetting(settingContent)
             this.config = this.dataFormatting(this.config, { success: false })
           }
-
           this.remoteComponent = remoteVueLoader('data:text/plain,' + encodeURIComponent(vueContent))
         }).finally(() => {
           this.loading = false

+ 0 - 2
data-room-ui/packages/js/utils/httpParamsFormatting.js

@@ -35,13 +35,11 @@ export default function axiosFormatting (customConfig) {
   /** 添加响应拦截器  **/
   instance.interceptors.response.use(response => {
     const resp = response.data
-    console.log('resp', resp)
     // 执行响应脚本
     if (newCustomConfig.responseScript) {
       // eslint-disable-next-line no-new-func
       const getResp = new Function('resp', newCustomConfig.responseScript)
       const res = getResp(resp)
-      console.log('resp', res)
       return Promise.resolve(res)
     } else {
       return Promise.resolve(resp)