66 lines
2.4 KiB
HTML
66 lines
2.4 KiB
HTML
{% extends 'user/user_base.html' %}
|
|
|
|
{% block header %}
|
|
<script>
|
|
var typelist = {};
|
|
function switch_type(typename) {
|
|
if (typelist.hasOwnProperty(typename)) {
|
|
delete typelist[typename];
|
|
} else {
|
|
typelist[typename] = 1;
|
|
}
|
|
let typeinput = document.getElementById("booktype");
|
|
let typestr = "";
|
|
for (let typekey in typelist) {
|
|
typestr += typekey + ";";
|
|
}
|
|
typeinput.value = typestr;
|
|
}
|
|
function clear_toast(toastid) {
|
|
toast_elm = document.getElementById(toastid);
|
|
toast_elm.classList.add('d-none');
|
|
}
|
|
</script>
|
|
{% endblock %}
|
|
|
|
{% block user_content %}
|
|
<div class="panel">
|
|
<div class="panel-header">
|
|
<div class="panel-title text-center">
|
|
<h4>新建图书</h4>
|
|
</div>
|
|
</div>
|
|
<div class="panel-body">
|
|
{% if error%}
|
|
<div class="toast" id="toast1">
|
|
<button class="btn btn-clear float-right" onclick="clear_toast('toast1')"></button>
|
|
{{error}}
|
|
</div>
|
|
{% endif %}
|
|
<form method="post" class="form-group m-2">
|
|
<label class="form-label" for="bookname">书名*</label>
|
|
<input class="form-input" name="bookname" id="bookname" required>
|
|
<label class="form-label" for="bookisbn">ISBN</label>
|
|
<input class="form-input" name="bookisbn" id="bookisbn">
|
|
<label class="form-label" for="bookpublisher">出版社</label>
|
|
<input class="form-input" name="bookpublisher" id="bookpublisher">
|
|
<label class="form-label" for="bookauthor">作者</label>
|
|
<input class="form-input" name="bookauthor" id="bookauthor">
|
|
<label class="form-label" for="booklang">语言</label>
|
|
<select class="form-select" name="booklang" id="booklang">
|
|
<option selected>CN</option>
|
|
<option>EN</option>
|
|
<option>Other</option>
|
|
</select>
|
|
<label class="form-label" for="booktype">分类</label>
|
|
<input class="form-input" name="booktype" id="booktype">
|
|
<div>
|
|
{% for atype in typelist%}
|
|
<span class="chip btn" onclick="switch_type('{{atype['type_name']}}')">{{atype['type_name']}}</span>
|
|
{% endfor %}
|
|
</div>
|
|
<input class="btn btn-primary input-group-btn p-centered" type="submit" value="提交">
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endblock %} |