Merge branch 'dev' of https://gitea.f2b211.com/jsasg/orico-official-website into dev
This commit is contained in:
@@ -31,7 +31,7 @@ class Upload
|
||||
$max_size = strtobytes(env('ADMIN_API.MAX_IMAGE_SIZE', '1mb'));
|
||||
$validate = validate([
|
||||
'module' => 'require|max:64',
|
||||
'image' => "fileSize:$max_size|fileExt:jpg,jpeg,png,gif"
|
||||
'image' => "fileSize:$max_size|fileExt:jpg,jpeg,png,gif,webp"
|
||||
]);
|
||||
if (!$validate->check(['module' => $param['module'], 'image' => $file])) {
|
||||
return error($validate->getError());
|
||||
@@ -346,7 +346,7 @@ class Upload
|
||||
try {
|
||||
$max_size = strtobytes(env('ADMIN_API.MAX_ATTACHMENT_SIZE', '100mb'));
|
||||
$validate = validate([
|
||||
'attachment' => "fileSize:$max_size|fileExt:biz,bz,bz2,gz,tgz,zip,rar,7z,doc,docx,xls,xlsx,csv,ppt,pptx,pdf,txt,jpg,jpeg,png,ttf"
|
||||
'attachment' => "fileSize:$max_size|fileExt:biz,bz,bz2,gz,tgz,zip,rar,7z,doc,docx,xls,xlsx,csv,ppt,pptx,pdf,txt,jpg,jpeg,png,webp,ttf"
|
||||
]);
|
||||
if (!$validate->check(['attachment' => $file])) {
|
||||
return error($validate->getError());
|
||||
|
||||
@@ -178,3 +178,47 @@ if (!function_exists('date_format_i18n')) {
|
||||
return date($fmt, $timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_platform')) {
|
||||
/**
|
||||
* 获取平台
|
||||
* @return string
|
||||
*/
|
||||
function get_platform(): string
|
||||
{
|
||||
$detect = new \Detection\MobileDetect();
|
||||
$platform = 'pc';
|
||||
|
||||
if ($detect->isMobile() || $detect->isTablet()) {
|
||||
$platform = 'mobile';
|
||||
} else {
|
||||
// 在非移动端环境,根据配置规则判断是否要显示移动端
|
||||
$view_cfg = $view_cfg = [
|
||||
'rule' => env('VIEW_TPL.RULE', 'query'),
|
||||
'query' => [
|
||||
'name' => env('VIEW_TPL.RULE_QUERY_NAME', 'mtpl'),
|
||||
'value' => env('VIEW_TPL.RULE_QUERY_VALUE', '1'),
|
||||
],
|
||||
'domain' => [
|
||||
'scheme' => env('VIEW_TPL.RULE_DOMAIN_SCHEME', ['http']),
|
||||
'host' => env('VIEW_TPL.RULE_DOMAIN_HOST'),
|
||||
],
|
||||
];
|
||||
if ($view_cfg['rule'] == 'query') {
|
||||
$name = $view_cfg['query']['name'];
|
||||
$value = $view_cfg['query']['value'];
|
||||
if (request()->get($name) == $value) {
|
||||
$platform = 'mobile';
|
||||
}
|
||||
} elseif ($view_cfg['rule'] == 'domain') {
|
||||
$scheme = $view_cfg['domain']['scheme'];
|
||||
$host = $view_cfg['domain']['host'];
|
||||
if (in_array(request()->scheme(), $scheme) && $host == request()->host()) {
|
||||
$platform = 'mobile';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $platform;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,7 @@
|
||||
// | 模板设置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
use Detection\MobileDetect;
|
||||
|
||||
$detect = new MobileDetect();
|
||||
$view_device_name = 'pc';
|
||||
if ($detect->isMobile() || $detect->isTablet() || request()->get('mtpl') == 1) {
|
||||
$view_device_name = 'mobile';
|
||||
}
|
||||
$view_device_name = get_platform();
|
||||
|
||||
return [
|
||||
// 模板引擎类型使用Think
|
||||
|
||||
@@ -15,10 +15,7 @@ class ConfirmRequestFrom
|
||||
public function handle($request, \Closure $next)
|
||||
{
|
||||
// 确认请求来源
|
||||
$request->from = 'pc';
|
||||
if ($request->isMobile() || $request->get('mtpl') == 1) {
|
||||
$request->from = 'mobile';
|
||||
}
|
||||
$request->from = get_platform();
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
{else/}
|
||||
<div style="text-align: center; padding: 10%;">暂无数据</div>
|
||||
{/notempty}
|
||||
<div style=" text-align: center;padding: 10%;">暂无数据</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
@@ -28,5 +28,31 @@
|
||||
{include file="public/footer"/}
|
||||
{/block}
|
||||
{block name="script"}{/block}
|
||||
<script>
|
||||
$(window).ready(function () {
|
||||
// 为所有站内链接,添加标识
|
||||
// 使用mtpl=1参数标识解决ipad访问站点时,从pc重定向到mobile每次页面都会pc - mobile闪现问题
|
||||
var LURL = new URL(window.location.href);
|
||||
if (LURL.searchParams.get('mtpl') == 1) {
|
||||
$('a').each(function () {
|
||||
var href = $(this).attr('href');
|
||||
if (href) {
|
||||
var origin = LURL.origin;
|
||||
if (href.indexOf('http') == -1) {
|
||||
href = new URL(href, origin);
|
||||
href.searchParams.set('mtpl', '1');
|
||||
$(this).attr('href', href);
|
||||
} else {
|
||||
href = new URL(href);
|
||||
if (href.origin == origin) {
|
||||
href.searchParams.set('mtpl', '1');
|
||||
$(this).attr('href', href);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -18,7 +18,9 @@
|
||||
{notempty name="fn.children"}
|
||||
{volist name="fn.children" id="fnc"}
|
||||
<p>
|
||||
<a href="{$fnc.link}" target="_blank" class="inline-block link-faded break-all">{$fnc.name}</a>
|
||||
<a href="{$fnc.link}" {eq name="fnc.link" value="1"}target="_blank"{/eq} class="inline-block link-faded break-all">
|
||||
{$fnc.name}
|
||||
</a>
|
||||
</p>
|
||||
{/volist}
|
||||
{/notempty}
|
||||
|
||||
@@ -101,7 +101,6 @@
|
||||
var windowHeight = $(window).height();
|
||||
// 监听滚动事件
|
||||
$(window).scroll(function() {
|
||||
console.log($(this).scrollTop(),windowHeight)
|
||||
// 检查滚动距离是否超过一屏幕高度
|
||||
if ($(this).scrollTop() > windowHeight) {
|
||||
// 如果超过,显示返回顶部按钮
|
||||
|
||||
Reference in New Issue
Block a user