Cool
Cool
Published on 2021-05-14 / 26 Visits
0
0

博客侧边栏添加登录按钮

效果

代码


 
         <div class="joe_header__below-sign">
                <div class="joe_dropdown" trigger="click">
                    <?php if ($this->user->hasLogin()) : ?>
                        <div class="joe_dropdown__link">
                            <svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="15" height="15">
                                <path d="M231.594 610.125C135.087 687.619 71.378 804.28 64.59 935.994c-.373 7.25 3.89 23.307 30.113 23.307s33.512-16.06 33.948-23.301c6.861-114.025 63.513-214.622 148.5-280.346 3.626-2.804 16.543-17.618 3.24-39.449-13.702-22.483-40.863-12.453-48.798-6.08zm280.112-98.44v63.96c204.109 0 370.994 159.345 383.06 360.421.432 7.219 8.649 23.347 32.44 23.347s31.991-16.117 31.62-23.342c-12.14-236.422-207.676-424.386-447.12-424.386z" />
                                <path d="M319.824 319.804c0-105.974 85.909-191.883 191.882-191.883s191.883 85.91 191.883 191.883c0 26.57-5.405 51.88-15.171 74.887-5.526 14.809-2.082 31.921 20.398 38.345 23.876 6.822 36.732-8.472 41.44-20.583 11.167-28.729 17.294-59.973 17.294-92.65 0-141.297-114.545-255.842-255.843-255.842S255.863 178.506 255.863 319.804s114.545 255.843 255.843 255.843v-63.961c-105.973-.001-191.882-85.909-191.882-191.882z" />
                                <path d="M512 255.843s21.49-5.723 21.49-31.306S512 191.882 512 191.882c-70.65 0-127.921 57.273-127.921 127.922 0 3.322.126 6.615.375 9.875.264 3.454 14.94 18.116 37.044 14.425 22.025-3.679 26.6-21.93 26.6-21.93-.028-.788-.06-1.575-.06-2.37.001-35.325 28.637-63.961 63.962-63.961z" />
                            </svg>
                            <span><?php $this->user->screenName(); ?></span>
                        </div>
                        <nav class="joe_dropdown__menu list">
                            <?php if ($this->user->group == 'administrator' || $this->user->group == 'editor' || $this->user->group == 'contributor') : ?>
                                <a rel="noopener noreferrer nofollow" target="_balnk" href="<?php $this->options->adminUrl("manage-posts.php"); ?>">管理文章</a>
                            <?php endif; ?>
                            <?php if ($this->user->group == 'administrator' || $this->user->group == 'editor') : ?>
                                <a rel="noopener noreferrer nofollow" target="_balnk" href="<?php $this->options->adminUrl("manage-comments.php"); ?>">管理评论</a>
                            <?php endif; ?>
                            <?php if ($this->user->group == 'administrator') : ?>
                                <a rel="noopener noreferrer nofollow" target="_balnk" href="<?php $this->options->adminUrl("options-theme.php"); ?>">修改外观</a>
                            <?php endif; ?>
                            <a rel="noopener noreferrer nofollow" target="_balnk" href="<?php $this->options->adminUrl(); ?>">进入后台</a>
                            <a rel="noopener noreferrer nofollow" href="<?php $this->options->logoutUrl(); ?>">退出登录</a>
                        </nav>
                    <?php else : ?>
                        <div class="joe_dropdown__link">
                            <svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="16" height="16">
                                <path d="M929.792 340.48c-22.016-52.224-53.76-99.328-94.208-139.776s-88.064-72.192-140.288-94.72c-54.272-23.04-112.128-34.816-171.52-34.816-77.312 0-153.6 20.48-220.16 58.88-15.36 8.704-20.48 28.16-11.776 43.52 8.704 15.36 28.16 20.48 43.52 11.776 56.832-32.768 121.856-50.176 188.416-50.176 100.352 0 195.072 38.912 266.24 110.08s110.08 165.888 110.08 266.24-38.912 195.072-110.08 266.24-165.888 110.08-266.24 110.08c-66.048 0-131.072-17.408-188.416-50.176-15.36-8.704-34.816-3.584-43.52 11.776s-3.584 34.816 11.776 43.52c66.56 38.4 142.848 58.88 220.16 58.88 59.392 0 117.248-11.776 171.52-34.816 52.224-22.016 99.328-53.76 140.288-94.208 40.448-40.448 72.192-87.552 94.208-140.288 23.04-54.272 34.816-112.128 34.816-171.52s-11.776-116.224-34.816-170.496z" />
                                <path d="M426.496 691.712c-12.288 12.288-12.288 32.768 0 45.056 6.144 6.144 14.336 9.216 22.528 9.216s16.384-3.072 22.528-9.216l202.24-202.24c2.56-2.56 4.608-5.632 6.144-8.704l.512-1.536c0-.512.512-1.024.512-1.536s.512-.512.512-1.024v-.512c0-.512 0-.512.512-1.024V502.272c0-.512 0-.512-.512-1.024v-.512c0-.512 0-.512-.512-1.024v-.512c0-.512 0-.512-.512-1.024v-.512c0-.512-.512-.512-.512-1.024v-.512c0-.512-.512-.512-.512-1.024v-.512l-.512-.512s0-.512-.512-.512c0-.512-.512-.512-.512-1.024 0 0 0-.512-.512-.512l-.512-.512-.512-.512-.512-.512-1.024-1.024L472.064 286.72c-12.288-12.288-32.768-12.288-45.056 0-12.288 12.288-12.288 32.768 0 45.056l147.968 147.968H147.968c-17.92 0-31.744 14.336-31.744 31.744s14.336 31.744 31.744 31.744h426.496l-147.968 148.48z" />
                            </svg>
                            <span>登录</span>
                        </div>
                        <form class="joe_dropdown__menu form" method="post" name="login2" action="<?php $this->options->loginAction() ?>">
                            <input type="hidden" name="referer" value="<?php $this->options->siteUrl(); ?>">
                            <div class="item">
                                <div class="label">用户名</div>
                                <input class="username" placeholder="请输入用户名" type="text" maxlength="16" name="name" autocomplete="off" />
                            </div>
                            <div class="item">
                                <div class="label">密码</div>
                                <input class="password" placeholder="请输入密码" type="password" maxlength="16" name="password" autocomplete="off" />
                            </div>
                            <button type="submit" id="sidelogin">登 录</button>
                        </form>
                    <?php endif; ?>
                </div>
<style>
	#sidelogin {
		width: 220px;
		height: 34px;
		color: white;
		font: 13px Arial;
		background: #ff99cc;
	}
</style>

            </div>

{message type="success" content="代码添加到以下位置"/}

{dotted startColor="#ff6c6c" endColor="#1989fa"/}


Comment