set.html 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. <div class="layui-form-item {% if value[1] in ('text',) %}layui-form-text{% end %}">
  9. <label for="{{value[0]}}" class="layui-form-label">
  10. {% if value[2] or (value[1] == 'password' and not data['info']) %}<span class="x-red">*</span>{% end %}
  11. {{name}}
  12. </label>
  13. <div class="layui-input-block">
  14. {% if value[1] == 'input' %}
  15. <input type="text" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{{value[2]}}"
  16. autocomplete="off" class="layui-input" value="{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}" />
  17. {% elif value[1] == 'date' %}
  18. <input type="text" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{{value[2]}}"
  19. 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 />
  20. {% elif value[1] == 'password' %}
  21. <input type="password" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{% if not data['info'] %}required{% end %}"
  22. autocomplete="off" class="layui-input" value="" />
  23. {% elif value[1] == 'text' %}
  24. <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>
  25. {% elif value[1] == 'editor' %}
  26. <textarea placeholder="请输入内容" class="layui-textarea layui-editor" 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>
  27. {% elif value[1] == 'pic' %}
  28. <div class="site-demo-upbar">
  29. <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;"/>
  30. <input type="file" class="layui-upload-file" lay-type="images" name="file" id="upload_{{value[0]}}"/>
  31. <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 %}"/>
  32. </div>
  33. {% elif value[1] == 'select' %}
  34. {%set option = 'update_' + value[0] %}
  35. {% if option in data['common'] %}
  36. {%set select = data['common'][option] %}
  37. <select name="update_{{value[0]}}" id="update_{{value[0]}}" lay-verify="{{value[2]}}" lay-search>
  38. {% for v in select %}
  39. <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>
  40. {% end %}
  41. </select>
  42. {% end %}
  43. {% end %}
  44. </div>
  45. </div>
  46. {% end %}
  47. {% end %}
  48. {% block script %}
  49. {% end %}