店铺认证、人员拓展属性、店铺功能修改

This commit is contained in:
ly19960718 2021-04-09 18:14:42 +08:00
parent 9546f17e9b
commit 0cf5871afb
28 changed files with 2324 additions and 87 deletions

View File

@ -106,6 +106,13 @@
<artifactId>java-sdk</artifactId>
<version>4.8.0</version>
</dependency>
<dependency>
<groupId>ink.wgink</groupId>
<artifactId>login-wechat</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>

View File

@ -43,29 +43,6 @@ public class ShopAuditLogController extends DefaultBaseController {
return new SuccessResult();
}
@ApiOperation(value = "删除", notes = "删除接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("remove/{ids}")
public SuccessResult remove(@PathVariable("ids") String ids) {
shopAuditLogService.remove(Arrays.asList(ids.split("\\_")));
return new SuccessResult();
}
@ApiOperation(value = "修改", notes = "修改接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "shopAuditLogId", value = "ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("update/{shopAuditLogId}")
@CheckRequestBodyAnnotation
public SuccessResult update(@PathVariable("shopAuditLogId") String shopAuditLogId, @RequestBody ShopAuditLogVO shopAuditLogVO) {
shopAuditLogService.update(shopAuditLogId, shopAuditLogVO);
return new SuccessResult();
}
@ApiOperation(value = "详情", notes = "详情接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "shopAuditLogId", value = "ID", paramType = "path")
@ -78,9 +55,10 @@ public class ShopAuditLogController extends DefaultBaseController {
@ApiOperation(value = "列表", notes = "列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list")
public List<ShopAuditLogDTO> list() {
@GetMapping("list/{bId}")
public List<ShopAuditLogDTO> list(@PathVariable("bId") String bId) {
Map<String, Object> params = requestParams();
params.put("auditBId",bId);
return shopAuditLogService.list(params);
}

View File

@ -34,6 +34,17 @@ public class ShopCertificationController extends DefaultBaseController {
@Autowired
private IShopCertificationService shopCertificationService;
@ApiOperation(value = "修改店铺认证状态", notes = "修改店铺认证接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "shopCertificationId", value = "店铺认证ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updateAuditStatus/{shopCertificationId}/{auditStatus}")
public SuccessResult updateAuditStatus(@PathVariable("shopCertificationId") String shopCertificationId,@PathVariable("auditStatus") String auditStatus) {
shopCertificationService.updateAuditStatus(shopCertificationId, auditStatus);
return new SuccessResult();
}
@ApiOperation(value = "新增店铺认证", notes = "新增店铺认证接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("save")

View File

@ -0,0 +1,51 @@
package cn.com.tenlion.controller.api.userexpand;
import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResult;
import ink.wgink.pojo.result.SuccessResultData;
import ink.wgink.pojo.result.SuccessResultList;
import cn.com.tenlion.pojo.dtos.userexpand.UserExpandDTO;
import cn.com.tenlion.pojo.vos.userexpand.UserExpandVO;
import cn.com.tenlion.service.userexpand.IUserExpandService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @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);
}
}

View File

@ -0,0 +1,65 @@
package cn.com.tenlion.controller.app.apis.userexpand;
import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResult;
import ink.wgink.pojo.result.SuccessResultData;
import ink.wgink.pojo.result.SuccessResultList;
import cn.com.tenlion.pojo.dtos.userexpand.UserExpandDTO;
import cn.com.tenlion.pojo.vos.userexpand.UserExpandVO;
import cn.com.tenlion.service.userexpand.IUserExpandService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @ClassName: UserExpandAppController
* @Description:
* @Author: CodeFactory
* @Date: 2021-04-09 14:12:12
* @Version: 3.0
**/
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "个人拓展信息接口")
@RestController
@RequestMapping(ISystemConstant.APP_PREFIX + "/userexpand")
public class UserExpandAppController extends DefaultBaseController {
@Autowired
private IUserExpandService userExpandService;
@ApiOperation(value = "新增", notes = "新增接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("save")
@CheckRequestBodyAnnotation
public SuccessResult save(@RequestHeader("token") String token, @RequestBody UserExpandVO userExpandVO) {
userExpandService.save(token, userExpandVO);
return new SuccessResult();
}
@ApiOperation(value = "详情(通过ID)", notes = "详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get/{userId}")
public UserExpandDTO get(@RequestHeader("token") String token, @PathVariable("userId") String userId) {
return userExpandService.get(userId);
}
}

View File

@ -0,0 +1,120 @@
package cn.com.tenlion.dao.userexpand;
import ink.wgink.exceptions.RemoveException;
import ink.wgink.exceptions.SaveException;
import ink.wgink.exceptions.SearchException;
import ink.wgink.exceptions.UpdateException;
import cn.com.tenlion.pojo.bos.userexpand.UserExpandBO;
import cn.com.tenlion.pojo.pos.userexpand.UserExpandPO;
import cn.com.tenlion.pojo.dtos.userexpand.UserExpandDTO;
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;
}

View File

@ -0,0 +1,69 @@
package cn.com.tenlion.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;
}
}

View File

@ -48,6 +48,12 @@ public class ShopCertificationDTO {
private String certificationImage;
@ApiModelProperty(name = "审核状态", value = "0 未审核 1审核通过 -1审核不通过")
private Integer auditStatus;
@ApiModelProperty(name = "gmtCreate", value = "申请时间")
private String gmtCreate;
@ApiModelProperty(name = "creatorName", value = "申请人姓名")
private String creatorName;
@ApiModelProperty(name = "creatorName", value = "申请人ID")
private String creator;
public String getShopCertificationId() {
@ -186,4 +192,28 @@ public class ShopCertificationDTO {
public void setAuditStatus(Integer auditStatus) {
this.auditStatus = auditStatus;
}
public String getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
public String getCreatorName() {
return creatorName;
}
public void setCreatorName(String creatorName) {
this.creatorName = creatorName;
}
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
}

View File

@ -0,0 +1,68 @@
package cn.com.tenlion.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;
}
}

View File

@ -0,0 +1,69 @@
package cn.com.tenlion.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;
}
}

