set.html 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. {% extends "../theme/set.html" %}
  2. {% block action %}{{data['common']['path']}}{% end %}
  3. {% block url %}{{data['common']['path']}}{% end %}
  4. {% block form %}
  5. {% for index,name in enumerate(data['common']['label']) %}
  6. {%set value = data['common']['update'][index] %}
  7. {%set value = value.split('-') %}
  8. {%set length = len(value) %}
  9. <div class="layui-form-item {% if value[1] in ('text',) %}layui-form-text{% end %}">
  10. <label for="{{value[0]}}" class="layui-form-label">
  11. {% if value[2] or (value[1] == 'password' and not data['info']) %}<span class="x-red">*</span>{% end %}
  12. {{name}}
  13. </label>
  14. <div class="layui-input-block">
  15. {% if value[1] == 'input' %}
  16. <input type="text" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{{value[2]}}"
  17. autocomplete="off" class="layui-input" value="{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}" />
  18. {% elif value[1] == 'date' %}
  19. <input type="text" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{{value[2]}}"
  20. autocomplete="off" class="layui-input time" value="{% if data['info'] and value[0] in data['info'] %}{{datetime.datetime.fromtimestamp(data['info'][value[0]]).strftime('%Y-%m-%d %H:%M:%S')}}{% end %}" readonly />
  21. {% elif value[1] == 'password' %}
  22. <input type="password" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{% if not data['info'] %}required{% end %}"
  23. autocomplete="off" class="layui-input" value="" />
  24. {% elif value[1] == 'text' %}
  25. <textarea placeholder="请输入内容" class="layui-textarea" id="update_{{value[0]}}" name="update_{{value[0]}}" value="{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}" lay-verify="{{value[2]}}">{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}</textarea>
  26. {% elif value[1] == 'editor' %}
  27. <textarea placeholder="请输入内容" class="layui-textarea layui-editor" key="1" id="update_{{value[0]}}" name="update_{{value[0]}}" value="{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}" lay-verify="{{value[2]}}">{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}</textarea>
  28. {% elif value[1] == 'pic' %}
  29. <div class="site-demo-upbar">
  30. <img id="upload_{{value[0]}}_show" width="200" src="{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}" style="{% if data['info'] and value[0] in data['info'] and data['info'][value[0]] %}display:;{% else %}display:none;{% end %}margin-left:10px;"/>
  31. <input type="file" class="layui-upload-file" lay-type="images" name="file" id="upload_{{value[0]}}"/>{% if length > 3 %}(建议图片尺寸:{{value[3]}}){% end %}
  32. <input type="hidden" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{{value[2]}}" value="{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}"/>
  33. </div>
  34. {% elif value[1] == 'select' %}
  35. {%set option = 'update_' + value[0] %}
  36. {% if option in data['common'] %}
  37. {%set select = data['common'][option] %}
  38. <select name="update_{{value[0]}}" id="update_{{value[0]}}" lay-verify="{{value[2]}}" lay-search>
  39. {% for v in select %}
  40. <option value="{{v['id']}}" {% if data['info'] and value[0] in data['info'] and data['info'][value[0]] == v['id'] %}selected{% end %}>{{v['name']}}</option>
  41. {% end %}
  42. </select>
  43. {% end %}
  44. {% end %}
  45. </div>
  46. </div>
  47. {% end %}
  48. {% end %}
  49. {% block script %}
  50. {% end %}