优化文档编辑器页面新建文集后默认选中新建的文集
This commit is contained in:
parent
f35e5cc956
commit
acdea49ab0
@ -298,7 +298,7 @@ def create_project(request):
|
||||
role = int(role) if role in role_list else 0
|
||||
)
|
||||
project.save()
|
||||
return JsonResponse({'status':True,'data':{'id':project.id,'name':project.name}})
|
||||
return JsonResponse({'status':True,'data':{'id':project.id,'name':project.name,'role':project.role}})
|
||||
else:
|
||||
return JsonResponse({'status':False,'data':'文集名称不能为空!'})
|
||||
except Exception as e:
|
||||
|
||||
@ -201,10 +201,12 @@
|
||||
}
|
||||
$.post("{% url 'create_project' %}",data,function(r){
|
||||
if(r.status){
|
||||
var role_str = r.data.role == 0 ? '公开':'私密'
|
||||
//创建成功,更新文集select
|
||||
$("#self-project").append("<option value="+r.data.id+">《"+r.data.name+"》</option>");
|
||||
$("#self-project").append("<option value="+r.data.id+">["+role_str+"]《"+r.data.name+"》</option>");
|
||||
$("#project").val(r.data.id);
|
||||
form.render();
|
||||
layer.close(index)
|
||||
layer.close(index);
|
||||
}else{
|
||||
//创建失败,提示
|
||||
console.log(r)
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
<!-- 新建文集div块 -->
|
||||
<div style="padding: 20px;display:none;" id="create-project-div">
|
||||
<input class="layui-input" type="text" id="pname" style="margin-bottom:10px;" placeholder="输入文集名" required lay-verify="required">
|
||||
<textarea name="desc" id="desc" placeholder="输入文集简介,不超过100个字,超出将被截断" maxlength="100" class="layui-textarea"></textarea>
|
||||
<textarea name="desc" id="desc" placeholder="输入文集简介" maxlength="100" class="layui-textarea"></textarea>
|
||||
<div class="layui-form-item" style="margin-top:10px;">
|
||||
<label class="layui-form-label" style="text-align:left;padding:9px 0px;">文集权限</label>
|
||||
<div class="layui-input-block">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user