Browse Source

add share page

master
filesite 7 months ago
parent
commit
48eebb1643
  1. 2
      themes/tajian/controller/FrontapiController.php
  2. 7
      themes/tajian/controller/MyController.php
  3. 1
      themes/tajian/views/my/index.php
  4. 33
      themes/tajian/views/my/share.php
  5. 4
      www/img/share-fill.svg
  6. 7
      www/js/clipboard.min.js
  7. 20
      www/js/tajian.js

2
themes/tajian/controller/FrontapiController.php

@ -734,7 +734,7 @@ eof;
if (empty($err)) { //如果数据检查通过,尝试登录 if (empty($err)) { //如果数据检查通过,尝试登录
$newUser = Common::saveUserIntoSession($cellphone); $newUser = Common::saveUserIntoSession($cellphone);
if (!empty($newUser)) { if (!empty($newUser)) {
$shareUrl = "/{$newUser['username']}/"; $shareUrl = "/{$newUser['username']}/my/";
$msg = "登录成功,开始收藏你喜欢的视频吧"; $msg = "登录成功,开始收藏你喜欢的视频吧";
$code = 1; $code = 1;

7
themes/tajian/controller/MyController.php

@ -93,4 +93,11 @@ Class MyController extends SiteController {
return $this->actionIndex($viewName, $defaultTitle); return $this->actionIndex($viewName, $defaultTitle);
} }
//分享收藏夹
public function actionShare() {
$defaultTitle = "分享收藏夹";
$viewName = 'share';
return $this->actionIndex($viewName, $defaultTitle);
}
} }

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

@ -24,6 +24,7 @@ if (!empty(FSC::$app['config']['multipleUserUriParse']) && !empty(FSC::$app['use
<li><a href="<?=$linkPrefix?>/my/favs"><img src="/img/favorite.png" alt="favorite" width="20"> 管理收藏</a></li> <li><a href="<?=$linkPrefix?>/my/favs"><img src="/img/favorite.png" alt="favorite" width="20"> 管理收藏</a></li>
<li><a href="<?=$linkPrefix?>/my/addtag"><img src="/img/edit.svg" alt="edit" width="18"> 添加分类</a></li> <li><a href="<?=$linkPrefix?>/my/addtag"><img src="/img/edit.svg" alt="edit" width="18"> 添加分类</a></li>
<li><a href="<?=$linkPrefix?>/site/new"><img src="/img/addvideos.svg" alt="add favorite" width="20"> 添加收藏</a></li> <li><a href="<?=$linkPrefix?>/site/new"><img src="/img/addvideos.svg" alt="add favorite" width="20"> 添加收藏</a></li>
<li><a href="<?=$linkPrefix?>/my/share"><img src="/img/share-fill.svg" alt="add favorite" width="18"> 分享收藏</a></li>
</ul> </ul>
</div> </div>
</main> </main>

33
themes/tajian/views/my/share.php

@ -0,0 +1,33 @@
<?php
$linkPrefix = '';
//多用户路径支持
if (!empty(FSC::$app['config']['multipleUserUriParse']) && !empty(FSC::$app['user_id'])) {
$linkPrefix = '/' . FSC::$app['user_id'];
}
$shareUrl = "{$linkPrefix}/";
?><main class="g_main_lay">
<form class="g_form_style mt65" id="share_form" action="" method="POST">
<div class="mb-3 pt20">
<label for="text_share_content" class="form-label">分享链接</label>
<textarea id="text_share_content" name="share_content" rows="5" data-share-url="<?=$shareUrl?>"><?=$shareUrl?>,“<?=$viewData['nickname']?>”的Ta荐视频收藏夹,都是我喜欢的视频,来看看吧~</textarea>
<p class="mt10">复制上面分享内容,在微信、QQ等App里粘贴发给朋友。</p>
</div>
<div class="avform_bt vercenter">
<button class="jsbtn" aria-label="复制" type="button" data-clipboard-target="#text_share_content">
<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>
</form>
</main>
<script src="/js/clipboard.min.js"></script>

4
www/img/share-fill.svg

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-share-fill" viewBox="0 0 16 16">
<path d="M11 2.5a2.5 2.5 0 1 1 .603 1.628l-6.718 3.12a2.5 2.5 0 0 1 0 1.504l6.718 3.12a2.5 2.5 0 1 1-.488.876l-6.718-3.12a2.5 2.5 0 1 1 0-3.256l6.718-3.12A2.5 2.5 0 0 1 11 2.5"/>
</svg>

After

Width:  |  Height:  |  Size: 356 B

7
www/js/clipboard.min.js vendored

File diff suppressed because one or more lines are too long

20
www/js/tajian.js

@ -602,4 +602,24 @@ if ($('#favmg').get(0)) {
}); });
} }
// 分享收藏夹
if ($('#share_form').get(0)) {
var share_content = $('#share_form textarea').val();
$('#share_form textarea').val(location.protocol + '//' + location.host + (location.port ? ':' + location.port : '') + share_content);
var clipboard = new ClipboardJS('#share_form .jsbtn');
clipboard.on('success', function(e) {
e.clearSelection();
$('#share_form .jsbtn').text('已复制');
setTimeout(function() {
$('#share_form .jsbtn').text('复制');
}, 5000);
});
clipboard.on('error', function(e) {
alert('复制失败,请手动选择后复制。');
});
}
})(); })();

Loading…
Cancel
Save