Parcourir la source

fix:添加免责声明

liu.shiyi il y a 10 mois
Parent
commit
52f2bb9ad0

+ 67 - 0
data-room-ui/example/App.vue

@@ -3,6 +3,32 @@
     <transition name="fade">
       <router-view />
     </transition>
+    <el-dialog
+      class="disclaimer-dialog"
+      title="免责声明"
+      :visible.sync="dialogVisible"
+      :close-on-press-escape="false"
+      :close-on-click-modal="false"
+      :show-close="false"
+      width="80%"
+    >
+      <span v-html="message" />
+      <span
+        slot="footer"
+        class="dialog-footer"
+      >
+        <el-button @click="out">退出</el-button>
+        <el-button
+          type="primary"
+          :disabled="time>0"
+          @click="agree"
+        >我已知晓<span
+          v-if="time"
+          style="padding-left: 4px"
+        >{{ time }}</span></el-button>
+
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -14,6 +40,47 @@ export default {
     if (loading) {
       document.body.removeChild(loading)
     }
+  },
+  data () {
+    return {
+      dialogVisible: false,
+      message: '',
+      timer: null,
+      time: 10
+
+    }
+  },
+  mounted () {
+    this.init()
+  },
+  methods: {
+    init () {
+      // 如果不是演示环境或者已经阅读过免责声明,则不显示弹窗
+      if ((!window?.SITE_CONFIG?.demoEnv) || sessionStorage.getItem('disclaimer') === 'read ') {
+        return
+      }
+      this.dialogVisible = true
+      // 新建是否阅读免责声明的本地存储
+      sessionStorage.setItem('disclaimer', '')
+      this.$dataRoomAxios.get('/dataroom/opensource/disclaimer').then(res => {
+        this.message = res
+        this.timer = setInterval(() => {
+          if (this.time > 0) {
+            this.time--
+          } else {
+            clearInterval(this.timer)
+          }
+        }, 1000)
+      })
+    },
+    out () {
+      window.close()
+      // window.location.href = 'about:blank'
+    },
+    agree () {
+      sessionStorage.setItem('disclaimer', 'read ')
+      this.dialogVisible = false
+    }
   }
 }
 </script>

+ 4 - 3
data-room-ui/example/main.js

@@ -14,10 +14,11 @@ import * as $dataRoomAxios from '../packages/js/utils/http.js'
 import { registerConfig } from '@gcpaas/data-room-ui'
 import remoteComponents from '@/remoteComponents/exports.js'
 import customDatasetComponents from '@/customDatasetComponents/exports.js'
-import { Column } from '@antv/g2plot';
+import { Column } from '@antv/g2plot'
 // import customPlots from '@/customPlots/exports'
 Vue.use(ElementUI, { size: 'mini' })
 Vue.prototype.Column = Column
+console.log('window.CONFIG', window.CONFIG)
 registerConfig(
   {
     routers: {
@@ -41,9 +42,9 @@ registerConfig(
       componentUrl: '/big-screen-components'
     },
     httpConfigs: {
-      baseURL: window.CONFIG?.baseUrl,
+      baseURL: window.CONFIG?.baseURL,
       // 现在文件路径保存的是相对路径,所以需要加上前缀,这个值一般和后端的gc.starter.file.urlPrefix一致
-      fileUrlPrefix: window.CONFIG.fileUrlPrefix ? window.CONFIG.fileUrlPrefix : window.CONFIG?.baseUrl + '/static',
+      fileUrlPrefix: window.CONFIG?.fileUrlPrefix ? window.CONFIG.fileUrlPrefix : window.CONFIG?.baseUrl + '/static'
     },
     customTheme: {
       '--bs-background-1': '#151a26', // 整体背景色

+ 0 - 4
data-room-ui/packages/DataSetManagement/src/TypeTree.vue

@@ -382,10 +382,6 @@ export default {
         })
         return
       }
-      if (window.CONFIG.dataRoom.datasetBtn.disabled) {
-        this.$message.error(window.CONFIG.dataRoom.datasetBtn.message)
-        return
-      }
       // 编辑节点
       this.editFormVisible = true
       if (editType === this.editTypeConstant.editOrg) {

+ 0 - 8
data-room-ui/packages/DataSetManagement/src/index.vue

@@ -591,10 +591,6 @@ export default {
       this.isEdit = false
     },
     toEdit (id, type, name, typeId) {
-      if (window.CONFIG.dataRoom.datasetBtn.disabled) {
-        this.$message.error(window.CONFIG.dataRoom.datasetBtn.message)
-        return
-      }
       this.datasetId = id
       this.datasetType = type
       this.componentData = this.getComponents(this.datasetTypeList.find(item => item?.datasetType === type)?.componentName) ?? ''
@@ -674,10 +670,6 @@ export default {
     },
     // 新增数据集
     addDataset () {
-      if (window.CONFIG.dataRoom.datasetBtn.disabled) {
-        this.$message.error(window.CONFIG.dataRoom.datasetBtn.message)
-        return
-      }
       this.$refs.DatasetTypeDialog.dialogVisible = true
     },
     selectChange () {

+ 2 - 8
data-room-ui/public/config/starter.js

@@ -1,12 +1,6 @@
 (function(window) {
-  window.CONFIG = {
-    dataRoom:{
-      datasetBtn:{// 数据集按钮的配置
-        disabled: true, // 是否禁用数据集按钮
-        message: '演示环境不允许操作' // 按钮提示信息
-
-      }
-    }
+  window.SITE_CONFIG = {
+    demoEnv:true
   }
 })(window);