修复首页背景适应

This commit is contained in:
HFO4 2018-02-06 17:08:16 +08:00
parent b6c1382e73
commit 1431f433d1
3 changed files with 77 additions and 2 deletions

View file

@ -0,0 +1,72 @@
<?php
namespace app\index\model;
use think\Model;
use think\Db;
use \app\index\model\Option;
class B2 extends Model{
public $policy;
private $ak;
public function __construct($policy){
$this->policy = $policy;
$akInfo = explode(":",$this->policy["ak"]);
$this->ak = $akInfo[0];
if(time()-$akInfo[1]>=86000){
$this->updateAuth();
}
}
private function updateAuth(){
$credentials = base64_encode($this->ak . ":" . $this->policy["sk"]);
$url = "https://api.backblazeb2.com/b2api/v1/b2_authorize_account";
$session = curl_init($url);
$headers = array();
$headers[] = "Accept: application/json";
$headers[] = "Authorization: Basic " . $credentials;
curl_setopt($session, CURLOPT_HTTPHEADER, $headers);
curl_setopt($session, CURLOPT_HTTPGET, true);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false); //不验证证书
curl_setopt($session, CURLOPT_SSL_VERIFYHOST, false); //不验证证书
$server_output = curl_exec($session);
curl_close ($session);
$authInfo = json_decode($server_output,true);
Db::name("policy")->where("id",$this->policy["id"])
->update([
"ak" => $this->ak . ":" . time(),
"op_name" => $authInfo["apiUrl"],
"url" => $authInfo["downloadUrl"],
"op_pwd" => $authInfo["authorizationToken"],
]);
$this->policy = Db::name("policy")->where("id",$this->policy["id"])->find();
$this->updateUploadAuth();
}
private function updateUploadAuth(){
$session = curl_init($this->policy["op_name"] . "/b2api/v1/b2_get_upload_url");
$data = array("bucketId" => $this->policy["bucketname"]);
$post_fields = json_encode($data);
curl_setopt($session, CURLOPT_POSTFIELDS, $post_fields);
$headers = array();
$headers[] = "Authorization: " . $this->policy["op_pwd"];
curl_setopt($session, CURLOPT_HTTPHEADER, $headers);
curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false); //不验证证书
curl_setopt($session, CURLOPT_SSL_VERIFYHOST, false); //不验证证书
curl_setopt($session, CURLOPT_POST, true);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($session);
curl_close ($session);
$authInfo = json_decode($server_output,true);
Db::name("policy")->where("id",$this->policy["id"])
->update([
"server" => $authInfo["uploadUrl"] . "|" . $authInfo["authorizationToken"],
]);
$this->policy = Db::name("policy")->where("id",$this->policy["id"])->find();
die("");
}
}
?>

View file

@ -3,7 +3,7 @@
<!--Video-->
<div class="intro-video view" id="home">
<img src="static/img/output.jpg">
<div class="hm-gradient">

View file

