新增个人简介功能
This commit is contained in:
parent
e0c270ceee
commit
5359c81835
@ -0,0 +1,34 @@
|
||||
package com.tenlion.twoduty.controller.api.contentdatabase;
|
||||
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.common.component.SecurityComponent;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 文章数据封装
|
||||
* @author liuyang
|
||||
* @create 2021-03-29 15:31
|
||||
* @description
|
||||
*/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "文章数据封装")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/contentdatabase")
|
||||
public class ContentDataBaseController extends DefaultBaseController {
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
protected SecurityComponent securityComponent;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package com.tenlion.twoduty.controller.api.departmentbase;
|
||||
|
||||
|
||||
import com.tenlion.twoduty.pojo.dtos.userexpand.UserExpandDTO;
|
||||
import com.tenlion.twoduty.service.userexpand.IUserExpandService;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.common.component.SecurityComponent;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
@ -21,6 +23,7 @@ import ink.wgink.service.position.service.IPositionUserService;
|
||||
import ink.wgink.service.role.service.IRoleService;
|
||||
import ink.wgink.service.role.service.IRoleUserService;
|
||||
import ink.wgink.service.user.service.IUserService;
|
||||
import ink.wgink.util.map.HashMapUtil;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -41,7 +44,7 @@ import java.util.Map;
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "组织机构数据封装")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/departmentBase")
|
||||
public class departmentBaseController extends DefaultBaseController {
|
||||
public class DepartmentBaseController extends DefaultBaseController {
|
||||
|
||||
@Autowired
|
||||
protected SecurityComponent securityComponent;
|
||||
@ -58,6 +61,9 @@ public class departmentBaseController extends DefaultBaseController {
|
||||
@Autowired
|
||||
private IPositionUserService positionUserService;
|
||||
|
||||
@Autowired
|
||||
private IUserExpandService userExpandService;
|
||||
|
||||
|
||||
/**
|
||||
* 组织机构默认ID
|
||||
@ -145,14 +151,26 @@ public class departmentBaseController extends DefaultBaseController {
|
||||
@ApiOperation(value = "用户详情", notes = "用户详情用户列表")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get-by-user-id/{userId}")
|
||||
public UserDTO getByUserId(@PathVariable("userId") String userId){
|
||||
public Map<String,Object> getByUserId(@PathVariable("userId") String userId){
|
||||
UserDTO userDTO = userService.get(userId);
|
||||
this.setUserParams(userDTO);
|
||||
return userDTO;
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(userDTO);
|
||||
params.put("userExpand","");
|
||||
UserExpandDTO userExpandDTO = userExpandService.get(userId);
|
||||
if(userExpandDTO != null){
|
||||
params.put("userExpand",userExpandDTO.getSummary());
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void setUserParams(UserDTO userDTO){
|
||||
String positionNames = "";
|
||||
List<PositionPO> positionPOS = positionUserService.listPositionPOByUserId(userDTO.getUserId());
|
||||
@ -164,15 +182,4 @@ public class departmentBaseController extends DefaultBaseController {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package com.tenlion.twoduty.controller.api.userexpand;
|
||||
|
||||
|
||||
import com.tenlion.twoduty.pojo.dtos.userexpand.UserExpandDTO;
|
||||
import com.tenlion.twoduty.pojo.vos.supervisecheck.SuperviseCheckVO;
|
||||
import com.tenlion.twoduty.pojo.vos.userexpand.UserExpandVO;
|
||||
import com.tenlion.twoduty.service.userexpand.IUserExpandService;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @ClassName: UserExpandController
|
||||
* @Description:
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-04-09 14:12:12
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "用户拓展信息接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/userexpand")
|
||||
public class UserExpandController extends DefaultBaseController {
|
||||
|
||||
@Autowired
|
||||
private IUserExpandService userExpandService;
|
||||
|
||||
|
||||
@ApiOperation(value = "详情(通过ID)", notes = "详情(通过ID)接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get/{userId}")
|
||||
public UserExpandDTO get(@PathVariable("userId") String userId) {
|
||||
return userExpandService.get(userId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "保存", notes = "保存接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("save")
|
||||
public SuccessResult save(@RequestBody UserExpandVO userExpandVO) {
|
||||
userExpandService.save(null,userExpandVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package com.tenlion.twoduty.dao.userexpand;
|
||||
|
||||
|
||||
import com.tenlion.twoduty.pojo.bos.userexpand.UserExpandBO;
|
||||
import com.tenlion.twoduty.pojo.dtos.userexpand.UserExpandDTO;
|
||||
import com.tenlion.twoduty.pojo.pos.userexpand.UserExpandPO;
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: IUserExpandDao
|
||||
* @Description:
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-04-09 14:12:12
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@Repository
|
||||
public interface IUserExpandDao {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void save(Map<String, Object> params) throws SaveException;
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param params
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void remove(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 删除(物理)
|
||||
*
|
||||
* @param params
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void delete(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param params
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void update(Map<String, Object> params) throws UpdateException;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
UserExpandDTO get(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
UserExpandBO getBO(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
UserExpandPO getPO(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<UserExpandDTO> list(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<UserExpandBO> listBO(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<UserExpandPO> listPO(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 统计
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
Integer count(Map<String, Object> params) throws SearchException;
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.tenlion.twoduty.pojo.bos.userexpand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: UserExpandBO
|
||||
* @Description:
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-04-09 14:12:12
|
||||
* @Version: 3.0
|
||||
**/
|
||||
public class UserExpandBO {
|
||||
|
||||
private String userExpandId;
|
||||
private String userId;
|
||||
private String summary;
|
||||
private String photo;
|
||||
private String video;
|
||||
private Integer isDelete;
|
||||
|
||||
public String getUserExpandId() {
|
||||
return userExpandId == null ? "" : userExpandId.trim();
|
||||
}
|
||||
|
||||
public void setUserExpandId(String userExpandId) {
|
||||
this.userExpandId = userExpandId;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getSummary() {
|
||||
return summary == null ? "" : summary.trim();
|
||||
}
|
||||
|
||||
public void setSummary(String summary) {
|
||||
this.summary = summary;
|
||||
}
|
||||
|
||||
public String getPhoto() {
|
||||
return photo == null ? "" : photo.trim();
|
||||
}
|
||||
|
||||
public void setPhoto(String photo) {
|
||||
this.photo = photo;
|
||||
}
|
||||
|
||||
public String getVideo() {
|
||||
return video == null ? "" : video.trim();
|
||||
}
|
||||
|
||||
public void setVideo(String video) {
|
||||
this.video = video;
|
||||
}
|
||||
|
||||
public Integer getIsDelete() {
|
||||
return isDelete == null ? 0 : isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.tenlion.twoduty.pojo.dtos.userexpand;
|
||||
|
||||
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @version 1.0
|
||||
* @author LY
|
||||
* @date 2021/4/9 12:05
|
||||
*/
|
||||
public class UserExpandDTO extends UserDTO {
|
||||
|
||||
@ApiModelProperty(name = "userExpandId", value = "ID")
|
||||
private String userExpandId;
|
||||
@ApiModelProperty(name = "userId", value = "用户ID")
|
||||
private String userId;
|
||||
@ApiModelProperty(name = "summary", value = "简介")
|
||||
private String summary;
|
||||
@ApiModelProperty(name = "photo", value = "宣传照片")
|
||||
private String photo;
|
||||
@ApiModelProperty(name = "video", value = "宣传视频")
|
||||
private String video;
|
||||
|
||||
|
||||
public String getUserExpandId() {
|
||||
return userExpandId;
|
||||
}
|
||||
|
||||
public void setUserExpandId(String userExpandId) {
|
||||
this.userExpandId = userExpandId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getSummary() {
|
||||
return summary;
|
||||
}
|
||||
|
||||
public void setSummary(String summary) {
|
||||
this.summary = summary;
|
||||
}
|
||||
|
||||
public String getPhoto() {
|
||||
return photo;
|
||||
}
|
||||
|
||||
public void setPhoto(String photo) {
|
||||
this.photo = photo;
|
||||
}
|
||||
|
||||
public String getVideo() {
|
||||
return video;
|
||||
}
|
||||
|
||||
public void setVideo(String video) {
|
||||
this.video = video;
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.tenlion.twoduty.pojo.pos.userexpand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: UserExpandPO
|
||||
* @Description:
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-04-09 14:12:12
|
||||
* @Version: 3.0
|
||||
**/
|
||||
public class UserExpandPO {
|
||||
|
||||
private String userExpandId;
|
||||
private String userId;
|
||||
private String summary;
|
||||
private String photo;
|
||||
private String video;
|
||||
private Integer isDelete;
|
||||
|
||||
public String getUserExpandId() {
|
||||
return userExpandId == null ? "" : userExpandId.trim();
|
||||
}
|
||||
|
||||
public void setUserExpandId(String userExpandId) {
|
||||
this.userExpandId = userExpandId;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getSummary() {
|
||||
return summary == null ? "" : summary.trim();
|
||||
}
|
||||
|
||||
public void setSummary(String summary) {
|
||||
this.summary = summary;
|
||||
}
|
||||
|
||||
public String getPhoto() {
|
||||
return photo == null ? "" : photo.trim();
|
||||
}
|
||||
|
||||
public void setPhoto(String photo) {
|
||||
this.photo = photo;
|
||||
}
|
||||
|
||||
public String getVideo() {
|
||||
return video == null ? "" : video.trim();
|
||||
}
|
||||
|
||||
public void setVideo(String video) {
|
||||
this.video = video;
|
||||
}
|
||||
|
||||
public Integer getIsDelete() {
|
||||
return isDelete == null ? 0 : isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package com.tenlion.twoduty.pojo.vos.userexpand;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: UserExpandVO
|
||||
* @Description:
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-04-09 14:12:12
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class UserExpandVO {
|
||||
|
||||
@ApiModelProperty(name = "userId", value = "用户ID")
|
||||
private String userId;
|
||||
@ApiModelProperty(name = "summary", value = "简介")
|
||||
private String summary;
|
||||
@ApiModelProperty(name = "photo", value = "宣传照片")
|
||||
private String photo;
|
||||
@ApiModelProperty(name = "video", value = "宣传视频")
|
||||
private String video;
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getSummary() {
|
||||
return summary == null ? "" : summary.trim();
|
||||
}
|
||||
|
||||
public void setSummary(String summary) {
|
||||
this.summary = summary;
|
||||
}
|
||||
|
||||
public String getPhoto() {
|
||||
return photo == null ? "" : photo.trim();
|
||||
}
|
||||
|
||||
public void setPhoto(String photo) {
|
||||
this.photo = photo;
|
||||
}
|
||||
|
||||
public String getVideo() {
|
||||
return video == null ? "" : video.trim();
|
||||
}
|
||||
|
||||
public void setVideo(String video) {
|
||||
this.video = video;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.tenlion.twoduty.service.userexpand;
|
||||
|
||||
|
||||
import com.tenlion.twoduty.pojo.dtos.userexpand.UserExpandDTO;
|
||||
import com.tenlion.twoduty.pojo.vos.userexpand.UserExpandVO;
|
||||
import ink.wgink.interfaces.user.IUserExpandBaseService;
|
||||
|
||||
public interface IUserExpandService extends IUserExpandBaseService<UserExpandDTO> {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param token
|
||||
* @param userExpandVO
|
||||
* @return
|
||||
*/
|
||||
void save(String token, UserExpandVO userExpandVO);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
package com.tenlion.twoduty.service.userexpand.impl;
|
||||
|
||||
|
||||
|
||||
import com.tenlion.twoduty.dao.userexpand.IUserExpandDao;
|
||||
import com.tenlion.twoduty.pojo.dtos.userexpand.UserExpandDTO;
|
||||
import com.tenlion.twoduty.pojo.vos.userexpand.UserExpandVO;
|
||||
import com.tenlion.twoduty.service.userexpand.IUserExpandService;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.util.UUIDUtil;
|
||||
import ink.wgink.util.map.HashMapUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @version 1.0
|
||||
* @author LY
|
||||
* @date 2021/4/9 12:07
|
||||
*/
|
||||
@Service
|
||||
public class UserExpandServiceImpl extends DefaultBaseService implements IUserExpandService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IUserExpandDao userExpandDao;
|
||||
|
||||
@Override
|
||||
public String getRoute() {
|
||||
return "route/userexpand/save.html";
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserExpandDTO get(String s) {
|
||||
Map<String, Object> params = super.getHashMap(2);
|
||||
params.put("userId", s);
|
||||
return userExpandDao.get(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserExpandDTO getByUsername(String s) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserExpandDTO> listByUserIds(List<String> list) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserExpandDTO> listByUsernames(List<String> list) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserExpandDTO> list(Map<String, Object> map) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserExpandDTO>> listPage(ListPage listPage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserExpandDTO>> listPageByIds(List<String> list, ListPage listPage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserExpandDTO>> listPageByExcludeIds(List<String> list, ListPage listPage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countDateRange(String s, String s1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<UserExpandDTO> listByKeywords(String s) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void save(String token, UserExpandVO userExpandVO) {
|
||||
UserExpandDTO userExpandDTO = this.get(userExpandVO.getUserId());
|
||||
if (userExpandDTO == null){
|
||||
saveReturnId(token, userExpandVO);
|
||||
}else{
|
||||
update(token,userExpandVO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String saveReturnId(String token, UserExpandVO userExpandVO) {
|
||||
String userExpandId = UUIDUtil.getUUID();
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(userExpandVO);
|
||||
params.put("userExpandId", userExpandId);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
setSaveInfo(params);
|
||||
} else {
|
||||
setAppSaveInfo(token, params);
|
||||
}
|
||||
userExpandDao.save(params);
|
||||
return userExpandId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void update(String token, UserExpandVO userExpandVO) {
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(userExpandVO);
|
||||
setUpdateInfo(params);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
|
||||
} else {
|
||||
setAppUpdateInfo(token, params);
|
||||
}
|
||||
userExpandDao.update(params);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,224 @@
|
||||
<?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.tenlion.twoduty.dao.userexpand.IUserExpandDao">
|
||||
|
||||
<resultMap id="userExpandDTO" type="com.tenlion.twoduty.pojo.dtos.userexpand.UserExpandDTO">
|
||||
<result column="user_expand_id" property="userExpandId"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="summary" property="summary"/>
|
||||
<result column="photo" property="photo"/>
|
||||
<result column="video" property="video"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="userExpandBO" type="com.tenlion.twoduty.pojo.bos.userexpand.UserExpandBO">
|
||||
<result column="user_expand_id" property="userExpandId"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="summary" property="summary"/>
|
||||
<result column="photo" property="photo"/>
|
||||
<result column="video" property="video"/>
|
||||
<result column="is_delete" property="isDelete"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="userExpandPO" type="com.tenlion.twoduty.pojo.pos.userexpand.UserExpandPO">
|
||||
<result column="user_expand_id" property="userExpandId"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="summary" property="summary"/>
|
||||
<result column="photo" property="photo"/>
|
||||
<result column="video" property="video"/>
|
||||
<result column="is_delete" property="isDelete"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 新增 -->
|
||||
<insert id="save" parameterType="map">
|
||||
INSERT INTO sys_user_expand(
|
||||
user_expand_id,
|
||||
user_id,
|
||||
summary,
|
||||
photo,
|
||||
video,
|
||||
is_delete
|
||||
) VALUES(
|
||||
#{userExpandId},
|
||||
#{userId},
|
||||
#{summary},
|
||||
#{photo},
|
||||
#{video},
|
||||
#{isDelete}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 删除 -->
|
||||
<update id="remove" parameterType="map">
|
||||
UPDATE
|
||||
sys_user_expand
|
||||
SET
|
||||
is_delete = 1
|
||||
WHERE
|
||||
user_expand_id IN
|
||||
<foreach collection="userExpandIds" index="index" open="(" separator="," close=")">
|
||||
#{userExpandIds[${index}]}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 删除(物理) -->
|
||||
<update id="delete" parameterType="map">
|
||||
DELETE FROM
|
||||
sys_user_expand
|
||||
WHERE
|
||||
user_expand_id IN
|
||||
<foreach collection="userExpandIds" index="index" open="(" separator="," close=")">
|
||||
#{userExpandIds[${index}]}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 修改 -->
|
||||
<update id="update" parameterType="map">
|
||||
UPDATE
|
||||
sys_user_expand
|
||||
SET
|
||||
summary = #{summary},
|
||||
photo = #{photo},
|
||||
video = #{video}
|
||||
WHERE
|
||||
user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<!-- 详情 -->
|
||||
<select id="get" parameterType="map" resultMap="userExpandDTO">
|
||||
SELECT
|
||||
t1.user_id,
|
||||
t1.summary,
|
||||
t1.photo,
|
||||
t1.video,
|
||||
t1.user_expand_id
|
||||
FROM
|
||||
sys_user_expand t1
|
||||
WHERE
|
||||
t1.is_delete = 0 AND t1.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<!-- 详情 -->
|
||||
<select id="getBO" parameterType="map" resultMap="userExpandBO">
|
||||
SELECT
|
||||
t1.user_expand_id,
|
||||
t1.user_id,
|
||||
t1.summary,
|
||||
t1.photo,
|
||||
t1.video,
|
||||
t1.is_delete
|
||||
FROM
|
||||
sys_user_expand t1
|
||||
WHERE
|
||||
t1.is_delete = 0 AND t1.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<!-- 详情 -->
|
||||
<select id="getPO" parameterType="map" resultMap="userExpandPO">
|
||||
SELECT
|
||||
t1.user_expand_id,
|
||||
t1.user_id,
|
||||
t1.summary,
|
||||
t1.photo,
|
||||
t1.video,
|
||||
t1.is_delete
|
||||
FROM
|
||||
sys_user_expand t1
|
||||
WHERE
|
||||
t1.is_delete = 0 AND t1.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<!-- 列表 -->
|
||||
<select id="list" parameterType="map" resultMap="userExpandDTO">
|
||||
SELECT
|
||||
t1.user_expand_id,
|
||||
t1.user_id,
|
||||
t1.summary,
|
||||
t1.photo,
|
||||
t1.video,
|
||||
1
|
||||
FROM
|
||||
sys_user_expand t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
<!-- 这里添加其他条件 -->
|
||||
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="userExpandIds != null and userExpandIds.size > 0">
|
||||
AND
|
||||
t1.user_expand_id IN
|
||||
<foreach collection="userExpandIds" index="index" open="(" separator="," close=")">
|
||||
#{userExpandIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 列表 -->
|
||||
<select id="listBO" parameterType="map" resultMap="userExpandBO">
|
||||
SELECT
|
||||
t1.user_expand_id,
|
||||
t1.user_id,
|
||||
t1.summary,
|
||||
t1.photo,
|
||||
t1.video,
|
||||
t1.is_delete
|
||||
FROM
|
||||
sys_user_expand t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
<!-- 这里添加其他条件 -->
|
||||
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="userExpandIds != null and userExpandIds.size > 0">
|
||||
AND
|
||||
t1.user_expand_id IN
|
||||
<foreach collection="userExpandIds" index="index" open="(" separator="," close=")">
|
||||
#{userExpandIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 列表 -->
|
||||
<select id="listPO" parameterType="map" resultMap="userExpandPO">
|
||||
SELECT
|
||||
t1.user_expand_id,
|
||||
t1.user_id,
|
||||
t1.summary,
|
||||
t1.photo,
|
||||
t1.video,
|
||||
t1.is_delete
|
||||
FROM
|
||||
sys_user_expand t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
<!-- 这里添加其他条件 -->
|
||||
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="userExpandIds != null and userExpandIds.size > 0">
|
||||
AND
|
||||
t1.user_expand_id IN
|
||||
<foreach collection="userExpandIds" index="index" open="(" separator="," close=")">
|
||||
#{userExpandIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 统计 -->
|
||||
<select id="count" parameterType="map" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
sys_user_expand t1
|
||||
WHERE
|
||||
t1.is_delete = 0 AND t1.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
280
src/main/resources/static/route/userexpand/list.html
Normal file
280
src/main/resources/static/route/userexpand/list.html
Normal file
@ -0,0 +1,280 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/twoduty/">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间" readonly>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
|
||||
</div>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
</div>
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
<!-- 表头按钮组 -->
|
||||
<script type="text/html" id="headerToolBar">
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
|
||||
<i class="fa fa-lg fa-plus"></i> 新增
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
|
||||
<i class="fa fa-lg fa-edit"></i> 编辑
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
|
||||
<i class="fa fa-lg fa-trash"></i> 删除
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'table', 'laydate', 'common'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var common = layui.common;
|
||||
var resizeTimeout = null;
|
||||
var tableUrl = 'api/userexpand/listpage';
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 90,
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
toolbar: '#headerToolBar',
|
||||
request: {
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
cols: [
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'userExpandId', width: 180, title: 'ID', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'userId', width: 180, title: '用户ID', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'summary', width: 180, title: '简介', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'photo', width: 180, title: '宣传照片', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
var downloadFile = '';
|
||||
var datas = rowData.split(',');
|
||||
for(var i = 0, item = datas[i]; item = datas[i++];) {
|
||||
if(downloadFile.length > 0) {
|
||||
downloadFile += ' | ';
|
||||
}
|
||||
downloadFile += '<a href="route/file/download/false/'+ item +'" target="_blank">点击下载</a>'
|
||||
}
|
||||
return downloadFile;
|
||||
}
|
||||
},
|
||||
{field: 'video', width: 180, title: '宣传视频', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
var downloadFile = '';
|
||||
var datas = rowData.split(',');
|
||||
for(var i = 0, item = datas[i]; item = datas[i++];) {
|
||||
if(downloadFile.length > 0) {
|
||||
downloadFile += ' | ';
|
||||
}
|
||||
downloadFile += '<a href="route/file/download/false/'+ item +'" target="_blank">点击下载</a>'
|
||||
}
|
||||
return downloadFile;
|
||||
}
|
||||
},
|
||||
]
|
||||
],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
return {
|
||||
'code': 0,
|
||||
'msg': '',
|
||||
'count': data.total,
|
||||
'data': data.rows
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
startTime: $('#startTime').val(),
|
||||
endTime: $('#endTime').val()
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
},
|
||||
height: $win.height() - 90,
|
||||
});
|
||||
}
|
||||
// 初始化日期
|
||||
function initDate() {
|
||||
// 日期选择
|
||||
laydate.render({
|
||||
elem: '#startTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#endTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
});
|
||||
}
|
||||
// 删除
|
||||
function removeData(ids) {
|
||||
top.dialog.msg(top.dataMessage.delete, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
var layIndex;
|
||||
top.restAjax.delete(top.restAjax.path('api/userexpand/remove/{ids}', [ids]), {}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
|
||||
reloadTable();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function () {
|
||||
top.dialog.close(layIndex);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
initTable();
|
||||
initDate();
|
||||
// 事件 - 页面变化
|
||||
$win.on('resize', function() {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(function() {
|
||||
reloadTable();
|
||||
}, 500);
|
||||
});
|
||||
// 事件 - 搜索
|
||||
$(document).on('click', '#search', function() {
|
||||
reloadTable(1);
|
||||
});
|
||||
// 事件 - 增删改
|
||||
table.on('toolbar(dataTable)', function(obj) {
|
||||
var layEvent = obj.event;
|
||||
var checkStatus = table.checkStatus('dataTable');
|
||||
var checkDatas = checkStatus.data;
|
||||
if(layEvent === 'saveEvent') {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/userexpand/save.html', []),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
} else if(layEvent === 'updateEvent') {
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectEdit);
|
||||
} else if(checkDatas.length > 1) {
|
||||
top.dialog.msg(top.dataMessage.table.selectOneEdit);
|
||||
} else {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/userexpand/update.html?userExpandId={userExpandId}', [checkDatas[0].userExpandId]),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if(layEvent === 'removeEvent') {
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectDelete);
|
||||
} else {
|
||||
var ids = '';
|
||||
for(var i = 0, item; item = checkDatas[i++];) {
|
||||
if(i > 1) {
|
||||
ids += '_';
|
||||
}
|
||||
ids += item['userExpandId'];
|
||||
}
|
||||
removeData(ids);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
335
src/main/resources/static/route/userexpand/save.html
Normal file
335
src/main/resources/static/route/userexpand/save.html
Normal file
@ -0,0 +1,335 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/twoduty/">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
|
||||
<a href="javascript:void(0);"><cite>个人简介</cite></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||
<input type="hidden" id="userId" name="userId" >
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">简介</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="summary" name="summary" class="layui-textarea" placeholder="请输入简介" style="height: 500px"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="layui-form-item layui-form-text">-->
|
||||
<!--<label class="layui-form-label">宣传照片</label>-->
|
||||
<!--<div class="layui-input-block">-->
|
||||
<!--<input type="hidden" id="photo" name="photo">-->
|
||||
<!--<div class="layui-btn-container" id="photoFileBox" style="border: 1px solid #e6e6e6;"></div>-->
|
||||
<!--<script id="photoFileDownload" type="text/html">-->
|
||||
<!--{{# var fileName = 'photo'; }}-->
|
||||
<!--{{# if(d[fileName].length > 0) { }}-->
|
||||
<!--{{# var files = d[fileName];}}-->
|
||||
<!--{{# for(var i = 0, item = files[i]; item = files[i++];) { }}-->
|
||||
<!--<div class="upload-image-box">-->
|
||||
<!--<span class="upload-image-span">-->
|
||||
<!--<img src="route/file/download/false/{{item.fileId}}" align="加载失败">-->
|
||||
<!--</span>-->
|
||||
<!--<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="photoRemoveFile">-->
|
||||
<!--<i class="fa fa-trash-o"></i>-->
|
||||
<!--</a>-->
|
||||
<!--</div>-->
|
||||
<!--{{# } }}-->
|
||||
<!--{{# } }}-->
|
||||
<!--{{# if(d[fileName].length < 9) { }}-->
|
||||
<!--<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">-->
|
||||
<!--<a href="javascript:void(0);" lay-form-button data-explain="宣传照片" data-name="photo" lay-filter="photoUploadFile">-->
|
||||
<!--<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>-->
|
||||
<!--</a>-->
|
||||
<!--</div>-->
|
||||
<!--{{# } }}-->
|
||||
<!--</script>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="layui-form-item layui-form-text">-->
|
||||
<!--<label class="layui-form-label">宣传视频</label>-->
|
||||
<!--<div class="layui-input-block">-->
|
||||
<!--<input type="hidden" id="video" name="video">-->
|
||||
<!--<div class="layui-btn-container" id="videoFileBox" style="border: 1px solid #e6e6e6;"></div>-->
|
||||
<!--<script id="videoFileDownload" type="text/html">-->
|
||||
<!--{{# var fileName = 'video' }}-->
|
||||
<!--{{# if(d[fileName] != '') { }}-->
|
||||
<!--{{# var files = d[fileName];}}-->
|
||||
<!--{{# for(var i = 0, item = files[i]; item = files[i++];) { }}-->
|
||||
<!--<div class="upload-video-box">-->
|
||||
<!--<div id="{{fileName}}{{i}}" style="width:300px; height:200px;"></div>-->
|
||||
<!--<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-video" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="videoRemoveFile">-->
|
||||
<!--<i class="fa fa-trash-o"></i>-->
|
||||
<!--</a>-->
|
||||
<!--</div>-->
|
||||
<!--{{# } }}-->
|
||||
<!--{{# } }}-->
|
||||
<!--{{# if(d[fileName].length < 1) { }}-->
|
||||
<!--<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">-->
|
||||
<!--<a href="javascript:void(0);" lay-form-button data-explain="宣传视频" data-name="video" lay-filter="videoUploadFile">-->
|
||||
<!--<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>-->
|
||||
<!--</a>-->
|
||||
<!--</div>-->
|
||||
<!--{{# } }}-->
|
||||
<!--</script>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交修改</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
|
||||
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var wangEditor = window.wangEditor;
|
||||
var wangEditorObj = {};
|
||||
var viewerObj = {};
|
||||
var userId = top.restAjax.params(window.location.href).userId;
|
||||
$("#userId").val(userId)
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
function refreshDownloadTemplet(fileName, file) {
|
||||
var dataRander = {};
|
||||
dataRander[fileName] = file;
|
||||
|
||||
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
|
||||
document.getElementById(fileName +'FileBox').innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化文件列表
|
||||
function initFileList(fileName, ids, callback) {
|
||||
var dataForm = {};
|
||||
dataForm[fileName] = ids;
|
||||
form.val('dataForm', dataForm);
|
||||
|
||||
if(!ids) {
|
||||
refreshDownloadTemplet(fileName, []);
|
||||
if(callback) {
|
||||
callback(fileName, []);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
top.restAjax.get(top.restAjax.path('api/file/list', []), {
|
||||
ids: ids
|
||||
}, null, function(code, data) {
|
||||
refreshDownloadTemplet(fileName, data);
|
||||
if(callback) {
|
||||
callback(fileName, data);
|
||||
}
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化视频
|
||||
function initVideo(fileName, data) {
|
||||
for(var i = 0, item; item = data[i++];) {
|
||||
var player = new ckplayer({
|
||||
container: '#'+ fileName + i,
|
||||
variable: 'player',
|
||||
flashplayer: false,
|
||||
video: {
|
||||
file: 'route/file/download/true/'+ item.fileId,
|
||||
type: 'video/mp4'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化宣传照片图片上传
|
||||
function initPhotoUploadFile() {
|
||||
var files = $('#photo').val();
|
||||
initFileList('photo', files, function(fileName) {
|
||||
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
|
||||
viewerObj[fileName] = viewer;
|
||||
});
|
||||
|
||||
form.on('button(photoUploadFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var explain = this.dataset.explain;
|
||||
top.dialog.file({
|
||||
type: 'image',
|
||||
title: '上传'+ explain,
|
||||
width: '400px',
|
||||
height: '420px',
|
||||
maxFileCount: '1',
|
||||
onClose: function() {
|
||||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||
var files = $('#'+ name).val();
|
||||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||
if(files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += file.data;
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.on('button(photoRemoveFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var id = this.dataset.id;
|
||||
var files = $('#'+ name).val().replace(id, '');
|
||||
files = files.replace(/\,+/g, ',');
|
||||
if(files.charAt(0) == ',') {
|
||||
files = files.substring(1);
|
||||
}
|
||||
if(files.charAt(files.length - 1) == ',') {
|
||||
files = files.substring(0, files.length - 1);
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化宣传视频视频上传
|
||||
function initVideoUploadFile() {
|
||||
var files = $('#video').val();
|
||||
initFileList('video', files, initVideo);
|
||||
|
||||
form.on('button(videoUploadFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var explain = this.dataset.explain;
|
||||
top.dialog.file({
|
||||
type: 'video',
|
||||
title: '上传'+ explain,
|
||||
width: '400px',
|
||||
height: '420px',
|
||||
maxFileCount: '1',
|
||||
onClose: function() {
|
||||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||
var files = $('#'+ name).val();
|
||||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||
if(files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += file.data;
|
||||
}
|
||||
initFileList(name, files, initVideo);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.on('button(videoRemoveFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var id = this.dataset.id;
|
||||
var files = $('#'+ name).val().replace(id, '');
|
||||
files = files.replace(/\,+/g, ',');
|
||||
if(files.charAt(0) == ',') {
|
||||
files = files.substring(1);
|
||||
}
|
||||
if(files.charAt(files.length - 1) == ',') {
|
||||
files = files.substring(0, files.length - 1);
|
||||
}
|
||||
initFileList(name, files, initVideo);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 初始化内容
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/userexpand/get/{userId}', [userId]), {}, null, function(code, data) {
|
||||
var dataFormData = {};
|
||||
for(var i in data) {
|
||||
dataFormData[i] = data[i] +'';
|
||||
}
|
||||
form.val('dataForm', dataFormData);
|
||||
form.render(null, 'dataForm');
|
||||
//initPhotoUploadFile();
|
||||
//initVideoUploadFile();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
initData();
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.post(top.restAjax.path('api/userexpand/save', []), formData.field, null, function(code, data) {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
window.location.reload();
|
||||
},
|
||||
btn2: function() {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
// 校验
|
||||
form.verify({
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
329
src/main/resources/static/route/userexpand/show.html
Normal file
329
src/main/resources/static/route/userexpand/show.html
Normal file
@ -0,0 +1,329 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/twoduty/">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||
<input type="hidden" id="userId" name="userId">
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">个人简介</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="summary" name="summary" class="layui-textarea" placeholder="请输入个人简介" readonly="readonly"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">宣传照片</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="photo" name="photo">
|
||||
<div class="layui-btn-container" id="photoFileBox" style="border: 1px solid #e6e6e6;"></div>
|
||||
<script id="photoFileDownload" type="text/html">
|
||||
{{# var fileName = 'photo'; }}
|
||||
{{# if(d[fileName].length > 0) { }}
|
||||
{{# var files = d[fileName];}}
|
||||
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
|
||||
<div class="upload-image-box">
|
||||
<span class="upload-image-span">
|
||||
<img src="route/file/download/false/{{item.fileId}}" align="加载失败">
|
||||
</span>
|
||||
<!--<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="photoRemoveFile">-->
|
||||
<!--<i class="fa fa-trash-o"></i>-->
|
||||
<!--</a>-->
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
{{# if(d[fileName].length < 9) { }}
|
||||
<!--<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">-->
|
||||
<!--<a href="javascript:void(0);" lay-form-button data-explain="宣传照片" data-name="photo" lay-filter="photoUploadFile">-->
|
||||
<!--<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>-->
|
||||
<!--</a>-->
|
||||
<!--</div>-->
|
||||
{{# } }}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">宣传视频</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="video" name="video">
|
||||
<div class="layui-btn-container" id="videoFileBox" style="border: 1px solid #e6e6e6;"></div>
|
||||
<script id="videoFileDownload" type="text/html">
|
||||
{{# var fileName = 'video' }}
|
||||
{{# if(d[fileName] != '') { }}
|
||||
{{# var files = d[fileName];}}
|
||||
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
|
||||
<div class="upload-video-box">
|
||||
<div id="{{fileName}}{{i}}" style="width:300px; height:200px;"></div>
|
||||
<!--<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-video" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="videoRemoveFile">-->
|
||||
<!--<i class="fa fa-trash-o"></i>-->
|
||||
<!--</a>-->
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
{{# if(d[fileName].length < 1) { }}
|
||||
<!--<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">-->
|
||||
<!--<a href="javascript:void(0);" lay-form-button data-explain="宣传视频" data-name="video" lay-filter="videoUploadFile">-->
|
||||
<!--<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>-->
|
||||
<!--</a>-->
|
||||
<!--</div>-->
|
||||
{{# } }}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<!-- <button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交编辑</button>-->
|
||||
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
|
||||
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var userId = top.restAjax.params(window.location.href).userId;
|
||||
|
||||
var wangEditor = window.wangEditor;
|
||||
var wangEditorObj = {};
|
||||
var viewerObj = {};
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
function refreshDownloadTemplet(fileName, file) {
|
||||
var dataRander = {};
|
||||
dataRander[fileName] = file;
|
||||
|
||||
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
|
||||
document.getElementById(fileName +'FileBox').innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化文件列表
|
||||
function initFileList(fileName, ids, callback) {
|
||||
var dataForm = {};
|
||||
dataForm[fileName] = ids;
|
||||
form.val('dataForm', dataForm);
|
||||
|
||||
if(!ids) {
|
||||
refreshDownloadTemplet(fileName, []);
|
||||
if(callback) {
|
||||
callback(fileName, []);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
top.restAjax.get(top.restAjax.path('api/file/list', []), {
|
||||
ids: ids
|
||||
}, null, function(code, data) {
|
||||
refreshDownloadTemplet(fileName, data);
|
||||
if(callback) {
|
||||
callback(fileName, data);
|
||||
}
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化视频
|
||||
function initVideo(fileName, data) {
|
||||
for(var i = 0, item; item = data[i++];) {
|
||||
var player = new ckplayer({
|
||||
container: '#'+ fileName + i,
|
||||
variable: 'player',
|
||||
flashplayer: false,
|
||||
video: {
|
||||
file: 'route/file/download/true/'+ item.fileId,
|
||||
type: 'video/mp4'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化宣传照片图片上传
|
||||
function initPhotoUploadFile() {
|
||||
var files = $('#photo').val();
|
||||
initFileList('photo', files, function(fileName) {
|
||||
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
|
||||
viewerObj[fileName] = viewer;
|
||||
});
|
||||
|
||||
form.on('button(photoUploadFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var explain = this.dataset.explain;
|
||||
top.dialog.file({
|
||||
type: 'image',
|
||||
title: '上传'+ explain,
|
||||
width: '400px',
|
||||
height: '420px',
|
||||
maxFileCount: '1',
|
||||
onClose: function() {
|
||||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||
var files = $('#'+ name).val();
|
||||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||
if(files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += file.data;
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.on('button(photoRemoveFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var id = this.dataset.id;
|
||||
var files = $('#'+ name).val().replace(id, '');
|
||||
files = files.replace(/\,+/g, ',');
|
||||
if(files.charAt(0) == ',') {
|
||||
files = files.substring(1);
|
||||
}
|
||||
if(files.charAt(files.length - 1) == ',') {
|
||||
files = files.substring(0, files.length - 1);
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化宣传视频视频上传
|
||||
function initVideoUploadFile() {
|
||||
var files = $('#video').val();
|
||||
initFileList('video', files, initVideo);
|
||||
|
||||
form.on('button(videoUploadFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var explain = this.dataset.explain;
|
||||
top.dialog.file({
|
||||
type: 'video',
|
||||
title: '上传'+ explain,
|
||||
width: '400px',
|
||||
height: '420px',
|
||||
maxFileCount: '1',
|
||||
onClose: function() {
|
||||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||
var files = $('#'+ name).val();
|
||||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||
if(files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += file.data;
|
||||
}
|
||||
initFileList(name, files, initVideo);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.on('button(videoRemoveFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var id = this.dataset.id;
|
||||
var files = $('#'+ name).val().replace(id, '');
|
||||
files = files.replace(/\,+/g, ',');
|
||||
if(files.charAt(0) == ',') {
|
||||
files = files.substring(1);
|
||||
}
|
||||
if(files.charAt(files.length - 1) == ',') {
|
||||
files = files.substring(0, files.length - 1);
|
||||
}
|
||||
initFileList(name, files, initVideo);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 初始化内容
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/userexpand/get/{userId}', [userId]), {}, null, function(code, data) {
|
||||
var dataFormData = {};
|
||||
for(var i in data) {
|
||||
dataFormData[i] = data[i] +'';
|
||||
}
|
||||
form.val('dataForm', dataFormData);
|
||||
form.render(null, 'dataForm');
|
||||
initPhotoUploadFile();
|
||||
initVideoUploadFile();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
initData();
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/userexpand/update/{userExpandId}', [userExpandId]), formData.field, null, function(code, data) {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
window.location.reload();
|
||||
},
|
||||
btn2: function() {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
// 校验
|
||||
form.verify({
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
340
src/main/resources/static/route/userexpand/update.html
Normal file
340
src/main/resources/static/route/userexpand/update.html
Normal file
@ -0,0 +1,340 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/twoduty/">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
|
||||
<a href="javascript:void(0);"><cite>编辑内容</cite></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||
<!--<div class="layui-form-item">-->
|
||||
<!--<label class="layui-form-label">用户ID</label>-->
|
||||
<!--<div class="layui-input-block">-->
|
||||
<!--<input type="text" id="userId" name="userId" class="layui-input" value="" placeholder="请输入用户ID" maxlength="36">-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">个人简介</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="summary" name="summary" class="layui-textarea" placeholder="请输入简介" style="height: 500px"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="layui-form-item layui-form-text">-->
|
||||
<!--<label class="layui-form-label">宣传照片</label>-->
|
||||
<!--<div class="layui-input-block">-->
|
||||
<!--<input type="hidden" id="photo" name="photo">-->
|
||||
<!--<div class="layui-btn-container" id="photoFileBox" style="border: 1px solid #e6e6e6;"></div>-->
|
||||
<!--<script id="photoFileDownload" type="text/html">-->
|
||||
<!--{{# var fileName = 'photo'; }}-->
|
||||
<!--{{# if(d[fileName].length > 0) { }}-->
|
||||
<!--{{# var files = d[fileName];}}-->
|
||||
<!--{{# for(var i = 0, item = files[i]; item = files[i++];) { }}-->
|
||||
<!--<div class="upload-image-box">-->
|
||||
<!--<span class="upload-image-span">-->
|
||||
<!--<img src="route/file/download/false/{{item.fileId}}" align="加载失败">-->
|
||||
<!--</span>-->
|
||||
<!--<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="photoRemoveFile">-->
|
||||
<!--<i class="fa fa-trash-o"></i>-->
|
||||
<!--</a>-->
|
||||
<!--</div>-->
|
||||
<!--{{# } }}-->
|
||||
<!--{{# } }}-->
|
||||
<!--{{# if(d[fileName].length < 9) { }}-->
|
||||
<!--<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">-->
|
||||
<!--<a href="javascript:void(0);" lay-form-button data-explain="宣传照片" data-name="photo" lay-filter="photoUploadFile">-->
|
||||
<!--<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>-->
|
||||
<!--</a>-->
|
||||
<!--</div>-->
|
||||
<!--{{# } }}-->
|
||||
<!--</script>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="layui-form-item layui-form-text">-->
|
||||
<!--<label class="layui-form-label">宣传视频</label>-->
|
||||
<!--<div class="layui-input-block">-->
|
||||
<!--<input type="hidden" id="video" name="video">-->
|
||||
<!--<div class="layui-btn-container" id="videoFileBox" style="border: 1px solid #e6e6e6;"></div>-->
|
||||
<!--<script id="videoFileDownload" type="text/html">-->
|
||||
<!--{{# var fileName = 'video' }}-->
|
||||
<!--{{# if(d[fileName] != '') { }}-->
|
||||
<!--{{# var files = d[fileName];}}-->
|
||||
<!--{{# for(var i = 0, item = files[i]; item = files[i++];) { }}-->
|
||||
<!--<div class="upload-video-box">-->
|
||||
<!--<div id="{{fileName}}{{i}}" style="width:300px; height:200px;"></div>-->
|
||||
<!--<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-video" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="videoRemoveFile">-->
|
||||
<!--<i class="fa fa-trash-o"></i>-->
|
||||
<!--</a>-->
|
||||
<!--</div>-->
|
||||
<!--{{# } }}-->
|
||||
<!--{{# } }}-->
|
||||
<!--{{# if(d[fileName].length < 1) { }}-->
|
||||
<!--<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">-->
|
||||
<!--<a href="javascript:void(0);" lay-form-button data-explain="宣传视频" data-name="video" lay-filter="videoUploadFile">-->
|
||||
<!--<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>-->
|
||||
<!--</a>-->
|
||||
<!--</div>-->
|
||||
<!--{{# } }}-->
|
||||
<!--</script>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交编辑</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
|
||||
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var userId = top.restAjax.params(window.location.href).userId;
|
||||
|
||||
var wangEditor = window.wangEditor;
|
||||
var wangEditorObj = {};
|
||||
var viewerObj = {};
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
function refreshDownloadTemplet(fileName, file) {
|
||||
var dataRander = {};
|
||||
dataRander[fileName] = file;
|
||||
|
||||
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
|
||||
document.getElementById(fileName +'FileBox').innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化文件列表
|
||||
function initFileList(fileName, ids, callback) {
|
||||
var dataForm = {};
|
||||
dataForm[fileName] = ids;
|
||||
form.val('dataForm', dataForm);
|
||||
|
||||
if(!ids) {
|
||||
refreshDownloadTemplet(fileName, []);
|
||||
if(callback) {
|
||||
callback(fileName, []);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
top.restAjax.get(top.restAjax.path('api/file/list', []), {
|
||||
ids: ids
|
||||
}, null, function(code, data) {
|
||||
refreshDownloadTemplet(fileName, data);
|
||||
if(callback) {
|
||||
callback(fileName, data);
|
||||
}
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化视频
|
||||
function initVideo(fileName, data) {
|
||||
for(var i = 0, item; item = data[i++];) {
|
||||
var player = new ckplayer({
|
||||
container: '#'+ fileName + i,
|
||||
variable: 'player',
|
||||
flashplayer: false,
|
||||
video: {
|
||||
file: 'route/file/download/true/'+ item.fileId,
|
||||
type: 'video/mp4'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化宣传照片图片上传
|
||||
function initPhotoUploadFile() {
|
||||
var files = $('#photo').val();
|
||||
initFileList('photo', files, function(fileName) {
|
||||
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
|
||||
viewerObj[fileName] = viewer;
|
||||
});
|
||||
|
||||
form.on('button(photoUploadFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var explain = this.dataset.explain;
|
||||
top.dialog.file({
|
||||
type: 'image',
|
||||
title: '上传'+ explain,
|
||||
width: '400px',
|
||||
height: '420px',
|
||||
maxFileCount: '1',
|
||||
onClose: function() {
|
||||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||
var files = $('#'+ name).val();
|
||||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||
if(files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += file.data;
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.on('button(photoRemoveFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var id = this.dataset.id;
|
||||
var files = $('#'+ name).val().replace(id, '');
|
||||
files = files.replace(/\,+/g, ',');
|
||||
if(files.charAt(0) == ',') {
|
||||
files = files.substring(1);
|
||||
}
|
||||
if(files.charAt(files.length - 1) == ',') {
|
||||
files = files.substring(0, files.length - 1);
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化宣传视频视频上传
|
||||
function initVideoUploadFile() {
|
||||
var files = $('#video').val();
|
||||
initFileList('video', files, initVideo);
|
||||
|
||||
form.on('button(videoUploadFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var explain = this.dataset.explain;
|
||||
top.dialog.file({
|
||||
type: 'video',
|
||||
title: '上传'+ explain,
|
||||
width: '400px',
|
||||
height: '420px',
|
||||
maxFileCount: '1',
|
||||
onClose: function() {
|
||||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||
var files = $('#'+ name).val();
|
||||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||
if(files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += file.data;
|
||||
}
|
||||
initFileList(name, files, initVideo);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.on('button(videoRemoveFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var id = this.dataset.id;
|
||||
var files = $('#'+ name).val().replace(id, '');
|
||||
files = files.replace(/\,+/g, ',');
|
||||
if(files.charAt(0) == ',') {
|
||||
files = files.substring(1);
|
||||
}
|
||||
if(files.charAt(files.length - 1) == ',') {
|
||||
files = files.substring(0, files.length - 1);
|
||||
}
|
||||
initFileList(name, files, initVideo);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 初始化内容
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/userexpand/get/{userId}', [userId]), {}, null, function(code, data) {
|
||||
var dataFormData = {};
|
||||
for(var i in data) {
|
||||
dataFormData[i] = data[i] +'';
|
||||
}
|
||||
form.val('dataForm', dataFormData);
|
||||
form.render(null, 'dataForm');
|
||||
//initPhotoUploadFile();
|
||||
//initVideoUploadFile();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
initData();
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/userexpand/update/{userExpandId}', [userExpandId]), formData.field, null, function(code, data) {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
window.location.reload();
|
||||
},
|
||||
btn2: function() {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
// 校验
|
||||
form.verify({
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user