forked from github/dataease
feat: 创建公共链接
This commit is contained in:
parent
a664a79e5f
commit
1eae5f2e37
@ -48,13 +48,11 @@ public class ShiroConfig {
|
|||||||
// 添加自己的过滤器并且取名为jwt
|
// 添加自己的过滤器并且取名为jwt
|
||||||
Map<String, Filter> filterMap = new LinkedHashMap<>();
|
Map<String, Filter> filterMap = new LinkedHashMap<>();
|
||||||
filterMap.put("f2cPerms", new F2CPermissionsFilter());
|
filterMap.put("f2cPerms", new F2CPermissionsFilter());
|
||||||
//filterMap.put("f2cRoles", new F2CRolesFilter());
|
|
||||||
filterMap.put("jwt", new JWTFilter());
|
filterMap.put("jwt", new JWTFilter());
|
||||||
/*filterMap.put("jwt", jwtFilter);*/
|
|
||||||
filterMap.put("logout", new F2CLogoutFilter());
|
filterMap.put("logout", new F2CLogoutFilter());
|
||||||
factoryBean.setSecurityManager(securityManager);
|
factoryBean.setSecurityManager(securityManager);
|
||||||
factoryBean.setLoginUrl("/index.html");
|
factoryBean.setLoginUrl("/login");
|
||||||
factoryBean.setUnauthorizedUrl("/index.html");
|
factoryBean.setUnauthorizedUrl("/login");
|
||||||
factoryBean.setFilterChainDefinitionMap(shiroService.loadFilterChainDefinitionMap());
|
factoryBean.setFilterChainDefinitionMap(shiroService.loadFilterChainDefinitionMap());
|
||||||
factoryBean.setFilters(filterMap);
|
factoryBean.setFilters(filterMap);
|
||||||
return factoryBean;
|
return factoryBean;
|
||||||
|
@ -80,12 +80,14 @@ public class JWTFilter extends BasicHttpAuthenticationFilter {
|
|||||||
}else {
|
}else {
|
||||||
response401(request, response);
|
response401(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String refreshToken(ServletRequest request, ServletResponse response) throws Exception{
|
private String refreshToken(ServletRequest request, ServletResponse response) throws Exception{
|
||||||
// 获取AccessToken(Shiro中getAuthzHeader方法已经实现)
|
// 获取AccessToken(Shiro中getAuthzHeader方法已经实现)
|
||||||
String token = this.getAuthzHeader(request);
|
String token = this.getAuthzHeader(request);
|
||||||
|
@ -34,17 +34,19 @@ public class ShiroServiceImpl implements ShiroService {
|
|||||||
filterChainDefinitionMap.put("/fonts/**", ANON);
|
filterChainDefinitionMap.put("/fonts/**", ANON);
|
||||||
filterChainDefinitionMap.put("/favicon.ico", ANON);
|
filterChainDefinitionMap.put("/favicon.ico", ANON);
|
||||||
filterChainDefinitionMap.put("/", ANON);
|
filterChainDefinitionMap.put("/", ANON);
|
||||||
|
filterChainDefinitionMap.put("/login", ANON);
|
||||||
|
filterChainDefinitionMap.put("/link/**", ANON);
|
||||||
|
filterChainDefinitionMap.put("/test/**", ANON);
|
||||||
filterChainDefinitionMap.put("/index.html", ANON);
|
filterChainDefinitionMap.put("/index.html", ANON);
|
||||||
|
filterChainDefinitionMap.put("/link.html", ANON);
|
||||||
filterChainDefinitionMap.put("/api/auth/login", ANON);
|
filterChainDefinitionMap.put("/api/auth/login", ANON);
|
||||||
filterChainDefinitionMap.put("/unauth", ANON);
|
filterChainDefinitionMap.put("/unauth", ANON);
|
||||||
filterChainDefinitionMap.put("/display/**", ANON);
|
filterChainDefinitionMap.put("/display/**", ANON);
|
||||||
filterChainDefinitionMap.put("/tokenExpired", ANON);
|
filterChainDefinitionMap.put("/tokenExpired", ANON);
|
||||||
filterChainDefinitionMap.put("/downline", ANON);
|
filterChainDefinitionMap.put("/downline", ANON);
|
||||||
filterChainDefinitionMap.put("/common-files/**", ANON);
|
filterChainDefinitionMap.put("/common-files/**", ANON);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
filterChainDefinitionMap.put("/api/auth/logout", "logout");
|
filterChainDefinitionMap.put("/api/auth/logout", "logout");
|
||||||
|
filterChainDefinitionMap.put("/**", "authc");
|
||||||
filterChainDefinitionMap.put("/**", "jwt");
|
filterChainDefinitionMap.put("/**", "jwt");
|
||||||
return filterChainDefinitionMap;
|
return filterChainDefinitionMap;
|
||||||
}
|
}
|
||||||
|
15
backend/src/main/java/io/dataease/base/domain/PanelLink.java
Normal file
15
backend/src/main/java/io/dataease/base/domain/PanelLink.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package io.dataease.base.domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PanelLink implements Serializable {
|
||||||
|
private String resourceId;
|
||||||
|
|
||||||
|
private Boolean enablePwd;
|
||||||
|
|
||||||
|
private String pwd;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
@ -0,0 +1,400 @@
|
|||||||
|
package io.dataease.base.domain;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PanelLinkExample {
|
||||||
|
protected String orderByClause;
|
||||||
|
|
||||||
|
protected boolean distinct;
|
||||||
|
|
||||||
|
protected List<Criteria> oredCriteria;
|
||||||
|
|
||||||
|
public PanelLinkExample() {
|
||||||
|
oredCriteria = new ArrayList<Criteria>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderByClause(String orderByClause) {
|
||||||
|
this.orderByClause = orderByClause;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderByClause() {
|
||||||
|
return orderByClause;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistinct(boolean distinct) {
|
||||||
|
this.distinct = distinct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDistinct() {
|
||||||
|
return distinct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Criteria> getOredCriteria() {
|
||||||
|
return oredCriteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void or(Criteria criteria) {
|
||||||
|
oredCriteria.add(criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria or() {
|
||||||
|
Criteria criteria = createCriteriaInternal();
|
||||||
|
oredCriteria.add(criteria);
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria createCriteria() {
|
||||||
|
Criteria criteria = createCriteriaInternal();
|
||||||
|
if (oredCriteria.size() == 0) {
|
||||||
|
oredCriteria.add(criteria);
|
||||||
|
}
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criteria createCriteriaInternal() {
|
||||||
|
Criteria criteria = new Criteria();
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
oredCriteria.clear();
|
||||||
|
orderByClause = null;
|
||||||
|
distinct = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract static class GeneratedCriteria {
|
||||||
|
protected List<Criterion> criteria;
|
||||||
|
|
||||||
|
protected GeneratedCriteria() {
|
||||||
|
super();
|
||||||
|
criteria = new ArrayList<Criterion>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
return criteria.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Criterion> getAllCriteria() {
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Criterion> getCriteria() {
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addCriterion(String condition) {
|
||||||
|
if (condition == null) {
|
||||||
|
throw new RuntimeException("Value for condition cannot be null");
|
||||||
|
}
|
||||||
|
criteria.add(new Criterion(condition));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addCriterion(String condition, Object value, String property) {
|
||||||
|
if (value == null) {
|
||||||
|
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||||
|
}
|
||||||
|
criteria.add(new Criterion(condition, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||||
|
if (value1 == null || value2 == null) {
|
||||||
|
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||||
|
}
|
||||||
|
criteria.add(new Criterion(condition, value1, value2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceIdIsNull() {
|
||||||
|
addCriterion("resource_id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceIdIsNotNull() {
|
||||||
|
addCriterion("resource_id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceIdEqualTo(String value) {
|
||||||
|
addCriterion("resource_id =", value, "resourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceIdNotEqualTo(String value) {
|
||||||
|
addCriterion("resource_id <>", value, "resourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceIdGreaterThan(String value) {
|
||||||
|
addCriterion("resource_id >", value, "resourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceIdGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("resource_id >=", value, "resourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceIdLessThan(String value) {
|
||||||
|
addCriterion("resource_id <", value, "resourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceIdLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("resource_id <=", value, "resourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceIdLike(String value) {
|
||||||
|
addCriterion("resource_id like", value, "resourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceIdNotLike(String value) {
|
||||||
|
addCriterion("resource_id not like", value, "resourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceIdIn(List<String> values) {
|
||||||
|
addCriterion("resource_id in", values, "resourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceIdNotIn(List<String> values) {
|
||||||
|
addCriterion("resource_id not in", values, "resourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceIdBetween(String value1, String value2) {
|
||||||
|
addCriterion("resource_id between", value1, value2, "resourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceIdNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("resource_id not between", value1, value2, "resourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andEnablePwdIsNull() {
|
||||||
|
addCriterion("enable_pwd is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andEnablePwdIsNotNull() {
|
||||||
|
addCriterion("enable_pwd is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andEnablePwdEqualTo(Boolean value) {
|
||||||
|
addCriterion("enable_pwd =", value, "enablePwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andEnablePwdNotEqualTo(Boolean value) {
|
||||||
|
addCriterion("enable_pwd <>", value, "enablePwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andEnablePwdGreaterThan(Boolean value) {
|
||||||
|
addCriterion("enable_pwd >", value, "enablePwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andEnablePwdGreaterThanOrEqualTo(Boolean value) {
|
||||||
|
addCriterion("enable_pwd >=", value, "enablePwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andEnablePwdLessThan(Boolean value) {
|
||||||
|
addCriterion("enable_pwd <", value, "enablePwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andEnablePwdLessThanOrEqualTo(Boolean value) {
|
||||||
|
addCriterion("enable_pwd <=", value, "enablePwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andEnablePwdIn(List<Boolean> values) {
|
||||||
|
addCriterion("enable_pwd in", values, "enablePwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andEnablePwdNotIn(List<Boolean> values) {
|
||||||
|
addCriterion("enable_pwd not in", values, "enablePwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andEnablePwdBetween(Boolean value1, Boolean value2) {
|
||||||
|
addCriterion("enable_pwd between", value1, value2, "enablePwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andEnablePwdNotBetween(Boolean value1, Boolean value2) {
|
||||||
|
addCriterion("enable_pwd not between", value1, value2, "enablePwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPwdIsNull() {
|
||||||
|
addCriterion("pwd is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPwdIsNotNull() {
|
||||||
|
addCriterion("pwd is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPwdEqualTo(String value) {
|
||||||
|
addCriterion("pwd =", value, "pwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPwdNotEqualTo(String value) {
|
||||||
|
addCriterion("pwd <>", value, "pwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPwdGreaterThan(String value) {
|
||||||
|
addCriterion("pwd >", value, "pwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPwdGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("pwd >=", value, "pwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPwdLessThan(String value) {
|
||||||
|
addCriterion("pwd <", value, "pwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPwdLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("pwd <=", value, "pwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPwdLike(String value) {
|
||||||
|
addCriterion("pwd like", value, "pwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPwdNotLike(String value) {
|
||||||
|
addCriterion("pwd not like", value, "pwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPwdIn(List<String> values) {
|
||||||
|
addCriterion("pwd in", values, "pwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPwdNotIn(List<String> values) {
|
||||||
|
addCriterion("pwd not in", values, "pwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPwdBetween(String value1, String value2) {
|
||||||
|
addCriterion("pwd between", value1, value2, "pwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPwdNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("pwd not between", value1, value2, "pwd");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
||||||
|
protected Criteria() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Criterion {
|
||||||
|
private String condition;
|
||||||
|
|
||||||
|
private Object value;
|
||||||
|
|
||||||
|
private Object secondValue;
|
||||||
|
|
||||||
|
private boolean noValue;
|
||||||
|
|
||||||
|
private boolean singleValue;
|
||||||
|
|
||||||
|
private boolean betweenValue;
|
||||||
|
|
||||||
|
private boolean listValue;
|
||||||
|
|
||||||
|
private String typeHandler;
|
||||||
|
|
||||||
|
public String getCondition() {
|
||||||
|
return condition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getSecondValue() {
|
||||||
|
return secondValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNoValue() {
|
||||||
|
return noValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSingleValue() {
|
||||||
|
return singleValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBetweenValue() {
|
||||||
|
return betweenValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isListValue() {
|
||||||
|
return listValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeHandler() {
|
||||||
|
return typeHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition) {
|
||||||
|
super();
|
||||||
|
this.condition = condition;
|
||||||
|
this.typeHandler = null;
|
||||||
|
this.noValue = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, String typeHandler) {
|
||||||
|
super();
|
||||||
|
this.condition = condition;
|
||||||
|
this.value = value;
|
||||||
|
this.typeHandler = typeHandler;
|
||||||
|
if (value instanceof List<?>) {
|
||||||
|
this.listValue = true;
|
||||||
|
} else {
|
||||||
|
this.singleValue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition, Object value) {
|
||||||
|
this(condition, value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||||
|
super();
|
||||||
|
this.condition = condition;
|
||||||
|
this.value = value;
|
||||||
|
this.secondValue = secondValue;
|
||||||
|
this.typeHandler = typeHandler;
|
||||||
|
this.betweenValue = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, Object secondValue) {
|
||||||
|
this(condition, value, secondValue, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package io.dataease.base.mapper;
|
||||||
|
|
||||||
|
import io.dataease.base.domain.PanelLink;
|
||||||
|
import io.dataease.base.domain.PanelLinkExample;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
public interface PanelLinkMapper {
|
||||||
|
long countByExample(PanelLinkExample example);
|
||||||
|
|
||||||
|
int deleteByExample(PanelLinkExample example);
|
||||||
|
|
||||||
|
int deleteByPrimaryKey(String resourceId);
|
||||||
|
|
||||||
|
int insert(PanelLink record);
|
||||||
|
|
||||||
|
int insertSelective(PanelLink record);
|
||||||
|
|
||||||
|
List<PanelLink> selectByExample(PanelLinkExample example);
|
||||||
|
|
||||||
|
PanelLink selectByPrimaryKey(String resourceId);
|
||||||
|
|
||||||
|
int updateByExampleSelective(@Param("record") PanelLink record, @Param("example") PanelLinkExample example);
|
||||||
|
|
||||||
|
int updateByExample(@Param("record") PanelLink record, @Param("example") PanelLinkExample example);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(PanelLink record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(PanelLink record);
|
||||||
|
}
|
@ -0,0 +1,181 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="io.dataease.base.mapper.PanelLinkMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="io.dataease.base.domain.PanelLink">
|
||||||
|
<id column="resource_id" jdbcType="VARCHAR" property="resourceId" />
|
||||||
|
<result column="enable_pwd" jdbcType="BIT" property="enablePwd" />
|
||||||
|
<result column="pwd" jdbcType="VARCHAR" property="pwd" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Example_Where_Clause">
|
||||||
|
<where>
|
||||||
|
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||||
|
<if test="criteria.valid">
|
||||||
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||||
|
<foreach collection="criteria.criteria" item="criterion">
|
||||||
|
<choose>
|
||||||
|
<when test="criterion.noValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.singleValue">
|
||||||
|
and ${criterion.condition} #{criterion.value}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.betweenValue">
|
||||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.listValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||||
|
#{listItem}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</foreach>
|
||||||
|
</trim>
|
||||||
|
</if>
|
||||||
|
</foreach>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
<sql id="Update_By_Example_Where_Clause">
|
||||||
|
<where>
|
||||||
|
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||||
|
<if test="criteria.valid">
|
||||||
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||||
|
<foreach collection="criteria.criteria" item="criterion">
|
||||||
|
<choose>
|
||||||
|
<when test="criterion.noValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.singleValue">
|
||||||
|
and ${criterion.condition} #{criterion.value}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.betweenValue">
|
||||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.listValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||||
|
#{listItem}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</foreach>
|
||||||
|
</trim>
|
||||||
|
</if>
|
||||||
|
</foreach>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
resource_id, enable_pwd, pwd
|
||||||
|
</sql>
|
||||||
|
<select id="selectByExample" parameterType="io.dataease.base.domain.PanelLinkExample" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<if test="distinct">
|
||||||
|
distinct
|
||||||
|
</if>
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from panel_link
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
<if test="orderByClause != null">
|
||||||
|
order by ${orderByClause}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from panel_link
|
||||||
|
where resource_id = #{resourceId,jdbcType=VARCHAR}
|
||||||
|
</select>
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||||
|
delete from panel_link
|
||||||
|
where resource_id = #{resourceId,jdbcType=VARCHAR}
|
||||||
|
</delete>
|
||||||
|
<delete id="deleteByExample" parameterType="io.dataease.base.domain.PanelLinkExample">
|
||||||
|
delete from panel_link
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" parameterType="io.dataease.base.domain.PanelLink">
|
||||||
|
insert into panel_link (resource_id, enable_pwd, pwd
|
||||||
|
)
|
||||||
|
values (#{resourceId,jdbcType=VARCHAR}, #{enablePwd,jdbcType=BIT}, #{pwd,jdbcType=VARCHAR}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" parameterType="io.dataease.base.domain.PanelLink">
|
||||||
|
insert into panel_link
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="resourceId != null">
|
||||||
|
resource_id,
|
||||||
|
</if>
|
||||||
|
<if test="enablePwd != null">
|
||||||
|
enable_pwd,
|
||||||
|
</if>
|
||||||
|
<if test="pwd != null">
|
||||||
|
pwd,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="resourceId != null">
|
||||||
|
#{resourceId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="enablePwd != null">
|
||||||
|
#{enablePwd,jdbcType=BIT},
|
||||||
|
</if>
|
||||||
|
<if test="pwd != null">
|
||||||
|
#{pwd,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<select id="countByExample" parameterType="io.dataease.base.domain.PanelLinkExample" resultType="java.lang.Long">
|
||||||
|
select count(*) from panel_link
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<update id="updateByExampleSelective" parameterType="map">
|
||||||
|
update panel_link
|
||||||
|
<set>
|
||||||
|
<if test="record.resourceId != null">
|
||||||
|
resource_id = #{record.resourceId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.enablePwd != null">
|
||||||
|
enable_pwd = #{record.enablePwd,jdbcType=BIT},
|
||||||
|
</if>
|
||||||
|
<if test="record.pwd != null">
|
||||||
|
pwd = #{record.pwd,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</update>
|
||||||
|
<update id="updateByExample" parameterType="map">
|
||||||
|
update panel_link
|
||||||
|
set resource_id = #{record.resourceId,jdbcType=VARCHAR},
|
||||||
|
enable_pwd = #{record.enablePwd,jdbcType=BIT},
|
||||||
|
pwd = #{record.pwd,jdbcType=VARCHAR}
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.PanelLink">
|
||||||
|
update panel_link
|
||||||
|
<set>
|
||||||
|
<if test="enablePwd != null">
|
||||||
|
enable_pwd = #{enablePwd,jdbcType=BIT},
|
||||||
|
</if>
|
||||||
|
<if test="pwd != null">
|
||||||
|
pwd = #{pwd,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where resource_id = #{resourceId,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.PanelLink">
|
||||||
|
update panel_link
|
||||||
|
set enable_pwd = #{enablePwd,jdbcType=BIT},
|
||||||
|
pwd = #{pwd,jdbcType=VARCHAR}
|
||||||
|
where resource_id = #{resourceId,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
@ -2,6 +2,7 @@ package io.dataease.controller;
|
|||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@ -15,11 +16,18 @@ public class IndexController {
|
|||||||
|
|
||||||
@GetMapping(value = "/login")
|
@GetMapping(value = "/login")
|
||||||
public String login() {
|
public String login() {
|
||||||
// if (SessionUtils.getUser() == null) {
|
return "index.html";
|
||||||
if (null == null) {
|
|
||||||
return "login.html";
|
|
||||||
} else {
|
|
||||||
return "redirect:/";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/link")
|
||||||
|
public String link() {
|
||||||
|
return "link.html";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/test")
|
||||||
|
public String test() {
|
||||||
|
return "test.html";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package io.dataease.controller.panel.api;
|
||||||
|
|
||||||
|
|
||||||
|
import io.dataease.controller.request.panel.link.LinkRequest;
|
||||||
|
import io.dataease.controller.request.panel.link.PasswordRequest;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Api(tags = "仪表板:链接管理")
|
||||||
|
@RequestMapping("/api/link")
|
||||||
|
public interface LinkApi {
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("设置密码")
|
||||||
|
@PostMapping("/replacePwd")
|
||||||
|
void replacePwd(PasswordRequest request);
|
||||||
|
|
||||||
|
@ApiOperation("生成")
|
||||||
|
@PostMapping("/generate")
|
||||||
|
void generateLink(LinkRequest request);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package io.dataease.controller.panel.server;
|
||||||
|
|
||||||
|
import io.dataease.base.domain.PanelLink;
|
||||||
|
import io.dataease.commons.utils.ServletUtils;
|
||||||
|
import io.dataease.controller.panel.api.LinkApi;
|
||||||
|
import io.dataease.controller.request.panel.link.LinkRequest;
|
||||||
|
import io.dataease.controller.request.panel.link.PasswordRequest;
|
||||||
|
import io.dataease.service.panel.PanelLinkService;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class LinkServer implements LinkApi {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PanelLinkService panelLinkService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void replacePwd(@RequestBody PasswordRequest request) {
|
||||||
|
panelLinkService.password(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateLink(@RequestBody LinkRequest request) {
|
||||||
|
panelLinkService.generator(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package io.dataease.controller.request.panel.link;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class LinkRequest {
|
||||||
|
|
||||||
|
private String resourceId;
|
||||||
|
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
private Boolean enablePwd;
|
||||||
|
|
||||||
|
private String uri;
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package io.dataease.controller.request.panel.link;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PasswordRequest {
|
||||||
|
|
||||||
|
private String resourceId;
|
||||||
|
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
package io.dataease.dto.panel;
|
||||||
|
|
||||||
|
public class PanelLinkDto {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package io.dataease.service.panel;
|
||||||
|
|
||||||
|
import io.dataease.base.domain.PanelLink;
|
||||||
|
import io.dataease.base.mapper.PanelLinkMapper;
|
||||||
|
import io.dataease.controller.request.panel.link.LinkRequest;
|
||||||
|
import io.dataease.controller.request.panel.link.PasswordRequest;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PanelLinkService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PanelLinkMapper mapper;
|
||||||
|
|
||||||
|
public void generator(LinkRequest request){
|
||||||
|
String resourceId = request.getResourceId();
|
||||||
|
PanelLink panelLink = mapper.selectByPrimaryKey(resourceId);
|
||||||
|
PanelLink po = new PanelLink();
|
||||||
|
po.setResourceId(resourceId);
|
||||||
|
po.setEnablePwd(request.getEnablePwd());
|
||||||
|
po.setPwd(request.getPassword());
|
||||||
|
if (ObjectUtils.isEmpty(panelLink)){
|
||||||
|
mapper.insert(po);
|
||||||
|
}else{
|
||||||
|
mapper.updateByPrimaryKey(po);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void password(PasswordRequest request){
|
||||||
|
PanelLink po = new PanelLink();
|
||||||
|
po.setResourceId(request.getResourceId());
|
||||||
|
po.setPwd(request.getPassword());
|
||||||
|
mapper.updateByPrimaryKeySelective(po);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PanelLink findOne(String resourceId){
|
||||||
|
PanelLink panelLink = mapper.selectByPrimaryKey(resourceId);
|
||||||
|
return panelLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -60,6 +60,8 @@ logging.level.org.springframework.boot.web=trace
|
|||||||
spring.mvc.log-request-details=true
|
spring.mvc.log-request-details=true
|
||||||
pagehelper.PageRowBounds=true
|
pagehelper.PageRowBounds=true
|
||||||
|
|
||||||
|
front-url=http://localhost:9528
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -134,3 +134,12 @@ INSERT INTO `file_metadata` VALUES ('VIEW_DEFAULT_IMAGE', 'view-demo.png', 'PNG'
|
|||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `panel_link`;
|
||||||
|
CREATE TABLE `panel_link` (
|
||||||
|
`resource_id` varchar(50) NOT NULL COMMENT '资源ID',
|
||||||
|
`enable_pwd` tinyint(1) default 0 COMMENT '启用密码',
|
||||||
|
`pwd` varchar(255) DEFAULT NULL COMMENT '密码',
|
||||||
|
PRIMARY KEY (`resource_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='仪表板链接';
|
||||||
|
@ -19,7 +19,8 @@ if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
|
|||||||
app.use(
|
app.use(
|
||||||
publicPath,
|
publicPath,
|
||||||
serveStatic('./dist', {
|
serveStatic('./dist', {
|
||||||
index: ['index.html', '/']
|
index: ['index.html', '/'],
|
||||||
|
link: ['link.html']
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
"vue-uuid": "2.0.2",
|
"vue-uuid": "2.0.2",
|
||||||
"vuedraggable": "^2.24.3",
|
"vuedraggable": "^2.24.3",
|
||||||
"vuex": "3.1.0",
|
"vuex": "3.1.0",
|
||||||
|
"vue-clipboard2": "0.3.1",
|
||||||
"webpack": "^4.46.0"
|
"webpack": "^4.46.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
13
frontend/public/link.html
Normal file
13
frontend/public/link.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
|
<link rel="shortcut icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
|
<title>DataEase</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="link"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
18
frontend/src/api/link/index.js
Normal file
18
frontend/src/api/link/index.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function validate(param) {
|
||||||
|
return request({
|
||||||
|
url: 'api/link/validate',
|
||||||
|
method: 'post',
|
||||||
|
loading: true,
|
||||||
|
param
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function generate(param) {
|
||||||
|
return request({
|
||||||
|
url: 'api/link/generate',
|
||||||
|
method: 'post',
|
||||||
|
param
|
||||||
|
})
|
||||||
|
}
|
15
frontend/src/link/Link.vue
Normal file
15
frontend/src/link/Link.vue
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<template>
|
||||||
|
<div id="link"><router-view />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
18
frontend/src/link/link-router.js
Normal file
18
frontend/src/link/link-router.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import Router from 'vue-router'
|
||||||
|
|
||||||
|
Vue.use(Router)
|
||||||
|
|
||||||
|
export default new Router({
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
path: '/',
|
||||||
|
name: 'home',
|
||||||
|
component: () =>
|
||||||
|
import('../views/link/index.vue'),
|
||||||
|
meta: {
|
||||||
|
title: '首页'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
8
frontend/src/link/link.js
Normal file
8
frontend/src/link/link.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import Link from './Link.vue'
|
||||||
|
import router from './link-router'
|
||||||
|
Vue.config.productionTip = false
|
||||||
|
new Vue({
|
||||||
|
router,
|
||||||
|
render: h => h(Link)
|
||||||
|
}).$mount('#link')
|
@ -14,7 +14,7 @@ import '@/permission' // permission control
|
|||||||
import api from '@/api/index.js'
|
import api from '@/api/index.js'
|
||||||
import filter from '@/filter/filter'
|
import filter from '@/filter/filter'
|
||||||
import directives from './directive'
|
import directives from './directive'
|
||||||
|
import VueClipboard from 'vue-clipboard2'
|
||||||
Vue.prototype.$api = api
|
Vue.prototype.$api = api
|
||||||
|
|
||||||
import * as echarts from 'echarts'
|
import * as echarts from 'echarts'
|
||||||
@ -28,7 +28,7 @@ Vue.use(UmyUi)
|
|||||||
import vcolorpicker from 'vcolorpicker'
|
import vcolorpicker from 'vcolorpicker'
|
||||||
|
|
||||||
Vue.use(vcolorpicker)
|
Vue.use(vcolorpicker)
|
||||||
|
Vue.use(VueClipboard)
|
||||||
/**
|
/**
|
||||||
* If you don't want to use mock-server
|
* If you don't want to use mock-server
|
||||||
* you want to use MockJs for mock api
|
* you want to use MockJs for mock api
|
||||||
|
@ -162,3 +162,14 @@ export function formatCondition(param) {
|
|||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getQueryVariable(variable) {
|
||||||
|
const query = window.location.search.substring(1)
|
||||||
|
const vars = query.split('&')
|
||||||
|
for (var i = 0; i < vars.length; i++) {
|
||||||
|
const pair = vars[i].split('=')
|
||||||
|
if (pair[0] === variable) { return pair[1] }
|
||||||
|
}
|
||||||
|
return (false)
|
||||||
|
}
|
||||||
|
|
||||||
|
19
frontend/src/views/link/error/index.vue
Normal file
19
frontend/src/views/link/error/index.vue
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
我是错误页面
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'LinkError',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
88
frontend/src/views/link/generate/index.vue
Normal file
88
frontend/src/views/link/generate/index.vue
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form ref="createOrganization" inline :model="form" size="small" label-width="80px">
|
||||||
|
|
||||||
|
<el-form-item label="链接分享">
|
||||||
|
<el-switch
|
||||||
|
v-model="valid"
|
||||||
|
style="width: 370px;"
|
||||||
|
:active-value="true"
|
||||||
|
:inactive-value="false"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label=" ">
|
||||||
|
<el-link class="de-link" style="width: 370px;" disabled>开启链接后,任何人可通过此链接访问仪表板。</el-link>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="valid" label="链接">
|
||||||
|
<el-input
|
||||||
|
v-model.number="form.uri"
|
||||||
|
disabled
|
||||||
|
style="width: 370px;"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item v-if="valid" label=" ">
|
||||||
|
<el-checkbox v-model="form.enablePwd">密码保护</el-checkbox>
|
||||||
|
|
||||||
|
<span v-if="form.enablePwd" class="de-span">{{ form.pwd }}</span>
|
||||||
|
<span v-if="form.enablePwd" class="de-span"><el-link :underline="false" type="primary">重置</el-link></span>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<div v-if="valid" class="auth-root-class">
|
||||||
|
<span slot="footer">
|
||||||
|
|
||||||
|
<el-button v-if="!form.enablePwd" v-clipboard:copy="form.uri" v-clipboard:success="onCopy" v-clipboard:error="onError" type="primary">复制链接及</el-button>
|
||||||
|
<el-button v-if="form.enablePwd" v-clipboard:copy="form.uri + ' 密码: '+ form.pwd" v-clipboard:success="onCopy" v-clipboard:error="onError" type="primary">复制链接及密码</el-button>
|
||||||
|
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
|
||||||
|
name: 'LinkGenerate',
|
||||||
|
components: {
|
||||||
|
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
resourceId: {
|
||||||
|
type: String,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
valid: false,
|
||||||
|
form: {},
|
||||||
|
defaultForm: { enablePwd: false, pwd: '000000', uri: 'http://baidu.com' }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.form = this.defaultForm
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onCopy(e) {
|
||||||
|
// alert('You just copied: ' + e.text)
|
||||||
|
},
|
||||||
|
onError(e) {
|
||||||
|
// alert('Failed to copy texts')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.de-link{
|
||||||
|
justify-content: left !important;
|
||||||
|
}
|
||||||
|
.de-span {
|
||||||
|
margin: 0 15px;
|
||||||
|
}
|
||||||
|
.auth-root-class {
|
||||||
|
margin: 15px 0px 5px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
64
frontend/src/views/link/index.vue
Normal file
64
frontend/src/views/link/index.vue
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<link-error v-if="showIndex===0" />
|
||||||
|
<link-pwd v-if="showIndex===1" />
|
||||||
|
<link-view v-if="showIndex===2" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { getQueryVariable } from '@/utils/index'
|
||||||
|
import { validate } from '@/api/link'
|
||||||
|
import LinkView from './view'
|
||||||
|
import LinkError from './error'
|
||||||
|
import LinkPwd from './pwd'
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
LinkError, LinkPwd, LinkView
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
PARAMKEY: 'link',
|
||||||
|
link: null,
|
||||||
|
showIndex: -1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.loadInit()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
loadInit() {
|
||||||
|
this.link = getQueryVariable(this.PARAMKEY)
|
||||||
|
validate(this.buildParam()).then(res => {
|
||||||
|
const { valid, enablePwd, passPwd } = res.data
|
||||||
|
// 如果链接无效 直接显示无效页面
|
||||||
|
!valid && this.showError()
|
||||||
|
|
||||||
|
// 如果未启用密码 直接显示视图页面
|
||||||
|
!enablePwd && this.showView()
|
||||||
|
|
||||||
|
// 如果启用密码 但是未通过密码验证 显示密码框
|
||||||
|
!passPwd && this.showPwd()
|
||||||
|
|
||||||
|
this.showView()
|
||||||
|
})
|
||||||
|
console.log(this.link)
|
||||||
|
},
|
||||||
|
buildParam() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
// 显示无效链接
|
||||||
|
showError() {
|
||||||
|
this.showIndex = 0
|
||||||
|
},
|
||||||
|
// 显示密码框
|
||||||
|
showPwd() {
|
||||||
|
this.showIndex = 1
|
||||||
|
},
|
||||||
|
// 显示仪表板
|
||||||
|
showView() {
|
||||||
|
this.showIndex = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
19
frontend/src/views/link/pwd/index.vue
Normal file
19
frontend/src/views/link/pwd/index.vue
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
我是密码页面
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'LinkPwd',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
19
frontend/src/views/link/view/index.vue
Normal file
19
frontend/src/views/link/view/index.vue
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
我是视图7u页面
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'LinkView',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -91,6 +91,10 @@
|
|||||||
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-edit" :command="beforeClickMore('edit',data,node)">
|
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-edit" :command="beforeClickMore('edit',data,node)">
|
||||||
{{ $t('panel.edit') }}
|
{{ $t('panel.edit') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
|
||||||
|
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-paperclip" :command="beforeClickMore('link',data,node)">
|
||||||
|
创建公共链接
|
||||||
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</span>
|
</span>
|
||||||
@ -124,19 +128,35 @@
|
|||||||
<el-button type="primary" @click="authVisible = false">确 定</el-button>
|
<el-button type="primary" @click="authVisible = false">确 定</el-button>
|
||||||
</span> -->
|
</span> -->
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
:title="linkTitle"
|
||||||
|
:visible.sync="linkVisible"
|
||||||
|
custom-class="de-dialog"
|
||||||
|
@closed="removeLink"
|
||||||
|
>
|
||||||
|
<link-generate v-if="linkVisible" :resource-id="linkResourceId" />
|
||||||
|
<!-- <span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="copyUri">复制链接</el-button>
|
||||||
|
</span> -->
|
||||||
|
</el-dialog>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-col>
|
</el-col>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import GrantAuth from '../GrantAuth'
|
import GrantAuth from '../GrantAuth'
|
||||||
|
import LinkGenerate from '@/views/link/generate'
|
||||||
import { loadTable, getScene, addGroup, delGroup, addTable, delTable, groupTree, defaultTree } from '@/api/panel/panel'
|
import { loadTable, getScene, addGroup, delGroup, addTable, delTable, groupTree, defaultTree } from '@/api/panel/panel'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PanelList',
|
name: 'PanelList',
|
||||||
components: { GrantAuth },
|
components: { GrantAuth, LinkGenerate },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
linkTitle: '链接分享',
|
||||||
|
linkVisible: false,
|
||||||
|
linkResourceId: null,
|
||||||
authTitle: null,
|
authTitle: null,
|
||||||
authResourceId: null,
|
authResourceId: null,
|
||||||
authVisible: false,
|
authVisible: false,
|
||||||
@ -235,6 +255,9 @@ export default {
|
|||||||
case 'edit':
|
case 'edit':
|
||||||
this.edit(param.data)
|
this.edit(param.data)
|
||||||
break
|
break
|
||||||
|
case 'link':
|
||||||
|
this.link(param.data)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -497,6 +520,14 @@ export default {
|
|||||||
edit(data) {
|
edit(data) {
|
||||||
this.$store.dispatch('panel/setPanelInfo', data)
|
this.$store.dispatch('panel/setPanelInfo', data)
|
||||||
this.$router.replace('/panelEdit')
|
this.$router.replace('/panelEdit')
|
||||||
|
},
|
||||||
|
link(data) {
|
||||||
|
this.linkVisible = true
|
||||||
|
this.linkResourceId = data.id
|
||||||
|
},
|
||||||
|
removeLink() {
|
||||||
|
this.linkVisible = false
|
||||||
|
this.linkResourceId = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@ module.exports = {
|
|||||||
devServer: {
|
devServer: {
|
||||||
port: port,
|
port: port,
|
||||||
proxy: {
|
proxy: {
|
||||||
['^(?!/login)']: {
|
'^(?!/login)': {
|
||||||
target: 'http://localhost:8081/',
|
target: 'http://localhost:8081/',
|
||||||
ws: false,
|
ws: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
open: true,
|
open: true,
|
||||||
@ -27,6 +27,18 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
before: require('./mock/mock-server.js')
|
before: require('./mock/mock-server.js')
|
||||||
},
|
},
|
||||||
|
pages: {
|
||||||
|
index: {
|
||||||
|
entry: 'src/main.js',
|
||||||
|
template: 'public/index.html',
|
||||||
|
filename: 'index.html'
|
||||||
|
},
|
||||||
|
link: {
|
||||||
|
entry: 'src/link/link.js',
|
||||||
|
template: 'public/link.html',
|
||||||
|
filename: 'link.html'
|
||||||
|
}
|
||||||
|
},
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
name: name,
|
name: name,
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
@ -54,105 +66,3 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// module.exports = {
|
|
||||||
|
|
||||||
// publicPath: '/',
|
|
||||||
// outputDir: 'dist',
|
|
||||||
// assetsDir: 'static',
|
|
||||||
// lintOnSave: process.env.NODE_ENV === 'development',
|
|
||||||
// productionSourceMap: false,
|
|
||||||
// css: {
|
|
||||||
// sourceMap: true // 开启 CSS source maps
|
|
||||||
// },
|
|
||||||
// devServer: {
|
|
||||||
// port: port,
|
|
||||||
// open: true,
|
|
||||||
// overlay: {
|
|
||||||
// warnings: false,
|
|
||||||
// errors: true
|
|
||||||
// },
|
|
||||||
// before: require('./mock/mock-server.js')
|
|
||||||
// },
|
|
||||||
// configureWebpack: {
|
|
||||||
|
|
||||||
// name: name,
|
|
||||||
// resolve: {
|
|
||||||
// alias: {
|
|
||||||
// '@': resolve('src')
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// chainWebpack(config) {
|
|
||||||
// config.plugins.delete('preload') // TODO: need test
|
|
||||||
// config.plugins.delete('prefetch') // TODO: need test
|
|
||||||
|
|
||||||
// config.module
|
|
||||||
// .rule('svg')
|
|
||||||
// .exclude.add(resolve('src/icons'))
|
|
||||||
// .end()
|
|
||||||
// config.module
|
|
||||||
// .rule('icons')
|
|
||||||
// .test(/\.svg$/)
|
|
||||||
// .include.add(resolve('src/icons'))
|
|
||||||
// .end()
|
|
||||||
// .use('svg-sprite-loader')
|
|
||||||
// .loader('svg-sprite-loader')
|
|
||||||
// .options({
|
|
||||||
// symbolId: 'icon-[name]'
|
|
||||||
// })
|
|
||||||
// .end()
|
|
||||||
|
|
||||||
// config.module
|
|
||||||
// .rule('vue')
|
|
||||||
// .use('vue-loader')
|
|
||||||
// .loader('vue-loader')
|
|
||||||
// .tap(options => {
|
|
||||||
// options.compilerOptions.preserveWhitespace = true
|
|
||||||
// return options
|
|
||||||
// })
|
|
||||||
// .end()
|
|
||||||
|
|
||||||
// config
|
|
||||||
// .when(process.env.NODE_ENV === 'development',
|
|
||||||
// config => config.devtool('source-map')
|
|
||||||
// )
|
|
||||||
|
|
||||||
// config
|
|
||||||
// .when(process.env.NODE_ENV !== 'development',
|
|
||||||
// config => {
|
|
||||||
// config
|
|
||||||
// .plugin('ScriptExtHtmlWebpackPlugin')
|
|
||||||
// .after('html')
|
|
||||||
// .use('script-ext-html-webpack-plugin', [{
|
|
||||||
// inline: /runtime\..*\.js$/
|
|
||||||
// }])
|
|
||||||
// .end()
|
|
||||||
// config
|
|
||||||
// .optimization.splitChunks({
|
|
||||||
// chunks: 'all',
|
|
||||||
// cacheGroups: {
|
|
||||||
// libs: {
|
|
||||||
// name: 'chunk-libs',
|
|
||||||
// test: /[\\/]node_modules[\\/]/,
|
|
||||||
// priority: 10,
|
|
||||||
// chunks: 'initial' // only package third parties that are initially dependent
|
|
||||||
// },
|
|
||||||
// elementUI: {
|
|
||||||
// name: 'chunk-elementUI', // split elementUI into a single package
|
|
||||||
// priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
|
|
||||||
// test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
|
|
||||||
// },
|
|
||||||
// commons: {
|
|
||||||
// name: 'chunk-commons',
|
|
||||||
// test: resolve('src/components'), // can customize your rules
|
|
||||||
// minChunks: 3, // minimum common number
|
|
||||||
// priority: 5,
|
|
||||||
// reuseExistingChunk: true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// config.optimization.runtimeChunk('single')
|
|
||||||
// }
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
Loading…
Reference in New Issue
Block a user