View File

@ -25,14 +25,14 @@ public class ShopAuditLogVO {
@ApiModelProperty(name = "auditUserName", value = "审核人姓名")
private String auditUserName;
@ApiModelProperty(name = "auditStatus", value = "审核状态0未审核 1审核通过 -1审核未通过")
@CheckNumberAnnotation(name = "审核状态0未审核 1审核通过 -1审核未通过")
@CheckNumberAnnotation(name = "审核状态")
private Integer auditStatus;
@ApiModelProperty(name = "auditResult", value = "审核说明")
private String auditResult;
@ApiModelProperty(name = "auditDate", value = "审核时间")
@CheckEmptyAnnotation(name = "审核时间", verifyType = "datetime")
private String auditDate;
@ApiModelProperty(name = "auditType", value = "审核类型")
@CheckEmptyAnnotation(name = "审核类型")
private String auditType;
public String getShopAuditId() {

View File

@ -0,0 +1,61 @@
package cn.com.tenlion.pojo.vos.userexpand;
import ink.wgink.annotation.CheckEmptyAnnotation;
import ink.wgink.annotation.CheckNumberAnnotation;
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;
}
}

View File

@ -106,8 +106,6 @@ public class ShopServiceImpl extends DefaultBaseService implements IShopService
LOG.info("新增员工表");
ShopStaffVO shopstaffvo = new ShopStaffVO();
shopstaffvo.setShopId(shopId);
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
shopstaffvo.setUserId(appTokenUser.getId());
shopstaffvo.setPositionId(positonId);
shopstaffvo.setIsAdmin(0);
shopstaffvo.setIsLeader(1);

View File

