From 822cdb2c340bc01ac6039b8c05969613276e9793 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Sat, 2 Apr 2022 22:02:58 +0800 Subject: [PATCH 1/9] =?UTF-8?q?fix:=20=E6=94=AF=E6=8C=81=20es8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/provider/datasource/EsProvider.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/src/main/java/io/dataease/provider/datasource/EsProvider.java b/backend/src/main/java/io/dataease/provider/datasource/EsProvider.java index 077c25c5d9..de1595045e 100644 --- a/backend/src/main/java/io/dataease/provider/datasource/EsProvider.java +++ b/backend/src/main/java/io/dataease/provider/datasource/EsProvider.java @@ -239,6 +239,11 @@ public class EsProvider extends DatasourceProvider { tableDesc.setName(row[0]); tables.add(tableDesc); } + if (row.length == 4 && row[2].contains("TABLE") && row[3].equalsIgnoreCase("INDEX")) { + TableDesc tableDesc = new TableDesc(); + tableDesc.setName(row[1]); + tables.add(tableDesc); + } } return tables; } From 0ebb8b1d78adf6b2833c3da3090349d819323cf8 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Sat, 2 Apr 2022 22:20:46 +0800 Subject: [PATCH 2/9] =?UTF-8?q?fix:=20=E9=BB=98=E8=AE=A4=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/service/dataset/DataSetTableService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index f4ae1d03d2..53e30ce5d4 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -172,6 +172,7 @@ public class DataSetTableService { DataTableInfoDTO info = new DataTableInfoDTO(); info.setExcelSheetDataList(excelSheetDataList); sheetTable.setInfo(new Gson().toJson(info)); + sysAuthService.copyAuth(datasetTable.getId(), SysAuthConstants.AUTH_SOURCE_TYPE_DATASET); datasetTableMapper.insert(sheetTable); saveExcelTableField(sheetTable.getId(), excelSheetDataList.get(0).getFields(), true); datasetIdList.add(sheetTable.getId()); @@ -202,6 +203,7 @@ public class DataSetTableService { info.setExcelSheetDataList(excelSheetDataList); sheetTable.setInfo(new Gson().toJson(info)); datasetTableMapper.insert(sheetTable); + sysAuthService.copyAuth(datasetTable.getId(), SysAuthConstants.AUTH_SOURCE_TYPE_DATASET); saveExcelTableField(sheetTable.getId(), sheet.getFields(), true); datasetIdList.add(sheetTable.getId()); } From 6ca6e25a3e2f17b83d253731c1c527ed565d5dd4 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Sat, 2 Apr 2022 23:03:20 +0800 Subject: [PATCH 3/9] =?UTF-8?q?fix:=20=E9=BB=98=E8=AE=A4=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/service/dataset/DataSetTableService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index 53e30ce5d4..21eb7aa271 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -172,8 +172,8 @@ public class DataSetTableService { DataTableInfoDTO info = new DataTableInfoDTO(); info.setExcelSheetDataList(excelSheetDataList); sheetTable.setInfo(new Gson().toJson(info)); - sysAuthService.copyAuth(datasetTable.getId(), SysAuthConstants.AUTH_SOURCE_TYPE_DATASET); datasetTableMapper.insert(sheetTable); + sysAuthService.copyAuth(sheetTable.getId(), SysAuthConstants.AUTH_SOURCE_TYPE_DATASET); saveExcelTableField(sheetTable.getId(), excelSheetDataList.get(0).getFields(), true); datasetIdList.add(sheetTable.getId()); } @@ -203,7 +203,7 @@ public class DataSetTableService { info.setExcelSheetDataList(excelSheetDataList); sheetTable.setInfo(new Gson().toJson(info)); datasetTableMapper.insert(sheetTable); - sysAuthService.copyAuth(datasetTable.getId(), SysAuthConstants.AUTH_SOURCE_TYPE_DATASET); + sysAuthService.copyAuth(sheetTable.getId(), SysAuthConstants.AUTH_SOURCE_TYPE_DATASET); saveExcelTableField(sheetTable.getId(), sheet.getFields(), true); datasetIdList.add(sheetTable.getId()); } From ff436ddb88f868b22ced4606847aec99a6edf476 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Sun, 3 Apr 2022 19:34:48 +0800 Subject: [PATCH 4/9] =?UTF-8?q?fix:=20=E6=9B=BF=E6=8D=A2excel=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=88=87=E6=8D=A2tab=20=E5=88=B7=E6=96=B0=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../provider/datasource/JdbcProvider.java | 4 +- frontend/src/views/dataset/data/ViewTable.vue | 106 +++++++++++------- 2 files changed, 69 insertions(+), 41 deletions(-) diff --git a/backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java b/backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java index d193600cb1..200f7afdad 100644 --- a/backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java +++ b/backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java @@ -284,8 +284,8 @@ public class JdbcProvider extends DatasourceProvider { String f = metaData.getColumnName(j + 1); String l = StringUtils.isNotEmpty(metaData.getColumnLabel(j + 1)) ? metaData.getColumnLabel(j + 1) : f; String t = metaData.getColumnTypeName(j + 1); - if (datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.hive.name()) && l.contains("\\.")) { - l = l.split("\\.")[1]; + if (datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.hive.name()) && l.contains(".")) { + l = l.split(".")[1]; } TableField field = new TableField(); field.setFieldName(l); diff --git a/frontend/src/views/dataset/data/ViewTable.vue b/frontend/src/views/dataset/data/ViewTable.vue index 841d07f9d7..46f82ab45e 100644 --- a/frontend/src/views/dataset/data/ViewTable.vue +++ b/frontend/src/views/dataset/data/ViewTable.vue @@ -11,12 +11,14 @@ @show="showTab" @hide="hideTab" > - + - + - + {{ $t('dataset.edit_excel') }} @@ -40,44 +42,53 @@ - + - + - - + + - - + + - - + + - - + + - - + + From c716dee72529d48c02e6ec932be45a75bcf83d5b Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 4 Apr 2022 21:34:05 +0800 Subject: [PATCH 5/9] =?UTF-8?q?fix:=20=E6=8F=92=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=89=88=E6=9C=AC=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/base/domain/MyPlugin.java | 2 + .../io/dataease/commons/utils/CodingUtil.java | 12 +++ .../dataease/service/sys/PluginService.java | 78 ++++++++++++++++++- frontend/src/lang/en.js | 4 +- frontend/src/lang/tw.js | 6 +- frontend/src/lang/zh.js | 6 +- frontend/src/views/system/plugin/index.vue | 20 +++-- 7 files changed, 113 insertions(+), 15 deletions(-) diff --git a/backend/src/main/java/io/dataease/base/domain/MyPlugin.java b/backend/src/main/java/io/dataease/base/domain/MyPlugin.java index e7c9e0ca76..a79291d8e1 100644 --- a/backend/src/main/java/io/dataease/base/domain/MyPlugin.java +++ b/backend/src/main/java/io/dataease/base/domain/MyPlugin.java @@ -35,5 +35,7 @@ public class MyPlugin implements Serializable { private String icon; + private String require = "1.9.0"; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/dataease/commons/utils/CodingUtil.java b/backend/src/main/java/io/dataease/commons/utils/CodingUtil.java index ec283b549b..714392e36f 100644 --- a/backend/src/main/java/io/dataease/commons/utils/CodingUtil.java +++ b/backend/src/main/java/io/dataease/commons/utils/CodingUtil.java @@ -195,4 +195,16 @@ public class CodingUtil { } return shortBuffer.toString(); } + + public static Integer string2Integer(String str) { + StringBuffer sb = new StringBuffer(); + if (StringUtils.isBlank(str)) return null; + for (int i = 0; i < str.length(); i++) { + char c = str.charAt(i); + if (Character.isDigit(c)) { + sb.append(c); + } + } + return sb.length() > 0 ? Integer.parseInt(sb.toString()) : null; + } } diff --git a/backend/src/main/java/io/dataease/service/sys/PluginService.java b/backend/src/main/java/io/dataease/service/sys/PluginService.java index 282f3fe68f..cce8a8b175 100644 --- a/backend/src/main/java/io/dataease/service/sys/PluginService.java +++ b/backend/src/main/java/io/dataease/service/sys/PluginService.java @@ -1,17 +1,22 @@ package io.dataease.service.sys; +import cn.hutool.core.io.FileUtil; import com.google.gson.Gson; import io.dataease.base.domain.MyPlugin; import io.dataease.base.mapper.MyPluginMapper; import io.dataease.base.mapper.ext.ExtSysPluginMapper; import io.dataease.base.mapper.ext.query.GridExample; import io.dataease.commons.constants.AuthConstants; +import io.dataease.commons.exception.DEException; +import io.dataease.commons.utils.CodingUtil; import io.dataease.commons.utils.DeFileUtils; +import io.dataease.commons.utils.LogUtil; import io.dataease.commons.utils.ZipUtils; import io.dataease.controller.sys.base.BaseGridRequest; import io.dataease.listener.util.CacheUtils; import io.dataease.plugins.config.LoadjarUtil; import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -22,8 +27,10 @@ import javax.annotation.Resource; import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; @Service @@ -43,6 +50,9 @@ public class PluginService { @Autowired private LoadjarUtil loadjarUtil; + @Value("${version}") + private String version; + public List query(BaseGridRequest request) { GridExample gridExample = request.convertExample(); @@ -66,7 +76,9 @@ public class PluginService { DeFileUtils.deleteFile(pluginDir + "temp/"); DeFileUtils.deleteFile(folder); // 需要删除文件 - e.printStackTrace(); + // e.printStackTrace(); + LogUtil.error(e.getMessage(), e); + DEException.throwException(e); } //3.解析plugin.json 失败则 直接返回错误 删除文件 File folderFile = new File(folder); @@ -74,15 +86,31 @@ public class PluginService { if (ArrayUtils.isEmpty(jsonFiles)) { DeFileUtils.deleteFile(pluginDir + "temp/"); DeFileUtils.deleteFile(folder); - throw new RuntimeException("缺少插件描述文件"); + String msg = "缺少插件描述文件【plugin.json】"; + LogUtil.error(msg); + DEException.throwException(new RuntimeException(msg)); } MyPlugin myPlugin = formatJsonFile(jsonFiles[0]); + + if (!versionMatch(myPlugin.getRequire())) { + String msg = "当前插件要求系统版本最低为:" + myPlugin.getRequire(); + LogUtil.error(msg); + DEException.throwException(new RuntimeException(msg)); + } //4.加载jar包 失败则 直接返回错误 删除文件 File[] jarFiles = folderFile.listFiles(this::isPluginJar); if (ArrayUtils.isEmpty(jarFiles)) { DeFileUtils.deleteFile(pluginDir + "temp/"); DeFileUtils.deleteFile(folder); - throw new RuntimeException("缺少插件jar文件"); + String msg = "缺少插件jar文件"; + LogUtil.error(msg); + DEException.throwException(new RuntimeException(msg)); + } + + if (pluginExist(myPlugin)) { + String msg = "插件【"+myPlugin.getName()+"】已存在,请先卸载"; + LogUtil.error(msg); + DEException.throwException(new RuntimeException(msg)); } String targetDir = null; try { @@ -100,7 +128,8 @@ public class PluginService { if (StringUtils.isNotEmpty(targetDir)) { DeFileUtils.deleteFile(targetDir); } - e.printStackTrace(); + LogUtil.error(e.getMessage(), e); + DEException.throwException(e); } finally { DeFileUtils.deleteFile(pluginDir + "temp/"); DeFileUtils.deleteFile(folder); @@ -122,6 +151,19 @@ public class PluginService { return dir; } + /** + * 检测插件是否已存在 + * @param myPlugin + * @return + */ + public boolean pluginExist(MyPlugin myPlugin) { + GridExample gridExample = new GridExample(); + List plugins = extSysPluginMapper.query(gridExample); + return plugins.stream().anyMatch(plugin -> { + return StringUtils.equals(myPlugin.getName(), plugin.getName()) || StringUtils.equals(myPlugin.getModuleName(), plugin.getModuleName()); + }); + } + /** * 卸载插件 * @@ -129,6 +171,13 @@ public class PluginService { * @return */ public Boolean uninstall(Long pluginId) { + MyPlugin myPlugin = myPluginMapper.selectByPrimaryKey(pluginId); + if (ObjectUtils.isEmpty(myPlugin)) { + String msg = "当前插件不存在"; + LogUtil.error(msg); + DEException.throwException(new RuntimeException(msg)); + } + deleteJarFile(myPlugin); CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME); CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME); CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME); @@ -136,6 +185,15 @@ public class PluginService { return true; } + private void deleteJarFile(MyPlugin plugin) { + String version = plugin.getVersion(); + String moduleName = plugin.getModuleName(); + String fileName = moduleName + "-" + version + ".jar"; + String path = pluginDir + plugin.getStore() + "/" + fileName; + File jarFile = new File(path); + FileUtil.del(jarFile); + } + /** * 改变插件状态 * @@ -195,4 +253,16 @@ public class PluginService { public Map remoteInstall(Map params) { return null; } + + public boolean versionMatch(String pluginVersion) { + List versionLists = Arrays.stream(version.split(".")).map(CodingUtil::string2Integer).collect(Collectors.toList()); + List requireVersionLists = Arrays.stream(pluginVersion.split(".")).map(CodingUtil::string2Integer).collect(Collectors.toList()); + int maxSize = Math.max(versionLists.size(), requireVersionLists.size()); + for (int i = 0; i < maxSize; i++) { + Integer currentV = versionLists.size() == i ? 0 : versionLists.get(i); + Integer requireV = requireVersionLists.size() == i ? 0 : requireVersionLists.get(i); + if (requireV > currentV) return false; + } + return false; + } } diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 9758b4c53b..c3ff4f0aa0 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -1645,7 +1645,9 @@ export default { uninstall_cancel: 'Cancel uninstall plugin', setting_background: 'BackGround', setting_jump: 'Jump Setting', - select_view: 'Select View' + select_view: 'Select View', + un_install_success: 'Uninstall is successful and restart takes effect', + un_install_error: 'Uninstall failed, please contact the administrator' }, display: { logo: 'Head system logo', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 8a8bfa1c4b..ff9d4aa51b 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -1644,9 +1644,11 @@ export default { creator: '作者', install_time: '安裝時間', release_time: '時間', - un_install: '卸載', + un_install: '卸載(重啟服務後生效)', uninstall_confirm: '確定卸載該插件', - uninstall_cancel: '取消卸載插件' + uninstall_cancel: '取消卸載插件', + un_install_success: '卸載成功,重啟生效', + un_install_error: '卸載失敗,請聯系管理員' }, display: { logo: '頭部繫統logo', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index f29106533f..79ea248c7d 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -1653,9 +1653,11 @@ export default { creator: '作者', install_time: '安装时间', release_time: '时间', - un_install: '卸载', + un_install: '卸载(卸载并重启服务后生效)', uninstall_confirm: '确定卸载该插件', - uninstall_cancel: '取消卸载插件' + uninstall_cancel: '取消卸载插件', + un_install_success: '卸载成功,重启生效', + un_install_error: '卸载失败,请联系管理员' }, display: { logo: '头部系统logo', diff --git a/frontend/src/views/system/plugin/index.vue b/frontend/src/views/system/plugin/index.vue index 99c08b8f62..3713f245ee 100644 --- a/frontend/src/views/system/plugin/index.vue +++ b/frontend/src/views/system/plugin/index.vue @@ -8,7 +8,6 @@ @search="search" > - + @@ -72,6 +71,10 @@ export default { // label: this.$t('commons.delete'), icon: 'el-icon-delete', type: 'danger', click: this.del, // show: checkPermission(['user:del']) // } + { + label: this.$t('plugin.un_install'), icon: 'el-icon-delete', type: 'danger', click: this.del, + disabled: this.btnDisabled + } ], searchConfig: { useQuickSearch: true, @@ -113,6 +116,8 @@ export default { this.uploading = true }, uploadFail(response, file, fileList) { + const msg = response && response.message || '安装失败' + this.$error(msg) this.uploading = false }, uploadSuccess(response, file, fileList) { @@ -121,20 +126,23 @@ export default { }, del(row) { - this.$confirm(this.$t('user.delete_confirm'), '', { + this.$confirm(this.$t('plugin.uninstall_confirm'), '', { confirmButtonText: this.$t('commons.confirm'), cancelButtonText: this.$t('commons.cancel'), type: 'warning' }).then(() => { uninstall(row.pluginId).then(res => { this.search() - this.$success('卸载成功') + this.$success(this.$t('plugin.un_install_success')) }).catch(() => { - this.$error('卸载失败') + this.$error(this.$t('plugin.un_install_error')) }) }).catch(() => { - this.$info(this.$t('commons.delete_cancel')) + this.$info(this.$t('plugin.uninstall_cancel')) }) + }, + btnDisabled(row) { + return row.pluginId < 4 } } From 686606162194f73477738eea36028c227b893144 Mon Sep 17 00:00:00 2001 From: junjun Date: Mon, 4 Apr 2022 22:02:42 +0800 Subject: [PATCH 6/9] =?UTF-8?q?fix:=20=E8=87=AA=E5=AE=9A=E4=B9=89=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=8A=A5=E9=94=99=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/service/dataset/DataSetTableService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index 21eb7aa271..00b46582d4 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -1101,10 +1101,10 @@ public class DataSetTableService { Map customInfo = new TreeMap<>(); for (DataTableInfoCustomUnion ele : dataTableInfoDTO.getList()) { DatasetTable datasetTable = datasetTableMapper.selectByPrimaryKey(ele.getTableId()); - String table = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable(); if (ObjectUtils.isEmpty(datasetTable)) { throw new RuntimeException(Translator.get("i18n_custom_ds_delete")); } + String table = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable(); List fields = dataSetTableFieldsService.getListByIdsEach(ele.getCheckedFields()); if (CollectionUtils.isEmpty(fields)) { throw new RuntimeException(Translator.get("i18n_cst_ds_tb_or_field_deleted")); From 22f3a0c461c4edb600ab7f722d7b668e4b0942b9 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Tue, 5 Apr 2022 11:57:29 +0800 Subject: [PATCH 7/9] =?UTF-8?q?fix:=20StarRocks=E3=80=81tidb=20=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/service/dataset/ExtractDataService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java b/backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java index 6d6f441a42..fe31d15721 100644 --- a/backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java +++ b/backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java @@ -872,6 +872,8 @@ public class ExtractDataService { case ds_doris: case mariadb: case mysql: + case TiDB: + case StarRocks: MysqlConfiguration mysqlConfiguration = new Gson().fromJson(datasource.getConfiguration(), MysqlConfiguration.class); dataMeta = new DatabaseMeta("db", "MYSQL", "Native", mysqlConfiguration.getHost().trim(), mysqlConfiguration.getDataBase().trim(), mysqlConfiguration.getPort().toString(), mysqlConfiguration.getUsername(), mysqlConfiguration.getPassword()); dataMeta.addExtraOption("MYSQL", "characterEncoding", "UTF-8"); From 3950349308b052a4f4f04c03c52ac0b608e63b1b Mon Sep 17 00:00:00 2001 From: fit2cloudrd Date: Tue, 5 Apr 2022 19:00:53 +0800 Subject: [PATCH 8/9] =?UTF-8?q?fix:=20=E8=A7=86=E9=A2=91=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E9=94=99=E8=AF=AF=E5=90=8E=E5=86=8D?= =?UTF-8?q?=E5=A1=AB=E5=86=99=E9=93=BE=E6=8E=A5=E6=97=A0=E6=B3=95=E7=AB=8B?= =?UTF-8?q?=E5=8D=B3=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: wangjiahao <1522128093@qq.com> --- .../canvas/components/Editor/VideoLinks.vue | 2 ++ .../canvas/custom-component/DeStreamMedia.vue | 11 ++++++++-- .../canvas/custom-component/DeVideo.vue | 22 ++++++++++++------- .../canvas/custom-component/component-list.js | 3 ++- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/canvas/components/Editor/VideoLinks.vue b/frontend/src/components/canvas/components/Editor/VideoLinks.vue index 616cead784..c839335f03 100644 --- a/frontend/src/components/canvas/components/Editor/VideoLinks.vue +++ b/frontend/src/components/canvas/components/Editor/VideoLinks.vue @@ -43,6 +43,7 @@ import { mapState } from 'vuex' import { deepCopy } from '@/components/canvas/utils/utils' import { checkAddHttp } from '@/utils/urlUtils' +import bus from "@/utils/bus"; export default { props: { @@ -88,6 +89,7 @@ export default { this.linkInfoTemp[this.linkInfoTemp.videoType].sources[0].src = checkAddHttp(this.linkInfoTemp[this.linkInfoTemp.videoType].sources[0].src) this.curComponent.videoLinks = this.linkInfoTemp this.$store.state.styleChangeTimes++ + bus.$emit('videoLinksChange-' + this.curComponent.id) this.popoverClose() }, onClose() { diff --git a/frontend/src/components/canvas/custom-component/DeStreamMedia.vue b/frontend/src/components/canvas/custom-component/DeStreamMedia.vue index 8488ed4668..af831b6de1 100644 --- a/frontend/src/components/canvas/custom-component/DeStreamMedia.vue +++ b/frontend/src/components/canvas/custom-component/DeStreamMedia.vue @@ -42,7 +42,8 @@ export default { data() { return { pOption: this.element.streamMediaLinks[this.element.streamMediaLinks.videoType], - flvPlayer: null + flvPlayer: null, + videoShow: true } }, @@ -70,7 +71,13 @@ export default { mounted() { this.initOption() bus.$on('streamMediaLinksChange-' + this.element.id, () => { - this.initOption() + this.pOption = this.element.streamMediaLinks[this.element.streamMediaLinks.videoType], + this.flvPlayer = null, + this.videoShow = false + this.$nextTick(() => { + this.videoShow = true + this.initOption() + }) }) }, methods: { diff --git a/frontend/src/components/canvas/custom-component/DeVideo.vue b/frontend/src/components/canvas/custom-component/DeVideo.vue index e9af0c4029..8dc5788c3d 100644 --- a/frontend/src/components/canvas/custom-component/DeVideo.vue +++ b/frontend/src/components/canvas/custom-component/DeVideo.vue @@ -2,12 +2,12 @@
{ + this.showVideo = false + this.$nextTick(() => { + this.showVideo = true + this.initOption() + }) + }) }, methods: { initOption() { @@ -102,9 +111,6 @@ export default { onPlayerPlay(player) { // console.log('player play!', player) }, - onPlayerPause(player) { - // console.log('player pause!', player) - }, onPlayerEnded(player) { // console.log('player ended!', player) }, diff --git a/frontend/src/components/canvas/custom-component/component-list.js b/frontend/src/components/canvas/custom-component/component-list.js index b05b616d1c..b674eaba5f 100644 --- a/frontend/src/components/canvas/custom-component/component-list.js +++ b/frontend/src/components/canvas/custom-component/component-list.js @@ -77,7 +77,8 @@ export const VIDEOLINKS = { remainingTimeDisplay: false, currentTimeDisplay: false, // 当前时间 volumeControl: false, // 声音控制键 - fullscreenToggle: false + fullscreenToggle: false, + pause: false }, sources: [{ }] From 076c3b7fa202b306f5e5787406771f90c312ebf4 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 5 Apr 2022 19:28:58 +0800 Subject: [PATCH 9/9] =?UTF-8?q?fix:=20=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=BD=91=E9=A1=B5=E7=BB=84=E4=BB=B6=E6=9B=B4=E6=8D=A2=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E6=97=A0=E6=B3=95=E7=AB=8B=E5=8D=B3=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canvas/components/Editor/FrameLinks.vue | 2 ++ .../components/canvas/custom-component/DeFrame.vue | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/canvas/components/Editor/FrameLinks.vue b/frontend/src/components/canvas/components/Editor/FrameLinks.vue index 351728af6a..c0e3b21497 100644 --- a/frontend/src/components/canvas/components/Editor/FrameLinks.vue +++ b/frontend/src/components/canvas/components/Editor/FrameLinks.vue @@ -28,6 +28,7 @@ import { mapState } from 'vuex' import { deepCopy } from '@/components/canvas/utils/utils' import { checkAddHttp } from '@/utils/urlUtils' +import bus from '@/utils/bus' export default { props: { @@ -73,6 +74,7 @@ export default { this.linkInfoTemp.src = checkAddHttp(this.linkInfoTemp.src) this.curComponent.frameLinks = this.linkInfoTemp this.$store.state.styleChangeTimes++ + bus.$emit('frameLinksChange-' + this.curComponent.id) this.popoverClose() }, onClose() { diff --git a/frontend/src/components/canvas/custom-component/DeFrame.vue b/frontend/src/components/canvas/custom-component/DeFrame.vue index 44f412cf75..dc27903414 100644 --- a/frontend/src/components/canvas/custom-component/DeFrame.vue +++ b/frontend/src/components/canvas/custom-component/DeFrame.vue @@ -1,7 +1,7 @@