| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- /**
- *
- */
- package com.xcgl.weixin.utils;
- import com.xcgl.weixin.entity.WXMultiRowViewer;
- import com.xcgl.weixin.entity.WXMultiRowViewerDto;
- import org.apache.commons.lang3.StringUtils;
- import java.util.List;
- /**
- * @author xzx
- *
- * 2019年1月5日
- *
- */
- public class WXViewerUtils {
- /**
- *
- * @param viewerDtos
- * @return
- */
- public static String getWXMultiRowViewerHtml(WXMultiRowViewer viewer) {
- StringBuffer sb = new StringBuffer();
- if(viewer.getWarning() != null && viewer.getWarning().length()>0) {
- sb.append("<div class=\"mui-card\" style=\"margin-bottom: 10px;\">");
- // start li
- sb.append(" <li class=\"mui-table-view-cell\">");
- //start mui-table
- sb.append(" <div class=\"mui-table\">");
- // start mui-table-cell
- sb.append("<div class=\"mui-table-cell mui-col-xs-10\">");
- // start main content
- sb.append("<h5 class=\"mui-ellipsis-4\" style=\"color: red;font-style:italic\">");
- sb.append("提示:").append(viewer.getWarning());
- // sb.append("!");
- // end main content
- sb.append("</h5>");
- // end mui-table-cell
- sb.append("</div>");
- // end mui-table
- sb.append("</div>");
- // end li
- sb.append(" </li>");
- // end card
- sb.append("</div>");
- }
- List<WXMultiRowViewerDto> dtos = viewer.getRows();
- if(dtos != null && dtos.size()>0) {
- for(WXMultiRowViewerDto dto : dtos) {
- if(dto.getDivTitle()!=null && dto.getDivTitle().length()>0) {
- sb.append(" <div class=\"divtitle\">");
- if(dto.isDeleteView()) {
- sb.append("<s>");
- }
- sb.append(dto.getDivTitle());
- if(dto.isDeleteView()) {
- sb.append("</s>");
- }
- sb.append("</div>");
- }
-
- // // start card
- // sb.append("<div class=\"mui-card\" style=\"margin-bottom: 35px;\">");
- // start li
- sb.append(" <li class=\"mui-table-view-cell\">");
- //start mui-table
- sb.append(" <div class=\"mui-table\">");
- // start mui-table-cell
- sb.append("<div class=\"mui-table-cell mui-col-xs-10\" ");
- if(StringUtils.isNotEmpty(dto.getOnclick())){
- sb.append(" onclick='").append(dto.getOnclick()).append("'");
- }
- sb.append(" >");
- // start main content
- if(dto.isDeleteView()) {
- sb.append("<s>");
- }
- sb.append("<h4 class=\"mui-ellipsis-4\">");
- if(StringUtils.isNotEmpty(dto.getHiddenText())){
- sb.append("<input id = \"hidden\" name=\"hidden\" type=\"hidden\" value=\""+dto.getHiddenText()+"\"/>");
- }
-
- if(dto.getMainContent() == null || dto.getMainContent().length() == 0) {
- sb.append("无");
- }else {
- sb.append(dto.getMainContent());
- }
-
- // end main content
- sb.append("</h4>");
- if(dto.isDeleteView()) {
- sb.append("</s>");
- }
- if(dto.getSecondContent() != null && dto.getSecondContent().length()>0) {
- sb.append(" <h5>");
- sb.append(dto.getSecondContent());
- sb.append(" </h5>");
- }
-
- if(dto.getThirdContent() != null && dto.getThirdContent().length()>0) {
- sb.append(" <p class=\"mui-h6 mui-ellipsis\">");
- sb.append(dto.getThirdContent());
- sb.append(" </p>");
- }
- // end mui-table-cell
- sb.append("</div>");
- if(dto.getRightTag() != null && dto.getRightTag().length()>0) {
- sb.append("<div class=\"mui-table-cell mui-col-xs-2 mui-text-right\"><span class=\"mui-h5\">");
- if(dto.isDeleteView()) {
- sb.append("<s>");
- }
- sb.append(dto.getRightTag());
- if(dto.isDeleteView()) {
- sb.append("</s>");
- }
- sb.append("</span></div>");
- }
- // end mui-table
- // sb.append("</div>");
-
- // end li
- sb.append(" </li>");
- // end card
- sb.append("</div>");
-
- }
- }
- return sb.toString();
- }
- }
|