v2board/public/p__dashboard.async.js
2019-11-23 13:46:00 +08:00

1 line
15 KiB
JavaScript
Vendored

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[9],{Bl7J:function(e,a,t){"use strict";var n=t("q1tI"),s=t.n(n),i=t("3a4m"),l=t.n(i),r=t("/MKj"),c=t("20nU"),m=t("yWgo");class o extends s.a.Component{constructor(){super(...arguments),this.state={nav:[]}}componentDidMount(){var e=[{title:"\u4eea\u8868\u76d8",type:"item",href:"/dashboard",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-speedometer"})},{title:"\u8ba2\u9605",type:"heading"},{title:"\u6211\u7684\u8ba2\u9605",type:"item",href:"/subscribe",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-badge"})},{title:"\u8d2d\u4e70\u8ba2\u9605",type:"item",href:"/plan",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-bag"})},{title:"\u8d22\u52a1",type:"heading"},{title:"\u6211\u7684\u8ba2\u5355",type:"item",href:"/order",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-list"})},{title:"\u6211\u7684\u9080\u8bf7",type:"item",href:"/invite",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-users"})},{title:"\u7528\u6237",type:"heading"},{title:"\u4e2a\u4eba\u4e2d\u5fc3",type:"item",href:"/profile",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-user"})},{title:"\u4f7f\u7528\u6559\u7a0b",type:"item",href:"/tutorial",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-book-open"})}],a=[{title:"\u8fd4\u56de\u7528\u6237\u4e2d\u5fc3",type:"item",href:"/dashboard",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-action-undo"})},{title:"\u8bbe\u7f6e",type:"heading"},{title:"\u7ad9\u70b9\u914d\u7f6e",type:"item",href:"/admin/config/site",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-equalizer"})},{title:"\u652f\u4ed8\u914d\u7f6e",type:"item",href:"/admin/config/payment",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-credit-card"})},{title:"\u670d\u52a1\u5668",type:"heading"},{title:"\u8282\u70b9\u7ba1\u7406",type:"item",href:"/admin/server",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-vector"})},{title:"\u6743\u9650\u7ec4\u7ba1\u7406",type:"item",href:"/admin/server/group",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-wrench"})},{title:"\u8d22\u52a1",type:"heading"},{title:"\u8ba2\u9605\u7ba1\u7406",type:"item",href:"/admin/plan",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-bag"})},{title:"\u8ba2\u5355\u7ba1\u7406",type:"item",href:"/admin/order",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-list"})},{title:"\u7528\u6237",type:"heading"},{title:"\u7528\u6237\u7ba1\u7406",type:"item",href:"/admin/user",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-users"})}];Object(m["c"])("is_admin")&&e.unshift({title:"\u8fd4\u56de\u7ba1\u7406\u4e2d\u5fc3",type:"item",href:"/admin/dashboard",icon:s.a.createElement("i",{className:"nav-main-link-icon si si-action-undo"})}),this.isAdmin()?this.setState({nav:a}):this.setState({nav:e})}renderMenu(e,a,t,n){switch(e){case"heading":return s.a.createElement("li",{className:"nav-main-heading"},a);case"item":return s.a.createElement("li",{className:"nav-main-item"},s.a.createElement("a",{className:"nav-main-link ".concat(this.props.location.pathname===t&&"active"),onClick:()=>{l.a.push(t),this.props.dispatch({type:"header/showNav"})}},n&&n,s.a.createElement("span",{className:"nav-main-link-name"},a)))}}isAdmin(){return-1!==this.props.location.pathname.indexOf("admin")}render(){return s.a.createElement("nav",{id:"sidebar","aria-label":"Main Navigation"},s.a.createElement("div",{className:"smini-visible-block"},s.a.createElement("div",{className:"content-header bg-black-10"},s.a.createElement("a",{className:"link-fx font-size-lg text-white",href:"index.html"},s.a.createElement("span",{className:"text-white-75"},"X"),s.a.createElement("span",{className:"text-white"},"H")))),s.a.createElement("div",{className:"smini-hidden ".concat(1===c["a"].theme?"":"bg-header-dark")},s.a.createElement("div",{className:"content-header justify-content-lg-center bg-black-10"},s.a.createElement("a",{className:"link-fx font-size-lg text-white",href:"index.html"},s.a.createElement("span",{className:"text-white-75"},window.v2board.title?window.v2board.title:"V2Board")),s.a.createElement("div",{className:"d-lg-none"},s.a.createElement("a",{className:"text-white ml-2","data-toggle":"layout","data-action":"sidebar_close",href:"javascript:void(0)",onClick:()=>this.props.dispatch({type:"header/showNav"})},s.a.createElement("i",{className:"fa fa-times-circle"}))))),s.a.createElement("div",{className:"content-side content-side-full"},s.a.createElement("ul",{className:"nav-main"},this.state.nav.map(e=>{return this.renderMenu(e.type,e.title,e.href,e.icon)}))))}}var d=Object(r["c"])(e=>{var a=e.header;return{header:a}})(o),p=t("t3Un");class h extends s.a.Component{constructor(){super(...arguments),this.state={showAvatarMenu:!1,loading:!1}}componentDidMount(){var e=this;this.props.header.userInfo.email||this.setState({loading:!0},()=>{this.props.dispatch({type:"header/getUserInfo",complete:()=>e.setState({loading:!1})})})}showAvatarMenu(){var e=this;this.setState({showAvatarMenu:!this.state.showAvatarMenu},()=>{document.onclick=function(a){e.state.showAvatarMenu&&e.setState({showAvatarMenu:!1}),document.onclick=void 0}})}logout(){Object(p["a"])("/user/logout").then(e=>{l.a.push("/login")})}render(){return s.a.createElement("header",{id:"page-header"},s.a.createElement("div",{className:"content-header"},s.a.createElement("div",{className:"sidebar-toggle",style:{display:this.props.search?"none":"block"}},s.a.createElement("button",{type:"button",className:"btn btn-dual mr-1 d-lg-none","data-toggle":"layout","data-action":"sidebar_toggle",onClick:()=>this.props.dispatch({type:"header/showNav"})},s.a.createElement("i",{className:"fa fa-fw fa-bars"}))),this.props.search&&s.a.createElement("div",null,s.a.createElement("input",{type:"text",className:"form-control rounded-lg px-4",placeholder:this.props.search.placeholder,onChange:e=>this.props.search.onChange(e.target.value)})),s.a.createElement("div",null,this.state.loading?s.a.createElement("div",{className:"spinner-grow text-primary"}):s.a.createElement("div",{className:"dropdown d-inline-block"},s.a.createElement("button",{type:"button",className:"btn btn-dual",id:"page-header-user-dropdown","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",onClick:()=>this.showAvatarMenu()},s.a.createElement("img",{className:"img-avatar img-avatar32 img-avatar-thumb",src:this.props.header.userInfo.avatar_url,alt:""}),s.a.createElement("span",{className:"d-none d-lg-inline ml-1"},this.props.header.userInfo.email),s.a.createElement("i",{className:"fa fa-fw fa-angle-down ml-1"})),s.a.createElement("div",{className:"dropdown-menu dropdown-menu-right dropdown-menu-lg p-0 ".concat(this.state.showAvatarMenu&&"show"),"aria-labelledby":"page-header-user-dropdown"},s.a.createElement("div",{className:"p-2"},s.a.createElement("a",{className:"dropdown-item d-flex justify-content-between align-items-center",href:"javascript:;",onClick:()=>this.logout()},"\u9000\u51fa\u767b\u5f55",s.a.createElement("i",{className:"fa fa-fw fa-sign-out-alt text-danger ml-1"}))))))))}}var u=Object(r["c"])(e=>{var a=e.header;return{header:a}})(h);class f extends s.a.Component{render(){return s.a.createElement("footer",{id:"page-footer",className:"bg-body-light"},s.a.createElement("div",{className:"content py-0"},s.a.createElement("div",{className:"row font-size-sm"},s.a.createElement("div",{className:"col-sm-6 order-sm-2 mb-1 mb-sm-0 text-center text-sm-right"},s.a.createElement("i",{className:"fa fa-heart text-danger"})," ",window.v2board.title?window.v2board.title:"V2Board"),s.a.createElement("div",{className:"col-sm-6 order-sm-1 text-center text-sm-left"},s.a.createElement("a",{className:"font-w600",href:"/",target:"_blank"},"V2Board v0.1"),s.a.createElement("span",{"data-toggle":"year-copy"})))))}}class b extends s.a.Component{render(){return s.a.createElement("div",{id:"page-container",className:"sidebar-o ".concat(1===c["a"].theme?"sidebar-dark":"page-header-dark"," side-scroll page-header-fixed main-content-boxed side-trans-enabled ").concat(this.props.header.showNav&&"sidebar-o-xs")},s.a.createElement(d,this.props),s.a.createElement(u,{search:this.props.search}),this.props.loading?s.a.createElement("main",{id:"main-container"},s.a.createElement("div",{className:"content content-full"},s.a.createElement("div",{className:"spinner-grow text-primary",role:"status"},s.a.createElement("span",{className:"sr-only"},"Loading...")))):this.props.children,s.a.createElement(f,null))}}a["a"]=Object(r["c"])(e=>{var a=e.header;return{header:a}})(b)},sFYk:function(e,a,t){"use strict";t.r(a),t.d(a,"default",function(){return w});var n=t("jehZ"),s=t.n(n),i=(t("miYZ"),t("tsqr")),l=(t("qVdP"),t("jsC+")),r=(t("lUTK"),t("BvKs")),c=t("p0pE"),m=t.n(c),o=t("q1tI"),d=t.n(o),p=t("Bl7J"),h=t("t3Un"),u=t("yWgo"),f=t("3a4m"),b=t.n(f),v=t("+QRC"),E=t.n(v),g=t("wd/R"),N=t.n(g);class w extends d.a.Component{constructor(){super(...arguments),this.state={user:{plan:{}},stat:[],loading:!0}}componentDidMount(){Object(h["a"])("/user/dashboard").then(e=>{200===e.code&&this.setState(m()({},e.data,{loading:!1}))})}render(){return d.a.createElement(p["a"],s()({},this.props,{loading:this.state.loading}),d.a.createElement("main",{id:"main-container"},d.a.createElement("div",{className:"content content-full"},d.a.createElement("h2",{className:"font-w300 mt-4 mb-3"},"\u603b\u89c8"),d.a.createElement("div",{className:"row"},d.a.createElement("div",{className:"col-sm-4 col-lg-4 js-appear-enabled animated fadeIn","data-toggle":"appear","data-timeout":"300"},d.a.createElement("div",{className:"block block-rounded block-fx-pop text-center"},d.a.createElement("div",{className:"block-content block-content-full aspect-ratio-16-9 d-flex justify-content-center align-items-center"},d.a.createElement("div",null,d.a.createElement("a",{className:"link-fx text-danger font-size-h1 font-w700",onClick:()=>b.a.push("/order")},this.state.stat[0]),d.a.createElement("div",{className:"font-size-sm font-w700 text-uppercase text-muted mt-1"},"\u5f85\u4ed8\u8ba2\u5355"))))),d.a.createElement("div",{className:"col-sm-4 col-lg-4 js-appear-enabled animated fadeIn","data-toggle":"appear","data-timeout":"150"},d.a.createElement("div",{className:"block block-rounded block-fx-pop text-center"},d.a.createElement("div",{className:"block-content block-content-full aspect-ratio-16-9 d-flex justify-content-center align-items-center"},d.a.createElement("div",null,d.a.createElement("a",{className:"link-fx text-warning font-size-h1 font-w700"},this.state.stat[1]),d.a.createElement("div",{className:"font-size-sm font-w700 text-uppercase text-muted mt-1"},"\u5f85\u529e\u5de5\u5355"))))),d.a.createElement("div",{className:"col-sm-4 col-lg-4 js-appear-enabled animated fadeIn","data-toggle":"appear","data-timeout":"450"},d.a.createElement("div",{className:"block block-rounded block-fx-pop text-center"},d.a.createElement("div",{className:"block-content block-content-full aspect-ratio-16-9 d-flex justify-content-center align-items-center"},d.a.createElement("div",null,d.a.createElement("a",{className:"link-fx text-success font-size-h1 font-w700",onClick:()=>b.a.push("/invite")},this.state.stat[2]),d.a.createElement("div",{className:"font-size-sm font-w700 text-uppercase text-muted mt-1"},"\u6211\u7684\u9080\u8bf7")))))),d.a.createElement("div",{className:"d-flex justify-content-between align-items-center mt-6 mb-3"},d.a.createElement("h2",{className:"font-w300 mb-0"},"\u6211\u7684\u8ba2\u9605")),this.state.user.plan_id?d.a.createElement("div",{className:"block block-rounded mb-2 block-fx-pop animated fadeIn","data-toggle":"appear"},d.a.createElement("div",{className:"block-content block-content-full"},d.a.createElement("div",{className:"d-md-flex justify-content-md-between align-items-md-center"},d.a.createElement("div",{className:"p-1 p-md-3 w-50"},d.a.createElement("h3",{className:"h4 font-w700 mb-1"},this.state.user.plan.name),d.a.createElement("p",{className:"font-size-sm text-muted"},this.state.user.expired_at<(new Date).getTime()/1e3?d.a.createElement("a",{className:"font-w600 text-danger",href:"javascript:void(0)"},"\u5df2\u8fc7\u671f"):d.a.createElement("span",null,"\u4e8e ",N()().format("YYYY/MM/DD")," \u5230\u671f\uff0c\u8ddd\u79bb\u5230\u671f\u8fd8\u6709 ",((this.state.user.expired_at-N()().format("X"))/86400).toFixed(0)," \u5929")),d.a.createElement("div",{className:"mb-0"},d.a.createElement("div",{className:"progress mb-1",style:{height:6}},d.a.createElement("div",{className:"progress-bar progress-bar-striped progress-bar-animated bg-success",role:"progressbar",style:{width:Object(u["d"])(this.state.user.u+this.state.user.d,this.state.user.transfer_enable)+"%"}})),d.a.createElement("p",{className:"font-size-sm font-w600 mb-3"},d.a.createElement("span",{className:"font-w700"},((this.state.user.u+this.state.user.d)/1073741824).toFixed(2)," GB")," / ",d.a.createElement("span",{className:"font-w700"},(this.state.user.transfer_enable/1073741824).toFixed(2)," GB")))),d.a.createElement("div",{className:"p-1 p-md-3 text-md-right"},Object(u["e"])()?d.a.createElement(l["a"],{trigger:["click"],overlay:d.a.createElement(r["a"],null,d.a.createElement(r["a"].Item,{key:"0",onClick:()=>window.location.href="quantumult://configuration?server="+window.btoa(this.state.user.subscribe_url).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},d.a.createElement("a",null,"Quantumult")),d.a.createElement(r["a"].Item,{key:"1",onClick:()=>window.location.href="quantumult-x:///update-configuration?remote-resource="+encodeURI(JSON.stringify({server_remote:[this.state.user.subscribe_url+", tag="+window.v2board.title]}))},d.a.createElement("a",null,"QuantumultX")),d.a.createElement(r["a"].Item,{key:"2",onClick:()=>window.location.href="shadowrocket://add/sub://"+window.btoa(this.state.user.subscribe_url).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")+"?remark="+window.v2board.title},d.a.createElement("a",null,"Shadowrocket")))},d.a.createElement("a",{className:"btn btn-sm btn-primary btn-rounded px-3 mr-1 my-1",href:"javascript:void(0)"},d.a.createElement("i",{className:"fa fa-rss mr-1"}),"\u4e00\u952e\u8ba2\u9605")):d.a.createElement("a",{className:"btn btn-sm btn-outline-warning btn-rounded px-3 mr-1 my-1",href:"javascript:void(0)",onClick:()=>{E()(this.state.user.subscribe_url),i["a"].success("\u590d\u5236\u6210\u529f")}},d.a.createElement("i",{className:"fa fa-copy mr-1"}),"\u590d\u5236\u8ba2\u9605\u5730\u5740"),d.a.createElement("a",{className:"btn btn-sm btn-outline-secondary btn-rounded px-3 mr-1 my-1",href:"javascript:void(0)",onClick:()=>b.a.push("/subscribe")},d.a.createElement("i",{className:"fa fa-cog mr-1"}),"\u67e5\u770b\u8ba2\u9605"),d.a.createElement("a",{className:"btn btn-sm btn-outline-danger btn-rounded px-3 my-1",href:"javascript:void(0)",onClick:()=>b.a.push("/plan/"+this.state.user.plan_id)},d.a.createElement("i",{className:"fa fa-redo mr-1"}),"\u7eed\u8d39"))))):d.a.createElement("a",{className:"block block-rounded mb-2 block-link-pop animated fadeIn",onClick:()=>b.a.push("/plan")},d.a.createElement("div",{className:"block-content block-content-full"},d.a.createElement("div",{className:"text-center align-items-md-center py-5"},d.a.createElement("div",null,d.a.createElement("i",{className:"fa fa-plus fa-2x"})),d.a.createElement("div",{className:"font-size-sm font-w700 text-uppercase text-muted pt-2"},"\u6dfb\u52a0\u8ba2\u9605")))))))}}}}]);