mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 17:49:11 +08:00
1 line
12 KiB
JavaScript
Vendored
1 line
12 KiB
JavaScript
Vendored
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[18],{"9Emu":function(e,a,t){"use strict";t.r(a),t.d(a,"default",function(){return u});var n=t("jehZ"),s=t.n(n),i=(t("BoS7"),t("Sdc0")),r=(t("+L6B"),t("2/Rp")),l=(t("miYZ"),t("tsqr")),c=t("q1tI"),o=t.n(c),m=t("Bl7J"),d=t("t3Un"),h=t("3a4m"),p=t.n(h);class u extends o.a.Component{constructor(){super(...arguments),this.state={info:{},loading:!0}}componentDidMount(){this.fetchData()}fetchData(){Object(d["a"])("/user/info").then(e=>{200===e.code&&this.setState({info:e.data,loading:!1})})}changePassword(){if(this.refs.re_password.value!==this.refs.new_password.value)return l["a"].error("\u4e24\u6b21\u65b0\u5bc6\u7801\u8f93\u5165\u4e0d\u540c");Object(d["b"])("/user/changePassword",{old_password:this.refs.old_password.value,new_password:this.refs.new_password.value}).then(e=>{200===e.code&&(l["a"].success("\u4fee\u6539\u6210\u529f\uff0c\u8bf7\u91cd\u65b0\u767b\u9646"),p.a.push("/login"))})}update(e,a){this.setState({[e+"_loading"]:!0},()=>{Object(d["b"])("/user/update",{[e]:a}).then(a=>{200===a.code&&(this.fetchData(),this.setState({[e+"_loading"]:!1}))})})}render(){return o.a.createElement(m["a"],s()({},this.props,{loading:this.state.loading}),o.a.createElement("main",{id:"main-container"},o.a.createElement("div",{className:"content content-full"},o.a.createElement("h2",{className:"font-w300 mt-4 mb-3"},"\u4e2a\u4eba\u4e2d\u5fc3"),o.a.createElement("div",{className:"block block-rounded block-bordered"},o.a.createElement("div",{className:"block-header block-header-default"},o.a.createElement("h3",{className:"block-title"},"\u4fee\u6539\u5bc6\u7801"),o.a.createElement("div",{className:"block-options"},o.a.createElement(r["a"],{type:"primary",onClick:()=>this.changePassword()},"\u4fdd\u5b58"))),o.a.createElement("div",{className:"block-content"},o.a.createElement("div",{className:"row push"},o.a.createElement("div",{className:"col-lg-8 col-xl-5"},o.a.createElement("div",{className:"form-group"},o.a.createElement("label",{for:"example-text-input"},"\u65e7\u5bc6\u7801"),o.a.createElement("input",{type:"password",className:"form-control",placeholder:"\u8bf7\u8f93\u5165\u65e7\u5bc6\u7801",ref:"old_password"})),o.a.createElement("div",{className:"form-group"},o.a.createElement("label",{for:"example-text-input"},"\u65b0\u5bc6\u7801"),o.a.createElement("input",{type:"password",className:"form-control",placeholder:"\u8bf7\u8f93\u5165\u65b0\u5bc6\u7801",ref:"new_password"})),o.a.createElement("div",{className:"form-group"},o.a.createElement("label",{for:"example-text-input"},"\u65b0\u5bc6\u7801"),o.a.createElement("input",{type:"password",className:"form-control",placeholder:"\u8bf7\u786e\u8ba4\u65b0\u5bc6\u7801",ref:"re_password"})))))),o.a.createElement("div",{className:"block block-rounded block-bordered"},o.a.createElement("div",{className:"block-header block-header-default"},o.a.createElement("h3",{className:"block-title"},"\u901a\u77e5")),o.a.createElement("div",{className:"block-content"},o.a.createElement("div",{className:"row push"},o.a.createElement("div",{className:"col-lg-8 col-xl-5"},o.a.createElement("div",{className:"form-group"},o.a.createElement("label",{for:"example-text-input"},"\u5230\u671f\u90ae\u4ef6\u63d0\u9192"),o.a.createElement("div",null,o.a.createElement(i["a"],{loading:this.state.remind_expire_loading,checked:this.state.info.remind_expire,onChange:e=>this.update("remind_expire",e?1:0)}))),o.a.createElement("div",{className:"form-group"},o.a.createElement("label",{for:"example-text-input"},"\u6d41\u91cf\u90ae\u4ef6\u63d0\u9192"),o.a.createElement("div",null,o.a.createElement(i["a"],{loading:this.state.remind_traffic_loading,checked:this.state.info.remind_traffic,onChange:e=>this.update("remind_traffic",e?1:0)}))))))))))}}},Bl7J:function(e,a,t){"use strict";var n=t("q1tI"),s=t.n(n),i=t("3a4m"),r=t.n(i),l=t("/MKj"),c=t("20nU"),o=t("yWgo");class m 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"})}],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(o["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:()=>{r.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(l["c"])(e=>{var a=e.header;return{header:a}})(m),h=t("t3Un");class p 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(h["a"])("/user/logout").then(e=>{r.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(l["c"])(e=>{var a=e.header;return{header:a}})(p);class v 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 f 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(v,null))}}a["a"]=Object(l["c"])(e=>{var a=e.header;return{header:a}})(f)}}]); |