XBlog开发手册 XBlog开发手册
  • 快速入门
  • API参考
  • 快速入门
  • API参考
GitHub (opens new window)
  • 快速入门
  • API参考
  • 快速入门
  • API参考
GitHub (opens new window)
  • 快速入门

    • 简介
    • 结构介绍
    • 主页
    • 登录和注册
    • 文章
    • 日记
    • 文档系统
    • 更多界面
    • 站点地图
  • API参考

  • 主题开发
  • 快速入门
小游
2021-08-01

日记

日记这个功能看你是否需要实现,如果不需要那么就不管

代码在根目录的 diary.php 下,我们这边是通过 xy_diary() 来获取日记列表。

日记卡片在 content/diary.php 下,每篇日记都有一个卡片,你只需要负责显示就行了,日记的内容和信息可以通过对应的函数来获取,这里我简单贴一下代码,所有的函数都可以在API参考里找到

<div class="diary-card">
    <img alt class="user-icon" src="<?php plugins_diary_avatar(); ?>" />
    <div class="arrow"></div>
    <div class="diary-content">
        <div class="diary-head">
            <div class="diary-head-name">
                <?php plugins_diary_nickname(); ?>
            </div><div class="diary-head-time">
                <?php plugins_diary_date(); ?>
            </div>
        </div>
        <?php if (!get_plugins_diary_encrypt()):?>
        <div class="diary-body">
            <?php plugins_diary_content(); ?>
        </div>
        <?php else: ?>
        <div class="lock-face">
            <div class="lock-text">
                这篇日记已被上锁了,请输入密码解锁
            </div>
            <div class="lock-input">
                <el-input v-model="password" type="password" placeholder="请输入访问密码">
                    <el-button slot="prepend" icon="el-icon-key" ></el-button>
                </el-input>
            </div>
            <el-button class="lock-btn" type="primary" @click="getEncryptContent(<?php echo get_plugins_diary_id() ?>)">
                点击访问
            </el-button>
        </div>
        <?php endif;?>
        <div class="diary-footer" @click="gotoDiary(<?php echo get_plugins_diary_id() ?>)">
            <div class="diary-comment">
                <i class="far fa-comment"></i><?php plugins_diary_comment(); ?>条评论
            </div>
            <div class="diary-like">
                <i class="far fa-thumbs-up"></i><?php plugins_diary_good(); ?>人点赞
            </div>
        </div>
    </div>
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
编辑 (opens new window)
上次更新: 2021/08/01, 17:13:03
文章
文档系统

← 文章 文档系统→

Theme by Vdoing | Copyright © 2021-2021 小游
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式