feat(web/blog/write): display blog id
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-10-16 20:38:03 +08:00
parent 14094a4d44
commit ef7c6eb83d
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 16 additions and 0 deletions

View File

@ -60,6 +60,7 @@
} else { } else {
insertBlog($data); insertBlog($data);
$blog = array('id' => DB::insert_id(), 'tags' => array()); $blog = array('id' => DB::insert_id(), 'tags' => array());
$ret['blog_id'] = $blog['id'];
$ret['blog_write_url'] = HTML::blog_url(UOJContext::user()['username'], "/post/{$blog['id']}/write"); $ret['blog_write_url'] = HTML::blog_url(UOJContext::user()['username'], "/post/{$blog['id']}/write");
$ret['blog_url'] = HTML::blog_url(UOJContext::user()['username'], "/post/{$blog['id']}"); $ret['blog_url'] = HTML::blog_url(UOJContext::user()['username'], "/post/{$blog['id']}");
} }
@ -77,6 +78,18 @@
<?php echoUOJPageHeader('写博客') ?> <?php echoUOJPageHeader('写博客') ?>
<div class="card"> <div class="card">
<div class="card-header bg-transparent d-flex justify-content-between">
<div class="fw-bold">写博客</div>
<div id="div-blog-id"
<?php if (!$blog): ?>
style="display: none"
<?php endif ?>
>
<?php if ($blog): ?>
<small>博客 ID<b><?= $blog['id'] ?></b></small>
<?php endif ?>
</div>
</div>
<div class="card-body"> <div class="card-body">
<?php $blog_editor->printHTML() ?> <?php $blog_editor->printHTML() ?>
</div> </div>

View File

@ -212,6 +212,9 @@ function blog_editor_init(name, editor_config) {
if (data.blog_url) { if (data.blog_url) {
$('#a-' + name + '_view_blog').attr('href', data.blog_url).show(); $('#a-' + name + '_view_blog').attr('href', data.blog_url).show();
} }
if (data.blog_id) {
$('#div-blog-id').html('<small>博客 ID<b>' + data.blog_id + '</b></small>').show();
}
} }
}).fail(function() { }).fail(function() {
if (config.need_preview) { if (config.need_preview) {