@ -35,7 +35,7 @@ public class ShopAuditLogServiceImpl extends DefaultBaseService implements IShop
@Autowired
private IShopAuditLogDao shopAuditLogDao;
@Autowired
private SecurityComponent securityComponent;
@Autowired
private IShopService shopService;
@ -60,9 +60,9 @@ public class ShopAuditLogServiceImpl extends DefaultBaseService implements IShop
public String saveReturnId(String token, ShopAuditLogVO shopAuditLogVO) {
shopAuditLogVO.setAuditUserName(securityComponent.getCurrentUser().getUserName());
shopAuditLogVO.setAuditUser(securityComponent.getCurrentUser().getUserId());
String shopAuditLogId = UUIDUtil.getUUID();
String shopAuditId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(shopAuditLogVO);
params.put("shopAuditLogId", shopAuditLogId);
params.put("shopAuditId", shopAuditId);
params.put("auditDate", DateUtil.getTime());
if (StringUtils.isBlank(token)) {
setSaveInfo(params);
@ -70,7 +70,7 @@ public class ShopAuditLogServiceImpl extends DefaultBaseService implements IShop
setAppSaveInfo(token, params);
}
shopAuditLogDao.save(params);
return shopAuditLogId;
return shopAuditId;
}
@Override
@ -81,7 +81,7 @@ public class ShopAuditLogServiceImpl extends DefaultBaseService implements IShop
@Override
public void remove(String token, List<String> ids) {
Map<String, Object> params = getHashMap(2);
params.put("shopAuditLogIds", ids);
params.put("shopAuditIds", ids);
if (StringUtils.isBlank(token)) {
setUpdateInfo(params);
} else {
@ -93,7 +93,7 @@ public class ShopAuditLogServiceImpl extends DefaultBaseService implements IShop
@Override
public void delete(List<String> ids) {
Map<String, Object> params = getHashMap(2);
params.put("shopAuditLogIds", ids);
params.put("shopAuditIds", ids);
shopAuditLogDao.delete(params);
}
@ -105,7 +105,7 @@ public class ShopAuditLogServiceImpl extends DefaultBaseService implements IShop
@Override
public void update(String token, String shopAuditLogId, ShopAuditLogVO shopAuditLogVO) {
Map<String, Object> params = HashMapUtil.beanToMap(shopAuditLogVO);
params.put("shopAuditLogId", shopAuditLogId);
params.put("shopAuditId", shopAuditLogId);
if (StringUtils.isBlank(token)) {
setUpdateInfo(params);
} else {
@ -122,7 +122,7 @@ public class ShopAuditLogServiceImpl extends DefaultBaseService implements IShop
@Override
public ShopAuditLogDTO get(String shopAuditLogId) {
Map<String, Object> params = super.getHashMap(2);
params.put("shopAuditLogId", shopAuditLogId);
params.put("shopAuditId", shopAuditLogId);
return get(params);
}
@ -134,7 +134,7 @@ public class ShopAuditLogServiceImpl extends DefaultBaseService implements IShop
@Override
public ShopAuditLogBO getBO(String shopAuditLogId) {
Map<String, Object> params = super.getHashMap(2);
params.put("shopAuditLogId", shopAuditLogId);
params.put("shopAuditId", shopAuditLogId);
return getBO(params);
}
@ -146,7 +146,7 @@ public class ShopAuditLogServiceImpl extends DefaultBaseService implements IShop
@Override
public ShopAuditLogPO getPO(String shopAuditLogId) {
Map<String, Object> params = super.getHashMap(2);
params.put("shopAuditLogId", shopAuditLogId);
params.put("shopAuditId", shopAuditLogId);
return getPO(params);
}

View File

@ -19,6 +19,14 @@ import java.util.Map;
**/
public interface IShopCertificationService {
/**
* 更新认证审核状态
* @param shopCertificationId
* @param auditStatus
*/
void updateAuditStatus(String shopCertificationId,String auditStatus);
/**
* 新增店铺认证
*

View File

@ -1,5 +1,6 @@
package cn.com.tenlion.service.shopcertification.impl;
import cn.com.tenlion.service.shop.IShopService;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.exceptions.ParamsException;
import ink.wgink.pojo.ListPage;
@ -33,6 +34,31 @@ public class ShopCertificationServiceImpl extends DefaultBaseService implements
@Autowired
private IShopCertificationDao shopCertificationDao;
@Autowired
private IShopService shopService;
public void updateAuditStatus(String shopCertificationId,String auditStatus) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("shopCertificationId", shopCertificationId);
params.put("auditStatus", auditStatus);
setUpdateInfo(params);
shopCertificationDao.update(params);
ShopCertificationDTO shopCertificationDTO = this.get(shopCertificationId);
if(shopCertificationDTO == null){
throw new ParamsException("系统异常");
}
//审核通过更新店铺认证状态
if(shopCertificationDTO.getAuditStatus() == 1){
shopService.updateIsCertification(shopCertificationDTO.getShopId());
}
}
@Override
public void save(ShopCertificationVO shopCertificationVO) {
@ -103,6 +129,7 @@ public class ShopCertificationServiceImpl extends DefaultBaseService implements
public void update(String token, String shopCertificationId, ShopCertificationVO shopCertificationVO) {
Map<String, Object> params = HashMapUtil.beanToMap(shopCertificationVO);
params.put("shopCertificationId", shopCertificationId);
params.put("auditStatus", 0);
if (StringUtils.isBlank(token)) {
setUpdateInfo(params);
} else {

View File

@ -2,9 +2,12 @@ package cn.com.tenlion.service.shopstaff.impl;
import cn.com.tenlion.pojo.dtos.shopposition.ShopPositionDTO;
import cn.com.tenlion.service.shopposition.IShopPositionService;
import ink.wgink.app.AppTokenManager;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.common.component.SecurityComponent;
import ink.wgink.exceptions.SaveException;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.app.AppTokenUser;
import ink.wgink.pojo.dtos.user.UserDTO;
import ink.wgink.pojo.result.SuccessResult;
import ink.wgink.pojo.result.SuccessResultList;
@ -42,6 +45,8 @@ public class ShopStaffServiceImpl extends DefaultBaseService implements IShopSta
@Autowired
private IShopPositionService shopPositionService;
@Autowired
protected SecurityComponent securityComponent;
@Override
public void save(ShopStaffVO shopStaffVO) {
@ -50,6 +55,14 @@ public class ShopStaffServiceImpl extends DefaultBaseService implements IShopSta
@Override
public void save(String token, ShopStaffVO shopStaffVO) {
if (StringUtils.isBlank(token)) {
shopStaffVO.setUserId(securityComponent.getCurrentUser().getUserId());
} else {
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
shopStaffVO.setUserId(appTokenUser.getId());
}
Map<String,Object> params = new HashMap<>();
params.put("userId",shopStaffVO.getUserId());
params.put("shopId",shopStaffVO.getShopId());

View File

@ -0,0 +1,30 @@
package cn.com.tenlion.service.userexpand;
import cn.com.tenlion.pojo.bos.userexpand.UserExpandBO;
import cn.com.tenlion.pojo.dtos.userexpand.UserExpandDTO;
import cn.com.tenlion.pojo.pos.userexpand.UserExpandPO;
import cn.com.tenlion.pojo.vos.userexpand.UserExpandVO;
import ink.wgink.interfaces.user.IUserExpandBaseService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultList;
import java.util.List;
import java.util.Map;
public interface IUserExpandService extends IUserExpandBaseService<UserExpandDTO> {
/**
* 新增
*
* @param token
* @param userExpandVO
* @return
*/
void save(String token, UserExpandVO userExpandVO);
}

View File

@ -0,0 +1,135 @@
package cn.com.tenlion.service.userexpand.impl;
import cn.com.tenlion.dao.userexpand.IUserExpandDao;
import cn.com.tenlion.pojo.dtos.userexpand.UserExpandDTO;
import cn.com.tenlion.pojo.vos.userexpand.UserExpandVO;
import cn.com.tenlion.service.userexpand.IUserExpandService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
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/show.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;
}
@Override
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);
if (StringUtils.isBlank(token)) {
setUpdateInfo(params);
} else {
setAppUpdateInfo(token, params);
}
userExpandDao.update(params);
}
}

