Typecho的Joe主题实现手机端登录/注册功能

Typecho的Joe主题实现手机端登录/注册功能

李哲
2022-05-25 / 2 评论 / 67 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2022年05月25日,已超过43天没有更新,若内容或图片失效,请留言反馈。
  1. 成品图展示
    微信图片_20220525184408.jpg
    微信图片_20220525184404.jpg
    327950809.png
  2. 修改header.php问题,新增代码,问了路径:usr/themes/Joe-master/public

    <ul class="joe_header__slideout-menu panel-box" style="margin-top: 15px; <?php if(Helper::options()->login4Phone !== 'on') echo 'display:none;'  ?>">
     <li>
         <?php if ($this->user->hasLogin()) : ?>
             <a class="link panel" href="#" rel="nofollow">
                 <span><?php $this->user->screenName(); ?></span>
                 <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>
             </a>
             <ul class="slides panel-body">
                 <li>
                     <?php if ($this->user->group == 'administrator' || $this->user->group == 'editor' || $this->user->group == 'contributor') : ?>
                         <a class="link" rel="noopener noreferrer nofollow" target="_blank" href="<?php $this->options->adminUrl("manage-posts.php"); ?>">管理文章</a>
                     <?php endif; ?>
                 </li>
                 <li>
                     <?php if ($this->user->group == 'administrator' || $this->user->group == 'editor') : ?>
                         <a class="link" rel="noopener noreferrer nofollow" target="_blank" href="<?php $this->options->adminUrl("manage-comments.php"); ?>">管理评论</a>
                     <?php endif; ?>
                 </li>
                 <li>
                     <?php if ($this->user->group == 'administrator') : ?>
                         <a class="link" rel="noopener noreferrer nofollow" target="_blank" href="<?php $this->options->adminUrl("options-theme.php"); ?>">修改外观</a>
                     <?php endif; ?>
                 </li>
                 <li>
                     <a class="link" rel="noopener noreferrer nofollow" target="_blank" href="<?php $this->options->adminUrl(); ?>">进入后台</a>
                 </li>
                 <li>
                     <a class="link" rel="noopener noreferrer nofollow" href="<?php $this->options->logoutUrl(); ?>">退出登录</a>
                 </li>
             </ul>
         <?php else : ?>
             <a class="link panel" href="#" rel="nofollow">
                 <span>用户登录</span>
                 <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>
             </a>
             <ul class="slides panel-body">
                 <li>
                     <a class="link" href="<?php $this->options->adminUrl('login.php'); ?>" target="_blank" rel="noopener noreferrer nofollow">登录</a>
                     <?php if ($this->options->allowRegister) : ?>
                         <a class="link" href="<?php $this->options->adminUrl('register.php'); ?>" target="_blank" rel="noopener noreferrer nofollow">注册</a>
                     <?php endif; ?>
                 </li>
             </ul>
         <?php endif; ?>
     </li>
    </ul>

    放在ul后面
    1702679921.png

  3. 修改functions.php,最后新增,文件路径:usr/themes/Joe-master

    // 手机端登录
    $login4Phone = new Typecho_Widget_Helper_Form_Element_Select(
     'login4Phone',
     array(
         'off' => '关闭(默认)',
         'on' => '开启',
     ),
     'on',
     '是否启用手机端登录功能',
     '介绍:开启后,手机端侧边栏将展示登录功能和登录后的操作'
    );
    $login4Phone->setAttribute('class', 'joe_content joe_custom'); // 如果无法展示,则将joe_custom替换为joe_other
    $form->addInput($login4Phone->multiMode());

    1092463305.png

2
取消

感谢您的支持,我会继续努力哒!

扫码打赏
支付金额随意哦!

打开支付宝扫一扫,即可进行扫码打赏哦

评论 (2)

取消
  1. 头像
    执子之手
    iPhone · Safari

    醒来就要给这个世界一拳,不为别的,就因为要早起

    回复
  2. 头像
    喜欢的少年是你
    iPhone · Safari

    23岁那年我就获得了一种超能力,一种瞬间获得3000块人民币的能力,虽然看起来很厉害,但是冷却时间是一个月

    回复