@ -1 +1,4 @@
.intro-page .navbar:not(.top-nav-collapse){background:0 0!important;box-shadow:none}.full-height,.full-height body,.full-height header,.full-height header .view{height:100%}.intro-page .navbar:not(.top-nav-collapse){background:0 0!important;box-shadow:none}.creative-lp .navbar{background-color:#6d7275}.grey-skin .navbar{background-color:#7d8488}.navbar{font-weight:300}.navbar.navbar-dark .navbar-brand{color:#fff}.navbar .navbar-brand{-webkit-align-self:flex-start;-ms-flex-item-align:start;align-self:flex-start;overflow:visible}.full-height,.full-height body,.full-height header,.full-height header .view{height:100%}header .view{position:relative;width:100%;height:auto;background-repeat:no-repeat;background-position:center center;-webkit-background-size:cover;-moz-background-size:cover;background-size:cover;-o-background-size:cover}header .view{position:relative;width:100%;height:auto;background-repeat:no-repeat;background-position:center center;background-size:cover}.view{overflow:hidden;position:relative;cursor:default}.creative-lp .hm-gradient .full-bg-img{background:-moz-linear-gradient(45deg,rgba(153,122,226,.6),rgba(3,3,4,.6) 100%);background:-webkit-linear-gradient(45deg,rgba(153,122,226,.6),rgba(3,3,4,.6) 100%);background:linear-gradient(to 45deg,rgba(153,122,226,.6),rgba(3,3,4,.6) 100%)}.full-bg-img{height:100%;width:100%;position:absolute;overflow:hidden;top:0;left:0}.card .card-circle,.card-overlay,.flex-center,.section.team-section .avatar,.testimonial-carousel .testimonial .avatar{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:100%}.white-text{color:#FFF!important}.brand-name{font-size:4.5rem}.font-bold{font-weight:500}.mb-2{margin-bottom:1.5rem!important}.hr-streak hr.hr-light,.intro hr.hr-light,.intro-video hr.hr-light{margin-left:31%;margin-right:31%;background-color:#fff;height:1px}.hr-streak hr,.intro hr,.intro-video hr{margin:1.5rem 0 1.5rem 0}.hr-light{background-color:#fff;height:.5px}.subtext-header{line-height:1.5}.btn-light-green-2{background:#00bfa5}.btn-rounded{-webkit-border-radius:10em;-moz-border-radius:10em;-ms-border-radius:10em;-o-border-radius:10em;border-radius:10em!important}.btn{border-radius:2px;border:0;transition:.2s ease-out;color:#fff!important;margin:6px;white-space:normal!important;word-wrap:break-word;text-transform:uppercase}.btn{font-size:.8rem;padding:.85rem 2.13rem}.badge,.btn,.btn-floating,.card,.card-cascade-2 .card-block,.card-cascade.wider .card-block,.card-wrapper .back,.card-wrapper .front,.cascading-media .view,.chip,.dropdown-content,.dropdown-menu,.jumbotron,.list-group,.modal-dialog.cascading-modal .modal-c-tabs .nav-tabs,.modal-dialog.modal-notify .modal-header,.navbar,.navbar .nav-item .dropdown-menu.dropdown a:active,.navbar .nav-item .dropdown-menu.dropdown a:focus,.navbar .nav-item .dropdown-menu.dropdown a:hover,.pager li a,.pagination .active .page-link,.popover,.pricing-card .price .version,.social-list,.top-nav-collapse,.z-depth-1{box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)}.btn,.btn-floating{transition:.5s}
.intro-page .navbar:not(.top-nav-collapse){background:0 0!important;box-shadow:none}.full-height,.full-height body,.full-height header,.full-height header .view{height:100%}.intro-page .navbar:not(.top-nav-collapse){background:0 0!important;box-shadow:none}.creative-lp .navbar{background-color:#6d7275}.grey-skin .navbar{background-color:#7d8488}.navbar{font-weight:300}.navbar.navbar-dark .navbar-brand{color:#fff}.navbar .navbar-brand{-webkit-align-self:flex-start;-ms-flex-item-align:start;align-self:flex-start;overflow:visible}.full-height,.full-height body,.full-height header,.full-height header .view{height:100%}header .view{position:relative;width:100%;height:auto;background-repeat:no-repeat;background-position:center center;-webkit-background-size:cover;-moz-background-size:cover;background-size:cover;-o-background-size:cover}header .view{position:relative;width:100%;height:auto;background-repeat:no-repeat;background-position:center center;background-size:cover}.view{overflow:hidden;position:relative;cursor:default}.creative-lp .hm-gradient .full-bg-img{background:-moz-linear-gradient(45deg,rgba(153,122,226,.6),rgba(3,3,4,.6) 100%);background:-webkit-linear-gradient(45deg,rgba(153,122,226,.6),rgba(3,3,4,.6) 100%);background:linear-gradient(to 45deg,rgba(153,122,226,.6),rgba(3,3,4,.6) 100%)}.full-bg-img{height:100%;width:100%;position:absolute;overflow:hidden;top:0;left:0}.card .card-circle,.card-overlay,.flex-center,.section.team-section .avatar,.testimonial-carousel .testimonial .avatar{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:100%}.white-text{color:#FFF!important}.brand-name{font-size:4.5rem}.font-bold{font-weight:500}.mb-2{margin-bottom:1.5rem!important}.hr-streak hr.hr-light,.intro hr.hr-light,.intro-video hr.hr-light{margin-left:31%;margin-right:31%;background-color:#fff;height:1px}.hr-streak hr,.intro hr,.intro-video hr{margin:1.5rem 0 1.5rem 0}.hr-light{background-color:#fff;height:.5px}.subtext-header{line-height:1.5}.btn-light-green-2{background:#00bfa5}.btn-rounded{-webkit-border-radius:10em;-moz-border-radius:10em;-ms-border-radius:10em;-o-border-radius:10em;border-radius:10em!important}.btn{border-radius:2px;border:0;transition:.2s ease-out;color:#fff!important;margin:6px;white-space:normal!important;word-wrap:break-word;text-transform:uppercase}.btn{font-size:.8rem;padding:.85rem 2.13rem}.badge,.btn,.btn-floating,.card,.card-cascade-2 .card-block,.card-cascade.wider .card-block,.card-wrapper .back,.card-wrapper .front,.cascading-media .view,.chip,.dropdown-content,.dropdown-menu,.jumbotron,.list-group,.modal-dialog.cascading-modal .modal-c-tabs .nav-tabs,.modal-dialog.modal-notify .modal-header,.navbar,.navbar .nav-item .dropdown-menu.dropdown a:active,.navbar .nav-item .dropdown-menu.dropdown a:focus,.navbar .nav-item .dropdown-menu.dropdown a:hover,.pager li a,.pagination .active .page-link,.popover,.pricing-card .price .version,.social-list,.top-nav-collapse,.z-depth-1{box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)}.btn,.btn-floating{transition:.5s}
.intro-video{
background-image: url(/static/img/output.jpg);
}