View File

@ -20,6 +20,7 @@
<result column="certification_composition" property="certificationComposition"/>
<result column="certification_image" property="certificationImage"/>
<result column="audit_status" property="auditStatus"/>
<result column="gmt_create" property="gmtCreate"/>
</resultMap>
<resultMap id="shopCertificationBO" type="cn.com.tenlion.pojo.bos.shopcertification.ShopCertificationBO">
@ -320,6 +321,7 @@
t1.certification_composition,
t1.certification_image,
t1.audit_status,
t1.gmt_create,
t2.shop_name
FROM
svc_shop_certification t1
@ -332,7 +334,7 @@
<!-- 这里添加其他条件 -->
t2.shop_name LIKE CONCAT('%', #{keywords}, '%')
OR
t2.certification_name LIKE CONCAT('%', #{keywords}, '%')
t1.certification_name LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
@ -353,7 +355,7 @@
<if test="auditStatus != null and auditStatus != ''">
AND t1.audit_status = #{auditStatus}
</if>
ORDER BY t1.gmt_create
ORDER BY t1.gmt_create DESC
</select>
<!-- 店铺认证列表 -->

View File

@ -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="cn.com.tenlion.dao.userexpand.IUserExpandDao">
<resultMap id="userExpandDTO" type="cn.com.tenlion.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="cn.com.tenlion.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="cn.com.tenlion.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
</select>
</mapper>

View File

@ -21,17 +21,18 @@
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<input type="hidden" name="shopId" id="shopId" value="">
<input type="hidden" name="auditBId" id="auditBId" value="">
<input type="hidden" name="auditType" id="auditType" value="">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">审核意见</label>
<div class="layui-input-block">
<textarea id="auditResult" name="auditResult" class="layui-textarea" placeholder="请输入审核意见"></textarea>
<textarea id="auditResult" name="auditResult" class="layui-textarea" placeholder="请输入审核意见" lay-verify="required"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">审核结果</label>
<div class="layui-input-block">
<select name="auditStatus">
<select name="auditStatus" lay-verify="required">
<option value="1">通过</option>
<option value="-1">驳回</option>
</select>
@ -63,7 +64,10 @@
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var shopId = top.restAjax.params(window.location.href).shopId;
var bId = top.restAjax.params(window.location.href).bId;
var auditType = top.restAjax.params(window.location.href).auditType;
$("#auditBId").val(bId);
$("#auditType").val(auditType);
function closeBox() {
@ -77,18 +81,12 @@
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.post(top.restAjax.path('api/shopauditlog/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();
}
});
var auditType = formData.field['auditType'];
var auditBId = formData.field['auditBId'];
var auditStatus = formData.field['auditStatus'];
if(auditType == 1){
auditType1(auditBId,auditStatus)
}
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
@ -100,13 +98,26 @@
return false;
});
function auditType1(shopCertificationId,auditStatus){
var loadLayerIndex;
top.restAjax.put(top.restAjax.path('api/shopcertification/updateAuditStatus/{shopCertificationId}/{auditStatus}', [shopCertificationId,auditStatus]), null, null, function(code, data) {
var layerIndex = top.dialog.msg("提交成功!", {
time: 0,
btn: [top.dataMessage.button.yes],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
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);
});
}

View File

@ -43,7 +43,7 @@
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var shopId = top.restAjax.params(window.location.href).shopId;
var bId = top.restAjax.params(window.location.href).bId;
function closeBox() {
@ -54,10 +54,10 @@
// 初始化内容
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/shopauditlog/list/{shopId}', [shopId]), {}, null, function(code, data) {
top.restAjax.get(top.restAjax.path('api/shopauditlog/list/{bId}', [bId]), {}, null, function(code, data) {
var dataFormData = "";
for(var i in data) {
dataFormData +=initLineData(data[i].auditDate,data[i].auditUser,data[i].auditStatus,data[i].auditResult)
dataFormData +=initLineData(data[i].auditDate,data[i].auditUserName,data[i].auditStatus,data[i].auditResult)
}
$("#logData").append(dataFormData);
}, function(code, data) {
@ -78,11 +78,8 @@
if(status == -1){
sName = "审核不通过"
}
var data =
'<li class="layui-timeline-item">'+
'<li class="layui-timeline-item">'+
'<i class="layui-icon layui-timeline-axis">&#xe63f;</i>'+
'<div class="layui-timeline-content layui-text">'+
'<h3 class="layui-timeline-title">'+data+'</h3>'+
@ -111,7 +108,6 @@
'</p>'+
'</div>'+
'</li>';
return data;
}

View File

@ -28,8 +28,8 @@
<div class="layui-inline">
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
</div>
<div class="layui-inline">
<select name="auditStatus" lay-verify="required">
<div class="layui-inline layui-form search-item">
<select name="auditStatus" id="auditStatus">
<option value="">全部</option>
<option value="0">未审核</option>
<option value="1">通过</option>
@ -147,15 +147,6 @@
return rowData;
}
},
{field: 'creator', width: 180, title: '申请人', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'gmtCreate', width: 180, title: '申请时间', align:'center',fixed: 'right',
templet: function(row) {
var rowData = row[this.field];
@ -213,7 +204,8 @@
where: {
keywords: $('#keywords').val(),
startTime: $('#startTime').val(),
endTime: $('#endTime').val()
endTime: $('#endTime').val(),
auditStatus: $('#auditStatus').val()
},
page: {
curr: currentPage
@ -359,7 +351,7 @@
area: ['50%', '50%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/shopauditlog/audit.html?shopId={shopId}', [data.shopId]),
content: top.restAjax.path('route/shopauditlog/audit.html?auditType=1&bId={shopCertificationId}', [data.shopCertificationId]),
end: function() {
reloadTable();
}
@ -369,10 +361,10 @@
type: 2,
title: false,
closeBtn: 0,
area: ['50%', '50%'],
area: ['70%', '70%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/shopauditlog/audit.html?shopId={shopId}', [data.shopId]),
content: top.restAjax.path('route/shopauditlog/show.html?bId={bId}', [data.shopCertificationId]),
end: function() {
reloadTable();
}

View File

@ -0,0 +1,280 @@
<!doctype html>
<html lang="en">
<head>
<base href="/businesscard/">
<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>

View File

@ -0,0 +1,323 @@
<!doctype html>
<html lang="en">
<head>
<base href="/businesscard/">
<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="请输入简介"></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 = {};
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() {
initPhotoUploadFile();
initVideoUploadFile();
}
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>

View File

@ -0,0 +1,329 @@
<!doctype html>
<html lang="en">
<head>
<base href="/businesscard/">
<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>

View File

@ -0,0 +1,340 @@
<!doctype html>
<html lang="en">
<head>
<base href="/businesscard/">
<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="请输入简介"></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 userExpandId = top.restAjax.params(window.location.href).userExpandId;
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/{userExpandId}', [userExpandId]), {}, 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>