Browse Source

add tag manage page

master
filesite 7 months ago
parent
commit
7747338e2c
  1. 55
      themes/tajian/controller/MyController.php
  2. 2
      themes/tajian/views/layout/main.php
  3. 2
      themes/tajian/views/my/index.php
  4. 2
      themes/tajian/views/my/setnickname.php
  5. 46
      themes/tajian/views/my/tags.php
  6. 6
      themes/tajian/views/site/myindex.php
  7. 4
      www/css/tajian.css

55
themes/tajian/controller/MyController.php

@ -8,7 +8,7 @@ require_once __DIR__ . '/SiteController.php';
Class MyController extends SiteController { Class MyController extends SiteController {
public function actionIndex() { public function actionIndex($viewName = 'index', $defaultTitle = '个人中心') {
//判断是否已经登录,自动跳转到自己的添加视频网址 //判断是否已经登录,自动跳转到自己的添加视频网址
$loginedUser = Common::getUserFromSession(); $loginedUser = Common::getUserFromSession();
if (empty($loginedUser['username'])) { if (empty($loginedUser['username'])) {
@ -51,8 +51,7 @@ Class MyController extends SiteController {
//昵称支持 //昵称支持
$nickname = $this->getNickname($readmeFile); $nickname = $this->getNickname($readmeFile);
$pageTitle = $defaultTitle = '个人中心 | ' . FSC::$app['config']['site_name']; $pageTitle = "{$defaultTitle} | " . FSC::$app['config']['site_name'];
$viewName = 'index';
$params = compact( $params = compact(
'dirTree', 'scanResults', 'dirTree', 'scanResults',
'htmlReadme', 'tags', 'nickname' 'htmlReadme', 'tags', 'nickname'
@ -62,50 +61,16 @@ Class MyController extends SiteController {
//修改昵称 //修改昵称
public function actionSetnickname() { public function actionSetnickname() {
//判断是否已经登录 $defaultTitle = "修改昵称";
$loginedUser = Common::getUserFromSession(); $viewName = 'setnickname';
if (empty($loginedUser['username'])) { return $this->actionIndex($viewName, $defaultTitle);
return $this->redirect('/site/login');
}else if (!empty(FSC::$app['config']['multipleUserUriParse']) && FSC::$app['user_id'] != $loginedUser['username']) {
$shareUrl = "/{$loginedUser['username']}/my/setnickname/";
return $this->redirect($shareUrl);
}
$htmlReadme = ''; //Readme.md 内容,底部网站详细介绍
$menus_sorted = array(); //Readme_sort.txt 说明文件内容,一级目录菜单从上到下的排序
$scanner = new DirScanner();
$scanner->setWebRoot(FSC::$app['config']['content_directory']);
$dirTree = $scanner->scan(__DIR__ . '/../../../www/' . FSC::$app['config']['content_directory'], 4);
$readmeFile = $scanner->getDefaultReadme();
if (!empty($readmeFile)) {
if (!empty($readmeFile['sort'])) {
$menus_sorted = explode("\n", $readmeFile['sort']);
}
$Parsedown = new Parsedown();
$content = file_get_contents($readmeFile['realpath']);
$htmlReadme = $Parsedown->text($content);
$htmlReadme = $scanner->fixMDUrls($readmeFile['realpath'], $htmlReadme);
}
//获取tags分类
$tags = $this->getTags($dirTree);
//排序
if (!empty($menus_sorted) && !empty($tags)) {
$tags = $this->sortTags($menus_sorted, $tags);
} }
$nickname = $this->getNickname($readmeFile); //分类管理
public function actionTags() {
$pageTitle = "修改昵称 | " . FSC::$app['config']['site_name']; $defaultTitle = "管理分类";
$viewName = 'tags';
$viewName = 'setnickname'; return $this->actionIndex($viewName, $defaultTitle);
$params = compact(
'htmlReadme', 'tags', 'pageTitle', 'nickname'
);
return $this->render($viewName, $params, $pageTitle);
} }
} }

2
themes/tajian/views/layout/main.php

@ -127,7 +127,7 @@ eof;
</form> </form>
</div> </div>
<?php if (FSC::$app['controller'] == 'site' && FSC::$app['action'] == 'index') { ?> <?php if (in_array(FSC::$app['controller'], array('site', 'my')) && FSC::$app['action'] == 'index') { ?>
<div class="footer"> <div class="footer">
<div class="copyright"> <div class="copyright">
<?php if (!empty(FSC::$app['config']['theme'])) { ?> <?php if (!empty(FSC::$app['config']['theme'])) { ?>

2
themes/tajian/views/my/index.php

@ -20,7 +20,7 @@ if (!empty(FSC::$app['config']['multipleUserUriParse']) && !empty(FSC::$app['use
</div> </div>
<hr> <hr>
<ul class="mg_menus"> <ul class="mg_menus">
<li><a href="###"><img src="/img/collection.svg" alt="collection" width="18"> 管理分类</a></li> <li><a href="<?=$linkPrefix?>/my/tags"><img src="/img/collection.svg" alt="collection" width="18"> 管理分类</a></li>
<li><a href="###"><img src="/img/favorite.png" alt="favorite" width="20"> 管理收藏</a></li> <li><a href="###"><img src="/img/favorite.png" alt="favorite" width="20"> 管理收藏</a></li>
<li><a href="###"><img src="/img/edit.svg" alt="edit" width="18"> 添加分类</a></li> <li><a href="###"><img src="/img/edit.svg" alt="edit" width="18"> 添加分类</a></li>
<li><a href="###"><img src="/img/addvideos.svg" alt="add favorite" width="20"> 添加收藏</a></li> <li><a href="###"><img src="/img/addvideos.svg" alt="add favorite" width="20"> 添加收藏</a></li>

2
themes/tajian/views/my/setnickname.php

@ -5,7 +5,7 @@ if (!empty(FSC::$app['config']['multipleUserUriParse']) && !empty(FSC::$app['use
$linkPrefix = '/' . FSC::$app['user_id']; $linkPrefix = '/' . FSC::$app['user_id'];
} }
?><main class="g_main_lay"> ?><main class="g_main_lay">
<form class="add_video_form g_form_style mt65" id="nickname_form" action="" method="POST"> <form class="g_form_style mt65" id="nickname_form" action="" method="POST">
<div class="mb-3 pt20"> <div class="mb-3 pt20">
<label for="text_input_nickname" class="form-label">昵称</label> <label for="text_input_nickname" class="form-label">昵称</label>
<input id="text_input_nickname" name="nickname" placeholder="请填写 2 - 5 个汉字" value="<?=$viewData['nickname']?>"> <input id="text_input_nickname" name="nickname" placeholder="请填写 2 - 5 个汉字" value="<?=$viewData['nickname']?>">

46
themes/tajian/views/my/tags.php

@ -0,0 +1,46 @@
<?php
$linkPrefix = '';
//多用户路径支持
if (!empty(FSC::$app['config']['multipleUserUriParse']) && !empty(FSC::$app['user_id'])) {
$linkPrefix = '/' . FSC::$app['user_id'];
}
?><main class="g_main_lay">
<form class="g_form_style mt65" id="tags_form" action="" method="POST">
<?php if (!empty($viewData['tags'])) {
$index = 0;
foreach($viewData['tags'] as $id => $tag) {
$index ++;
echo <<<eof
<div class="mb-3 tag-item">
<button class="btn-danger" type="button">删除</button>
<label class="form-label">分类 {$index}</label>
<input name="tags[]" placeholder="请填写 2 - 5 个汉字" value="{$tag['name']}">
</div>
eof;
}
?>
<div class="avform_bt vercenter">
<button class="jsbtn" aria-label="保存" type="button">
<div class="loading_bt bt_class_JS elementNone verMiddle">
<svg viewBox="25 25 50 50">
<circle cx="50" cy="50" r="20"></circle>
</svg>
</div>
<span class="bt_text_JS">保存</span>
<div class="bt_loading_cover bt_class_JS elementNone"></div>
</button>
<span class="ml20">
<a href="<?=$linkPrefix?>/my/">返回</a>
</span>
</div>
<?php }else { ?>
<div class="mb-3">
<h3>你还没添加任何分类哦</h3>
<p class="mt10"><a href="<?=$linkPrefix?>/my/addtag" class="btn-primary">添加分类</a></p>
</div>
<?php } ?>
</form>
</main>

6
themes/tajian/views/site/myindex.php

@ -70,12 +70,14 @@ eof;
$imgSrc = $index < 8 ? " src=\"{$snapshot}\"" : ''; $imgSrc = $index < 8 ? " src=\"{$snapshot}\"" : '';
$imgAlt = $index < 8 ? " alt=\"{$title}\"" : ''; $imgAlt = $index < 8 ? " alt=\"{$title}\"" : '';
$imgCls = $index < 8 ? '' : 'lazy';
$itemCls = $index < 4 ? '' : 'hidden-xs';
echo <<<eof echo <<<eof
<div class="vl_list_main advideo-item"> <div class="vl_list_main advideo-item {$itemCls}">
<div class="video_img_vl"> <div class="video_img_vl">
<a href="{$file['shortcut']['url']}" target="_blank"> <a href="{$file['shortcut']['url']}" target="_blank">
<img data-original="{$snapshot}" class="lazy"{$imgSrc}{$imgAlt}> <img data-original="{$snapshot}" class="{$imgCls}"{$imgSrc}{$imgAlt}>
</a> </a>
</div> </div>
<div class="video_title_vl"> <div class="video_title_vl">

4
www/css/tajian.css

@ -244,7 +244,8 @@ a:link{text-decoration:none;}
.tajian_index .btns a:hover{color:blue} .tajian_index .btns a:hover{color:blue}
.tajian_index .btns a:hover img{opacity:1} .tajian_index .btns a:hover img{opacity:1}
.tajian_index .kfwx{float:right;border-radius:6px} .tajian_index .kfwx{float:right;border-radius:6px}
.tajian_index .loginbtn{border:1px solid #50509d;background-color:#50509d;color:#FFF;padding:3px 10px;border-radius:4px} .btn-primary,.btn-danger,.tajian_index .loginbtn{border:1px solid #50509d;background-color:#50509d;color:#FFF;padding:3px 10px;border-radius:4px;cursor:pointer}
.btn-danger{background-color:#d32d2d;border-color:#e96b5b}
/* 注册/登录 */ /* 注册/登录 */
.twocol label{display:block} .twocol label{display:block}
@ -258,6 +259,7 @@ a:link{text-decoration:none;}
.mg_menus li a{display:block;padding:15px 10px} .mg_menus li a{display:block;padding:15px 10px}
.mg_menus li a:hover{background-color:lightblue;color:#FFF;font-weight:bold} .mg_menus li a:hover{background-color:lightblue;color:#FFF;font-weight:bold}
.mg_menus li img{vertical-align:middle} .mg_menus li img{vertical-align:middle}
.tag-item .btn-danger{float:right}
/* layout index */ /* layout index */
body.layout_index{background-color:#e5f1f3} body.layout_index{background-color:#e5f1f3}

Loading…
Cancel
Save