mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-19 01:44:13 +00:00
1 line
17 KiB
JavaScript
1 line
17 KiB
JavaScript
"use strict";(self.webpackChunkseahub_frontend=self.webpackChunkseahub_frontend||[]).push([[3596],{7039:function(e,s,t){t.d(s,{A:function(){return P}});var n=t(23029),a=t(92901),r=t(39874),i=t(85501),o=t(9950),c=t(4086),l=t(18849),d=t(48918),p=t(30038),u=t(99121),m=t(85077),h=t(58195),x=t(14113),g=t(99308),f=t(85907),j=t(40326),v=t(65604),y=t(26910),b=t(58801),N=function(){return(0,a.A)((function e(){(0,n.A)(this,e)}),[{key:"init",value:function(e){var s=e.server,t=e.username,n=e.password,a=e.token;return this.server=s,this.username=t,this.password=n,this.token=a,this.token&&this.server&&(this.req=y.A.create({baseURL:this.server,headers:{Authorization:"Token "+this.token}})),this}},{key:"initForSeahubUsage",value:function(e){var s=e.siteRoot,t=e.xcsrfHeaders;if(s&&"/"===s.charAt(s.length-1)){var n=s.substring(0,s.length-1);this.server=n}else this.server=s;return this.req=y.A.create({headers:{"X-CSRFToken":t}}),this}},{key:"getSubscription",value:function(){var e=this.server+"/api/v2.1/subscription/";return this.req.get(e)}},{key:"getSubscriptionPlans",value:function(e){var s=this.server+"/api/v2.1/subscription/plans/",t={payment_type:e};return this.req.get(s,{params:t})}},{key:"getSubscriptionLogs",value:function(){var e=this.server+"/api/v2.1/subscription/logs/";return this.req.get(e)}}])}(),_=new N,A=b.Ay.load("sfcsrftoken");_.initForSeahubUsage({siteRoot:j.Yc,xcsrfHeaders:A});var C=t(81446),T=(t(16322),t(44414)),S=window.app.pageOptions.isOrgContext,q=function(e){function s(e){var t;return(0,n.A)(this,s),(t=(0,r.A)(this,s,[e])).togglePlan=function(e){t.setState({currentPlan:e},(function(){}))},t.onPay=function(){var e,s,n,a=t.props.paymentType,r=t.state,i=r.currentPlan,o=r.assetQuotaUnitCount,l=r.count;if("paid"===a)n=i.count,e=i.total_amount;else if("extend_time"===a)n=i.count,s=i.asset_quota,e=i.total_amount;else if("add_user"===a)n=l,e=l*i.price_per_user;else{if("buy_quota"!==a)return void c.A.danger((0,j.AP)("Internal Server Error"));s=o*i.asset_quota_unit,e=o*i.price_per_asset_quota_unit}t.props.onPay(i.plan_id,n,s,e)},t.onCountInputChange=function(e){if(t.state.currentPlan.can_custom_count){var s=e.target.value.replace(/^(0+)|[^\d]+/g,"");s<1?s=1:s>9999&&(s=9999),t.setState({count:s})}},t.onAssetQuotaUnitCountInputChange=function(e){if(t.state.currentPlan.can_custom_asset_quota){var s=e.target.value.replace(/^(0+)|[^\d]+/g,"");s<1?s=1:s>9999&&(s=9999),t.setState({assetQuotaUnitCount:s})}},t.renderPaidOrExtendTime=function(){var e=t.props,s=e.plans,n=e.paymentType,a=t.state.currentPlan,r=0;"extend_time"===n&&(r=a.asset_quota-100);var i=a.total_amount,c=i;return(0,T.jsxs)("div",{className:"d-flex flex-column subscription-container",children:[(0,T.jsx)("span",{className:"subscription-subtitle",children:"\u9009\u62e9\u65b9\u6848"}),(0,T.jsx)("dl",{className:"items-dl",children:s.map((function(e,s){var n=e.plan_id===a.plan_id?"plan-selected":"",r="\uffe5"+e.price_per_user;return S&&(r+="/\u6bcf\u7528\u6237"),(0,T.jsxs)("dd",{className:"plan-description-item ".concat(n),onClick:t.togglePlan.bind(t,e),children:[(0,T.jsx)("span",{className:"plan-name",children:e.name}),(0,T.jsx)("span",{className:"plan-description",children:r})]},s)}))}),"extend_time"===n&&r>0&&(0,T.jsxs)(o.Fragment,{children:[(0,T.jsx)("span",{className:"subscription-subtitle",children:"\u589e\u52a0\u7a7a\u95f4"}),(0,T.jsx)("dl",{className:"items-dl",children:(0,T.jsxs)("dd",{className:"order-item order-item-top order-item-bottom subscription-list",children:[(0,T.jsx)("span",{className:"order-into",children:a.asset_quota_unit+"GB x "+r/a.asset_quota_unit}),(0,T.jsx)("span",{className:"order-value",children:"\uffe5"+r/a.asset_quota_unit*a.price_per_asset_quota_unit})]})})]}),(0,T.jsx)("span",{className:"subscription-subtitle",children:"\u65b9\u6848\u6c47\u603b"}),(0,T.jsx)("dl",{className:"items-dl",children:(0,T.jsxs)("div",{children:[(0,T.jsxs)("dd",{className:"order-item order-item-top",children:[(0,T.jsx)("span",{className:"order-into",children:"\u6240\u9009\u65b9\u6848"}),(0,T.jsx)("span",{className:"order-value",children:a.name})]}),S&&(0,T.jsxs)("dd",{className:"order-item",children:[(0,T.jsx)("span",{className:"order-into",children:"\u6210\u5458\u4eba\u6570"}),(0,T.jsx)("span",{className:"order-value",children:a.count+"\u4eba"})]}),(0,T.jsxs)("dd",{className:"order-item",children:[(0,T.jsx)("span",{className:"order-into",children:"\u53ef\u7528\u7a7a\u95f4"}),(0,T.jsx)("span",{className:"order-value",children:"100GB(\u9644\u8d60)"+(r>0?"+"+r+"GB(\u6269\u5145)":"")})]}),(0,T.jsxs)("dd",{className:"order-item order-item-bottom rounded-0",children:[(0,T.jsx)("span",{className:"order-into",children:"\u5230\u671f\u65f6\u95f4"}),(0,T.jsx)("span",{className:"order-value",children:a.new_term_end})]}),(0,T.jsxs)("dd",{className:"order-item order-item-bottom subscription-list",children:[(0,T.jsx)("span",{className:"order-into",children:"\u5b9e\u9645\u652f\u4ed8\u91d1\u989d"}),(0,T.jsxs)("span",{className:"order-price",children:[c!==i&&(0,T.jsx)("span",{style:{fontSize:"small",textDecoration:"line-through",color:"#9a9a9a"},children:"\uffe5"+c}),(0,T.jsx)("span",{children:"\uffe5"+i+" "})]})]})]})}),(0,T.jsx)(l.A,{className:"subscription-submit",color:"primary",onClick:t.onPay,children:"\u63d0\u4ea4\u8ba2\u5355"})]})},t.renderAddUser=function(){var e=t.state,s=e.currentPlan,n=e.count,a="\u65b0\u589e\u7528\u6237",r=n*s.price_per_user,i=r;return(0,T.jsxs)("div",{className:"d-flex flex-column subscription-container price-version-container-header subscription-add-user",children:[(0,T.jsx)("div",{className:"price-version-container-top"}),(0,T.jsx)("h3",{className:"user-quota-plan-name py-5",children:s.name}),(0,T.jsxs)("span",{className:"py-2 mb-0 text-orange font-500 text-center",children:["\xa5 ",(0,T.jsx)("span",{className:"price-version-plan-price",children:s.price})," "+s.description]}),(0,T.jsxs)(d.A,{style:{marginBottom:"5px"},className:"user-numbers",children:[(0,T.jsx)(p.A,{addonType:"prepend",children:(0,T.jsx)(u.A,{children:a})}),(0,T.jsx)(m.A,{className:"py-2",placeholder:a,title:a,type:"number",value:n||1,min:"1",max:"9999",disabled:!s.can_custom_count,onChange:t.onCountInputChange})]}),(0,T.jsxs)("span",{className:"py-2 text-orange mb-0 font-500 price-version-plan-whole-price text-center",children:["\u603b\u4ef7 \xa5 "+i,r!==i&&(0,T.jsx)("span",{style:{fontSize:"small",textDecoration:"line-through",color:"#9a9a9a"},children:" \uffe5"+r})]}),(0,T.jsx)("span",{className:"py-2 mb-0 text-lg-size font-500 price-version-plan-valid-day text-center",children:"\u6709\u6548\u671f\u81f3 "+s.new_term_end}),(0,T.jsx)("span",{className:"subscription-notice text-center py-5",children:"\u6ce8\uff1a\u5f53\u6709\u6548\u671f\u5269\u4f59\u5929\u6570\u5c11\u4e8e\u8ba1\u5212\u4e2d\u7684\u65f6\u5019\uff0c\u589e\u52a0\u7528\u6237\u7684\u4ef7\u683c\u6309\u5929\u6765\u8ba1\u7b97"}),(0,T.jsx)(l.A,{className:"subscription-submit",onClick:t.onPay,color:"primary",children:"\u7acb\u5373\u8d2d\u4e70"})]})},t.renderBuyQuota=function(){var e=t.state,s=e.currentPlan,n=e.assetQuotaUnitCount,a="\u65b0\u589e\u7a7a\u95f4",r=n*s.price_per_asset_quota_unit,i=r;return(0,T.jsxs)("div",{className:"d-flex flex-column subscription-container price-version-container-header subscription-add-space",children:[(0,T.jsx)("div",{className:"price-version-container-top"}),(0,T.jsx)("h3",{className:"user-quota-plan-name py-5",children:s.name}),(0,T.jsxs)("span",{className:"py-2 mb-0 text-orange font-500 text-center",children:["\xa5 ",(0,T.jsx)("span",{className:"price-version-plan-price",children:s.asset_quota_price})," "+s.asset_quota_description]}),(0,T.jsxs)(d.A,{style:{marginBottom:"5px"},className:"space-quota",children:[(0,T.jsx)(p.A,{addonType:"prepend",children:(0,T.jsx)(u.A,{children:(0,T.jsx)("span",{className:"font-500",children:a})})}),(0,T.jsx)(m.A,{className:"py-2",placeholder:a,title:a,type:"number",value:n||1,min:"1",max:"9999",disabled:!s.can_custom_asset_quota,onChange:t.onAssetQuotaUnitCountInputChange}),(0,T.jsx)(p.A,{addonType:"append",children:(0,T.jsx)(u.A,{children:(0,T.jsx)("span",{className:"font-500",children:" x "+s.asset_quota_unit+"GB"})})})]}),(0,T.jsxs)("span",{className:"py-4 text-orange mb-0 font-500 price-version-plan-whole-price text-center",children:["\u603b\u4ef7 \xa5 "+i,r!==i&&(0,T.jsx)("span",{style:{fontSize:"small",textDecoration:"line-through",color:"#9a9a9a"},children:" \uffe5"+r})]}),(0,T.jsx)("span",{className:"py-2 mb-0 text-lg-size font-500 price-version-plan-valid-day text-center",children:"\u6709\u6548\u671f\u81f3 "+s.new_term_end}),(0,T.jsx)("span",{className:"subscription-notice text-center py-5",children:"\u6ce8\uff1a\u5f53\u6709\u6548\u671f\u5269\u4f59\u5929\u6570\u5c11\u4e8e\u8ba1\u5212\u4e2d\u7684\u65f6\u5019\uff0c\u589e\u52a0\u7a7a\u95f4\u7684\u4ef7\u683c\u6309\u5929\u6765\u8ba1\u7b97"}),(0,T.jsx)(l.A,{className:"subscription-submit",onClick:t.onPay,color:"primary",children:"\u7acb\u5373\u8d2d\u4e70"})]})},t.state={currentPlan:e.plans[0],assetQuotaUnitCount:1,count:1},t}return(0,i.A)(s,e),(0,a.A)(s,[{key:"render",value:function(){var e=this.props.paymentType;return"paid"===e||"extend_time"===e?this.renderPaidOrExtendTime():"add_user"===e?this.renderAddUser():"buy_quota"===e?this.renderBuyQuota():void c.A.danger((0,j.AP)("Internal Server Error"))}}])}(o.Component),w=function(e){function s(e){var t;return(0,n.A)(this,s),(t=(0,r.A)(this,s,[e])).getPlans=function(){_.getSubscriptionPlans(t.props.paymentType).then((function(e){t.setState({planList:e.data.plan_list,paymentSourceList:e.data.payment_source_list,isLoading:!1})})).catch((function(e){var s=v.Aq.getErrorMsg(e);t.setState({isLoading:!1,errorMsg:s})}))},t.onPay=function(e,s,n,a){t.setState({isWaiting:!0});var r=j.xW+"/subscription/pay/?payment_source="+t.state.paymentSourceList[0]+"&payment_type="+t.props.paymentType+"&plan_id="+e+"&total_amount="+a;s&&(r+="&count="+s),n&&(r+="&asset_quota="+n),window.open(r)},t.onReload=function(){window.location.reload()},t.state={isLoading:!0,isWaiting:!1,planList:[],paymentSourceList:[]},t}return(0,i.A)(s,e),(0,a.A)(s,[{key:"componentDidMount",value:function(){this.getPlans()}},{key:"render",value:function(){var e=this.state,s=e.isLoading,t=e.isWaiting,n=e.planList,a=this.props,r=a.toggleDialog,i=a.paymentTypeTrans,o=a.paymentType,c="paid"===o||"extend_time"===o?{width:"560px",maxWidth:"560px"}:{width:"560px"};return s?(0,T.jsxs)(h.A,{isOpen:!0,toggle:r,children:[(0,T.jsx)(x.A,{toggle:r,children:i}),(0,T.jsx)(g.A,{children:(0,T.jsx)(C.A,{})})]}):t?(0,T.jsxs)(h.A,{isOpen:!0,toggle:this.onReload,children:[(0,T.jsx)(x.A,{toggle:this.onReload,children:i}),(0,T.jsx)(g.A,{children:(0,T.jsx)("div",{children:"\u662f\u5426\u5b8c\u6210\u4ed8\u6b3e?"})}),(0,T.jsx)(f.A,{children:(0,T.jsx)("button",{className:"btn btn-outline-primary",onClick:this.onReload,children:"\u662f"})})]}):(0,T.jsxs)(h.A,{isOpen:!0,toggle:r,style:c,children:[(0,T.jsx)(x.A,{toggle:r,children:i}),(0,T.jsx)(g.A,{children:(0,T.jsx)("div",{className:"d-flex justify-content-between",children:(0,T.jsx)(q,{plans:n,onPay:this.onPay,paymentType:this.props.paymentType})})})]})}}])}(o.Component),k=function(e){function s(e){var t;return(0,n.A)(this,s),(t=(0,r.A)(this,s,[e])).getSubscription=function(){_.getSubscription().then((function(e){var s=e.data.subscription,n=e.data.payment_type_list;if(s){var a=s.is_active,r=s.plan;t.setState({isLoading:!1,subscription:s,planName:r.name,userLimit:s.user_limit,assetQuota:a?s.asset_quota:r.asset_quota,termEnd:a?s.term_end:"\u5df2\u8fc7\u671f",paymentTypeList:n})}else t.setState({isLoading:!1,paymentTypeList:n})})).catch((function(e){var s=v.Aq.getErrorMsg(e);t.setState({isLoading:!1,errorMsg:s})}))},t.toggleDialog=function(){t.setState({isDialogOpen:!t.state.isDialogOpen})},t.togglePaymentType=function(e){t.setState({currentPaymentType:e}),t.toggleDialog()},t.paymentTypeTransMap={paid:"\u7acb\u5373\u8d2d\u4e70",extend_time:"\u7acb\u5373\u7eed\u8d39",add_user:"\u589e\u52a0\u7528\u6237",buy_quota:"\u589e\u52a0\u7a7a\u95f4"},t.state={isLoading:!0,errorMsg:"",isDialogOpen:!1,planName:t.props.isOrgContext?"\u56e2\u961f\u7248":"\u4e2a\u4eba\u7248",userLimit:20,assetQuota:1,termEnd:"\u957f\u671f",subscription:null,paymentTypeList:[],currentPaymentType:"",errorMsgCode:""},t}return(0,i.A)(s,e),(0,a.A)(s,[{key:"componentDidMount",value:function(){this.getSubscription()}},{key:"render",value:function(){var e=this,s=this.state,t=s.isLoading,n=s.errorMsg,a=s.planName,r=s.userLimit,i=s.assetQuota,c=s.termEnd,l=s.isDialogOpen,d=s.paymentTypeList,p=s.currentPaymentType;return t?(0,T.jsx)(C.A,{}):n?(0,T.jsx)("p",{className:"text-center mt-8 error",children:n}):(0,T.jsxs)(o.Fragment,{children:[(0,T.jsxs)("div",{className:"content position-relative",onScroll:this.props.handleContentScroll,children:[(0,T.jsxs)("div",{id:"current-plan",className:"subscription-info",children:[(0,T.jsx)("h3",{className:"subscription-info-heading",children:"\u5f53\u524d\u7248\u672c"}),(0,T.jsx)("p",{className:"mb-2",children:a})]}),this.props.isOrgContext&&(0,T.jsxs)("div",{id:"user-limit",className:"subscription-info",children:[(0,T.jsx)("h3",{className:"subscription-info-heading",children:"\u7528\u6237\u6570\u9650\u5236"}),(0,T.jsx)("p",{className:"mb-2",children:r})]}),(0,T.jsxs)("div",{id:"asset-quota",className:"subscription-info",children:[(0,T.jsx)("h3",{className:"subscription-info-heading",children:"\u7a7a\u95f4"}),(0,T.jsx)("p",{className:"mb-2",children:i?i+"GB":"1GB"})]}),(0,T.jsxs)("div",{id:"current-subscription-period",className:"subscription-info",children:[(0,T.jsx)("h3",{className:"subscription-info-heading",children:"\u8ba2\u9605\u6709\u6548\u671f"}),(0,T.jsx)("p",{className:"mb-2",children:c})]}),(0,T.jsxs)("div",{id:"product-price",className:"subscription-info",children:[(0,T.jsx)("h3",{className:"subscription-info-heading",children:"\u4e91\u670d\u52a1\u4ed8\u8d39\u65b9\u6848"}),(0,T.jsx)("p",{className:"mb-2",children:(0,T.jsx)("a",{rel:"noopener noreferrer",target:"_blank",href:"https://www.seafile.com/seafile-docs/home/",children:"\u67e5\u770b\u8be6\u60c5"})})]}),d.map((function(s,t){var n=e.paymentTypeTransMap[s];return(0,T.jsx)("button",{className:"btn btn-outline-primary mr-4",onClick:e.togglePaymentType.bind(e,s),children:n},t)})),!this.state.subscription&&(0,T.jsxs)("div",{id:"sales-consultant",className:"subscription-info mt-6",children:[(0,T.jsx)("h3",{className:"subscription-info-heading",children:"\u9500\u552e\u54a8\u8be2"}),(0,T.jsx)("img",{className:"mb-2",src:"/media/img/qr-sale.png",alt:"",width:"112"}),(0,T.jsx)("p",{className:"mb-2",children:"\u5fae\u4fe1\u626b\u7801\u8054\u7cfb\u9500\u552e"})]})]}),l&&(0,T.jsx)(w,{paymentType:p,paymentTypeTrans:this.paymentTypeTransMap[p],isOrgContext:this.props.isOrgContext,toggleDialog:this.toggleDialog})]})}}])}(o.Component),P=k},34555:function(e,s,t){var n=t(23029),a=t(92901),r=t(39874),i=t(85501),o=t(9950),c=t(44414),l=function(e){function s(){return(0,n.A)(this,s),(0,r.A)(this,s,arguments)}return(0,i.A)(s,e),(0,a.A)(s,[{key:"render",value:function(){var e=this;return(0,c.jsx)("div",{className:"side-nav",children:(0,c.jsx)("div",{className:"side-nav-con",children:(0,c.jsx)("ul",{className:"nav nav-pills flex-column",children:this.props.data.map((function(s,t){return s.show?(0,c.jsx)("li",{className:"nav-item".concat(e.props.curItemID==s.href.substr(1)?" active":""),children:(0,c.jsx)("a",{className:"nav-link".concat(e.props.curItemID==s.href.substr(1)?" active":""),href:s.href,children:s.text})},t):null}))})})})}}])}(o.Component);s.A=l},36676:function(e,s,t){var n=t(23029),a=t(92901),r=t(39874),i=t(85501),o=t(9950),c=t(17119),l=t(40326),d=t(34555),p=t(51925),u=t(86181),m=t(7039),h=(t(18291),t(81848),t(30923),t(44414)),x=function(e){function s(e){var t;return(0,n.A)(this,s),(t=(0,r.A)(this,s,[e])).handleContentScroll=function(e){var s=e.target.scrollTop,n=t.sideNavItems.filter((function(e,t){return e.show&&document.getElementById(e.href.substr(1)).offsetTop-45<s}));n.length&&t.setState({curItemID:n[n.length-1].href.substr(1)})},t.sideNavItems=[{show:!0,href:"#current-plan",text:"\u5f53\u524d\u7248\u672c"},{show:!0,href:"#asset-quota",text:"\u7a7a\u95f4"},{show:!0,href:"#current-subscription-period",text:"\u8ba2\u9605\u6709\u6548\u671f"},{show:!0,href:"#product-price",text:"\u4e91\u670d\u52a1\u4ed8\u8d39\u65b9\u6848"}],t.state={curItemID:t.sideNavItems[0].href.substr(1)},t}return(0,i.A)(s,e),(0,a.A)(s,[{key:"render",value:function(){var e=l.VI.startsWith("http")?l.VI:l.SG+l.VI;return(0,h.jsxs)("div",{className:"h-100 d-flex flex-column",children:[(0,h.jsxs)("div",{className:"top-header d-flex justify-content-between",children:[(0,h.jsx)("a",{href:l.Yc,children:(0,h.jsx)("img",{src:e,height:l.hM,width:l.gA,title:l.q0,alt:"logo"})}),(0,h.jsxs)("div",{className:"common-toolbar",children:[(0,h.jsx)(u.A,{}),(0,h.jsx)(p.A,{})]})]}),(0,h.jsxs)("div",{className:"flex-auto d-flex o-hidden",children:[(0,h.jsx)("div",{className:"side-panel o-auto",children:(0,h.jsx)(d.A,{data:this.sideNavItems,curItemID:this.state.curItemID})}),(0,h.jsxs)("div",{className:"main-panel d-flex flex-column",children:[(0,h.jsx)("h2",{className:"heading",children:"\u4ed8\u8d39\u7ba1\u7406"}),(0,h.jsx)(m.A,{isOrgContext:!1,handleContentScroll:this.handleContentScroll})]})]})]})}}])}(o.Component);c.render((0,h.jsx)(x,{}),document.getElementById("wrapper"))},30923:function(){}},function(e){e.O(0,[4223],(function(){return s=36676,e(e.s=s);var s}));e.O()}]); |