Skip to content

Commit c6350af

Browse files
committed
V1.3
完成文章查看功能
1 parent 2a91640 commit c6350af

File tree

5 files changed

+35
-17
lines changed

5 files changed

+35
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.project

backend/config/main.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
'controllerNamespace' => 'backend\controllers',
1313
'bootstrap' => ['log'],
1414
'modules' => [],
15+
'language'=> 'zh-CN',
1516
'components' => [
1617
'user' => [
1718
'identityClass' => 'common\models\User',

backend/views/post/view.php

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
/* @var $model common\models\Post */
88

99
$this->title = $model->title;
10-
$this->params['breadcrumbs'][] = ['label' => 'Posts', 'url' => ['index']];
10+
$this->params['breadcrumbs'][] = ['label' => '文章管理', 'url' => ['index']];
1111
$this->params['breadcrumbs'][] = $this->title;
1212
?>
1313
<div class="post-view">
1414

1515
<h1><?= Html::encode($this->title) ?></h1>
1616

1717
<p>
18-
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
19-
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
18+
<?= Html::a('修改', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
19+
<?= Html::a('删除', ['delete', 'id' => $model->id], [
2020
'class' => 'btn btn-danger',
2121
'data' => [
22-
'confirm' => 'Are you sure you want to delete this item?',
22+
'confirm' => '您确定删除这篇文章吗?',
2323
'method' => 'post',
2424
],
2525
]) ?>
@@ -32,11 +32,25 @@
3232
'title',
3333
'content:ntext',
3434
'tags:ntext',
35-
'status',
36-
'create_time:datetime',
37-
'update_time:datetime',
38-
'author_id',
35+
[
36+
'label'=>'状态',
37+
'value'=>$model->status0->name,
38+
],
39+
//'create_time:datetime',
40+
[
41+
'attribute'=>'create_time',
42+
'value'=>date("Y-m-d H:i:s",$model->create_time),
43+
],
44+
[
45+
'attribute'=>'update_time',
46+
'value'=>date("Y-m-d H:i:s",$model->update_time),
47+
],
48+
[
49+
'attribute'=>'author_id',
50+
'value'=>$model->author->nickname,
51+
],
3952
],
53+
'template'=>'<tr><th style="width:120px;">{label}</th><td>{value}</td></tr>',
54+
'options'=>['class'=>'table table-striped table-bordered detail-view'],
4055
]) ?>
41-
4256
</div>

common/models/Post.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ public function attributeLabels()
5252
{
5353
return [
5454
'id' => 'ID',
55-
'title' => 'Title',
56-
'content' => 'Content',
57-
'tags' => 'Tags',
58-
'status' => 'Status',
59-
'create_time' => 'Create Time',
60-
'update_time' => 'Update Time',
61-
'author_id' => 'Author ID',
55+
'title' => '标题',
56+
'content' => '内容',
57+
'tags' => '标签',
58+
'status' => '状态',
59+
'create_time' => '创建时间',
60+
'update_time' => '修改时间',
61+
'author_id' => '作者',
6262
];
6363
}
6464

database/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44

55
源码版本:V1.1 ————— SQL文件版本:V1.1
66

7-
源码版本:V1.2 ————— SQL文件版本:V1.2
7+
源码版本:V1.2 ————— SQL文件版本:V1.2
8+
9+
源码版本:V1.3 ————— 同上

0 commit comments

Comments
 (0)