Commit 972cc0e7 authored by liboyang's avatar liboyang

前后端分离

parent 601b1180
......@@ -46,24 +46,11 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<!--引入log4j2作为日志组件-->
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
......@@ -73,23 +60,14 @@
<!-- shiro相关 -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<artifactId>shiro-spring-boot-web-starter</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.github.theborakompanioni</groupId>
<artifactId>thymeleaf-extras-shiro</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
......@@ -97,11 +75,6 @@
<version>1.1.8</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
......@@ -109,6 +82,20 @@
<classifier>jdk15</classifier>
</dependency>
<!-- MyBatis分页插件 -->
<!--<dependency>-->
<!--<groupId>com.github.pagehelper</groupId>-->
<!--<artifactId>pagehelper</artifactId>-->
<!--<version>4.2.1</version>-->
<!--</dependency>-->
<!-- sql解析工具 -->
<!--<dependency>-->
<!--<groupId>com.github.jsqlparser</groupId>-->
<!--<artifactId>jsqlparser</artifactId>-->
<!--<version>0.9.5</version>-->
<!--</dependency>-->
</dependencies>
......
package com.yxproject.start;
import com.yxproject.start.config.JerseyConfig;
import org.glassfish.jersey.servlet.ServletContainer;
import org.glassfish.jersey.servlet.ServletProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
/**
* @author Administrator
*/
@SpringBootApplication
public class Main{
@Bean
public ServletRegistrationBean jerseyServlet() {
ServletRegistrationBean registration = new ServletRegistrationBean(new ServletContainer(), "/rest/*");
registration.addInitParameter(ServletProperties.JAXRS_APPLICATION_CLASS,
JerseyConfig.class.getName());
return registration;
}
public static void main(String[] args) {
SpringApplication.run(Main.class, args);
}
......
......@@ -8,30 +8,24 @@ import com.yxproject.start.service.UserInfoService;
import com.yxproject.start.utils.YXJSONResponse;
import net.sf.json.JSONObject;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.Context;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
*/
@Controller
public class ShiroApi {
@RestController
@RequestMapping("user")
public class UserApi {
@Autowired
private ProductionTaskListService productionTaskListService;
......@@ -45,49 +39,40 @@ public class ShiroApi {
@Autowired
private SysPermissionService sysPermissionService;
@RequestMapping(value={"/","/index"})
public String index(Map<String,Object> map){
System.out.println("HomeController.index()");
//获取到用户信息;
Subject subject = SecurityUtils.getSubject();
UserInfo ui = (UserInfo) subject.getPrincipal();
map.put("userInfo",ui);
return "/index";
}
@RequestMapping("/welcome")
public String welcome(Map<String,Object> map){
//获取到用户信息;
Subject subject = SecurityUtils.getSubject();
UserInfo ui = (UserInfo) subject.getPrincipal();
map.put("userInfo",ui);
return "/welcome";
@PostMapping("login")
public Map<String, Object> submitLogin(@RequestBody String jsonStr) {
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
String username = jsonObject.getString("username");
String password = jsonObject.getString("password");
Map<String, Object> resultMap = new LinkedHashMap<String, Object>();
Subject currentUser = SecurityUtils.getSubject();
// 把用户名和密码封装为 UsernamePasswordToken 对象
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
try {
currentUser.login(token);
UserInfo userInfo = (UserInfo) SecurityUtils.getSubject().getPrincipal();
resultMap.put("status", 200);
resultMap.put("message", "登录成功");
resultMap.put("user",userInfo);
} catch (UnknownAccountException e) {
resultMap.put("status", 201);
resultMap.put("message", "账号不存在!");
}catch(IncorrectCredentialsException e1){
resultMap.put("status", 202);
resultMap.put("message", "密码错误!");
}catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message", "用户名密码错误");
}
return resultMap;
}
@RequestMapping("/userLogin")
public String login(HttpServletRequest request, Map<String, Object> map) throws Exception {
System.out.println("HomeController.login()");
// 登录失败从request中获取shiro处理的异常信息。
// shiroLoginFailure:就是shiro异常类的全类名.
String exception = (String) request.getAttribute("shiroLoginFailure");
System.out.println("exception=" + exception);
String msg = "";
if (exception != null) {
if (UnknownAccountException.class.getName().equals(exception)) {
msg = "账号不存在!";
} else if (IncorrectCredentialsException.class.getName().equals(exception)) {
msg = "密码不正确!";
} else if ("kaptchaValidateFailed".equals(exception)) {
msg = "验证码错误!";
} else if(AuthenticationException.class.getName().equals(exception)){
msg = "用户名密码不能为空!";
}else{
msg = exception;
}
@RequestMapping("logout")
public void logout() {
Subject subject = SecurityUtils.getSubject();
if (subject.isAuthenticated()) {
subject.logout();
}
map.put("msg", msg);
// 此方法不处理登录成功,由shiro进行处理
return "/login";
}
......@@ -195,11 +180,13 @@ public class ShiroApi {
@RequestMapping(value = "/getProductionTaskListByID",method = RequestMethod.GET)
@RequiresPermissions("userInfo.del")//权限管理;
@ResponseBody
public String getProductionTaskListByID(@RequestParam("id") String id,@Context HttpServletResponse resp){
public String getProductionTaskListByID(@RequestParam("id") String id
// ,@Context HttpServletResponse resp
){
List<ProductionTaskListEntity> productionTaskListEntity = productionTaskListService.findProductionTaskListEntityByID(id);
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
// resp.setCharacterEncoding("UTF-8");
yxjsonResponse.outPutSuccess(productionTaskListEntity);
Map map = new HashMap();
// map.put("MakeType",productionTaskListEntity);
......@@ -213,12 +200,12 @@ public class ShiroApi {
@RequestMapping(value = "/updateProductionTask",method = RequestMethod.GET)
@RequiresPermissions("userInfo.add")//权限管理;
@ResponseBody
public String updateProductionTask(@RequestParam("id") String id,@Context HttpServletResponse resp){
public String updateProductionTask(@RequestParam("id") String id){
String map ="{\"productionTaskListId\":\"20181016001\",\"makeType\":4,\"oldMakeType\":7}";
JSONObject jsonObject = JSONObject.fromObject(map);
ProductionTaskListEntity productionTaskListEntity = (ProductionTaskListEntity)jsonObject.toBean(jsonObject, ProductionTaskListEntity.class);
ProductionTaskListEntity productionTaskListEntity = (ProductionTaskListEntity)JSONObject.toBean(jsonObject, ProductionTaskListEntity.class);
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
// resp.setCharacterEncoding("UTF-8");
int i = productionTaskListService.updateProductionTask(productionTaskListEntity);
yxjsonResponse.outPutSuccess(i+"更新成功");
return yxjsonResponse.toJSONString();
......@@ -231,7 +218,7 @@ public class ShiroApi {
@RequestMapping(value = "/addProductionTaskList",method = RequestMethod.GET)
@RequiresPermissions("userInfo.add")//权限管理;
@ResponseBody
public String addProductionTaskList(@RequestParam("id") String id,@Context HttpServletResponse resp){
public String addProductionTaskList(@RequestParam("id") String id){
String map ="{\"productionTaskListId\":\"20181016001\",\"makeType\":4,\"oldMakeType\":7}";
JSONObject jsonObject = JSONObject.fromObject(map);
Object productionTaskList = jsonObject.get("productionTaskList");
......@@ -240,7 +227,7 @@ public class ShiroApi {
ProductionTaskListEntity productionTaskListEntity = (ProductionTaskListEntity)productionTaskList;
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
// resp.setCharacterEncoding("UTF-8");
int i = productionTaskListService.addProductionTaskListEntity(productionTaskListEntity,groupinfoEntities);
yxjsonResponse.outPutSuccess(i+"添加成功");
return yxjsonResponse.toJSONString();
......@@ -253,10 +240,10 @@ public class ShiroApi {
@RequestMapping(value = "/findCardInfoByCardIDOrAcceptNo",method = RequestMethod.GET)
@RequiresPermissions("userInfo.add")//权限管理;
@ResponseBody
public String findCardInfoByCardIDOrAcceptNo(@RequestParam("id") String id,@Context HttpServletResponse resp){
public String findCardInfoByCardIDOrAcceptNo(@RequestParam("id") String id){
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
// resp.setCharacterEncoding("UTF-8");
List<Object> cardInfoByCardIDOrAcceptNo = productionTaskListService.findCardInfoByCardIDOrAcceptNo(id);
yxjsonResponse.outPutSuccess(cardInfoByCardIDOrAcceptNo);
return yxjsonResponse.toJSONString();
......@@ -269,10 +256,10 @@ public class ShiroApi {
@RequestMapping(value = "/addQuickCyclesheetInfo",method = RequestMethod.GET)
@RequiresPermissions("userInfo.add")//权限管理;
@ResponseBody
public String addQuickCyclesheetInfo(@RequestParam("id") String id,@Context HttpServletResponse resp){
public String addQuickCyclesheetInfo(@RequestParam("id") String id){
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
// resp.setCharacterEncoding("UTF-8");
int i = productionTaskListService.addQuickCyclesheetInfo(id);
yxjsonResponse.outPutSuccess(i+"添加成功");
return yxjsonResponse.toJSONString();
......
package com.yxproject.start.config;
import com.yxproject.start.api.UserInfoApi;
import org.glassfish.jersey.server.ResourceConfig;
public class JerseyConfig extends ResourceConfig {
public JerseyConfig() {
register(UserInfoApi.class);
}
}
......@@ -5,14 +5,15 @@ import com.yxproject.start.entity.SysPermission;
import com.yxproject.start.entity.SysRole;
import com.yxproject.start.entity.UserInfo;
import com.yxproject.start.service.ProductionTaskListService;
import com.yxproject.start.service.LoginService;
import com.yxproject.start.service.UserInfoService;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.crypto.hash.Sha256Hash;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.util.ByteSource;
......@@ -27,20 +28,24 @@ public class MyShiroRealm extends AuthorizingRealm {
@Autowired
private UserInfoService userInfoService;
@Autowired
private ProductionTaskListService productionTaskListService;
@Autowired
private LoginService loginService;
//告诉shiro如何根据获取到的用户信息中的密码和盐值来校验密码
{
//设置用于匹配密码的CredentialsMatcher
HashedCredentialsMatcher hashMatcher = new HashedCredentialsMatcher();
hashMatcher.setHashAlgorithmName("md5");
hashMatcher.setHashIterations(1024);
this.setCredentialsMatcher(hashMatcher);
}
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
System.out.println(principals.getPrimaryPrincipal());
System.out.println("权限配置-->MyShiroRealm.doGetAuthorizationInfo()");
SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
UserInfo user = (UserInfo)principals.getPrimaryPrincipal();
for(SysRole role:user.getRoleList()){
UserInfo userInfo = (UserInfo)principals.getPrimaryPrincipal();
for(SysRole role:userInfo.getRoleList()){
authorizationInfo.addRole(role.getRole());
for(SysPermission memu:role.getPermissions()){
authorizationInfo.addStringPermission(memu.getPermission());
for(SysPermission p:role.getPermissions()){
authorizationInfo.addStringPermission(p.getPermission());
}
}
return authorizationInfo;
......@@ -62,7 +67,7 @@ public class MyShiroRealm extends AuthorizingRealm {
System.out.println(token.getCredentials().toString());
//通过username从数据库中查找 User对象,如果找到,没找到.
//实际项目中,这里可以根据实际情况做缓存,如果不做,Shiro自己也是有时间间隔机制,2分钟内不会重复执行该方法
UserInfo user = loginService.findByUsername(username);
UserInfo user = userInfoService.findByUsername(username);
if(user == null || user.getState()==1){
return null;
}
......
package com.yxproject.start.config;
import at.pollux.thymeleaf.shiro.dialect.ShiroDialect;
import com.alibaba.druid.pool.DruidDataSourceFactory;
import com.yxproject.start.utils.DatabaseType;
import com.yxproject.start.utils.DynamicDataSource;
......@@ -10,8 +9,11 @@ import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.realm.Realm;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition;
import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
......@@ -30,181 +32,44 @@ import java.util.*;
*/
@Configuration
public class ShiroConfig {
@Bean
public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager) {
System.out.println("ShiroConfiguration.shiroFilter()");
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
shiroFilterFactoryBean.setSecurityManager(securityManager);
//拦截器.
Map<String,String> filterChainDefinitionMap = new LinkedHashMap<String,String>();
// 配置不会被拦截的链接 顺序判断
filterChainDefinitionMap.put("/favicon.ico", "anon");
filterChainDefinitionMap.put("/static/**", "anon");
filterChainDefinitionMap.put("/css/**", "anon");
filterChainDefinitionMap.put("/js/**", "anon");
filterChainDefinitionMap.put("/fonts/**", "anon");
filterChainDefinitionMap.put("/images/**", "anon");
filterChainDefinitionMap.put("/lib/**", "anon");
filterChainDefinitionMap.put("/layui/**", "anon");
filterChainDefinitionMap.put("/modules/**", "anon");
filterChainDefinitionMap.put("/laydate/**", "anon");
filterChainDefinitionMap.put("/default/**", "anon");
filterChainDefinitionMap.put("/layer/**", "anon");
filterChainDefinitionMap.put("/lay/**", "anon");
//配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了
filterChainDefinitionMap.put("/logout", "logout");
//<!-- 过滤链定义,从上向下顺序执行,一般将/**放在最为下边 -->:这是一个坑呢,一不小心代码就不好使了;
filterChainDefinitionMap.put("/**", "authc");
// 如果不设置默认会自动寻找Web工程根目录下的"/login.jsp"页面
shiroFilterFactoryBean.setLoginUrl("/userLogin");
// 登录成功后要跳转的链接
shiroFilterFactoryBean.setSuccessUrl("/index");
//<!-- authc:所有url都必须认证通过才可以访问; anon:所有url都都可以匿名访问-->
@Autowired
private MyShiroRealm realm;
//未授权界面;
shiroFilterFactoryBean.setUnauthorizedUrl("/403");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}
/**
* 凭证匹配器
* (由于我们的密码校验交给Shiro的SimpleAuthenticationInfo进行处理了
* )
* @return
*/
@Bean
public HashedCredentialsMatcher hashedCredentialsMatcher(){
HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher();
//散列算法:这里使用MD5算法;
hashedCredentialsMatcher.setHashAlgorithmName("md5");
//散列的次数,比如散列两次,相当于 md5("");
hashedCredentialsMatcher.setHashIterations(1024);
return hashedCredentialsMatcher;
public MyShiroRealm customRealm() {
return new MyShiroRealm();
}
@Bean
public MyShiroRealm myShiroRealm(){
MyShiroRealm myShiroRealm = new MyShiroRealm();
myShiroRealm.setCredentialsMatcher(hashedCredentialsMatcher());
return myShiroRealm;
}
@Bean
public SecurityManager securityManager(){
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
List<Realm> realms = new ArrayList<>();
realms.add(myShiroRealm());
securityManager.setRealms(realms);
public DefaultWebSecurityManager securityManager() {
System.out.println("添加了DefaultWebSecurityManager");
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
securityManager.setRealm(realm);
return securityManager;
}
@Bean
public static DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator(){
DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator=new DefaultAdvisorAutoProxyCreator();
defaultAdvisorAutoProxyCreator.setUsePrefix(true);
/**
* 开启shiro aop注解支持.
* 使用代理方式;所以需要开启代码支持;
* @param securityManager
* @return
*/
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager){
AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
authorizationAttributeSourceAdvisor.setSecurityManager(securityManager);
return authorizationAttributeSourceAdvisor;
return defaultAdvisorAutoProxyCreator;
}
@Bean(name="simpleMappingExceptionResolver")
public SimpleMappingExceptionResolver
createSimpleMappingExceptionResolver() {
SimpleMappingExceptionResolver r = new SimpleMappingExceptionResolver();
Properties mappings = new Properties();
//数据库异常处理
mappings.setProperty("DatabaseException", "databaseError");
mappings.setProperty("UnauthorizedException","403");
r.setExceptionMappings(mappings);
r.setDefaultErrorView("error");
r.setExceptionAttribute("ex");
return r;
}
@Bean(name = "shiroDialect")
public ShiroDialect shiroDialect(){
return new ShiroDialect();
@Bean
public ShiroFilterChainDefinition shiroFilterChainDefinition() {
System.out.println("添加了过滤器链");
DefaultShiroFilterChainDefinition chainDefinition = new DefaultShiroFilterChainDefinition();
chainDefinition.addPathDefinition("/admin/**", "authc");
chainDefinition.addPathDefinition("/admin/**", "roles[admin]");
chainDefinition.addPathDefinition("/user/login", "anon");
chainDefinition.addPathDefinition("/user/logout", "anon");
chainDefinition.addPathDefinition("/user/**", "authc");
chainDefinition.addPathDefinition("/**", "anon");
return chainDefinition;
}
// @Autowired
// private Environment env;
//
// /**
// * 创建数据源(数据源的名称:方法名可以取为XXXDataSource(),XXX为数据库名称,该名称也就是数据源的名称)
// */
// @Bean
// public DataSource prodDataSource() throws Exception {
// Properties props = new Properties();
// props.put("driverClassName", env.getProperty("jdbc.driverClassName"));
// props.put("url", env.getProperty("jdbc.url"));
// props.put("username", env.getProperty("jdbc.username"));
// props.put("password", env.getProperty("jdbc.password"));
// return DruidDataSourceFactory.createDataSource(props);
// }
//
// @Bean
// public DataSource accuDataSource() throws Exception {
// Properties props = new Properties();
// props.put("driverClassName", env.getProperty("jdbc2.driverClassName"));
// props.put("url", env.getProperty("jdbc2.url"));
// props.put("username", env.getProperty("jdbc2.username"));
// props.put("password", env.getProperty("jdbc2.password"));
// return DruidDataSourceFactory.createDataSource(props);
// }
//
// /**
// * @Primary 该注解表示在同一个接口有多个实现类可以注入的时候,默认选择哪一个,而不是让@autowire注解报错
// * @Qualifier 根据名称进行注入,通常是在具有相同的多个类型的实例的一个注入(例如有多个DataSource类型的实例)
// */
// @Bean
// @Primary
// public DynamicDataSource dataSource(@Qualifier("prodDataSource") DataSource myTestDbDataSource,
// @Qualifier("accuDataSource") DataSource myTestDb2DataSource) {
// Map<Object, Object> targetDataSources = new HashMap<>();
// targetDataSources.put(DatabaseType.mytestdb, myTestDbDataSource);
// targetDataSources.put(DatabaseType.mytestdb2, myTestDb2DataSource);
//
// DynamicDataSource dataSource = new DynamicDataSource();
// dataSource.setTargetDataSources(targetDataSources);// 该方法是AbstractRoutingDataSource的方法
// dataSource.setDefaultTargetDataSource(myTestDbDataSource);// 默认的datasource设置为myTestDbDataSource
//
// return dataSource;
// }
//
// /**
// * 根据数据源创建SqlSessionFactory
// */
// @Bean
// public SqlSessionFactory sqlSessionFactory(DynamicDataSource ds) throws Exception {
// SqlSessionFactoryBean fb = new SqlSessionFactoryBean();
// fb.setDataSource(ds);// 指定数据源(这个必须有,否则报错)
// // 下边两句仅仅用于*.xml文件,如果整个持久层操作不需要使用到xml文件的话(只用注解就可以搞定),则不加
// fb.setTypeAliasesPackage(env.getProperty("mybatis.typeAliasesPackage"));// 指定基包
// fb.setMapperLocations(
// new PathMatchingResourcePatternResolver().getResources(env.getProperty("mybatis.mapperLocations")));//
//
// return fb.getObject();
// }
//
// /**
// * 配置事务管理器
// */
// @Bean
// public DataSourceTransactionManager transactionManager(DynamicDataSource dataSource) throws Exception {
// return new DataSourceTransactionManager(dataSource);
// }
}
\ No newline at end of file
}
package com.yxproject.start.mapper;
import com.yxproject.start.entity.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.Map;
/**
* @author Administrator
*/
@Repository
public interface LoginMapper extends CrudRepository<UserInfo,Long> {
/**
* 通过用户名查询用户信息
* @param username
* @return
*/
public UserInfo findUserByUsername(String username);
}
......@@ -17,7 +17,7 @@ public interface SysPermissionMapper{
* @param sysPermission
*/
@Insert("INSERT INTO sys_permission (id,available,name,parent_id,parent_ids,permission,resource_type,url)\n" +
"VALUES (PERMISSION_seq.nextval,0,#{name},#{parent_id},#{parent_ids},#{permission},#{resource_type},#{url})")
"VALUES (PERMISSION_seq.nextval,0,#{name},'0','0/',#{permission},#{resource_type},'')")
public void addPermissionByMap(SysPermission sysPermission);
/**
......@@ -53,7 +53,7 @@ public interface SysPermissionMapper{
* @param roleId
* @return
*/
@Select("select sp.id,sp.name from SYS_ROLE_PERMISSION srp ,SYS_PERMISSION sp where srp.PERMISSION_ID=sp.ID and srp.ROLE_ID=#{roleId}")
@Select("select * from SYS_ROLE_PERMISSION srp ,SYS_PERMISSION sp where srp.PERMISSION_ID=sp.ID and srp.ROLE_ID=#{roleId}")
public List<SysPermission> selectPermissionByRoleId(@Param("roleId") Integer roleId);
/**
......@@ -77,6 +77,6 @@ public interface SysPermissionMapper{
* @param sysPermission
*/
@Update("update SYS_PERMISSION SET NAME=#{name},resource_type=#{resource_type},url=#{url}," +
"permission=#{permission},parent_id=#{parent_id},parent_ids=#{parent_ids} where id=#{id}")
"permission=#{permission} where id=#{id}")
public void updatePermission(SysPermission sysPermission);
}
......@@ -56,6 +56,20 @@ public interface SysRoleMapper {
@Select("select sr.id,sr.role from SYS_USER_ROLE sur ,SYS_ROLE sr where sur.ROLE_ID=sr.ID and sur.USER_ID=#{userId}")
List<SysRole> selectRoleByUserId(@Param("userId") Integer userId);
/**
* 通过用户id查询角色
* @param userId
* @return
*/
@Select("select * from SYS_USER_ROLE sur ,SYS_ROLE sr where sur.ROLE_ID=sr.ID and sur.USER_ID=#{userId}")
@Results({@Result(property = "id",column = "id"),
@Result(property = "role",column = "role"),
@Result(property = "description",column = "description"),
@Result(property = "available",column = "available"),
@Result(property = "permissions",javaType = List.class,column ="id",
many = @Many(select = "com.yxproject.start.mapper.SysPermissionMapper.selectPermissionByRoleId"))})
List<SysRole> selectRoleAndPermissionByUserId(@Param("userId") Integer userId);
/**
* 更新用户的角色
......
......@@ -10,6 +10,25 @@ import java.util.List;
*/
@Mapper
public interface UserInfoMapper {
/**
* 通过用户名查询用户信息
* @param username
* @return
*/
@Select("select * from USER_INFO where username=#{username}")
@Results({@Result(property = "id",column = "id"),
@Result(property = "username",column = "username"),
@Result(property = "name",column = "name"),
@Result(property = "password",column = "password"),
@Result(property = "salt",column = "salt"),
@Result(property = "state",column = "state"),
@Result(property = "roleList",javaType = List.class,column ="id",
many = @Many(select = "com.yxproject.start.mapper.SysRoleMapper.selectRoleAndPermissionByUserId"))})
public UserInfo findUserByUsername(String username);
/**
* 新增用户
* @param userinfo
......@@ -40,7 +59,7 @@ public interface UserInfoMapper {
@Result(property = "salt",column = "salt"),
@Result(property = "state",column = "state"),
@Result(property = "roleList",javaType = List.class,column ="id",
many = @Many(select = "com.yxproject.start.mapper.SysRoleMapper.selectRoleByUserId"))})
many = @Many(select = "com.yxproject.start.mapper.SysRoleMapper.selectRoleAndPermissionByUserId"))})
public List<UserInfo> selectAllUserInfo();
......
package com.yxproject.start.service;
import com.yxproject.start.entity.UserInfo;
/**
* @author liboyang
*/
public interface LoginService {
/**
* 查询用户
* @param username
* @return
*/
public UserInfo findByUsername(String username);
}
package com.yxproject.start.service;
import com.yxproject.start.entity.SysRole;
import net.sf.json.JSONArray;
import java.util.List;
......@@ -11,10 +12,10 @@ public interface SysRoleService {
/**
* 添加角色并分配权限
* @param sysRole
* @param ids
* @param jsonArray
* @return
*/
public boolean addRole(SysRole sysRole,String[] ids);
public boolean addRole(SysRole sysRole, JSONArray jsonArray);
/**
* 修改角色和权限
......@@ -24,7 +25,7 @@ public interface SysRoleService {
* @return
*/
public boolean updateRole(SysRole sysRole,String[] ids,String[] oldIds);
public boolean updateRole(SysRole sysRole,JSONArray ids,JSONArray oldIds);
/**
* 查询所有角色
......
......@@ -2,14 +2,20 @@ package com.yxproject.start.service;
import com.yxproject.start.entity.UserInfo;
import javax.persistence.criteria.CriteriaBuilder;
import java.util.List;
import java.util.Map;
/**
* @author liboyang
*/
public interface UserInfoService{
/**
* 查询用户
* @param username
* @return
*/
public UserInfo findByUsername(String username);
/**
* 新增用户
* @param userinfo
......
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.UserInfo;
import com.yxproject.start.mapper.LoginMapper;
import com.yxproject.start.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author liboyang
*/
@Service
public class LoginServiceImpl implements LoginService {
@Autowired
private LoginMapper loginMapper;
@Override
public UserInfo findByUsername(String username) {
UserInfo user = loginMapper.findUserByUsername(username);
return user;
}
}
......@@ -3,7 +3,9 @@ package com.yxproject.start.service.impl;
import com.yxproject.start.entity.SysRole;
import com.yxproject.start.mapper.SysRoleMapper;
import com.yxproject.start.service.SysRoleService;
import net.sf.json.JSONArray;
import org.apache.ibatis.annotations.Mapper;
import org.omg.CORBA.OBJ_ADAPTER;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
......@@ -22,24 +24,24 @@ public class SysRoleServiceImpl implements SysRoleService {
private SysRoleMapper sysRoleMapper;
@Override
@Transactional(rollbackFor=Exception.class)
public boolean addRole(SysRole sysRole,String[] ids) {
public boolean addRole(SysRole sysRole, JSONArray jsonArray) {
sysRoleMapper.addRoleByMap(sysRole);
Integer roleId = sysRole.getId();
for (int i=0;i<ids.length;i++){
sysRoleMapper.addRolePermission(roleId,Integer.parseInt(ids[i]));
for (Object object:jsonArray){
sysRoleMapper.addRolePermission(roleId,Integer.parseInt(object.toString()));
}
return true;
}
@Override
@Transactional(rollbackFor=Exception.class)
public boolean updateRole(SysRole sysRole, String[] ids, String[] oldIds) {
public boolean updateRole(SysRole sysRole, JSONArray ids, JSONArray oldIds) {
sysRoleMapper.updateSysRole(sysRole);
for (int i=0;i<oldIds.length;i++){
sysRoleMapper.delRolePermission(sysRole.getId(),Integer.parseInt(oldIds[i]));
for (Object object:oldIds){
sysRoleMapper.delRolePermission(sysRole.getId(),Integer.parseInt(object.toString()));
}
for (int i=0;i<ids.length;i++){
sysRoleMapper.addRolePermission(sysRole.getId(),Integer.parseInt(ids[i]));
for (Object object:ids){
sysRoleMapper.addRolePermission(sysRole.getId(),Integer.parseInt(object.toString()));
}
return true;
}
......
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.UserInfo;
import com.yxproject.start.mapper.LoginMapper;
import com.yxproject.start.mapper.SysRoleMapper;
import com.yxproject.start.mapper.UserInfoMapper;
import com.yxproject.start.service.UserInfoService;
......@@ -25,6 +24,14 @@ public class UserInfoServiceImpl implements UserInfoService {
@Autowired
private SysRoleMapper sysRoleMapper;
@Override
public UserInfo findByUsername(String username) {
UserInfo user = userInfoMapper.findUserByUsername(username);
return user;
}
@Override
@Transactional(rollbackFor=Exception.class)
public boolean addUser(UserInfo userinfo,Integer roleId) {
......
#spring集成Mybatis环境
mybatis.type-aliases-package=com.yx_project.start.entity
#加载Mybatis配置文件
mybatis.mapper-locations = classpath:mapper/*Mapper.xml
mybatis.config-location = classpath:mapper/config/mybatis-config.xml
#配置调度生产库数据库
spring.datasource.driver-class-name= oracle.jdbc.driver.OracleDriver
spring.datasource.url = jdbc:oracle:thin:@192.168.10.208:1521:GTYX
spring.datasource.username = dahai
spring.datasource.password = dahai
#spring.datasource.schema = classpath:database/import.sql
#配置mysql数据库
#spring.datasource.driver-class-name= com.mysql.jdbc.Driver
#spring.datasource.url = jdbc:mysql://localhost:3306/test
#spring.datasource.username = root
#spring.datasource.password = root
##配置调度生产库数据库
#spring.01.datasource.driver-class-name= oracle.jdbc.driver.OracleDriver
#spring.01.datasource.url = jdbc:oracle:thin:@192.168.10.208:1521:GTYX
#spring.01.datasource.username = dahai
#spring.01.datasource.password = dahai
#
##配置受理库数据库
#spring.02.datasource.driver-class-name= oracle.jdbc.driver.OracleDriver
#spring.02.datasource.url = jdbc:oracle:thin:@192.168.10.208:1521:GTYX
#spring.02.datasource.username = dahai
#spring.02.datasource.password = dahai
#
##配置制证库数据库
#spring.03.datasource.driver-class-name= oracle.jdbc.driver.OracleDriver
#spring.03.datasource.url = jdbc:oracle:thin:@192.168.10.208:1521:GTYX
#spring.03.datasource.username = dahai
#spring.03.datasource.password = dahai
#自动根据实体类生成数据库表
#spring.jpa.hibernate.ddl-auto= update
spring.jpa.show-sql=true
##jsp 支持
#spring.mvc.view.suffix=.jsp
#spring.mvc.view.prefix=/WEB-INF/jsp/
# thymeleaf
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML
spring.thymeleaf.encoding=UTF-8
## 多数据源配置
#slave.datasource.names=test,test1
#slave.datasource.test.driverClassName =oracle.jdbc.driver.OracleDriver
#slave.datasource.test.url=jdbc:oracle:thin:@192.168.10.208:1521:GTYX
#slave.datasource.test.username=dahai
#slave.datasource.test.password=dahai
## test1
#slave.datasource.test1.driverClassName =oracle.jdbc.driver.OracleDriver
#slave.datasource.test1.url=jdbc:oracle:thin:@192.168.10.208:1521:GTYX
#slave.datasource.test1.username=dahai
#slave.datasource.test1.password=dahai
server:
port: 8081
#spring集成Mybatis环境
mybatis:
type-aliases-package: com.yx_project.start.entity
#加载Mybatis配置文件
mapper-locations: classpath:mapper/*Mapper.xml
config-location: classpath:mapper/config/mybatis-config.xml
#配置调度生产Oracle数据库
spring:
datasource:
driver-class-name: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@192.168.10.208:1521:GTYX
username: dahai
password: dahai
#配置shiro
shiro:
loginUrl: http://localhost:8081
web:
enabled: true
unauthorizedUrl: /page_404.html
<?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="com.yxproject.start.mapper.UserInfoMapper">
<!--用户-->
<resultMap id="UserRoleMenuMap" type="com.yxproject.start.entity.UserInfo">
<id property="uid" column="uid"/>
<result column="username" property="username"/>
<result column="password" property="password"/>
<result column="state" property="state"/>
<result column="name" property="name"/>
<!--角色集合-->
<collection property="roleList" ofType="com.yxproject.start.entity.SysRole">
<id column="id" property="rid" />
<result column="description" property="description"/>
<result column="role" property="role"/>
<!--权限集合-->
<collection property="permissions" ofType="com.yxproject.start.entity.SysPermission">
<id column="id" property="pid" />
<result column="name" property="pname"/>
<result column="url" property="url"/>
</collection>
</collection>
</resultMap>
<!--<select id="findUserByUsername" resultMap="UserRoleMenuMap" parameterType="string">-->
<!--select user_info.uid,user_info.username,user_info.password,user_info.name,sys_role.id as rid,sys_role.role,sys_role.description,-->
<!--sys_permission.id as pid,sys_permission.name as pname,sys_permission.url-->
<!--from user_info-->
<!--left join sys_user_role on user_info.uid = sys_user_role.uid-->
<!--left join sys_role on sys_user_role.role_id= sys_role.id-->
<!--left join sys_role_permission on sys_role.id = sys_role_permission.permission_id-->
<!--left join sys_permission on sys_role_permission.permission_id = sys_permission.id-->
<!--where username=#{username}-->
<!--</select>-->
<insert id = "addUserInfo" parameterType = "map" statementType = "PREPARED" keyProperty = "u_id" useGeneratedKeys = "true" >
insert into USER_INFO (`u_id`,`username`,`name`,`password`,`salt`,`state`) VALUES (USER_INFO_seq.nextval, 'admin', '管理员', 'd3c59d25033dbf980d29554025c23a75', '8d78869f470951332959580424d4bf4f', 0)
</insert>
<!--<update id = "delUserInfo" parameterType = "int" >-->
<!--update user_info set STATE = 1 where u_id =#{uId}-->
<!--</update>-->
<!--<update id = "updateUserInfo" parameterType = "map" >-->
<!--update user_info set username =#{username},name =#{name},password =#{password} where u_id =#{uId}-->
<!--</update>-->
<!--<select id="findUserByUsername" resultMap="UserRoleMenuMap" parameterType="string">-->
<!--select user_info.uid,user_info.username,user_info.password,user_info.name,sys_role.id as rid,sys_role.role,sys_role.description,-->
<!--sys_permission.id as pid,sys_permission.name as pname,sys_permission.url-->
<!--from user_info-->
<!--left join sys_user_role on user_info.uid = sys_user_role.uid-->
<!--left join sys_role on sys_user_role.role_id= sys_role.id-->
<!--left join sys_role_permission on sys_role.id = sys_role_permission.permission_id-->
<!--left join sys_permission on sys_role_permission.permission_id = sys_permission.id-->
<!--where username=#{username}-->
<!--</select>-->
<select id="findUserByUsername" resultType="com.yxproject.start.entity.UserInfo" parameterType="String">
select * from "SYSTEM_USER" where username=#{username}
</select>
<!--用户-->
<resultMap id="UserRoleMenuMap" type="com.yxproject.start.entity.UserInfo">
<id property="uid" column="uid"/>
<result column="username" property="username"/>
<result column="password" property="password"/>
<result column="state" property="state"/>
<result column="name" property="name"/>
<!--角色集合-->
<collection property="roleList" ofType="com.yxproject.start.entity.SysRole">
<id column="id" property="rid"/>
<result column="description" property="description"/>
<result column="role" property="role"/>
<!--权限集合-->
<collection property="permissions" ofType="com.yxproject.start.entity.SysPermission">
<id column="id" property="pid"/>
<result column="name" property="pname"/>
<result column="url" property="url"/>
</collection>
</collection>
</resultMap>
</mapper>
\ No newline at end of file
......@@ -3,5 +3,20 @@
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<!--<plugins>-->
<!--<plugin interceptor="com.github.pagehelper.PageHelper">-->
<!--<property value="mysql" name="dialect"/>-->
<!--<property value="true" name="offsetAsPageNum"/>-->
<!--<property value="true" name="rowBoundsWithCount "/>-->
<!--<property value="true" name="pageSizeZero"/>-->
<!--<property value="true" name="reasonable"/>-->
<!--</plugin>-->
<!--</plugins>-->
</configuration>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
.ui-dialog-title{
padding-bottom:10px;
border-bottom:1px solid #DEDEDE;
font-weight: bold;
}
.ui-dialog-content{
font-size: 1em;
}
.ui-dialog-confirm{
border-top:1px solid #DEDEDE;
padding-top: 10px;
text-align: right;
}
.ngdialog{
text-align: left;
}
.dialog-margin-top{
margin-top: 7px;
}
@font-face {
font-family: 'iconfont';
src: url('../fonts/iconfont.eot');
src: url('../fonts/iconfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/iconfont.woff') format('woff'),
url('../fonts/iconfont.ttf') format('truetype'),
url('../fonts/iconfont.svg#iconfont') format('svg');
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 300;
src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/sourcesanspro/sourcesanspro-light.woff') format('woff');
}
.iconfont{
font-family:"iconfont" !important;
font-size:16px;font-style:normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 400;
src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url('../fonts/sourcesanspro/sourcesanspro.woff') format('woff');
}
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 700;
src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/sourcesanspro/sourcesanspro-bold.woff') format('woff');
}
\ No newline at end of file
@charset "utf-8";
@import url(../lib/layui/css/layui.css);
@import url(../vendor/layui/css/layui.css);
*{
margin: 0px;
padding: 0px;
......
<div class="ui-dialog-title">
添加权限
</div>
<div class="ui-dialog-content">
<form name="form" class="form-validation">
<div class="form-group">
<label>名称</label>
<input type="text" class="form-control" ng-model="name" required >
</div>
<div class="form-group">
<label>资源路径</label>
<input type="text" class="form-control" ng-model="url" required >
</div>
<div class="form-group">
<label>权限字符串</label>
<input type="text" class="form-control" ng-model="permission" required >
</div>
<div class="form-group">
<label>资源类型</label>
<div class="radio">
<label class="i-checks">
<input type="radio" ng-model="resourceType" value="menu">
<i></i>
menu
</label>
<label class="i-checks">
<input type="radio" ng-model="resourceType" value="button">
<i></i>
button
</label>
</div>
</div>
</form>
</div>
<div class="ui-dialog-confirm">
<button type="submit" class="btn btn-info" ng-click="permissionAdd(resourceType)&&closeThisDialog()">添加</button>
</div>
\ No newline at end of file
<div class="ui-dialog-title">
添加角色
</div>
<div class="ui-dialog-content">
<form name="form" class="form-validation">
<div class="form-group">
<label>角色名称</label>
<input type="text" class="form-control" ng-model="role" required >
</div>
<div class="form-group">
<label>角色描述</label>
<input type="text" class="form-control" ng-model="description" required >
</div>
<div class="form-group pull-in clearfix">
<div class="col-sm-6">
<label>权限</label>
<select ui-jq="chosen" multiple class="form-control w-md" ng-model="permissionId" ng-options="perm.id as perm.name for perm in activePermissionList"></select>
</div>
</div>
</form>
</div>
<div class="ui-dialog-confirm">
<button type="submit" class="btn btn-info" ng-click="roleAdd(permissionId)&&closeThisDialog()">添加</button>
</div>
\ No newline at end of file
<div class="ui-dialog-title">
添加用户
</div>
<div class="ui-dialog-content">
<form name="form" class="form-validation">
<div class="form-group">
<label>用户名</label>
<input type="text" class="form-control" ng-model="username" required >
</div>
<div class="form-group">
<label>昵称</label>
<input type="text" class="form-control" ng-model="name" required >
</div>
<div class="form-group pull-in clearfix">
<div class="col-sm-6">
<label>密码</label>
<input type="password" class="form-control" name="password" ng-model="password" required >
</div>
<div class="col-sm-6">
<label>确认密码</label>
<input type="password" class="form-control" name="confirm_password" required ng-model="confirm_password" ui-validate=" '$value==password' " ui-validate-watch=" 'password' ">
<span ng-show='form.confirm_password.$error.validator' style="color:red;">两次密码不一致!</span>
</div>
</div>
<div class="form-group pull-in clearfix">
<div class="col-sm-6">
<label>角色</label>
<select class="form-control w-md" ng-model="roleId" ng-options="role.id as role.role for role in activeRoleList"></select>
</div>
</div>
</form>
</div>
<div class="ui-dialog-confirm">
<button type="submit" class="btn btn-info" ng-click="userAdd(roleId)&&closeThisDialog()">添加</button>
</div>
\ No newline at end of file
<div class="ui-dialog-title">
修改权限
</div>
<div class="ui-dialog-content">
<form name="form" class="form-validation">
<div class="form-group">
<label>名称</label>
<input type="text" class="form-control" ng-model="thisPerm.name" ng-value="thisPerm.name" required >
</div>
<div class="form-group">
<label>权限字符串</label>
<input type="text" class="form-control" ng-model="thisPerm.permission" ng-value="thisPerm.permission" required >
</div>
<div class="form-group">
<label>资源类型</label>
<div class="radio">
<label class="i-checks">
<input type="radio" ng-model="resourceType" value="menu">
<i></i>
menu
</label>
<label class="i-checks">
<input type="radio" ng-model="resourceType" value="button">
<i></i>
button
</label>
</div>
</div>
</form>
</div>
<div class="ui-dialog-confirm">
<button type="submit" class="btn btn-info" ng-click="permUpdate(resourceType)&&closeThisDialog()">确认修改</button>
</div>
\ No newline at end of file
<div class="ui-dialog-title">
修改角色
</div>
<div class="ui-dialog-content">
<form name="form" class="form-validation">
<div class="form-group">
<label>角色名称</label>
<input type="text" class="form-control" ng-value="thisRole.role" ng-model="thisRole.role" required >
</div>
<div class="form-group">
<label>角色描述</label>
<input type="text" class="form-control" ng-value="thisRole.description" ng-model="thisRole.description" required >
</div>
<div class="form-group pull-in clearfix">
<div class="col-sm-6">
<label>权限</label>
<select ui-jq="chosen" multiple class="form-control w-md" ng-model="permissionId" ng-options="perm.id as perm.name for perm in activePermissionList"></select>
</div>
</div>
</form>
</div>
<div class="ui-dialog-confirm">
<button type="submit" class="btn btn-info" ng-click="roleUpdate(permissionId)&&closeThisDialog()">确认修改</button>
</div>
\ No newline at end of file
<div class="ui-dialog-title">
修改用户
</div>
<div class="ui-dialog-content">
<form name="form" class="form-validation">
<div class="form-group">
<label>用户名</label>
<input type="text" class="form-control" ng-value="thisUser.username" ng-model="thisUser.username" required >
</div>
<div class="form-group">
<label>昵称</label>
<input type="text" class="form-control" ng-value="thisUser.name" ng-model="thisUser.name" required >
</div>
<div class="form-group pull-in clearfix" ng-if="thisUser.username!='admin'">
<div class="col-sm-6">
<label>角色</label>
<select class="form-control w-md" ng-model="roleId" ng-options="role.id as role.role for role in activeRoleList"></select>
</div>
</div>
</form>
</div>
<div class="ui-dialog-confirm">
<button type="submit" class="btn btn-info" ng-click="userUpdate(roleId)&&closeThisDialog()">确认修改</button>
</div>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
'use strict';
/* Controllers */
// bootstrap controller
app.controller('AccordionDemoCtrl', ['$scope', function($scope) {
$scope.oneAtATime = true;
$scope.groups = [
{
title: 'Accordion group header - #1',
content: 'Dynamic group body - #1'
},
{
title: 'Accordion group header - #2',
content: 'Dynamic group body - #2'
}
];
$scope.items = ['Item 1', 'Item 2', 'Item 3'];
$scope.addItem = function() {
var newItemNo = $scope.items.length + 1;
$scope.items.push('Item ' + newItemNo);
};
$scope.status = {
isFirstOpen: true,
isFirstDisabled: false
};
}])
;
app.controller('AlertDemoCtrl', ['$scope', function($scope) {
$scope.alerts = [
{ type: 'success', msg: 'Well done! You successfully read this important alert message.' },
{ type: 'info', msg: 'Heads up! This alert needs your attention, but it is not super important.' },
{ type: 'warning', msg: 'Warning! Best check yo self, you are not looking too good...' }
];
$scope.addAlert = function() {
$scope.alerts.push({type: 'danger', msg: 'Oh snap! Change a few things up and try submitting again.'});
};
$scope.closeAlert = function(index) {
$scope.alerts.splice(index, 1);
};
}])
;
app.controller('ButtonsDemoCtrl', ['$scope', function($scope) {
$scope.singleModel = 1;
$scope.radioModel = 'Middle';
$scope.checkModel = {
left: false,
middle: true,
right: false
};
}])
;
app.controller('CarouselDemoCtrl', ['$scope', function($scope) {
$scope.myInterval = 5000;
var slides = $scope.slides = [];
$scope.addSlide = function() {
slides.push({
image: 'img/c' + slides.length + '.jpg',
text: ['Carousel text #0','Carousel text #1','Carousel text #2','Carousel text #3'][slides.length % 4]
});
};
for (var i=0; i<4; i++) {
$scope.addSlide();
}
}])
;
app.controller('DropdownDemoCtrl', ['$scope', function($scope) {
$scope.items = [
'The first choice!',
'And another choice for you.',
'but wait! A third!'
];
$scope.status = {
isopen: false
};
$scope.toggled = function(open) {
//console.log('Dropdown is now: ', open);
};
$scope.toggleDropdown = function($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.status.isopen = !$scope.status.isopen;
};
}])
;
app.controller('ModalInstanceCtrl', ['$scope', '$modalInstance', 'items', function($scope, $modalInstance, items) {
$scope.items = items;
$scope.selected = {
item: $scope.items[0]
};
$scope.ok = function () {
$modalInstance.close($scope.selected.item);
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
}])
;
app.controller('ModalDemoCtrl', ['$scope', '$modal', '$log', function($scope, $modal, $log) {
$scope.items = ['item1', 'item2', 'item3'];
$scope.open = function (size) {
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: 'ModalInstanceCtrl',
size: size,
resolve: {
items: function () {
return $scope.items;
}
}
});
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
};
}])
;
app.controller('PaginationDemoCtrl', ['$scope', '$log', function($scope, $log) {
$scope.totalItems = 64;
$scope.currentPage = 4;
$scope.setPage = function (pageNo) {
$scope.currentPage = pageNo;
};
$scope.pageChanged = function() {
$log.info('Page changed to: ' + $scope.currentPage);
};
$scope.maxSize = 5;
$scope.bigTotalItems = 175;
$scope.bigCurrentPage = 1;
}])
;
app.controller('PopoverDemoCtrl', ['$scope', function($scope) {
$scope.dynamicPopover = 'Hello, World!';
$scope.dynamicPopoverTitle = 'Title';
}])
;
app.controller('ProgressDemoCtrl', ['$scope', function($scope) {
$scope.max = 200;
$scope.random = function() {
var value = Math.floor((Math.random() * 100) + 1);
var type;
if (value < 25) {
type = 'success';
} else if (value < 50) {
type = 'info';
} else if (value < 75) {
type = 'warning';
} else {
type = 'danger';
}
$scope.showWarning = (type === 'danger' || type === 'warning');
$scope.dynamic = value;
$scope.type = type;
};
$scope.random();
$scope.randomStacked = function() {
$scope.stacked = [];
var types = ['success', 'info', 'warning', 'danger'];
for (var i = 0, n = Math.floor((Math.random() * 4) + 1); i < n; i++) {
var index = Math.floor((Math.random() * 4));
$scope.stacked.push({
value: Math.floor((Math.random() * 30) + 1),
type: types[index]
});
}
};
$scope.randomStacked();
}])
;
app.controller('TabsDemoCtrl', ['$scope', function($scope) {
$scope.tabs = [
{ title:'Dynamic Title 1', content:'Dynamic content 1' },
{ title:'Dynamic Title 2', content:'Dynamic content 2', disabled: true }
];
}])
;
app.controller('RatingDemoCtrl', ['$scope', function($scope) {
$scope.rate = 7;
$scope.max = 10;
$scope.isReadonly = false;
$scope.hoveringOver = function(value) {
$scope.overStar = value;
$scope.percent = 100 * (value / $scope.max);
};
}])
;
app.controller('TooltipDemoCtrl', ['$scope', function($scope) {
$scope.dynamicTooltip = 'Hello, World!';
$scope.dynamicTooltipText = 'dynamic';
$scope.htmlTooltip = 'I\'ve been made <b>bold</b>!';
}])
;
app.controller('TypeaheadDemoCtrl', ['$scope', '$http', function($scope, $http) {
$scope.selected = undefined;
$scope.states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Dakota', 'North Carolina', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'];
// Any function returning a promise object can be used to load values asynchronously
$scope.getLocation = function(val) {
return $http.get('http://maps.googleapis.com/maps/api/geocode/json', {
params: {
address: val,
sensor: false
}
}).then(function(res){
var addresses = [];
angular.forEach(res.data.results, function(item){
addresses.push(item.formatted_address);
});
return addresses;
});
};
}])
;
app.controller('DatepickerDemoCtrl', ['$scope', function($scope) {
$scope.today = function() {
$scope.dt = new Date();
};
$scope.today();
$scope.clear = function () {
$scope.dt = null;
};
// Disable weekend selection
$scope.disabled = function(date, mode) {
return ( mode === 'day' && ( date.getDay() === 0 || date.getDay() === 6 ) );
};
$scope.toggleMin = function() {
$scope.minDate = $scope.minDate ? null : new Date();
};
$scope.toggleMin();
$scope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.opened = true;
};
$scope.dateOptions = {
formatYear: 'yy',
startingDay: 1,
class: 'datepicker'
};
$scope.initDate = new Date('2016-15-20');
$scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
$scope.format = $scope.formats[0];
}])
;
app.controller('TimepickerDemoCtrl', ['$scope', function($scope) {
$scope.mytime = new Date();
$scope.hstep = 1;
$scope.mstep = 15;
$scope.options = {
hstep: [1, 2, 3],
mstep: [1, 5, 10, 15, 25, 30]
};
$scope.ismeridian = true;
$scope.toggleMode = function() {
$scope.ismeridian = ! $scope.ismeridian;
};
$scope.update = function() {
var d = new Date();
d.setHours( 14 );
d.setMinutes( 0 );
$scope.mytime = d;
};
$scope.changed = function () {
//console.log('Time changed to: ' + $scope.mytime);
};
$scope.clear = function() {
$scope.mytime = null;
};
}]);
\ No newline at end of file
'use strict';
/* Controllers */
app
// Flot Chart controller
.controller('FlotChartDemoCtrl', ['$scope', function($scope) {
$scope.d = [ [1,6.5],[2,6.5],[3,7],[4,8],[5,7.5],[6,7],[7,6.8],[8,7],[9,7.2],[10,7],[11,6.8],[12,7] ];
$scope.d0_1 = [ [0,7],[1,6.5],[2,12.5],[3,7],[4,9],[5,6],[6,11],[7,6.5],[8,8],[9,7] ];
$scope.d0_2 = [ [0,4],[1,4.5],[2,7],[3,4.5],[4,3],[5,3.5],[6,6],[7,3],[8,4],[9,3] ];
$scope.d1_1 = [ [10, 120], [20, 70], [30, 70], [40, 60] ];
$scope.d1_2 = [ [10, 50], [20, 60], [30, 90], [40, 35] ];
$scope.d1_3 = [ [10, 80], [20, 40], [30, 30], [40, 20] ];
$scope.d2 = [];
for (var i = 0; i < 20; ++i) {
$scope.d2.push([i, Math.sin(i)]);
}
$scope.d3 = [
{ label: "iPhone5S", data: 40 },
{ label: "iPad Mini", data: 10 },
{ label: "iPad Mini Retina", data: 20 },
{ label: "iPhone4S", data: 12 },
{ label: "iPad Air", data: 18 }
];
$scope.refreshData = function(){
$scope.d0_1 = $scope.d0_2;
};
$scope.getRandomData = function() {
var data = [],
totalPoints = 150;
if (data.length > 0)
data = data.slice(1);
while (data.length < totalPoints) {
var prev = data.length > 0 ? data[data.length - 1] : 50,
y = prev + Math.random() * 10 - 5;
if (y < 0) {
y = 0;
} else if (y > 100) {
y = 100;
}
data.push(y);
}
// Zip the generated y values with the x values
var res = [];
for (var i = 0; i < data.length; ++i) {
res.push([i, data[i]])
}
return res;
}
$scope.d4 = $scope.getRandomData();
}]);
\ No newline at end of file
app.controller('EditorCtrl', function($scope) {
$scope.htmlVariable = '<h3>Try me!</h3><p>textAngular is a super cool WYSIWYG Text Editor directive for AngularJS</p><p><b>Features:</b></p><ol><li>Automatic Seamless Two-Way-Binding</li><li style="color: blue;">Super Easy <b>Theming</b> Options</li><li>Simple Editor Instance Creation</li><li>Safely Parses Html for Custom Toolbar Icons</li><li>Doesn&apos;t Use an iFrame</li><li>Works with Firefox, Chrome, and IE8+</li></ol><p><b>Code at GitHub:</b> <a href="https://github.com/fraywing/textAngular">Here</a> </p>';
});
\ No newline at end of file
'use strict';
/* Controllers */
// Form controller
app.controller('FormDemoCtrl', ['$scope', function($scope) {
$scope.notBlackListed = function(value) {
var blacklist = ['bad@domain.com','verybad@domain.com'];
return blacklist.indexOf(value) === -1;
}
$scope.val = 15;
var updateModel = function(val){
$scope.$apply(function(){
$scope.val = val;
});
};
angular.element("#slider").on('slideStop', function(data){
updateModel(data.value);
});
$scope.select2Number = [
{text:'First', value:'One'},
{text:'Second', value:'Two'},
{text:'Third', value:'Three'}
];
$scope.list_of_string = ['tag1', 'tag2']
$scope.select2Options = {
'multiple': true,
'simple_tags': true,
'tags': ['tag1', 'tag2', 'tag3', 'tag4'] // Can be empty list.
};
angular.element("#LinkInput").bind('click', function (event) {
event.stopPropagation();
});
}])
;
\ No newline at end of file
app.controller('GridDemoCtrl', ['$scope', '$http', function($scope, $http) {
$scope.filterOptions = {
filterText: "",
useExternalFilter: true
};
$scope.totalServerItems = 0;
$scope.pagingOptions = {
pageSizes: [250, 500, 1000],
pageSize: 250,
currentPage: 1
};
$scope.setPagingData = function(data, page, pageSize){
var pagedData = data.slice((page - 1) * pageSize, page * pageSize);
$scope.myData = pagedData;
$scope.totalServerItems = data.length;
if (!$scope.$$phase) {
$scope.$apply();
}
};
$scope.getPagedDataAsync = function (pageSize, page, searchText) {
setTimeout(function () {
var data;
if (searchText) {
var ft = searchText.toLowerCase();
$http.get('js/controllers/largeLoad.json').success(function (largeLoad) {
data = largeLoad.filter(function(item) {
return JSON.stringify(item).toLowerCase().indexOf(ft) != -1;
});
$scope.setPagingData(data,page,pageSize);
});
} else {
$http.get('js/controllers/largeLoad.json').success(function (largeLoad) {
$scope.setPagingData(largeLoad,page,pageSize);
});
}
}, 100);
};
$scope.getPagedDataAsync($scope.pagingOptions.pageSize, $scope.pagingOptions.currentPage);
$scope.$watch('pagingOptions', function (newVal, oldVal) {
if (newVal !== oldVal && newVal.currentPage !== oldVal.currentPage) {
$scope.getPagedDataAsync($scope.pagingOptions.pageSize, $scope.pagingOptions.currentPage, $scope.filterOptions.filterText);
}
}, true);
$scope.$watch('filterOptions', function (newVal, oldVal) {
if (newVal !== oldVal) {
$scope.getPagedDataAsync($scope.pagingOptions.pageSize, $scope.pagingOptions.currentPage, $scope.filterOptions.filterText);
}
}, true);
$scope.gridOptions = {
data: 'myData',
enablePaging: true,
showFooter: true,
totalServerItems: 'totalServerItems',
pagingOptions: $scope.pagingOptions,
filterOptions: $scope.filterOptions
};
}]);
\ No newline at end of file
app.controller('ImgCropCtrl', ['$scope', function($scope) {
$scope.myImage='';
$scope.myCroppedImage='';
$scope.cropType="circle";
var handleFileSelect=function(evt) {
var file=evt.currentTarget.files[0];
var reader = new FileReader();
reader.onload = function (evt) {
$scope.$apply(function($scope){
$scope.myImage=evt.target.result;
});
};
reader.readAsDataURL(file);
};
angular.element(document.querySelector('#fileInput')).on('change',handleFileSelect);
}]);
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
app.controller('SliderCtrl', function($scope) {
$scope.cost = 40;
$scope.range = {
min: 30,
max: 60
};
$scope.currencyFormatting = function(value) {
return"$"+value.toString();
}
});
\ No newline at end of file
// tab controller
app.controller('CustomTabController', ['$scope', function($scope) {
$scope.tabs = [true, false, false];
$scope.tab = function(index){
angular.forEach($scope.tabs, function(i, v) {
$scope.tabs[v] = false;
});
$scope.tabs[index] = true;
}
}]);
\ No newline at end of file
app.controller('ToasterDemoCtrl', ['$scope', 'toaster', function($scope, toaster) {
$scope.toaster = {
type: 'success',
title: 'Title',
text: 'Message'
};
$scope.pop = function(){
toaster.pop($scope.toaster.type, $scope.toaster.title, $scope.toaster.text);
};
}]);
\ No newline at end of file
app.controller('AbnTestController', function($scope, $timeout) {
var apple_selected, tree, treedata_avm, treedata_geography;
$scope.my_tree_handler = function(branch) {
var _ref;
$scope.output = "You selected: " + branch.label;
if ((_ref = branch.data) != null ? _ref.description : void 0) {
return $scope.output += '(' + branch.data.description + ')';
}
};
apple_selected = function(branch) {
return $scope.output = "APPLE! : " + branch.label;
};
treedata_avm = [
{
label: 'Animal',
children: [
{
label: 'Dog',
data: {
description: "man's best friend"
}
}, {
label: 'Cat',
data: {
description: "Felis catus"
}
}, {
label: 'Hippopotamus',
data: {
description: "hungry, hungry"
}
}, {
label: 'Chicken',
children: ['White Leghorn', 'Rhode Island Red', 'Jersey Giant']
}
]
}, {
label: 'Vegetable',
data: {
definition: "A plant or part of a plant used as food, typically as accompaniment to meat or fish, such as a cabbage, potato, carrot, or bean.",
data_can_contain_anything: true
},
onSelect: function(branch) {
return $scope.output = "Vegetable: " + branch.data.definition;
},
children: [
{
label: 'Oranges'
}, {
label: 'Apples',
children: [
{
label: 'Granny Smith',
onSelect: apple_selected
}, {
label: 'Red Delicous',
onSelect: apple_selected
}, {
label: 'Fuji',
onSelect: apple_selected
}
]
}
]
}, {
label: 'Mineral',
children: [
{
label: 'Rock',
children: ['Igneous', 'Sedimentary', 'Metamorphic']
}, {
label: 'Metal',
children: ['Aluminum', 'Steel', 'Copper']
}, {
label: 'Plastic',
children: [
{
label: 'Thermoplastic',
children: ['polyethylene', 'polypropylene', 'polystyrene', ' polyvinyl chloride']
}, {
label: 'Thermosetting Polymer',
children: ['polyester', 'polyurethane', 'vulcanized rubber', 'bakelite', 'urea-formaldehyde']
}
]
}
]
}
];
treedata_geography = [
{
label: 'North America',
children: [
{
label: 'Canada',
children: ['Toronto', 'Vancouver']
}, {
label: 'USA',
children: ['New York', 'Los Angeles']
}, {
label: 'Mexico',
children: ['Mexico City', 'Guadalajara']
}
]
}, {
label: 'South America',
children: [
{
label: 'Venezuela',
children: ['Caracas', 'Maracaibo']
}, {
label: 'Brazil',
children: ['Sao Paulo', 'Rio de Janeiro']
}, {
label: 'Argentina',
children: ['Buenos Aires', 'Cordoba']
}
]
}
];
$scope.my_data = treedata_avm;
$scope.try_changing_the_tree_data = function() {
if ($scope.my_data === treedata_avm) {
return $scope.my_data = treedata_geography;
} else {
return $scope.my_data = treedata_avm;
}
};
$scope.my_tree = tree = {};
$scope.try_async_load = function() {
$scope.my_data = [];
$scope.doing_async = true;
return $timeout(function() {
if (Math.random() < 0.5) {
$scope.my_data = treedata_avm;
} else {
$scope.my_data = treedata_geography;
}
$scope.doing_async = false;
return tree.expand_all();
}, 1000);
};
return $scope.try_adding_a_branch = function() {
var b;
b = tree.get_selected_branch();
return tree.add_branch(b, {
label: 'New Branch',
data: {
something: 42,
"else": 43
}
});
};
});
\ No newline at end of file
'use strict';
// jVectorMap controller
app.controller('JVectorMapDemoCtrl', ['$scope', function($scope) {
$scope.world_markers = [
{latLng: [41.90, 12.45], name: 'Vatican City'},
{latLng: [43.73, 7.41], name: 'Monaco'},
{latLng: [-0.52, 166.93], name: 'Nauru'},
{latLng: [-8.51, 179.21], name: 'Tuvalu'},
{latLng: [43.93, 12.46], name: 'San Marino'},
{latLng: [47.14, 9.52], name: 'Liechtenstein'},
{latLng: [7.11, 171.06], name: 'Marshall Islands'},
{latLng: [17.3, -62.73], name: 'Saint Kitts and Nevis'},
{latLng: [3.2, 73.22], name: 'Maldives'},
{latLng: [35.88, 14.5], name: 'Malta'},
{latLng: [12.05, -61.75], name: 'Grenada'},
{latLng: [13.16, -61.23], name: 'Saint Vincent and the Grenadines'},
{latLng: [13.16, -59.55], name: 'Barbados'},
{latLng: [17.11, -61.85], name: 'Antigua and Barbuda'},
{latLng: [-4.61, 55.45], name: 'Seychelles'},
{latLng: [7.35, 134.46], name: 'Palau'},
{latLng: [42.5, 1.51], name: 'Andorra'},
{latLng: [14.01, -60.98], name: 'Saint Lucia'},
{latLng: [6.91, 158.18], name: 'Federated States of Micronesia'},
{latLng: [1.3, 103.8], name: 'Singapore'},
{latLng: [1.46, 173.03], name: 'Kiribati'},
{latLng: [-21.13, -175.2], name: 'Tonga'},
{latLng: [15.3, -61.38], name: 'Dominica'},
{latLng: [-20.2, 57.5], name: 'Mauritius'},
{latLng: [26.02, 50.55], name: 'Bahrain'},
{latLng: [0.33, 6.73], name: 'São Tomé and Príncipe'}
];
$scope.usa_markers = [
{latLng: [40.71, -74.00], name: 'New York'},
{latLng: [34.05, -118.24], name: 'Los Angeles'},
{latLng: [41.87, -87.62], name: 'Chicago'},
{latLng: [29.76, -95.36], name: 'Houston'},
{latLng: [39.95, -75.16], name: 'Philadelphia'},
{latLng: [38.90, -77.03], name: 'Washington'},
{latLng: [37.36, -122.03], name: 'Silicon Valley'}
];
}])
;
\ No newline at end of file
(function(e,t){function n(e,t){var n=e.createElement("p"),i=e.getElementsByTagName("head")[0]||e.documentElement;return n.innerHTML="x<style>"+t+"</style>",i.insertBefore(n.lastChild,i.firstChild)}function i(){var e=m.elements;return"string"==typeof e?e.split(" "):e}function r(e){var t={},n=e.createElement,r=e.createDocumentFragment,o=r();e.createElement=function(e){m.shivMethods||n(e);var i;return i=t[e]?t[e].cloneNode():g.test(e)?(t[e]=n(e)).cloneNode():n(e),i.canHaveChildren&&!f.test(e)?o.appendChild(i):i},e.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+i().join().replace(/\w+/g,function(e){return t[e]=n(e),o.createElement(e),'c("'+e+'")'})+");return n}")(m,o)}function o(e){var t;return e.documentShived?e:(m.shivCSS&&!d&&(t=!!n(e,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),h||(t=!r(e)),t&&(e.documentShived=t),e)}function a(e){for(var t,n=e.getElementsByTagName("*"),r=n.length,o=RegExp("^(?:"+i().join("|")+")$","i"),a=[];r--;)t=n[r],o.test(t.nodeName)&&a.push(t.applyElement(s(t)));return a}function s(e){for(var t,n=e.attributes,i=n.length,r=e.ownerDocument.createElement(b+":"+e.nodeName);i--;)t=n[i],t.specified&&r.setAttribute(t.nodeName,t.nodeValue);return r.style.cssText=e.style.cssText,r}function l(e){for(var t,n=e.split("{"),r=n.length,o=RegExp("(^|[\\s,>+~])("+i().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"),a="$1"+b+"\\:$2";r--;)t=n[r]=n[r].split("}"),t[t.length-1]=t[t.length-1].replace(o,a),n[r]=t.join("}");return n.join("{")}function c(e){for(var t=e.length;t--;)e[t].removeNode()}function u(e){var t,i,r=e.namespaces,o=e.parentWindow;return!y||e.printShived?e:(r[b]===void 0&&r.add(b),o.attachEvent("onbeforeprint",function(){for(var r,o,s,c=e.styleSheets,u=[],d=c.length,h=Array(d);d--;)h[d]=c[d];for(;s=h.pop();)if(!s.disabled&&v.test(s.media)){for(r=s.imports,d=0,o=r.length;o>d;d++)h.push(r[d]);try{u.push(s.cssText)}catch(p){}}u=l(u.reverse().join("")),i=a(e),t=n(e,u)}),o.attachEvent("onafterprint",function(){c(i),t.removeNode(!0)}),e.printShived=!0,e)}var d,h,p=e.html5||{},f=/^<|^(?:button|form|map|select|textarea|object|iframe)$/i,g=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i;(function(){var n=t.createElement("a");n.innerHTML="<xyz></xyz>",d="hidden"in n,d&&"function"==typeof injectElementWithStyles&&injectElementWithStyles("#modernizr{}",function(t){t.hidden=!0,d="none"==(e.getComputedStyle?getComputedStyle(t,null):t.currentStyle).display}),h=1==n.childNodes.length||function(){try{t.createElement("a")}catch(e){return!0}var n=t.createDocumentFragment();return n.cloneNode===void 0||n.createDocumentFragment===void 0||n.createElement===void 0}()})();var m={elements:p.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:p.shivCSS!==!1,shivMethods:p.shivMethods!==!1,type:"default",shivDocument:o};e.html5=m,o(t);var v=/^$|\b(?:all|print)\b/,b="html5shiv",y=!h&&function(){var n=t.documentElement;return t.namespaces!==void 0&&t.parentWindow!==void 0&&n.applyElement!==void 0&&n.removeNode!==void 0&&e.attachEvent!==void 0}();m.type+=" print",m.shivPrint=u,u(t)})(this,document);
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
* Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
* */
!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='&shy;<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<s.length;b++){var c=s[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!o[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(v(c.styleSheet.rawCssText,e,f),o[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!r||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}w()};x(),c.update=x,c.getEmValue=t,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);
\ No newline at end of file
var urlTimeStamp = function () {
var stamp = "?t=" + Math.floor(Date.now());
return stamp;
}
\ No newline at end of file
$(function () {
//加载弹出层
layui.use(['form','element'],
function() {
layer = layui.layer;
element = layui.element;
});
//触发事件
var tab = {
tabAdd: function(title,url,id){
//新增一个Tab项
element.tabAdd('xbs_tab', {
title: title
,content: '<iframe tab-id="'+id+'" frameborder="0" src="'+url+'" scrolling="yes" class="x-iframe"></iframe>'
,id: id
})
}
,tabDelete: function(othis){
//删除指定Tab项
element.tabDelete('xbs_tab', '44'); //删除:“商品管理”
othis.addClass('layui-btn-disabled');
}
,tabChange: function(id){
//切换到指定Tab项
element.tabChange('xbs_tab', id); //切换到:用户管理
}
};
tableCheck = {
init:function () {
$(".layui-form-checkbox").click(function(event) {
if($(this).hasClass('layui-form-checked')){
$(this).removeClass('layui-form-checked');
if($(this).hasClass('header')){
$(".layui-form-checkbox").removeClass('layui-form-checked');
}
}else{
$(this).addClass('layui-form-checked');
if($(this).hasClass('header')){
$(".layui-form-checkbox").addClass('layui-form-checked');
}
}
});
},
getData:function () {
var obj = $(".layui-form-checked").not('.header');
var arr=[];
obj.each(function(index, el) {
arr.push(obj.eq(index).attr('data-id'));
});
return arr;
}
}
//开启表格多选
tableCheck.init();
$('.container .left_open i').click(function(event) {
if($('.left-nav').css('left')=='0px'){
$('.left-nav').animate({left: '-221px'}, 100);
$('.page-content').animate({left: '0px'}, 100);
$('.page-content-bg').hide();
}else{
$('.left-nav').animate({left: '0px'}, 100);
$('.page-content').animate({left: '221px'}, 100);
if($(window).width()<768){
$('.page-content-bg').show();
}
}
});
$('.page-content-bg').click(function(event) {
$('.left-nav').animate({left: '-221px'}, 100);
$('.page-content').animate({left: '0px'}, 100);
$(this).hide();
});
$('.layui-tab-close').click(function(event) {
$('.layui-tab-title li').eq(0).find('i').remove();
});
$("tbody.x-cate tr[fid!='0']").hide();
// 栏目多级显示效果
$('.x-show').click(function () {
if($(this).attr('status')=='true'){
$(this).html('&#xe625;');
$(this).attr('status','false');
cateId = $(this).parents('tr').attr('cate-id');
$("tbody tr[fid="+cateId+"]").show();
}else{
cateIds = [];
$(this).html('&#xe623;');
$(this).attr('status','true');
cateId = $(this).parents('tr').attr('cate-id');
getCateId(cateId);
for (var i in cateIds) {
$("tbody tr[cate-id="+cateIds[i]+"]").hide().find('.x-show').html('&#xe623;').attr('status','true');
}
}
})
//左侧菜单效果
// $('#content').bind("click",function(event){
$('.left-nav #nav li').click(function (event) {
if($(this).children('.sub-menu').length){
if($(this).hasClass('open')){
$(this).removeClass('open');
$(this).find('.nav_right').html('&#xe697;');
$(this).children('.sub-menu').stop().slideUp();
$(this).siblings().children('.sub-menu').slideUp();
}else{
$(this).addClass('open');
$(this).children('a').find('.nav_right').html('&#xe6a6;');
$(this).children('.sub-menu').stop().slideDown();
$(this).siblings().children('.sub-menu').stop().slideUp();
$(this).siblings().find('.nav_right').html('&#xe697;');
$(this).siblings().removeClass('open');
}
}else{
var url = $(this).children('a').attr('_href');
var title = $(this).find('cite').html();
var index = $('.left-nav #nav li').index($(this));
for (var i = 0; i <$('.x-iframe').length; i++) {
if($('.x-iframe').eq(i).attr('tab-id')==index+1){
tab.tabChange(index+1);
event.stopPropagation();
return;
}
};
tab.tabAdd(title,url,index+1);
tab.tabChange(index+1);
}
event.stopPropagation();
})
})
var cateIds = [];
function getCateId(cateId) {
$("tbody tr[fid="+cateId+"]").each(function(index, el) {
id = $(el).attr('cate-id');
cateIds.push(id);
getCateId(id);
});
}
/*弹出层*/
/*
参数解释:
title 标题
url 请求的url
id 需要操作的数据id
w 弹出层宽度(缺省调默认值)
h 弹出层高度(缺省调默认值)
*/
function x_admin_show(title,url,w,h){
if (title == null || title == '') {
title=false;
};
if (url == null || url == '') {
url="404.html";
};
if (w == null || w == '') {
w=($(window).width()*0.9);
};
if (h == null || h == '') {
h=($(window).height() - 50);
};
layer.open({
type: 2,
area: [w+'px', h +'px'],
fix: false, //不固定
maxmin: true,
shadeClose: true,
shade:0.4,
title: title,
content: url
});
}
/*关闭弹出框口*/
function x_admin_close(){
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
This diff is collapsed.
/** layui-v2.2.6 MIT License By https://www.layui.com */
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}
\ No newline at end of file
/** layui-v2.2.6 MIT License By https://www.layui.com */
.laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px}
\ No newline at end of file
This diff is collapsed.
/** layui-v2.2.6 MIT License By https://www.layui.com */
;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['<button class="layui-icon '+u+'" lay-type="sub">'+("updown"===n.anim?"&#xe619;":"&#xe603;")+"</button>",'<button class="layui-icon '+u+'" lay-type="add">'+("updown"===n.anim?"&#xe61a;":"&#xe602;")+"</button>"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['<div class="'+c+'"><ul>',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("<li"+(n.index===e?' class="layui-this"':"")+"></li>")}),i.join("")}(),"</ul></div>"].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a<n.index&&e.slide("sub",n.index-a)})},m.prototype.slide=function(e,i){var n=this,l=n.elemItem,u=n.config,c=u.index,m=u.elem.attr("lay-filter");n.haveSlide||("sub"===e?(n.subIndex(i),l.eq(u.index).addClass(d),setTimeout(function(){l.eq(c).addClass(r),l.eq(u.index).addClass(r)},50)):(n.addIndex(i),l.eq(u.index).addClass(s),setTimeout(function(){l.eq(c).addClass(o),l.eq(u.index).addClass(o)},50)),setTimeout(function(){l.removeClass(a+" "+d+" "+s+" "+o+" "+r),l.eq(u.index).addClass(a),n.haveSlide=!1},300),n.elemInd.find("li").eq(u.index).addClass(a).siblings().removeClass(a),n.haveSlide=!0,layui.event.call(this,t,"change("+m+")",{index:u.index,prevIndex:c,item:l.eq(u.index)}))},m.prototype.events=function(){var e=this,i=e.config;i.elem.data("haveEvents")||(i.elem.on("mouseenter",function(){clearInterval(e.timer)}).on("mouseleave",function(){e.autoplay()}),i.elem.data("haveEvents",!0))},n.render=function(e){var i=new m(e);return i},e(t,n)});
\ No newline at end of file
/** layui-v2.2.6 MIT License By https://www.layui.com */
;layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")),c.html('<ol class="layui-code-ol"><li>'+o.replace(/[\r\t\n]+/g,"</li><li>")+"</li></ol>"),c.find(">.layui-code-h3")[0]||c.prepend('<h3 class="layui-code-h3">'+(c.attr("lay-title")||e.title||"code")+(e.about?'<a href="'+l+'" target="_blank">layui.code</a>':"")+"</h3>");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss");
\ No newline at end of file
/** layui-v2.2.6 MIT License By https://www.layui.com */
;layui.define("jquery",function(t){"use strict";var a=layui.$,i=(layui.hint(),layui.device()),e="element",l="layui-this",n="layui-show",s=function(){this.config={}};s.prototype.set=function(t){var i=this;return a.extend(!0,i.config,t),i},s.prototype.on=function(t,a){return layui.onevent.call(this,e,t,a)},s.prototype.tabAdd=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.children(".layui-tab-bar"),o=l.children(".layui-tab-content"),r='<li lay-id="'+(i.id||"")+'"'+(i.attr?' lay-attr="'+i.attr+'"':"")+">"+(i.title||"unnaming")+"</li>";return s[0]?s.before(r):n.append(r),o.append('<div class="layui-tab-item">'+(i.content||"")+"</div>"),f.hideTabMore(!0),f.tabAuto(),this},s.prototype.tabDelete=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+i+'"]');return f.tabDelete(null,s),this},s.prototype.tabChange=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+i+'"]');return f.tabClick.call(s[0],null,null,s),this},s.prototype.tab=function(t){t=t||{},b.on("click",t.headerElem,function(i){var e=a(this).index();f.tabClick.call(this,i,e,null,t)})},s.prototype.progress=function(t,i){var e="layui-progress",l=a("."+e+"[lay-filter="+t+"]"),n=l.find("."+e+"-bar"),s=n.find("."+e+"-text");return n.css("width",i),s.text(i),this};var o=".layui-nav",r="layui-nav-item",c="layui-nav-bar",u="layui-nav-tree",d="layui-nav-child",y="layui-nav-more",h="layui-anim layui-anim-upbit",f={tabClick:function(t,i,s,o){o=o||{};var r=s||a(this),i=i||r.parent().children("li").index(r),c=o.headerElem?r.parent():r.parents(".layui-tab").eq(0),u=o.bodyElem?a(o.bodyElem):c.children(".layui-tab-content").children(".layui-tab-item"),d=r.find("a"),y=c.attr("lay-filter");"javascript:;"!==d.attr("href")&&"_blank"===d.attr("target")||(r.addClass(l).siblings().removeClass(l),u.eq(i).addClass(n).siblings().removeClass(n)),layui.event.call(this,e,"tab("+y+")",{elem:c,index:i})},tabDelete:function(t,i){var n=i||a(this).parent(),s=n.index(),o=n.parents(".layui-tab").eq(0),r=o.children(".layui-tab-content").children(".layui-tab-item"),c=o.attr("lay-filter");n.hasClass(l)&&(n.next()[0]?f.tabClick.call(n.next()[0],null,s+1):n.prev()[0]&&f.tabClick.call(n.prev()[0],null,s-1)),n.remove(),r.eq(s).remove(),setTimeout(function(){f.tabAuto()},50),layui.event.call(this,e,"tabDelete("+c+")",{elem:o,index:s})},tabAuto:function(){var t="layui-tab-more",e="layui-tab-bar",l="layui-tab-close",n=this;a(".layui-tab").each(function(){var s=a(this),o=s.children(".layui-tab-title"),r=(s.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),c=a('<span class="layui-unselect layui-tab-bar" '+r+"><i "+r+' class="layui-icon">&#xe61a;</i></span>');if(n===window&&8!=i.ie&&f.hideTabMore(!0),s.attr("lay-allowClose")&&o.find("li").each(function(){var t=a(this);if(!t.find("."+l)[0]){var i=a('<i class="layui-icon layui-unselect '+l+'">&#x1006;</i>');i.on("click",f.tabDelete),t.append(i)}}),"string"!=typeof s.attr("lay-unauto"))if(o.prop("scrollWidth")>o.outerWidth()+1){if(o.find("."+e)[0])return;o.append(c),s.attr("overflow",""),c.on("click",function(a){o[this.title?"removeClass":"addClass"](t),this.title=this.title?"":"收缩"})}else o.find("."+e).remove(),s.removeAttr("overflow")})},hideTabMore:function(t){var i=a(".layui-tab-title");t!==!0&&"tabmore"===a(t.target).attr("lay-stope")||(i.removeClass("layui-tab-more"),i.find(".layui-tab-bar").attr("title",""))},clickThis:function(){var t=a(this),i=t.parents(o),n=i.attr("lay-filter"),s=t.parent(),c=t.siblings("."+d),y="string"==typeof s.attr("lay-unselect");"javascript:;"!==t.attr("href")&&"_blank"===t.attr("target")||y||c[0]||(i.find("."+l).removeClass(l),s.addClass(l)),i.hasClass(u)&&(c.removeClass(h),c[0]&&(s["none"===c.css("display")?"addClass":"removeClass"](r+"ed"),"all"===i.attr("lay-shrink")&&s.siblings().removeClass(r+"ed"))),layui.event.call(this,e,"nav("+n+")",t)},collapse:function(){var t=a(this),i=t.find(".layui-colla-icon"),l=t.siblings(".layui-colla-content"),s=t.parents(".layui-collapse").eq(0),o=s.attr("lay-filter"),r="none"===l.css("display");if("string"==typeof s.attr("lay-accordion")){var c=s.children(".layui-colla-item").children("."+n);c.siblings(".layui-colla-title").children(".layui-colla-icon").html("&#xe602;"),c.removeClass(n)}l[r?"addClass":"removeClass"](n),i.html(r?"&#xe61a;":"&#xe602;"),layui.event.call(this,e,"collapse("+o+")",{title:t,content:l,show:r})}};s.prototype.init=function(t,e){var l=function(){return e?'[lay-filter="'+e+'"]':""}(),s={tab:function(){f.tabAuto.call({})},nav:function(){var t=200,e={},s={},p={},b=function(l,o,r){var c=a(this),f=c.find("."+d);o.hasClass(u)?l.css({top:c.position().top,height:c.children("a").outerHeight(),opacity:1}):(f.addClass(h),l.css({left:c.position().left+parseFloat(c.css("marginLeft")),top:c.position().top+c.height()-l.height()}),e[r]=setTimeout(function(){l.css({width:c.width(),opacity:1})},i.ie&&i.ie<10?0:t),clearTimeout(p[r]),"block"===f.css("display")&&clearTimeout(s[r]),s[r]=setTimeout(function(){f.addClass(n),c.find("."+y).addClass(y+"d")},300))};a(o+l).each(function(i){var l=a(this),o=a('<span class="'+c+'"></span>'),h=l.find("."+r);l.find("."+c)[0]||(l.append(o),h.on("mouseenter",function(){b.call(this,o,l,i)}).on("mouseleave",function(){l.hasClass(u)||(clearTimeout(s[i]),s[i]=setTimeout(function(){l.find("."+d).removeClass(n),l.find("."+y).removeClass(y+"d")},300))}),l.on("mouseleave",function(){clearTimeout(e[i]),p[i]=setTimeout(function(){l.hasClass(u)?o.css({height:0,top:o.position().top+o.height()/2,opacity:0}):o.css({width:0,left:o.position().left+o.width()/2,opacity:0})},t)})),h.find("a").each(function(){var t=a(this),i=(t.parent(),t.siblings("."+d));i[0]&&!t.children("."+y)[0]&&t.append('<span class="'+y+'"></span>'),t.off("click",f.clickThis).on("click",f.clickThis)})})},breadcrumb:function(){var t=".layui-breadcrumb";a(t+l).each(function(){var t=a(this),i="lay-separator",e=t.attr(i)||"/",l=t.find("a");l.next("span["+i+"]")[0]||(l.each(function(t){t!==l.length-1&&a(this).after("<span "+i+">"+e+"</span>")}),t.css("visibility","visible"))})},progress:function(){var t="layui-progress";a("."+t+l).each(function(){var i=a(this),e=i.find(".layui-progress-bar"),l=e.attr("lay-percent");e.css("width",function(){return/^.+\/.+$/.test(l)?100*new Function("return "+l)()+"%":l}()),i.attr("lay-showPercent")&&setTimeout(function(){e.html('<span class="'+t+'-text">'+l+"</span>")},350)})},collapse:function(){var t="layui-collapse";a("."+t+l).each(function(){var t=a(this).find(".layui-colla-item");t.each(function(){var t=a(this),i=t.find(".layui-colla-title"),e=t.find(".layui-colla-content"),l="none"===e.css("display");i.find(".layui-colla-icon").remove(),i.append('<i class="layui-icon layui-colla-icon">'+(l?"&#xe602;":"&#xe61a;")+"</i>"),i.off("click",f.collapse).on("click",f.collapse)})})}};return s[t]?s[t]():layui.each(s,function(t,a){a()})},s.prototype.render=s.prototype.init;var p=new s,b=a(document);p.render();var v=".layui-tab-title li";b.on("click",v,f.tabClick),b.on("click",f.hideTabMore),a(window).on("resize",f.tabAuto),t(e,p)});
\ No newline at end of file
/** layui-v2.2.6 MIT License By https://www.layui.com */
;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon ">&#xe63e;</i>';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="<cite>加载更多</cite>",h=l('<div class="layui-flow-more"><a href="javascript:;">'+d+"</a></div>");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;s<t.lazyimg.elem.length;s++){var v=t.lazyimg.elem.eq(s),y=a?function(){return v.offset().top-n.offset().top+m}():v.offset().top;if(c(v,f),i=s,y>u)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)});
\ No newline at end of file
/** layui-v2.2.6 MIT License By https://www.layui.com */
;layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,a=layui.hint(),n=layui.device(),l="form",r=".layui-form",s="layui-this",o="layui-hide",u="layui-disabled",c=function(){this.config={verify:{required:[/[\S]+/,"必填项不能为空"],phone:[/^1\d{10}$/,"请输入正确的手机号"],email:[/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,"邮箱格式不正确"],url:[/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/,"链接格式不正确"],number:function(e){if(!e||isNaN(e))return"只能填写数字"},date:[/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,"日期格式不正确"],identity:[/(^\d{15}$)|(^\d{17}(x|X|\d)$)/,"请输入正确的身份证号"]}}};c.prototype.set=function(e){var i=this;return t.extend(!0,i.config,e),i},c.prototype.verify=function(e){var i=this;return t.extend(!0,i.config.verify,e),i},c.prototype.on=function(e,t){return layui.onevent.call(this,l,e,t)},c.prototype.render=function(e,i){var n=this,c=t(r+function(){return i?'[lay-filter="'+i+'"]':""}()),d={select:function(){var e,i="请选择",a="layui-form-select",n="layui-select-title",r="layui-select-none",d="",f=c.find("select"),y=function(i,l){t(i.target).parent().hasClass(n)&&!l||(t("."+a).removeClass(a+"ed "+a+"up"),e&&d&&e.val(d)),e=null},h=function(i,c,f){var h=t(this),p=i.find("."+n),m=p.find("input"),k=i.find("dl"),g=k.children("dd");if(!c){var x=function(){var e=i.offset().top+i.outerHeight()+5-v.scrollTop(),t=k.outerHeight();i.addClass(a+"ed"),g.removeClass(o),e+t>v.height()&&e>=t&&i.addClass(a+"up")},b=function(e){i.removeClass(a+"ed "+a+"up"),m.blur(),e||C(m.val(),function(e){e&&(d=k.find("."+s).html(),m&&m.val(d))})};p.on("click",function(e){i.hasClass(a+"ed")?b():(y(e,!0),x()),k.find("."+r).remove()}),p.find(".layui-edge").on("click",function(){m.focus()}),m.on("keyup",function(e){var t=e.keyCode;9===t&&x()}).on("keydown",function(e){var t=e.keyCode;9===t?b():13===t&&e.preventDefault()});var C=function(e,i,a){var n=0;layui.each(g,function(){var i=t(this),l=i.text(),r=l.indexOf(e)===-1;(""===e||"blur"===a?e!==l:r)&&n++,"keyup"===a&&i[r?"addClass":"removeClass"](o)});var l=n===g.length;return i(l),l},w=function(e){var t=this.value,i=e.keyCode;return 9!==i&&13!==i&&37!==i&&38!==i&&39!==i&&40!==i&&(C(t,function(e){e?k.find("."+r)[0]||k.append('<p class="'+r+'">无匹配项</p>'):k.find("."+r).remove()},"keyup"),void(""===t&&k.find("."+r).remove()))};f&&m.on("keyup",w).on("blur",function(t){e=m,d=k.find("."+s).html(),setTimeout(function(){C(m.val(),function(e){d||m.val("")},"blur")},200)}),g.on("click",function(){var e=t(this),a=e.attr("lay-value"),n=h.attr("lay-filter");return!e.hasClass(u)&&(e.hasClass("layui-select-tips")?m.val(""):(m.val(e.text()),e.addClass(s)),e.siblings().removeClass(s),h.val(a).removeClass("layui-form-danger"),layui.event.call(this,l,"select("+n+")",{elem:h[0],value:a,othis:i}),b(!0),!1)}),i.find("dl>dt").on("click",function(e){return!1}),t(document).off("click",y).on("click",y)}};f.each(function(e,l){var r=t(this),o=r.next("."+a),c=this.disabled,d=l.value,f=t(l.options[l.selectedIndex]),y=l.options[0];if("string"==typeof r.attr("lay-ignore"))return r.show();var v="string"==typeof r.attr("lay-search"),p=y?y.value?i:y.innerHTML||i:i,m=t(['<div class="'+(v?"":"layui-unselect ")+a+(c?" layui-select-disabled":"")+'">','<div class="'+n+'"><input type="text" placeholder="'+p+'" value="'+(d?f.html():"")+'" '+(v?"":"readonly")+' class="layui-input'+(v?"":" layui-unselect")+(c?" "+u:"")+'">','<i class="layui-edge"></i></div>','<dl class="layui-anim layui-anim-upbit'+(r.find("optgroup")[0]?" layui-select-group":"")+'">'+function(e){var t=[];return layui.each(e,function(e,a){0!==e||a.value?"optgroup"===a.tagName.toLowerCase()?t.push("<dt>"+a.label+"</dt>"):t.push('<dd lay-value="'+a.value+'" class="'+(d===a.value?s:"")+(a.disabled?" "+u:"")+'">'+a.innerHTML+"</dd>"):t.push('<dd lay-value="" class="layui-select-tips">'+(a.innerHTML||i)+"</dd>")}),0===t.length&&t.push('<dd lay-value="" class="'+u+'">没有选项</dd>'),t.join("")}(r.find("*"))+"</dl>","</div>"].join(""));o[0]&&o.remove(),r.after(m),h.call(this,m,c,v)})},checkbox:function(){var e={checkbox:["layui-form-checkbox","layui-form-checked","checkbox"],_switch:["layui-form-switch","layui-form-onswitch","switch"]},i=c.find("input[type=checkbox]"),a=function(e,i){var a=t(this);e.on("click",function(){var t=a.attr("lay-filter"),n=(a.attr("lay-text")||"").split("|");a[0].disabled||(a[0].checked?(a[0].checked=!1,e.removeClass(i[1]).find("em").text(n[1])):(a[0].checked=!0,e.addClass(i[1]).find("em").text(n[0])),layui.event.call(a[0],l,i[2]+"("+t+")",{elem:a[0],value:a[0].value,othis:e}))})};i.each(function(i,n){var l=t(this),r=l.attr("lay-skin"),s=(l.attr("lay-text")||"").split("|"),o=this.disabled;"switch"===r&&(r="_"+r);var c=e[r]||e.checkbox;if("string"==typeof l.attr("lay-ignore"))return l.show();var d=l.next("."+c[0]),f=t(['<div class="layui-unselect '+c[0]+(n.checked?" "+c[1]:"")+(o?" layui-checkbox-disbaled "+u:"")+'" lay-skin="'+(r||"")+'">',{_switch:"<em>"+((n.checked?s[0]:s[1])||"")+"</em><i></i>"}[r]||(n.title.replace(/\s/g,"")?"<span>"+n.title+"</span>":"")+'<i class="layui-icon">'+(r?"&#xe605;":"&#xe618;")+"</i>","</div>"].join(""));d[0]&&d.remove(),l.after(f),a.call(this,f,c)})},radio:function(){var e="layui-form-radio",i=["&#xe643;","&#xe63f;"],a=c.find("input[type=radio]"),n=function(a){var n=t(this),s="layui-anim-scaleSpring";a.on("click",function(){var o=n[0].name,u=n.parents(r),c=n.attr("lay-filter"),d=u.find("input[name="+o.replace(/(\.|#|\[|\])/g,"\\$1")+"]");n[0].disabled||(layui.each(d,function(){var a=t(this).next("."+e);this.checked=!1,a.removeClass(e+"ed"),a.find(".layui-icon").removeClass(s).html(i[1])}),n[0].checked=!0,a.addClass(e+"ed"),a.find(".layui-icon").addClass(s).html(i[0]),layui.event.call(n[0],l,"radio("+c+")",{elem:n[0],value:n[0].value,othis:a}))})};a.each(function(a,l){var r=t(this),s=r.next("."+e),o=this.disabled;if("string"==typeof r.attr("lay-ignore"))return r.show();s[0]&&s.remove();var c=t(['<div class="layui-unselect '+e+(l.checked?" "+e+"ed":"")+(o?" layui-radio-disbaled "+u:"")+'">','<i class="layui-anim layui-icon">'+i[l.checked?0:1]+"</i>","<div>"+function(){var e=l.title||"";return"string"==typeof r.next().attr("lay-radio")&&(e=r.next().html(),r.next().remove()),e}()+"</div>","</div>"].join(""));r.after(c),n.call(this,c)})}};return e?d[e]?d[e]():a.error("不支持的"+e+"表单渲染"):layui.each(d,function(e,t){t()}),n};var d=function(){var e=t(this),a=f.config.verify,s=null,o="layui-form-danger",u={},c=e.parents(r),d=c.find("*[lay-verify]"),y=e.parents("form")[0],v=c.find("input,select,textarea"),h=e.attr("lay-filter");if(layui.each(d,function(e,l){var r=t(this),u=r.attr("lay-verify").split("|"),c=r.attr("lay-verType"),d=r.val();if(r.removeClass(o),layui.each(u,function(e,t){var u,f="",y="function"==typeof a[t];if(a[t]){var u=y?f=a[t](d,l):!a[t][0].test(d);if(f=f||a[t][1],u)return"tips"===c?i.tips(f,function(){return"string"==typeof r.attr("lay-ignore")||"select"!==l.tagName.toLowerCase()&&!/^checkbox|radio$/.test(l.type)?r:r.next()}(),{tips:1}):"alert"===c?i.alert(f,{title:"提示",shadeClose:!0}):i.msg(f,{icon:5,shift:6}),n.android||n.ios||l.focus(),r.addClass(o),s=!0}}),s)return s}),s)return!1;var p={};return layui.each(v,function(e,t){if(t.name=(t.name||"").replace(/^\s*|\s*&/,""),t.name){if(/^.*\[\]$/.test(t.name)){var i=t.name.match(/^(.*)\[\]$/g)[0];p[i]=0|p[i],t.name=t.name.replace(/^(.*)\[\]$/,"$1["+p[i]++ +"]")}/^checkbox|radio$/.test(t.type)&&!t.checked||(u[t.name]=t.value)}}),layui.event.call(this,l,"submit("+h+")",{elem:this,form:y,field:u})},f=new c,y=t(document),v=t(window);f.render(),y.on("reset",r,function(){var e=t(this).attr("lay-filter");setTimeout(function(){f.render(null,e)},50)}),y.on("submit",r,d).on("click","*[lay-submit]",d),e(l,f)});
\ No newline at end of file
/** layui-v2.2.6 MIT License By https://www.layui.com */
;layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"&#x4E0A;&#x4E00;&#x9875;",a.next="next"in a?a.next:"&#x4E0B;&#x4E00;&#x9875;";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?'<a href="javascript:;" class="layui-laypage-prev'+(1==a.curr?" "+r:"")+'" data-page="'+(a.curr-1)+'">'+a.prev+"</a>":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push('<a href="javascript:;" class="layui-laypage-first" data-page="1" title="&#x9996;&#x9875;">'+(a.first||1)+"</a>");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r<t-1&&(r=u-t+1),a.first!==!1&&r>2&&e.push('<span class="layui-laypage-spr">&#x2026;</span>');r<=u;r++)r===a.curr?e.push('<span class="layui-laypage-curr"><em class="layui-laypage-em" '+(/^#/.test(a.theme)?'style="background-color:'+a.theme+';"':"")+"></em><em>"+r+"</em></span>"):e.push('<a href="javascript:;" data-page="'+r+'">'+r+"</a>");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1<a.pages&&e.push('<span class="layui-laypage-spr">&#x2026;</span>'),0!==t&&e.push('<a href="javascript:;" class="layui-laypage-last" title="&#x5C3E;&#x9875;" data-page="'+a.pages+'">'+(a.last||a.pages)+"</a>")),e.join("")}(),next:function(){return a.next?'<a href="javascript:;" class="layui-laypage-next'+(a.curr==a.pages?" "+r:"")+'" data-page="'+(a.curr+1)+'">'+a.next+"</a>":""}(),count:'<span class="layui-laypage-count">共 '+a.count+" 条</span>",limit:function(){var e=['<span class="layui-laypage-limits"><select lay-ignore>'];return layui.each(a.limits,function(t,n){e.push('<option value="'+n+'"'+(n===a.limit?"selected":"")+">"+n+" 条/页</option>")}),e.join("")+"</select></span>"}(),skip:function(){return['<span class="layui-laypage-skip">&#x5230;&#x7B2C;','<input type="text" min="1" value="'+a.curr+'" class="layui-input">','&#x9875;<button type="button" class="layui-laypage-btn">&#x786e;&#x5b9a;</button>',"</span>"].join("")}()};return['<div class="layui-box layui-laypage layui-laypage-'+(a.theme?/^#/.test(a.theme)?"molv":a.theme:"default")+'" id="layui-laypage-'+a.index+'">',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"</div>"].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;o<y;o++)"a"===r[o].nodeName.toLowerCase()&&s.on(r[o],"click",function(){var e=0|this.getAttribute("data-page");e<1||e>i.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)});
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment