提交 8a04a2d1 authored 作者: taojinlong's avatar taojinlong

refactor: 去掉 unused imports

......@@ -2,7 +2,7 @@
<h3 align="center">人人可用的开源数据可视化分析工具</h3>
<p align="center">
<a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0"><img src="https://img.shields.io/github/license/dataease/dataease?color=%231890FF&style=flat-square" alt="License: GPL v2"></a>
<a href="https://app.codacy.com/gh/metersphere/metersphere?utm_source=github.com&utm_medium=referral&utm_content=metersphere/metersphere&utm_campaign=Badge_Grade_Dashboard"><img src="https://api.codacy.com/project/badge/Grade/176186d132df448b955f8bdd5e6ef9c0" alt="Codacy"></a>
<a href="https://app.codacy.com/gh/dataease/dataease?utm_source=github.com&utm_medium=referral&utm_content=dataease/dataease&utm_campaign=Badge_Grade_Dashboard"><img src="https://app.codacy.com/project/badge/Grade/da67574fd82b473992781d1386b937ef" alt="Codacy"></a>
<a href="https://github.com/dataease/dataease/releases/latest"><img src="https://img.shields.io/github/v/release/dataease/dataease" alt="Latest release"></a>
<a href="https://github.com/dataease/dataease"><img src="https://img.shields.io/github/stars/dataease/dataease?color=%231890FF&style=flat-square" alt="Stars"></a>
<a href="https://github.com/dataease/dataease/releases/latest"><img src="https://img.shields.io/github/downloads/dataease/dataease/total" alt="Downloads"></a>
......
......@@ -7,6 +7,7 @@ import io.dataease.auth.service.AuthUserService;
import io.dataease.auth.util.JWTUtils;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.commons.utils.LogUtil;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authc.AuthenticationException;
......@@ -95,7 +96,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter {
AuthUserService authUserService = CommonBeanFactory.getBean(AuthUserService.class);
SysUserEntity user = authUserService.getUserById(tokenInfo.getUserId());
if(user == null){
throw new Exception(Translator.get("i18n_not_find_user"));
DataEaseException.throwException(Translator.get("i18n_not_find_user"));
}
String password = user.getPassword();
......
......@@ -14,6 +14,7 @@ import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.CodingUtil;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -40,10 +41,10 @@ public class AuthServer implements AuthApi {
SysUserEntity user = authUserService.getUserByName(username);
if (ObjectUtils.isEmpty(user)) {
throw new RuntimeException(Translator.get("i18n_id_or_pwd_error"));
DataEaseException.throwException(Translator.get("i18n_id_or_pwd_error"));
}
if (user.getEnabled() == 0) {
throw new RuntimeException(Translator.get("i18n_id_or_pwd_error"));
DataEaseException.throwException(Translator.get("i18n_id_or_pwd_error"));
}
String realPwd = user.getPassword();
//私钥解密
......@@ -52,7 +53,7 @@ public class AuthServer implements AuthApi {
pwd = CodingUtil.md5(pwd);
if (!StringUtils.equals(pwd, realPwd)) {
throw new RuntimeException(Translator.get("i18n_id_or_pwd_error"));
DataEaseException.throwException(Translator.get("i18n_id_or_pwd_error"));
}
Map<String, Object> result = new HashMap<>();
TokenInfo tokenInfo = TokenInfo.builder().userId(user.getUserId()).username(username).build();
......
......@@ -7,6 +7,7 @@ import com.auth0.jwt.exceptions.JWTDecodeException;
import com.auth0.jwt.interfaces.DecodedJWT;
import io.dataease.auth.entity.TokenInfo;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.exception.DataEaseException;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.env.Environment;
......@@ -50,7 +51,7 @@ public class JWTUtils {
String username = jwt.getClaim("username").asString();
Long userId = jwt.getClaim("userId").asLong();
if (StringUtils.isEmpty(username) || ObjectUtils.isEmpty(userId) ){
throw new RuntimeException("token格式错误!");
DataEaseException.throwException("token格式错误!");
}
TokenInfo tokenInfo = TokenInfo.builder().username(username).userId(userId).build();
return tokenInfo;
......
......@@ -5,6 +5,7 @@ package io.dataease.controller;
import com.google.gson.Gson;
import io.dataease.commons.license.DefaultLicenseService;
import io.dataease.commons.license.F2CLicenseResponse;
import io.dataease.exception.DataEaseException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -35,11 +36,12 @@ public class LicenseController {
return ResultHolder.success(null);
case expired:
String expired = f2CLicenseResponse.getLicense().getExpired();
throw new Exception("License has expired since " + expired + ", please update license.");
DataEaseException.throwException("License has expired since " + expired + ", please update license.");
case invalid:
throw new Exception(f2CLicenseResponse.getMessage());
DataEaseException.throwException(f2CLicenseResponse.getMessage());
default:
throw new Exception("Invalid License.");
DataEaseException.throwException("Invalid License.");
}
return new ResultHolder();
}
}
......@@ -7,6 +7,7 @@ import io.dataease.datasource.dto.MysqlConfigration;
import io.dataease.datasource.dto.SqlServerConfigration;
import io.dataease.datasource.dto.TableFiled;
import io.dataease.datasource.request.DatasourceRequest;
import io.dataease.exception.DataEaseException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
......@@ -31,9 +32,9 @@ public class JdbcProvider extends DatasourceProvider {
ResultSet rs = stat.executeQuery(datasourceRequest.getQuery());
list = fetchResult(rs);
} catch (SQLException e) {
throw new Exception("ERROR:" + e.getMessage(), e);
DataEaseException.throwException(e);
} catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e);
DataEaseException.throwException(e);
} finally {
if(connection != null){
connection.close();
......@@ -50,9 +51,9 @@ public class JdbcProvider extends DatasourceProvider {
Boolean result = stat.execute(datasourceRequest.getQuery());
stat.close();
} catch (SQLException e) {
throw new Exception("ERROR:" + e.getMessage(), e);
DataEaseException.throwException(e);
} catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e);
DataEaseException.throwException(e);
} finally {
if(connection != null){
connection.close();
......@@ -70,14 +71,15 @@ public class JdbcProvider extends DatasourceProvider {
rs = stat.executeQuery(datasourceRequest.getQuery());
return fetchResult(rs);
} catch (SQLException e) {
throw new Exception("ERROR:" + e.getMessage(), e);
DataEaseException.throwException(e);
} catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e);
DataEaseException.throwException(e);
} finally {
if(connection != null){
connection.close();
}
}
return new ArrayList<>();
}
private List<String[]> fetchResult(ResultSet rs) throws Exception {
......@@ -112,14 +114,15 @@ public class JdbcProvider extends DatasourceProvider {
rs = stat.executeQuery(datasourceRequest.getQuery());
return fetchResultField(rs);
} catch (SQLException e) {
throw new Exception("ERROR:" + e.getMessage(), e);
DataEaseException.throwException(e);
} catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e);
DataEaseException.throwException(e);
} finally {
if(connection != null){
connection.close();
}
}
return new ArrayList<>();
}
@Override
......@@ -139,14 +142,15 @@ public class JdbcProvider extends DatasourceProvider {
result.put("fieldList", fieldList);
return result;
} catch (SQLException e) {
throw new Exception("ERROR:" + e.getMessage(), e);
DataEaseException.throwException(e);
} catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e);
DataEaseException.throwException(e);
} finally {
if(connection != null){
connection.close();
}
}
return new HashMap<>();
}
private List<TableFiled> fetchResultField(ResultSet rs) throws Exception {
......@@ -183,12 +187,13 @@ public class JdbcProvider extends DatasourceProvider {
statement.close();
return tables;
} catch (Exception e) {
throw new Exception("ERROR: " + e.getMessage(), e);
DataEaseException.throwException(e);
} finally {
if(con != null){
con.close();
}
}
return new ArrayList<>();
}
@Override
......@@ -222,9 +227,9 @@ public class JdbcProvider extends DatasourceProvider {
}
resultSet.close();
} catch (SQLException e) {
throw new Exception("ERROR:" + e.getMessage(), e);
DataEaseException.throwException(e);
} catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e);
DataEaseException.throwException(e);
} finally {
if(connection != null){
connection.close();
......@@ -244,7 +249,7 @@ public class JdbcProvider extends DatasourceProvider {
resultSet.close();
ps.close();
} catch (Exception e) {
throw new Exception("ERROR: " + e.getMessage(), e);
DataEaseException.throwException(e);
} finally {
if(con != null){con.close();}
}
......@@ -261,7 +266,7 @@ public class JdbcProvider extends DatasourceProvider {
return resultSet.getLong(1);
}
} catch (Exception e) {
throw new Exception("ERROR: " + e.getMessage(), e);
DataEaseException.throwException( e);
} finally {
con.close();
}
......
......@@ -18,6 +18,7 @@ import io.dataease.datasource.provider.ProviderFactory;
import io.dataease.datasource.request.DatasourceRequest;
import io.dataease.dto.DatasourceDTO;
import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.service.dataset.DataSetGroupService;
import org.apache.commons.collections4.CollectionUtils;
......@@ -97,7 +98,7 @@ public class DatasourceService {
example.createCriteria().andDataSourceIdEqualTo(datasourceId);
List<DatasetTable> datasetTables = datasetTableMapper.selectByExample(example);
if(CollectionUtils.isNotEmpty(datasetTables)){
throw new Exception(datasetTables.size() + Translator.get("i18n_datasource_not_allow_delete_msg"));
DataEaseException.throwException(datasetTables.size() + Translator.get("i18n_datasource_not_allow_delete_msg"));
}
datasourceMapper.deleteByPrimaryKey(datasourceId);
}
......
......@@ -4,6 +4,7 @@ import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import io.dataease.commons.utils.LogUtil;
import io.dataease.exception.DataEaseException;
import io.dataease.exception.ExcelException;
import javax.servlet.http.HttpServletResponse;
......@@ -31,10 +32,10 @@ public class EasyExcelExporter {
EasyExcel.write(response.getOutputStream(), this.clazz).registerWriteHandler(horizontalCellStyleStrategy).sheet(sheetName).doWrite(data);
} catch (UnsupportedEncodingException e) {
LogUtil.error(e.getMessage(), e);
throw new ExcelException("Utf-8 encoding is not supported");
DataEaseException.throwException("Utf-8 encoding is not supported");
} catch (IOException e) {
LogUtil.error(e.getMessage(), e);
throw new ExcelException("IO exception");
DataEaseException.throwException("IO exception");
}
}
......
package io.dataease.job.sechedule;
import io.dataease.commons.utils.LogUtil;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.TriggerKey;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.SimpleTrigger;
import org.quartz.TriggerBuilder;
import org.quartz.SimpleScheduleBuilder;
import org.quartz.Trigger;
import org.quartz.CronScheduleBuilder;
import org.quartz.CronTrigger;
import org.quartz.CronExpression;
import org.quartz.JobExecutionContext;
import io.dataease.exception.DataEaseException;
import org.quartz.*;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
......@@ -111,7 +97,7 @@ public class ScheduleManager {
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
throw new RuntimeException(e);
DataEaseException.throwException(e);
}
}
......@@ -141,7 +127,7 @@ public class ScheduleManager {
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
throw new RuntimeException(e);
DataEaseException.throwException(e);
}
}
......@@ -202,7 +188,7 @@ public class ScheduleManager {
// addJob(jobName, jobGroupName, triggerName, triggerGroupName, jobClass, cron);
/** 方式二 :先删除,然后在创建一个新的Job */
} catch (Exception e) {
throw new RuntimeException(e);
DataEaseException.throwException(e);
}
}
......@@ -254,7 +240,7 @@ public class ScheduleManager {
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
throw new RuntimeException(e);
DataEaseException.throwException(e);
}
}
......@@ -286,7 +272,7 @@ public class ScheduleManager {
}
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
throw new RuntimeException(e);
DataEaseException.throwException(e);
}
}
......@@ -310,7 +296,7 @@ public class ScheduleManager {
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
throw new RuntimeException(e);
DataEaseException.throwException(e);
}
}
......@@ -320,7 +306,7 @@ public class ScheduleManager {
sched.start();
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
throw new RuntimeException(e);
DataEaseException.throwException(e);
}
}
......@@ -332,7 +318,7 @@ public class ScheduleManager {
}
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
throw new RuntimeException(e);
DataEaseException.throwException(e);
}
}
......@@ -431,7 +417,7 @@ public class ScheduleManager {
public static CronTrigger getCronTrigger(String cron) {
if (!CronExpression.isValidExpression(cron)) {
throw new RuntimeException("cron :" + cron + " error");
DataEaseException.throwException("cron :" + cron + " error");
}
return TriggerBuilder.newTrigger().withIdentity("Calculate Date").withSchedule(CronScheduleBuilder.cronSchedule(cron)).build();
......
......@@ -18,6 +18,7 @@ import io.dataease.datasource.provider.JdbcProvider;
import io.dataease.datasource.provider.ProviderFactory;
import io.dataease.datasource.request.DatasourceRequest;
import io.dataease.dto.dataset.*;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.provider.DDLProvider;
import io.dataease.provider.QueryProvider;
......@@ -412,7 +413,7 @@ public class DataSetTableService {
String sql = new Gson().fromJson(dataSetTableRequest.getInfo(), DataTableInfoDTO.class).getSql();
if (StringUtils.isEmpty(sql)) {
throw new Exception(Translator.get("i18n_sql_not_empty"));
DataEaseException.throwException(Translator.get("i18n_sql_not_empty"));
}
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
String sqlAsTable = qp.createSQLPreview(sql, null);
......@@ -734,7 +735,7 @@ public class DataSetTableService {
});
sort(sqlFileds);
if (!originNameFileds.equals(sqlFileds)) {
throw new Exception(Translator.get("i18n_sql_add_not_matching") + sqlFileds.toString());
DataEaseException.throwException(Translator.get("i18n_sql_add_not_matching") + sqlFileds.toString());
}
}
if (StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalDelete()) && StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalDelete().replace(" ", ""))) {// 增量删除
......@@ -747,7 +748,7 @@ public class DataSetTableService {
});
sort(sqlFileds);
if (!originNameFileds.equals(sqlFileds)) {
throw new Exception(Translator.get("i18n_sql_delete_not_matching") + sqlFileds.toString());
DataEaseException.throwException(Translator.get("i18n_sql_delete_not_matching") + sqlFileds.toString());
}
}
}
......
......@@ -8,6 +8,7 @@ import io.dataease.base.mapper.DatasetTableTaskMapper;
import io.dataease.commons.constants.JobStatus;
import io.dataease.commons.constants.ScheduleType;
import io.dataease.controller.request.dataset.DataSetTaskRequest;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.service.ScheduleService;
import org.apache.commons.lang3.ObjectUtils;
......@@ -71,11 +72,11 @@ public class DataSetTableTaskService {
if (datasetTableTask.getType().equalsIgnoreCase("add_scope")) {
DatasetTable datasetTable = dataSetTableService.get(datasetTableTask.getTableId());
if (datasetTable.getLastUpdateTime() == 0 || datasetTable.getLastUpdateTime() == null) {
throw new Exception(Translator.get("i18n_not_exec_add_sync"));
DataEaseException.throwException(Translator.get("i18n_not_exec_add_sync"));
}
}
if (extractDataService.updateSyncStatusIsNone(dataSetTableService.get(datasetTableTask.getTableId()))) {
throw new Exception(Translator.get("i18n_sync_job_exists"));
DataEaseException.throwException(Translator.get("i18n_sync_job_exists"));
} else {
//write log
DatasetTableTaskLog datasetTableTaskLog = new DatasetTableTaskLog();
......
......@@ -21,6 +21,7 @@ import io.dataease.datasource.provider.JdbcProvider;
import io.dataease.datasource.provider.ProviderFactory;
import io.dataease.datasource.request.DatasourceRequest;
import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.provider.QueryProvider;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FileUtils;
......@@ -460,7 +461,7 @@ public class ExtractDataService {
if (jobStatus.getStatusDescription().equals("Finished")) {
return;
} else {
throw new Exception(jobStatus.getLoggingString());
DataEaseException.throwException((jobStatus.getLoggingString()));
}
}
......
......@@ -10,6 +10,7 @@ import io.dataease.commons.utils.TreeUtils;
import io.dataease.controller.request.panel.PanelGroupRequest;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.service.chart.ChartViewService;
import io.dataease.service.sys.SysAuthService;
......@@ -119,7 +120,7 @@ public class PanelGroupService {
List<PanelGroup> checkResult = panelGroupMapper.selectByExample(groupExample);
if (CollectionUtils.isNotEmpty(checkResult)) {
throw new RuntimeException(Translator.get("i18n_same_folder_can_not_repeat"));
DataEaseException.throwException(Translator.get("i18n_same_folder_can_not_repeat"));
}
}
......
......@@ -41,13 +41,16 @@ public class PanelSubjectService {
public List<PanelSubject> query(PanelSubjectRequest request){
PanelSubjectExample example = new PanelSubjectExample();
return panelSubjectMapper.selectByExampleWithBLOBs(null);
example.setOrderByClause( "create_time asc");
return panelSubjectMapper.selectByExampleWithBLOBs(example);
}
public List querySubjectWithGroup(PanelSubjectRequest request){
List result = new ArrayList();
int pageSize = 4;
List<PanelSubject> allInfo = panelSubjectMapper.selectByExampleWithBLOBs(null);
PanelSubjectExample example = new PanelSubjectExample();
example.setOrderByClause( "create_time asc");
List<PanelSubject> allInfo = panelSubjectMapper.selectByExampleWithBLOBs(example);
for(int i =0;i<allInfo.size();i=i+pageSize){
List<PanelSubject> tmp = allInfo.subList(i,i+pageSize<allInfo.size()?i+pageSize:allInfo.size());
result.add(tmp);
......
......@@ -8,6 +8,7 @@ import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.controller.request.panel.PanelTemplateRequest;
import io.dataease.dto.panel.PanelTemplateDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
......@@ -70,7 +71,7 @@ public class PanelTemplateService {
request.setPid(request.getTemplateType());
String nameCheckResult = this.nameCheck(CommonConstants.OPT_TYPE.INSERT,request.getName(),request.getPid(),null);
if(CommonConstants.CHECK_RESULT.EXIST_ALL.equals(nameCheckResult)){
throw new RuntimeException(Translator.get("i18n_same_folder_can_not_repeat"));
DataEaseException.throwException(Translator.get("i18n_same_folder_can_not_repeat"));
}
}else{//模板插入 相同文件夹同名的模板进行覆盖(先删除)
PanelTemplateExample exampleDelete = new PanelTemplateExample();
......@@ -81,7 +82,7 @@ public class PanelTemplateService {
} else {
String nameCheckResult = this.nameCheck(CommonConstants.OPT_TYPE.UPDATE,request.getName(),request.getPid(),request.getId());
if(CommonConstants.CHECK_RESULT.EXIST_ALL.equals(nameCheckResult)){
throw new RuntimeException(Translator.get("i18n_same_folder_can_not_repeat"));
DataEaseException.throwException(Translator.get("i18n_same_folder_can_not_repeat"));
}
panelTemplateMapper.updateByPrimaryKeySelective(request);
}
......
......@@ -47,7 +47,9 @@ module.exports = {
'curly': [2, 'multi-line'],
'dot-location': [2, 'property'],
'eol-last': 2,
'eqeqeq': ["error", "always", {"null": "ignore"}],
'eqeqeq': ["error", "always", {
"null": "ignore"
}],
'generator-star-spacing': [2, {
'before': true,
'after': true
......
......@@ -1495,9 +1495,9 @@ export default {
addEvent(window, 'resize', this.checkParentSize)
},
createdFunction() {
// eslint-disable-next-line 无效的prop:minWidth不能大于maxWidth
// minWidth不能大于maxWidth
if (this.maxWidth && this.minWidth > this.maxWidth) console.warn('[Vdr warn]: Invalid prop: minWidth cannot be greater than maxWidth')
// eslint-disable-next-line 无效prop:minHeight不能大于maxHeight'
// minHeight不能大于maxHeight
if (this.maxWidth && this.minHeight > this.maxHeight) console.warn('[Vdr warn]: Invalid prop: minHeight cannot be greater than maxHeight')
this.elmX = 0
this.elmY = 0
......
......@@ -2,9 +2,9 @@
<div ref="rightPanel" :class="{show:show}" class="rightPanel-container">
<div class="rightPanel-background" />
<div class="rightPanel">
<!-- <div class="handle-button" :style="{'top':buttonTop+'px','background-color':theme}" @click="show=!show">-->
<!-- <i :class="show?'el-icon-close':'el-icon-setting'" />-->
<!-- </div>-->
<!-- <div class="handle-button" :style="{'top':buttonTop+'px','background-color':theme}" @click="show=!show">-->
<!-- <i :class="show?'el-icon-close':'el-icon-setting'" />-->
<!-- </div>-->
<div class="rightPanel-items">
<slot />
</div>
......
......@@ -21,9 +21,9 @@
<el-tab-pane v-for="item in animationClassData" :key="item.label" :label="item.label" :name="item.label">
<el-scrollbar class="animate-container">
<div
class="animate"
v-for="(animate, index) in item.children"
:key="index"
class="animate"
@mouseover="hoverPreviewAnimate = animate.value"
@click="addAnimation(animate)"
>
......@@ -52,11 +52,11 @@ export default {
hoverPreviewAnimate: '',
animationActiveName: '进入',
animationClassData,
showAnimatePanel: false,
showAnimatePanel: false
}
},
computed: mapState([
'curComponent',
'curComponent'
]),
methods: {
addAnimation(animate) {
......@@ -70,8 +70,8 @@ export default {
removeAnimation(index) {
this.$store.commit('removeAnimation', index)
},
},
}
}
}
</script>
......
......@@ -59,7 +59,7 @@ export default {
bus.$emit('component-dialog-edit')
}
//编辑样式组件
// 编辑样式组件
if (this.curComponent.type === 'v-text' || this.curComponent.type === 'rect-shape') {
bus.$emit('component-dialog-style')
......
......@@ -39,11 +39,11 @@ export default {
isShowEvent: false,
eventURL: '',
eventActiveName: 'redirect',
eventList,
eventList
}
},
computed: mapState([
'curComponent',
'curComponent'
]),
methods: {
addEvent(event, param) {
......@@ -53,8 +53,8 @@ export default {
removeEvent(event) {
this.$store.commit('removeEvent', event)
},
},
}
}
}
</script>
......
<template>
<div class="modal-bg" v-if="show" @click="hide">
<div v-if="show" class="modal-bg" @click="hide">
<div class="fadeInLeft animated modal" @click="stopPropagation">
<slot></slot>
<slot />
</div>
</div>
</template>
......@@ -10,13 +10,13 @@
export default {
model: {
prop: 'show',
event: 'change',
event: 'change'
},
props: {
show: {
type: Boolean,
default: false,
},
default: false
}
},
methods: {
hide() {
......@@ -25,8 +25,8 @@ export default {
stopPropagation(e) {
e.stopPropagation()
},
},
}
}
}
</script>
......
......@@ -3,12 +3,12 @@
<div>
<template v-for="item in propValue">
<component
class="component"
:is="item.component"
:style="item.groupStyle"
:propValue="item.propValue"
:key="item.id"
:id="'component' + item.id"
:key="item.id"
class="component"
:style="item.groupStyle"
:prop-value="item.propValue"
:element="item"
/>
</template>
......@@ -23,11 +23,11 @@ export default {
props: {
propValue: {
type: Array,
default: () => [],
default: () => []
},
element: {
type: Object,
},
type: Object
}
},
created() {
const parentStyle = this.element.style
......@@ -47,8 +47,8 @@ export default {
methods: {
toPercent(val) {
return val * 100 + '%'
},
},
}
}
}
</script>
......
......@@ -9,9 +9,9 @@ export default {
props: {
propValue: {
type: String,
require: true,
},
},
require: true
}
}
}
</script>
......
......@@ -7,9 +7,9 @@ export default {
props: {
propValue: {
type: String,
default: '',
},
},
default: ''
}
}
}
</script>
......
......@@ -6,6 +6,6 @@ export default {
removeAnimation({ curComponent }, index) {
curComponent.animations.splice(index, 1)
},
},
}
}
}
......@@ -2,7 +2,7 @@ export default {
state: {
menuTop: 0, // 右击菜单数据
menuLeft: 0,
menuShow: false,
menuShow: false
},
mutations: {
showContextMenu(state, { top, left }) {
......@@ -13,6 +13,6 @@ export default {
hideContextMenu(state) {
state.menuShow = false
},
},
}
}
}
......@@ -6,14 +6,14 @@ import { deepCopy } from '@/components/canvas/utils/utils'
export default {
state: {
copyData: null, // 复制粘贴剪切
isCut: false,
isCut: false
},
mutations: {
copy(state) {
if (!state.curComponent) return
state.copyData = {
data: deepCopy(state.curComponent),
index: state.curComponentIndex,
index: state.curComponentIndex
}
state.isCut = false
......@@ -62,6 +62,6 @@ export default {
store.commit('copy')
store.commit('deleteComponent')
state.isCut = true
},
},
}
}
}
......@@ -6,6 +6,6 @@ export default {
removeEvent({ curComponent }, event) {
delete curComponent.events[event]
},
},
}
}
}
......@@ -6,6 +6,6 @@ export default {
unlock({ curComponent }) {
curComponent.isLock = false
},
},
}
}
}
......@@ -37,8 +37,8 @@ export default [
{ label: '向右滑动展开', value: 'slideInLeft' },
{ label: '向左滑动展开', value: 'slideInRight' },
{ label: '向上滑动展开', value: 'slideInUp' },
{ label: '向下滑动展开', value: 'slideInDown' },
],
{ label: '向下滑动展开', value: 'slideInDown' }
]
},
{
label: '强调',
......@@ -52,8 +52,8 @@ export default [
{ label: '放大晃动缩小', value: 'tada' },
{ label: '扇形摇摆', value: 'wobble' },
{ label: '左右上下晃动', value: 'jello' },
{ label: 'Y轴旋转', value: 'flip' },
],
{ label: 'Y轴旋转', value: 'flip' }
]
},
{
label: '退出',
......@@ -88,7 +88,7 @@ export default [
{ label: '向左滑动收起', value: 'slideOutLeft' },
{ label: '向右滑动收起', value: 'slideOutRight' },
{ label: '向上滑动收起', value: 'slideOutUp' },
{ label: '向下滑动收起', value: 'slideOutDown' },
],
},
{ label: '向下滑动收起', value: 'slideOutDown' }
]
}
]
......@@ -7,7 +7,7 @@ export default function decomposeComponent(component, editorRect, parentStyle) {
// 获取元素的中心点坐标
const center = {
x: componentRect.left - editorRect.left + componentRect.width / 2,
y: componentRect.top - editorRect.top + componentRect.height / 2,
y: componentRect.top - editorRect.top + componentRect.height / 2
}
component.style.rotate = mod360(component.style.rotate + parentStyle.rotate)
......
......@@ -10,11 +10,11 @@ const events = {
if (msg) {
alert(msg)
}
},
}
}
const mixins = {
methods: events,
methods: events
}
const eventList = [
......@@ -22,18 +22,18 @@ const eventList = [
key: 'redirect',
label: '跳转事件',
event: events.redirect,
param: '',
param: ''
},
{
key: 'alert',
label: 'alert 事件',
event: events.alert,
param: '',
},
param: ''
}
]
export {
mixins,
events,
eventList,
eventList
}
import store from '@/store'
import eventBus from '@/components/canvas/utils/eventBus'
const ctrlKey = 17,
vKey = 86, // 粘贴
cKey = 67, // 复制
xKey = 88, // 剪切
const ctrlKey = 17
const vKey = 86 // 粘贴
const cKey = 67 // 复制
const xKey = 88 // 剪切
yKey = 89, // 重做
zKey = 90, // 撤销
const yKey = 89 // 重做
const zKey = 90 // 撤销
gKey = 71, // 组合
bKey = 66, // 拆分
const gKey = 71 // 组合
const bKey = 66 // 拆分
lKey = 76, // 锁定
uKey = 85, // 解锁
const lKey = 76 // 锁定
const uKey = 85 // 解锁
sKey = 83, // 保存
pKey = 80, // 预览
dKey = 68, // 删除
deleteKey = 46, // 删除
eKey = 69 // 清空画布
const sKey = 83 // 保存
const pKey = 80 // 预览
const dKey = 68 // 删除
const deleteKey = 46 // 删除
const eKey = 69 // 清空画布
export const keycodes = [66, 67, 68, 69, 71, 76, 80, 83, 85, 86, 88, 89, 90]
......@@ -30,13 +30,13 @@ const basemap = {
[zKey]: undo,
[sKey]: save,
[pKey]: preview,
[eKey]: clearCanvas,
[eKey]: clearCanvas
}
// 组件锁定状态下可以执行的操作
const lockMap = {
...basemap,
[uKey]: unlock,
[uKey]: unlock
}
// 组件未锁定状态下可以执行的操作
......@@ -48,7 +48,7 @@ const unlockMap = {
[bKey]: decompose,
[dKey]: deleteComponent,
[deleteKey]: deleteComponent,
[lKey]: lock,
[lKey]: lock
}
let isCtrlDown = false
......
......@@ -4,6 +4,6 @@ export default function toast(message = '', type = 'error', duration = 1500) {
Message({
message,
type,
duration,
duration
})
}
export function deepCopy(target) {
if (typeof target == 'object') {
const result = Array.isArray(target)? [] : {}
if (typeof target === 'object') {
const result = Array.isArray(target) ? [] : {}
for (const key in target) {
if (typeof target[key] == 'object') {
if (typeof target[key] === 'object') {
result[key] = deepCopy(target[key])
} else {
result[key] = target[key]
......
......@@ -871,6 +871,13 @@ export default {
input_limit_2_25: '2-25 chars',
input_limit_0_50: '0-50 chars'
},
pblink: {
key_pwd: 'Please enter the password to open the link',
input_placeholder: 'Please enter the 4-digit password',
pwd_error: 'Wrong password',
pwd_format_error: 'Please enter the 4-digit password',
sure_bt: 'Confirm'
},
panel: {
no_auth_role: 'Unshared roles',
auth_role: 'Shared roles',
......
......@@ -871,6 +871,13 @@ export default {
input_limit_2_25: '2-25字符',
input_limit_0_50: '0-50字符'
},
pblink: {
key_pwd: '請輸入密碼打開鏈接',
input_placeholder: '請輸入4位數字密碼',
pwd_error: '密碼錯誤',
pwd_format_error: '請輸入4位數字密碼',
sure_bt: '確定'
},
panel: {
no_auth_role: '未分享角色',
auth_role: '已分享角色',
......
......@@ -871,6 +871,13 @@ export default {
input_limit_2_25: '2-25字符',
input_limit_0_50: '0-50字符'
},
pblink: {
key_pwd: '请输入密码打开链接',
input_placeholder: '请输入4位数字密码',
pwd_error: '密码错误',
pwd_format_error: '请输入4位数字密码',
sure_bt: '确定'
},
panel: {
no_auth_role: '未分享角色',
auth_role: '已分享角色',
......
......@@ -5,14 +5,18 @@
<div class="span-header">
<div class="bi-text">
请输入密码打开链接
{{ $t('pblink.key_pwd') }}
</div>
</div>
<div class="input-layout">
<div class="input-main">
<div class="div-input">
<el-input v-model="pwd" class="real-input" />
<el-form ref="pwdForm" :model="form" :rules="rule" size="small">
<el-form-item prop="password">
<el-input v-model="form.password" maxlength="4" show-password class="real-input" :placeholder="$t('pblink.input_placeholder')" />
</el-form-item>
</el-form>
</div>
</div>
<div class="abs-input">
......@@ -22,7 +26,7 @@
<div class="auth-root-class">
<span slot="footer">
<el-button size="mini" type="primary" @click="refresh">确定</el-button>
<el-button size="mini" type="primary" @click="refresh">{{ $t('pblink.sure_bt') }}</el-button>
</span>
</div>
</div>
......@@ -45,25 +49,39 @@ export default {
},
data() {
return {
pwd: null,
msg: null
msg: null,
form: { password: null },
rule: {
password: [
{ required: true, message: this.$t('pblink.key_pwd'), trigger: 'blur' },
{
required: true,
pattern: /^\d{4}$/,
message: this.$t('pblink.pwd_format_error'),
trigger: 'blur'
}
]
}
}
},
methods: {
// 验证密码是否正确 如果正确 设置请求头部带LINK-PWD-TOKEN=entrypt(pwd)再刷新页面
refresh() {
this.$refs.pwdForm.validate(valid => {
if (!valid) return false
const param = {
password: encrypt(this.pwd),
password: encrypt(this.form.password),
resourceId: this.resourceId
}
validatePwd(param).then(res => {
if (!res.data) {
this.msg = '密码错误'
this.msg = this.$t('pblink.pwd_error')
} else {
window.location.reload()
}
})
})
}
}
}
......@@ -145,25 +163,25 @@ export default {
display: block;
}
.input-layout{
width: 152px;
width: 200px;
position: relative;
margin: 0px auto;
padding: 0;
display: block;
}
.input-main {
width: 150px;
height: 30px;
width: 192px;
height: 35px;
position: relative;
margin-top: 30px;
border: 1px solid #e8eaed;
display: block;
}
.div-input {
inset: 2px 4px;
position: absolute;
display: block;
}
// .div-input {
// inset: 2px 4px;
// position: absolute;
// display: block;
// }
.abs-input {
height: 20px;
position: relative;
......@@ -183,18 +201,18 @@ export default {
color: #E65251;
box-sizing: border-box;
}
.real-input {
width: 100%;
height: 100%;
border: none;
outline: none;
padding: 0px;
margin: 0px;
inset: 0px;
position: absolute;
display: block;
// .real-input {
// width: 100%;
// height: 100%;
// border: none;
// outline: none;
// padding: 0px;
// margin: 0px;
// inset: 0px;
// position: absolute;
// display: block;
}
// }
.auth-root-class {
margin: 15px 0px 5px;
text-align: center;
......
......@@ -80,7 +80,7 @@ export default {
background: '0% 0% / cover rgb(239, 241, 244)'
}
if (this.subjectItemDetails) {
if (this.subjectItemDetails.panel.backgroundType === 'image'&&this.subjectItemDetails.panel.imageUrl) {
if (this.subjectItemDetails.panel.backgroundType === 'image' && this.subjectItemDetails.panel.imageUrl) {
style = {
width: '100%',
height: '100%',
......
......@@ -20,14 +20,14 @@
<background-color-selector v-if="chart" class="attr-selector" :chart="chart" @onChangeBackgroundForm="onChangeBackgroundForm" />
</el-row>
</el-collapse-item>
<el-collapse-item :title="$t('panel.table')" name="table">
<el-collapse-item :title="$t('chart.shape_attr')" name="graphical">
<el-row style="background-color: #f7f8fa; margin: 5px">
<color-selector index="10002" :source-type="'panelTable'" class="attr-selector" :chart="tableChart" @onColorChange="onTableColorChange" />
<color-selector :source-type="'panelEchart'" class="attr-selector" :chart="chart" @onColorChange="onColorChange" />
</el-row>
</el-collapse-item>
<el-collapse-item :title="$t('chart.shape_attr')" name="graphical">
<el-collapse-item :title="$t('panel.table')" name="table">
<el-row style="background-color: #f7f8fa; margin: 5px">
<color-selector :source-type="'panelEchart'" class="attr-selector" :chart="chart" @onColorChange="onColorChange" />
<color-selector index="10002" :source-type="'panelTable'" class="attr-selector" :chart="tableChart" @onColorChange="onTableColorChange" />
</el-row>
</el-collapse-item>
</el-collapse>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论